make nginx script work via agent, patch by LinuxUser

git-svn-id: http://www.observium.org/svn/observer/trunk@3148 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-05-07 21:56:38 +00:00
parent 6a1cce6090
commit e39ac789a8
3 changed files with 16 additions and 7 deletions

View File

@@ -1,24 +1,31 @@
<?php
#Polls nginx statistics from script via SNMP
if (!empty($agent_data['app']['nginx']))
{
$nginx = $agent_data['app']['nginx'];
} else {
# Polls nginx statistics from script via SNMP
$nginx_cmd = $config['snmpget'] ." -m NET-SNMP-EXTEND-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$nginx_cmd .= " nsExtendOutputFull.5.110.103.105.110.120";
$nginx = shell_exec($nginx_cmd);
}
$nginx_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-nginx-".$app['app_id'].".rrd";
$nginx_cmd = $config['snmpget'] ." -m NET-SNMP-EXTEND-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$nginx_cmd .= " nsExtendOutputFull.5.110.103.105.110.120";
$nginx = shell_exec($nginx_cmd);
echo(" nginx statistics\n");
list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx);
if (!is_file($nginx_rrd)) {
rrdtool_create ($nginx_rrd, "--step 300 \
if (!is_file($nginx_rrd))
{
rrdtool_create ($nginx_rrd, "--step 300 \
DS:Requests:DERIVE:600:0:125000000000 \
DS:Active:GAUGE:600:0:125000000000 \
DS:Reading:GAUGE:600:0:125000000000 \
DS:Writing:GAUGE:600:0:125000000000 \
DS:Waiting:GAUGE:600:0:125000000000 ".$config['rrd_rra']);
}
print "active: $active reading: $reading writing: $writing waiting: $waiting Requests: $req";
rrdtool_update($nginx_rrd, "N:$req:$active:$reading:$writing:$waiting");

View File

@@ -42,6 +42,7 @@ if($device['os_group'] == "unix")
if ($section == "apache") { $sa = "app"; $sb = "apache"; }
if ($section == "mysql") { $sa = "app"; $sb = "mysql"; }
if ($section == "nginx") { $sa = "app"; $sb = "nginx"; }
# if ($section == "drbd") { $sa = "app"; $sb = "drbd"; }
if (!empty($sa) && !empty($sb))

View File

@@ -28,6 +28,7 @@ dataorder = [
"Requests"
]
print "<<<nginx>>>\n";
for param in dataorder:
if param == "Active":