mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -1,24 +1,31 @@
|
|||||||
<?php
|
<?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_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");
|
echo(" nginx statistics\n");
|
||||||
|
|
||||||
list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx);
|
list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx);
|
||||||
if (!is_file($nginx_rrd)) {
|
if (!is_file($nginx_rrd))
|
||||||
rrdtool_create ($nginx_rrd, "--step 300 \
|
{
|
||||||
|
rrdtool_create ($nginx_rrd, "--step 300 \
|
||||||
DS:Requests:DERIVE:600:0:125000000000 \
|
DS:Requests:DERIVE:600:0:125000000000 \
|
||||||
DS:Active:GAUGE:600:0:125000000000 \
|
DS:Active:GAUGE:600:0:125000000000 \
|
||||||
DS:Reading:GAUGE:600:0:125000000000 \
|
DS:Reading:GAUGE:600:0:125000000000 \
|
||||||
DS:Writing:GAUGE:600:0:125000000000 \
|
DS:Writing:GAUGE:600:0:125000000000 \
|
||||||
DS:Waiting:GAUGE:600:0:125000000000 ".$config['rrd_rra']);
|
DS:Waiting:GAUGE:600:0:125000000000 ".$config['rrd_rra']);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "active: $active reading: $reading writing: $writing waiting: $waiting Requests: $req";
|
print "active: $active reading: $reading writing: $writing waiting: $waiting Requests: $req";
|
||||||
rrdtool_update($nginx_rrd, "N:$req:$active:$reading:$writing:$waiting");
|
rrdtool_update($nginx_rrd, "N:$req:$active:$reading:$writing:$waiting");
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ if($device['os_group'] == "unix")
|
|||||||
|
|
||||||
if ($section == "apache") { $sa = "app"; $sb = "apache"; }
|
if ($section == "apache") { $sa = "app"; $sb = "apache"; }
|
||||||
if ($section == "mysql") { $sa = "app"; $sb = "mysql"; }
|
if ($section == "mysql") { $sa = "app"; $sb = "mysql"; }
|
||||||
|
if ($section == "nginx") { $sa = "app"; $sb = "nginx"; }
|
||||||
# if ($section == "drbd") { $sa = "app"; $sb = "drbd"; }
|
# if ($section == "drbd") { $sa = "app"; $sb = "drbd"; }
|
||||||
|
|
||||||
if (!empty($sa) && !empty($sb))
|
if (!empty($sa) && !empty($sb))
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ dataorder = [
|
|||||||
"Requests"
|
"Requests"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
print "<<<nginx>>>\n";
|
||||||
|
|
||||||
for param in dataorder:
|
for param in dataorder:
|
||||||
if param == "Active":
|
if param == "Active":
|
||||||
|
|||||||
Reference in New Issue
Block a user