]> Sergey Matveev's repositories - sgmon.git/blob - README
Nothing wrong with an empty message body
[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     EOF
34
35 You can run probe individually for testing:
36
37     $ cd probes/example.com/ping6
38     $ /path/to/sgmon/run.sh
39     [...]
40
41 Or start all of them in background:
42
43     $ cd probes
44     $ /path/to/sgmon/start.sh
45
46 Send signal to that script and it will exit when all probes will die.
47 It is advisable to run it under daemontools'es supervise utility for
48 convenience.
49
50 run.sh creates temporary directory for each probe and links it to
51 $probe/state. run-script expects that it is run from the $probe
52 directory, there is state/, where it can store its temporary files.
53 $SGMONDIR and $SGMONDIR are also always set too.
54
55 You can remove all state directories with clear.sh.
56
57 Generate HTML page with information about state of all services and
58 their output:
59
60     $ cd probes
61     $ /path/to/sgmon/status.sh > /path/to/index.html
62
63 If some probe is failed, then email message with its stdout/stderr will
64 be sent. If it succeeds after the fail, then another message is sent.
65 Each startup and shutdown are also notified by email.