fix ticketing system error on bootstrap of new install
[freeside.git] / torrus / scripts / rrdup_notify.sh
1 #!/bin/sh
2
3 # Periodically check if there are RRD files not updated by collector,
4 # and email the warning message.
5 # *.old.rrd files are ignored
6
7 # $Id: rrdup_notify.sh,v 1.1 2010-12-27 00:04:04 ivan Exp $
8 # Stanislav Sinyagin <ssinyagin@yahoo.com>
9 #
10
11 # Where the RRD files are located. Separate multiple paths with space
12 RRDSTORAGE=/srv/torrus/collector_rrd
13
14 # Maximum allowed age of an RRD file, in minutes.
15 MAXAGE=60
16
17 # Where to send complaints
18 NOTIFY=root
19
20 TMPFILE=/tmp/rrdup_notify.$$
21
22 cp /dev/null ${TMPFILE}
23
24 for d in ${RRDSTORAGE}; do
25   find ${d} -name '*.rrd' ! -name '*.old.rrd' \
26     -mmin +${MAXAGE} -print >>${TMPFILE}
27 done
28
29 nLines=`wc -l ${TMPFILE} | awk '{print $1}'`
30
31 if test ${nLines} -gt 0; then
32   cat ${TMPFILE} | \
33     mail -s "`printf \"Warning: %d aged RRD files\" ${nLines}`" ${NOTIFY}
34 fi
35
36 rm ${TMPFILE}
37
38 # Local Variables:
39 # mode: shell-script
40 # indent-tabs-mode: nil
41 # perl-indent-level: 4
42 # End: