Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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'm just getting started with Zabbix and would like to use it to run a similar check, but how?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted
+50

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.

share|improve this answer
    
If I'm not mistaken Web items are run from the Zabbix server, not the Zabbix agent. –  Red Tux Aug 15 '12 at 7:52
    
Yes, complex scenarios are run from Zabbix server, but since 2.0 there are web.page.* items in Zabbix agent, which can do simple checks. –  nudzo Aug 15 '12 at 20:00
    
Thanks! This is perfect, from the doc: "To use HTTP proxy, set the http_proxy environment variable for Zabbix server user. For example, http_proxy=proxy_ip:proxy_port."; Exactly what I need. –  Antonius Bloch Aug 16 '12 at 19:26
add comment

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.

share|improve this answer
    
Thanks. I'm going to go with the "web monitoring" solution baked into Zabbix, but I know I'm going to end up using this as well. Great info for a Zabbix noob. –  Antonius Bloch Aug 16 '12 at 19:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.