Debian Codegraph @

xymon-report

raw
1 #!/bin/sh
2
3 COLUMN=upd
4 COLOR=green
5
6 REPORTING_HELPERS="$(dirname $0)/reporting-helpers"
7 if [ -f "$REPORTING_HELPERS" ]; then
8 . "$REPORTING_HELPERS"
9 else
10 echo "E: $REPORTING_HELPERS helpers not present, bailing out." 1>&2
11 exit 1;
12 fi
13
14 #
15 # check for remaining upgrades
16 #
17 REMAINING_UPGRADES="$(remaining_upgrades)"
18 if [ -n "$REMAINING_UPGRADES" ]; then
19 COLOR=red
20 MSG="${MSG}${REMAINING_UPGRADES}"
21 fi
22
23 #
24 # check for errors in log file
25 #
26 ERRORS_IN_LOGFILE=$(errors_in_logfile "$1")
27 if [ "$ERRORS_IN_LOGFILE" = "notfound" ]; then
28 COLOR=red
29 MSG="${MSG}
30
31 log file missing -- please investigate
32
33 "
34 else
35 if [ "$ERRORS_IN_LOGFILE" = "warnings" ]; then
36 COLOR=yellow
37 elif [ "$ERRORS_IN_LOGFILE" = "errors" ]; then
38 COLOR=red
39 fi
40
41 MSG="${MSG}
42 $(print_logfile_for_xymon "$1")
43
44 "
45 fi
46
47 BB=/bin/false
48 if [ -x /usr/lib/hobbit/client/bin/bb ]; then
49 BB=/usr/lib/hobbit/client/bin/bb
50 fi
51 if [ -x /usr/lib/xymon/client/bin/xymon ]; then
52 BB=/usr/lib/xymon/client/bin/xymon
53 fi
54
55 if [ -f /etc/default/hobbit-client ]; then
56 . /etc/default/hobbit-client
57 fi
58 if [ -f /etc/default/xymon-client ]; then
59 . /etc/default/xymon-client
60 fi
61
62 for server in $HOBBITSERVERS $XYMONSERVERS; do
63 $BB $server "@" << EOF
64 status+36h $CLIENTHOSTNAME.$COLUMN $COLOR $(date)
65
66 ${MSG}
67 EOF
68 done
69
70 exit 0