The stuff that was out there for this kinda sucked real bad. So I modded it a bit so it didnt suck as much, but it still reaks of ass.
Feel free to post problems i will modd it.
Brian
Add this to agentd.conf:
And this is apache2.pl:
Feel free to post problems i will modd it.
Brian
Add this to agentd.conf:
Code:
UserParameter=apache.total_accesses,~zabbix/bin/apache2.pl http://127.0.0.1 0 UserParameter=apache.total_kbytes,~zabbix/bin/apache2.pl http://127.0.0.1 1 UserParameter=apache.cpuload,~zabbix/bin/apache2.pl http://127.0.0.1 2 UserParameter=apache.uptime,~zabbix/bin/apache2.pl http://127.0.0.1 3 UserParameter=apache.reqpersec,~zabbix/bin/apache2.pl http://127.0.0.1 4 UserParameter=apache.bytespersec,~zabbix/bin/apache2.pl http://127.0.0.1 5 UserParameter=apache.bytesperreq,~zabbix/bin/apache2.pl http://127.0.0.1 6 UserParameter=apache.busyservers,~zabbix/bin/apache2.pl http://127.0.0.1 7 UserParameter=apache.idleservers,~zabbix/bin/apache2.pl http://127.0.0.1 8 UserParameter=apache.scoreboard,~zabbix/bin/apache2.pl http://127.0.0.1 9
Code:
[root@bb-nj1-mon-web-1 bin]# cat /var/lib/zabbix/bin/apache2.pl #!/usr/bin/perl my $host = $ARGV[0]; my $cmd = 'curl -A "mozilla/4.0 (compatible; cURL 7.10.5-pre2; Linux 2.4.20)" -m 12 -s -L -k -b /tmp/bbapache_cookiejar.curl -c /tmp/bbapache_cookiejar.curl -H "Pragma: no-cache" -H "Cache-control: no-cache" -H "Connection: close" "'.$host.'/server-status?auto"'; my $server_status = qx($cmd); #print $server_status; my @apache_checks; $apache_checks[0] = $1 if ($server_status =~ /Total\ Accesses:\ ([\d|\.]+)/ig)||0; $apache_checks[1] = $1 if ($server_status =~ /Total\ kBytes:\ ([\d|\.]+)/gi); $apache_checks[2] = $1 if ($server_status =~ /CPULoad:\ ([\d|\.]+)/gi); $apache_checks[3] = $1 if ($server_status =~ /Uptime:\ ([\d|\.]+)/gi); $apache_checks[4] = $1 if ($server_status =~ /ReqPerSec:\ ([\d|\.]+)/gi); $apache_checks[5] = $1 if ($server_status =~ /BytesPerSec:\ ([\d|\.]+)/gi); $apache_checks[6] = $1 if ($server_status =~ /BytesPerReq:\ ([\d|\.]+)/gi); $apache_checks[7] = $1 if ($server_status =~ /BusyWorkers:\ ([\d|\.]+)/gi); $apache_checks[8] = $1 if ($server_status =~ /IdleWorkers:\ ([\d|\.]+)/gi); $apache_checks[9] = $1 if ($server_status =~ /Scoreboard:\ ([A-Z_]+)/gi); print "$apache_checks[$ARGV[1]]"; exit(0);

Comment