[Nagiosplug-help] Problems with a plugin on processes running for MAC
Alessandro Scorrano
alescrn at yahoo.it
Tue Apr 4 03:44:02 CEST 2006
Hi ;)
Sorry, this plugin is correct for Linux but don't work on MAC, why?
--------------------------------------------------------------
#!/bin/sh
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
if [ $# -lt 1 ] ; then
echo -e "Unknown - Usage $0 argument"
exit $STATE_UNKNOWN
fi
# this cicle control if a name user is inserted (example:
# check_processes03 root or check_processes03 nameuser)
# in this case appear: "You have inserted a name user: it is not correct"
for lista in $(cat /etc/passwd |tr ":" " " |awk {'print $1'})
do
if [ $lista == "$1" ]; then
echo "You have inserted a name user: it is not correct"
exit
fi
done
lsof |grep $1 > /dev/null # lsof to test if a program is open and redirect the output in dev/null
RC=$? # put the state in variable RC
if [ $RC -eq 0 ]; then # if RC is equal to 0 the state is OK
lsof | grep $1 | awk '{printf("%s STATO OK\n",$1)}' # output with costruct awk e to filter the output
exit $STATE_OK
else
echo -e "Critical - $1 is not running" # if state is different to 0 the state is CRITICAL
exit $STATE_CRITICAL
fi
fi
-----------------------------------------------------------------
Thank you very much ;)
---------------------------------
Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20060404/21d36a98/attachment.html>
More information about the Help
mailing list