Zabbix Tricks

/, Linux, Zabbix/Zabbix Tricks

Zabbix Tricks

Zabbix is a very powerfull monitoring tool that is highly flexible and supports many hardware units.

Listed below is the solutions i made in my use with the product.

How to get requests/sec og busy workers from server-status in Apache 2.0

First change to apache.conf to allow localhost to get the server-status

# Allow server status reports, with the URL of http://servername/server-status
# Change the ".your_domain.com" to match your domain to enable.
#

    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost

ExtendedStatus On

Write a PHP based CLI commaind script like this:

#!/usr/bin/php -q
<?php
		$thestats = file("http://localhost/server-status?auto");

		if ($argv[1] == "1") {
				print substr(strstr($thestats[4],":"),2);
		} else {
				print substr(strstr($thestats[7],":"),2);
		}

?>

Finally add this to the zabbix_agentd.conf

# Apache avg. request/sec
UserParameter=apache[rps],getApacheStats.sh.php 1
UserParameter=apache[runningproc],getApacheStats.sh.php 2

How to get current number of sessions/users in proftpd into zabbix

First we need a PHP based script to obtain the info. Place it in a command path, like /usr/local/bin or /usr/bin

		#!/usr/bin/php
		<?php

			$retval = ex ec('ps ax | grep proftpd | wc -l');
			$newval = intval($retval)-2;
			echo $newval."\n";

		?>

Add this to zabbix conf:

UserParameter=proftpd[users],/usr/bin/countftp.php  Or whatever you named the PHP script
By | 2011-04-27T00:19:19+00:00 April 20th, 2011|Apache, Linux, Zabbix|0 Comments

Leave A Comment