we have recently made the decision to move from nagios to zabbix. and i'm actually very excited to try zabbix!
just one question. i have a lot of existing scripts and all i want to do is how do i set up a script like this in zabbix??
the below script must run on the remote node (the monitored node). i understand this particular script may already exists in the zabbix repository as this is only a process check. but i need to be able to set up other checks like it. checks that will need be passed parameters.
i understand 'userParameter' can be used here. but i've been googling this for days and i see so many different confusinng things. so im hoping someone can show me exactly how to set this up in zabbix so i can begin importing all my custom scripts from nagios.
Thank you all!
just one question. i have a lot of existing scripts and all i want to do is how do i set up a script like this in zabbix??
the below script must run on the remote node (the monitored node). i understand this particular script may already exists in the zabbix repository as this is only a process check. but i need to be able to set up other checks like it. checks that will need be passed parameters.
i understand 'userParameter' can be used here. but i've been googling this for days and i see so many different confusinng things. so im hoping someone can show me exactly how to set this up in zabbix so i can begin importing all my custom scripts from nagios.
Thank you all!
Code:
#!/bin/sh
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
UPROCESS="${1}"
THRESHOLD=${2}
if [ $# -ne 2 ] ; then
echo "ERROR: No processname was specified!"
exit $STATE_UNKNOWN
elif [ $# -eq 1 ] ; then
COUNT=$(ps -ef | egrep ${UPROCESS} | wc -l)
if [ $COUNT -ge $THRESHOLD ] ; then
echo "OK: $COUNT $UPROCESS running"
exit ${STATE_OK}
elif [ $COUNT -lt $THRESHOLD ] ; then
echo "CRITICAL: $COUNT $UPROCESS running"
exit ${STATE_CRITICAL}
fi
fi

Comment