File: xymon-report

package info (click to toggle)
aptitude-robot 1.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 520 kB
  • sloc: sh: 704; perl: 536; makefile: 32
file content (70 lines) | stat: -rwxr-xr-x 1,321 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh

COLUMN=upd
COLOR=green

REPORTING_HELPERS="$(dirname $0)/reporting-helpers"
if [ -f "$REPORTING_HELPERS" ]; then
    . "$REPORTING_HELPERS"
else
    echo "E: $REPORTING_HELPERS helpers not present, bailing out." 1>&2
    exit 1;
fi

#
# check for remaining upgrades
#
REMAINING_UPGRADES="$(remaining_upgrades)"
if [ -n "$REMAINING_UPGRADES" ]; then
    COLOR=red
    MSG="${MSG}${REMAINING_UPGRADES}"
fi

#
# check for errors in log file
#
ERRORS_IN_LOGFILE=$(errors_in_logfile "$1")
if [ "$ERRORS_IN_LOGFILE" = "notfound" ]; then
    COLOR=red
    MSG="${MSG}

log file missing -- please investigate

"
else
    if [ "$ERRORS_IN_LOGFILE" = "warnings" ]; then
        COLOR=yellow
    elif [ "$ERRORS_IN_LOGFILE" = "errors" ]; then
        COLOR=red
    fi

    MSG="${MSG}
$(print_logfile_for_xymon "$1")

"
fi

BB=/bin/false
if [ -x /usr/lib/hobbit/client/bin/bb ]; then
    BB=/usr/lib/hobbit/client/bin/bb
fi
if [ -x /usr/lib/xymon/client/bin/xymon ]; then
    BB=/usr/lib/xymon/client/bin/xymon
fi

if [ -f /etc/default/hobbit-client ]; then
    . /etc/default/hobbit-client
fi
if [ -f /etc/default/xymon-client ]; then
    . /etc/default/xymon-client
fi

for server in $HOBBITSERVERS $XYMONSERVERS; do
    $BB $server "@" << EOF
status+36h $CLIENTHOSTNAME.$COLUMN $COLOR $(date)

${MSG}
EOF
done

exit 0