zabbix-trappers/scripts/memcached.trap.php
2013-06-28 12:42:51 -04:00

20 lines
552 B
PHP
Executable file

#!/usr/bin/php
<?php
#$zabbix_sender = "/usr/bin/zabbix_sender";
#$zabbix_server = "172.19.1.21";
#$zabbix_port = 10051;
#$agent_hostname = gethostname();
$agent_hostname = "-";
$memcache_server = $argv[1];
$memcache_port = $argv[2];
#$memcache_server = "172.19.1.21";
#$memcache_port = 11211;
$m=new Memcache;
$m->connect($memcache_server,$memcache_port);
$s=$m->getstats();
foreach($s as $key=>$value) {
echo "$agent_hostname memcache.$key $value\n";
#exec("$zabbix_sender $zabbix_server $zabbix_port $memcache_server memcache.$key $value");
}
?>