2010-10-22 18:14:59 +00:00
|
|
|
<?php
|
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
$name = 'nginx';
|
|
|
|
$app_id = $app['app_id'];
|
|
|
|
if (!empty($agent_data['app'][$name])) {
|
|
|
|
$nginx = $agent_data['app'][$name];
|
2016-08-28 12:32:58 -05:00
|
|
|
} else {
|
2015-07-10 13:36:21 +02:00
|
|
|
// Polls nginx statistics from script via SNMP
|
|
|
|
$nginx = snmp_get($device, 'nsExtendOutputFull.5.110.103.105.110.120', '-Ovq', 'NET-SNMP-EXTEND-MIB');
|
2012-05-07 21:56:38 +00:00
|
|
|
}
|
2010-10-22 18:14:59 +00:00
|
|
|
|
2016-06-08 21:13:01 -05:00
|
|
|
echo ' nginx';
|
2010-10-22 18:14:59 +00:00
|
|
|
|
|
|
|
list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx);
|
2016-06-08 21:13:01 -05:00
|
|
|
d_echo("active: $active reading: $reading writing: $writing waiting: $waiting Requests: $req");
|
2016-07-07 01:33:43 -05:00
|
|
|
|
|
|
|
$rrd_name = array('app', $name, $app_id);
|
|
|
|
$rrd_def = array(
|
|
|
|
'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'
|
2015-08-18 16:26:55 +00:00
|
|
|
);
|
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
$fields = array(
|
|
|
|
'Requests' => $req,
|
|
|
|
'Active' => $active,
|
|
|
|
'Reading' => $reading,
|
|
|
|
'Writing' => $writing,
|
|
|
|
'Waiting' => $waiting,
|
|
|
|
);
|
2010-10-22 18:14:59 +00:00
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
|
|
|
|
data_update($device, 'app', $tags, $fields);
|
2015-08-19 20:58:02 +00:00
|
|
|
|
2012-05-25 12:24:34 +00:00
|
|
|
// Unset the variables we set here
|
2016-07-07 01:33:43 -05:00
|
|
|
unset($nginx, $active, $reading, $writing, $req, $rrd_name, $rrd_def, $tags);
|