I need to be notified when our proxy server goes down. Currently I have a bash script that tests the proxy functionality:
CHECKRESULT=(curl -s --proxy 4.83.58.205:80 checkip.dyndns.com | awk '{print $6}' | sed 's/<\/body><\/html>\r//g';)
if [ "$CHECKRESULT" != "4.83.58.205" ]
then
echo "FAILED: proxy 4.83.58.205 returned \" $CHECKRESULT\""
FAILEDCOUNT=$(($FAILEDCOUNT+1))
fi
I would like to use Zabbix to run a similar check, but how?
Zabbix, when compiled with CURL support, can directly monitor web services including complex more steps scenarios. You can setup triggers on HTTP return code, returned data, response time...
Documentation here.
Assuming your existing script works well and does what you need, what you want to setup is an external check as described at http://www.zabbix.com/documentation/2.0/manual/config/items/itemtypes/external
Your script goes in the directory specified in your zabbix configuration for ExternalScripts - likely something like /etc/zabbix/externalscripts. Make sure it has appropriate permissions for the zabbix user to be able to execute it.
In the template or host, create a new item, and set the type to external check, and set the key to the name of your script.
Then create a trigger that looks for the "FAILED" line and alerts you.