Translate this

    Translate to:

The back catalog

Zabbix and external scripts – Getting them to work (v1.4.1)

I’ve been working with one of my coworkers in looking at Zabbix for monitoring rather than Nagios for the Global Ops Virtualization rollout. I’ve already done work on some monitoring of ESX3i with Nagios by writing some plugins to monitor different hardware components. (For more info see this blog post)

Zabbix supports multiple methods of checking on hosts/services with a preference for agents running on the monitored node. It also supports simple ping, http and ftp port type tests. There is also an option for what’s termed an “external check” which is more akin to how Nagios works.

We set up a VM running Ubuntu 7.10 and used apt-get to install Zabbix. This installed packages for version 1.4.1. (Version 1.4.5 is the most recent stable release.) In my testing I discovered that I wasn’t able to get external checks working. I kept getting an “agent not support” message when trying to set them up. In troubleshooting I downloaded the source and discovered a discrepancy between the what the front-end php (items.php) expects in the configuration when setting up an external check and what the c-code (zabbix-1.4.1./src/zabbix_server/poller/checks_external.c) was expecting to have submitted to it.

The documentation Zabbix provides says the following about external checks.

5.12.8. External checks

External check is a check executed by ZABBIX Server by running a shell script or a binary.

External checks do not require any agent running on a host being monitored.

Syntax of item’s key:

script(parameters)

script – name of the script.

parameters – list of command line parameters.

 

ZABBIX server will find and executed the script in directory defined in configuration parameter ExternalScripts. First command line parameter is host name, other parameters are substituted by parameters.

Note: Do not overuse external checks! It can decrease performance for ZABBIX system very much.

Example 1: Execute script check_oracle.sh with parameters “-h 192.168.1.4″.
Host name ‘www1.company.com’.

check_oracle.sh[-h 192.168.1.4]

ZABBIX will execute:

check_oracle.sh www1.company.com -h 192.168.1.4.

I noticed the server side piece was actually looking for parens “(” rather than square brackets “[". I tried to use parens check_oracle.sh(-h 192.168.1.4) but the front end wouldn't accept them. I was able to modify the front-end php code so that it accepted the parentheses and it worked fine after that.

The zabbix frontend files are installed (on this particular vm) at /usr/share/zabbix. In /usr/share/zabbix/include/defines.inc.php (line 391) change the definition of ZBX_EREG_ITEM_KEY_FORMAT from:

define('ZBX_EREG_ITEM_KEY_FORMAT', '('.ZBX_EREG_INTERNAL_NAMES.'(\['.ZBX_EREG_PARAMS.'\]){0,1})’);

To

define(’ZBX_EREG_ITEM_KEY_FORMAT’, ‘(’.ZBX_EREG_INTERNAL_NAMES.’(\(‘.ZBX_EREG_PARAMS.’\)){0,1})’);

I don’t know yet if this has been fixed in newer releases or not.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Posterous
  • Google Bookmarks
  • LinkedIn
  • Twitter

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>