chiark / gitweb /
rm some todos
[inn-innduct.git] / samples / innwatch.ctl
1 ##  $Revision: 4351 $
2 ##  innwatch.ctl -- control file for innwatch.
3 ##  Indicates what to run to test the state of the news system, and what
4 ##  to do about it.  Format:
5 ##      !state!when!command!test!limit!command!reason/comment
6 ##  where
7 ##      <!>             Delimiter; pick from [,:@;?!]
8 ##      <state>         State to enter if true.
9 ##      <when>          States we must be in to match.
10 ##      <command>       Command to run to test condition.
11 ##      <test>          Operator to use in test(1) command.
12 ##      <limit>         Value to test against.
13 ##      <command>       Command for innwatch to perform; use exit,
14 ##                      flush, go, pause, shutdown, skip, or throttle.
15 ##      <reason>        Used in ctlinnd command (if needed).
16
17 ##  First, just exit innwatch if innd has gone away.
18 !!! test -f ${LOCKS}/innd.pid && echo 0 || echo 1 ! eq ! 1 ! exit ! innd dead
19
20 ##  If another innwatch has started, exit.
21 !!! cat ${LOCKS}/LOCK.${PROGNAME} ! ne ! $$ ! exit ! innwatch replaced
22
23 ##  Next test the load average.  Above first threshold pause, above higher
24 ##  threshold throttle, below restart limit undo whatever was done.
25 !load!load hiload! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! lt ! ${INNWATCHLOLOAD} ! go ! loadav
26 !hiload!+ load! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! ${INNWATCHHILOAD} ! throttle ! loadav
27 !load!+! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! ${INNWATCHPAUSELOAD} ! pause ! loadav
28 ##
29 ## Uncomment these to keep overchan backlog in check.  Assumes your overchan
30 ## feed is named 'overview!'.
31 #::overblog:ctlinnd feedinfo overview!|awk 'NR==1{print $7}':lt:100000:go:overviewbacklog
32 #:overblog:+:ctlinnd feedinfo overview!|awk 'NR==1{print $7}':gt:400000:throttle:overviewbacklog
33 ##
34
35 ##  If load is OK, check space (and inodes) on various filesystems
36 !!! ${INNDF} . ! lt ! ${INNWATCHSPOOLSPACE} ! throttle ! No space (spool)
37 !!! ${INNDF} ${BATCH} ! lt ! ${INNWATCHBATCHSPACE} ! throttle ! No space (newsq)
38 !!! ${INNDF} ${PATHDB} ! lt ! ${INNWATCHLIBSPACE} ! throttle ! No space (newslib)
39 !!! ${INNDF} -i . ! lt ! ${INNWATCHSPOOLNODES} ! throttle ! No space (spool inodes)
40 !!! ${INNDF} ${OVERVIEWDIR} ! lt ! ${INNWATCHSPOOLSPACE} ! throttle ! No space (overview)