]> Sergey Matveev's repositories - sgmon.git/blob - README
CN place can be everywhere
[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     $ echo '"$SGMONDIR"/helper/http http://example.com/ Some.Expected.Title'
13         > probes/example.com/ping4/run <<EOF
14     # only 3 failures will generated notification email
15     $ echo 3 > probes/example.com/http/max-attempts
16
17     $ echo '"$SGMONDIR"/helper/ping 4 example.com' > probes/example.com/ping4/run
18
19     $ echo '"$SGMONDIR"/helper/ping 6 example.com' > probes/example.com/ping6/run
20     $ echo 5 > probes/example.com/ping4/period # every 5 seconds
21
22     $ cat > probes/jails/foobar/run <<EOF
23     #!/bin/sh -e
24     jls -j foobar-jail-name
25     EOF
26     $ chmod +x probes/jails/foobar/run
27
28 Set default configuration values:
29
30     $ cat > rc <<EOF
31     NOTIFY_EMAIL=user+sgmon@example.com
32     PERIOD_DEFAULT=60
33     ATTEMPTS_DEFAULT=1
34     EOF
35
36 You can run probe individually for testing:
37
38     $ cd probes/example.com/ping6
39     $ /path/to/sgmon/run.sh
40     [...]
41
42 Or start all of them in background:
43
44     $ cd probes
45     $ /path/to/sgmon/start.sh
46
47 Send signal to that script and it will exit when all probes will die.
48 It is advisable to run it under daemontools'es supervise utility for
49 convenience.
50
51 run.sh creates temporary directory for each probe and links it to
52 $probe/state. run-script expects that it is run from the $probe
53 directory, there is state/, where it can store its temporary files.
54 $SGMONDIR and $SGMONDIR are also always set too.
55
56 You can remove all state directories with clear.sh.
57
58 Generate HTML page with information about state of all services and
59 their output:
60
61     $ cd probes
62     $ /path/to/sgmon/status.sh > /path/to/index.html
63
64 If some probe is failed, then email message with its stdout/stderr will
65 be sent. If it succeeds after the fail, then another message is sent.
66 Each startup and shutdown are also notified by email.