Select Git revision
aes-decrypt-internal.c
Forked from
Nettle / nettle
Source project has a limited visibility.
check_enodia_monitored 1.17 KiB
#!/bin/sh
# Check that all hosts in /opt/enodia/export/active_ips.txt are
# monitored by Nagios. More accurately, for each line in
# active_ips.txt, check that /usr/local/nagios/var/checked_ips/$ip
# exists and is at most 24 hours old. That file is created by the
# check_ping script.
CHECKED=/usr/local/nagios/var/checked_ips
UNCHECKED=`tempfile`
unmonitored=""
find "$CHECKED" -mtime +0 -type f -exec rm {} \;
while read ip host
do
if [ ! -f $CHECKED/$ip ]
then
echo "$ip ($host)" >> "$UNCHECKED"
fi
done < /opt/enodia/export/active_ips.txt
unchecked=`wc -l < "$UNCHECKED"`
chmod 644 "$UNCHECKED"
if [ $unchecked = 0 ]
then
echo "OK - all checked | unchecked=0"
mv -f "$UNCHECKED" /usr/local/nagios/var/unchecked
exit 0
else
echo -n "CRITICAL - $unchecked unchecked hosts: "
sed 's/\.lysator\.liu\.se)$/)/' "$UNCHECKED" \
| awk 'BEGIN { sz = 0 }
NR > 1 && sz < 198 { printf ", "; sz += 2 }
sz < 200 { printf "%s", $0; sz += length($0) }
END { if (sz >= 200) printf ", others" } ' \
| sed 's/, \([^,]*\)$/ and \1/'
echo ". | unchecked=$unchecked"
mv -f "$UNCHECKED" /usr/local/nagios/var/unchecked
exit 2
fi