Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
artickl
byartickl, June 13, 2013
It's very useful check which must be turned on for every server!
PS: but small changes for check_all_diskstat.sh can be applied as soon it not returning a correct exit status for nagios notification.
I make some changes which can help somebody else:
###################
#!/bin/bash
EXITCODE=0
CHK=/usr/lib/nagios/plugins/check_diskstat.sh
WARN=${1:-"300,10000,10000"}
CRIT=${2:-"400,20000,20000"}
for DEVICE in `ls /sys/block`; do
if [ -L /sys/block/$DEVICE/device ]; then
DEVNAME=$(echo /dev/$DEVICE | sed 's#!#/#g')
echo -n "$DEVNAME: "
OUTPUT="`$CHK -d $DEVICE -w $WARN -c $CRIT`"
STATUS=$?
if [ "$EXITCODE" -le "$STATUS" ]; then
EXITCODE=$STATUS;
fi
echo $OUTPUT | sed "s#=#_$DEVNAME=#g"
fi
done
exit $EXITCODE
###################
PS: but small changes for check_all_diskstat.sh can be applied as soon it not returning a correct exit status for nagios notification.
I make some changes which can help somebody else:
###################
#!/bin/bash
EXITCODE=0
CHK=/usr/lib/nagios/plugins/check_diskstat.sh
WARN=${1:-"300,10000,10000"}
CRIT=${2:-"400,20000,20000"}
for DEVICE in `ls /sys/block`; do
if [ -L /sys/block/$DEVICE/device ]; then
DEVNAME=$(echo /dev/$DEVICE | sed 's#!#/#g')
echo -n "$DEVNAME: "
OUTPUT="`$CHK -d $DEVICE -w $WARN -c $CRIT`"
STATUS=$?
if [ "$EXITCODE" -le "$STATUS" ]; then
EXITCODE=$STATUS;
fi
echo $OUTPUT | sed "s#=#_$DEVNAME=#g"
fi
done
exit $EXITCODE
###################
byartickl, October 30, 2012
That's nice check, but I have issues with channel check and g729.
That's diff of fix if needed:
135c135
CHANNELS=`/bin/echo -e "Action: login\r\nUsername: ${AMIUSER}\r\nSecret: ${AMIPASS}\r\nEvents: off\r\n\r\nAction: Command\r\ncommand: Core Show Channels\r\n\r\nAction: Logoff\r\n\r\n" | /bin/netcat ${REMOTEHOST} ${AMIPORT} | awk '/active channels/ {print $1}'|tr -d "\r"`
294c294
MAXLICTEST=`/bin/echo -e "Action: login\r\nUsername: ${AMIUSER}\r\nSecret: ${AMIPASS}\r\nEvents: off\r\n\r\nAction: Command\r\ncommand: show g729\r\n\r\nAction: Logoff\r\n\r\n" | /bin/netcat ${REMOTEHOST} ${AMIPORT} | awk '/encoders/ {print $4}'`
302c302
ONUSE=`/bin/echo -e "Action: login\r\nUsername: ${AMIUSER}\r\nSecret: ${AMIPASS}\r\nEvents: off\r\n\r\nAction: Command\r\ncommand: show g729\r\n\r\nAction: Logoff\r\n\r\n" | /bin/netcat ${REMOTEHOST} ${AMIPORT} | awk '/encoders/ {print substr($1, 1, match($1, "/") -1)}'`
That's diff of fix if needed:
135c135
CHANNELS=`/bin/echo -e "Action: login\r\nUsername: ${AMIUSER}\r\nSecret: ${AMIPASS}\r\nEvents: off\r\n\r\nAction: Command\r\ncommand: Core Show Channels\r\n\r\nAction: Logoff\r\n\r\n" | /bin/netcat ${REMOTEHOST} ${AMIPORT} | awk '/active channels/ {print $1}'|tr -d "\r"`
294c294
MAXLICTEST=`/bin/echo -e "Action: login\r\nUsername: ${AMIUSER}\r\nSecret: ${AMIPASS}\r\nEvents: off\r\n\r\nAction: Command\r\ncommand: show g729\r\n\r\nAction: Logoff\r\n\r\n" | /bin/netcat ${REMOTEHOST} ${AMIPORT} | awk '/encoders/ {print $4}'`
302c302
ONUSE=`/bin/echo -e "Action: login\r\nUsername: ${AMIUSER}\r\nSecret: ${AMIPASS}\r\nEvents: off\r\n\r\nAction: Command\r\ncommand: show g729\r\n\r\nAction: Logoff\r\n\r\n" | /bin/netcat ${REMOTEHOST} ${AMIPORT} | awk '/encoders/ {print substr($1, 1, match($1, "/") -1)}'`