1

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?

Antonius Bloch
  • 4,680
  • 6
  • 29
  • 41

2 Answers2

3

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.

nudzo
  • 648
  • 1
  • 6
  • 8
  • If I'm not mistaken Web items are run from the Zabbix server, not the Zabbix agent. – Red Tux Aug 15 '12 at 07: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=http://proxy_ip:proxy_port." Exactly what I need. – Antonius Bloch Aug 16 '12 at 19:26
2

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.

Grant
  • 17,859
  • 14
  • 72
  • 103
  • 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