buried more whitesapce
[torrus-plus.git] / src / scripts / rrdup_notify.sh
blob68bab258e63263835444a65950a1096080b55a22
1 #!/bin/sh
3 # Periodically check if there are RRD files not updated by collector,
4 # and email the warning message.
5 # *.old.rrd files are ignored
7 # Stanislav Sinyagin <ssinyagin@yahoo.com>
10 # Where the RRD files are located. Separate multiple paths with space
11 RRDSTORAGE=/srv/torrus/collector_rrd
13 # Maximum allowed age of an RRD file, in minutes.
14 MAXAGE=60
16 # Where to send complaints
17 NOTIFY=root
19 TMPFILE=/tmp/rrdup_notify.$$
21 cp /dev/null ${TMPFILE}
23 for d in ${RRDSTORAGE}; do
24 find ${d} -name '*.rrd' ! -name '*.old.rrd' \
25 -mmin +${MAXAGE} -print >>${TMPFILE}
26 done
28 nLines=`wc -l ${TMPFILE} | awk '{print $1}'`
30 if test ${nLines} -gt 0; then
31 cat ${TMPFILE} | \
32 mail -s "`printf \"Warning: %d aged RRD files\" ${nLines}`" ${NOTIFY}
35 rm ${TMPFILE}
37 # Local Variables:
38 # mode: shell-script
39 # indent-tabs-mode: nil
40 # perl-indent-level: 4
41 # End: