]> Sergey Matveev's repositories - sgmon.git/blob - README
8454efe691d3b0f32fe5950f4d310f2c549679ee
[sgmon.git] / README
1 sgmon -- Simple stargrave's monitoring system
2 Intended for my own personal use, as a replacement for Monit.
3 All of that is just an ordinary plain POSIX shell scripts.
4
5 Create some directory hierarchy for convenience:
6
7     $ mkdir -p probes/example.com/{ping4,ping6,http}
8     $ mkdir -p probes/jails/foobar
9
10 Make probes from them:
11
12     $ cat > probes/example.com/ping4/run <<EOF
13     #!/bin/sh -e
14     "$SGMONDIR"/helper/http http://example.com/ Some.Expected.Title
15     EOF
16     # only 3 failures will generated notification email
17     $ echo 3 > probes/example.com/http/max-attempts
18
19     $ cat > probes/example.com/ping4/run <<EOF
20     #!/bin/sh -e
21     "$SGMONDIR"/helper/ping 4 example.com
22     EOF
23
24     $ cat > probes/example.com/ping6/run <<EOF
25     #!/bin/sh -e
26     "$SGMONDIR"/helper/ping 6 example.com
27     EOF
28     $ echo 5 > probes/example.com/ping4/period # every 5 seconds
29
30     $ cat > probes/jails/foobar/run <<EOF
31     #!/bin/sh -e
32     jls -j foobar-jail-name
33     EOF
34
35 Set default configuration values:
36
37     $ cat > rc <<EOF
38     NOTIFY_EMAIL=user+sgmon@example.com
39     PERIOD_DEFAULT=60
40     EOF
41
42 You can run probe individually for testing:
43
44     $ cd probes/example.com/ping6
45     $ /path/to/sgmon/run.sh
46     [...]
47
48 Or start all of them in background:
49
50     $ cd probes
51     $ /path/to/sgmon/start.sh
52
53 Send signal to that script and it will exit when all probes will die.
54 It is advisable to run it under daemontools'es supervise utility for
55 convenience.
56
57 run.sh creates temporary directory for each probe and links it to
58 $probe/state. Also $probe/pid file is created there. run-script expects
59 that it is run from the $probe directory, there is state/, where it can
60 store its temporary files. $SGMONDIR are also always set $SGMONSRV.
61
62 You can remove all pid-files and state/-directories with clear.sh.
63
64 Generate HTML page with information about state of all services and
65 their output:
66
67     $ cd probes
68     $ /path/to/sgmon/status.sh > /path/to/index.html
69
70 If some probe is failed, then email message with its stdout/stderr will
71 be sent. If it succeeds after the fail, then another message is sent.
72 Each startup and shutdown are also notified by email.