Tony Murray 57650e4ffc Remove nfs requirement for distributed poller (with rrdtool 1.5+)
Use data_update instead of rrd_update/rrd_create and influx_update
Centralize rrd file check so we can check against a remote rrdcached server too
Use rrd_name() to generate rrd file names
2016-07-07 21:10:06 -05:00

40 lines
1.1 KiB
PHP

<?php
// Polls MailScanner statistics from script via SNMP
$options = '-O qv';
$oid = 'nsExtendOutputFull.11.109.97.105.108.115.99.97.110.110.101.114';
$mailscanner = snmp_get($device, $oid, $options);
echo ' mailscanner';
list ($msg_recv, $msg_rejected, $msg_relay, $msg_sent, $msg_waiting, $spam, $virus) = explode("\n", $mailscanner);
$name = 'mailscannerV2';
$app_id = $app['app_id'];
$rrd_name = array('app', $name, $app_id);
$rrd_def = array(
'DS:msg_recv:COUNTER:600:0:125000000000',
'DS:msg_rejected:COUNTER:600:0:12500000000',
'DS:msg_relay:COUNTER:600:0:125000000000',
'DS:msg_sent:COUNTER:600:0:125000000000',
'DS:msg_waiting:COUNTER:600:0:125000000000',
'DS:spam:COUNTER:600:0:125000000000',
'DS:virus:COUNTER:600:0:125000000000'
);
$fields = array(
'msg_recv' => $msg_recv,
'msg_rejected' => $msg_rejected,
'msg_relay' => $msg_relay,
'msg_sent' => $msg_sent,
'msg_waiting' => $msg_waiting,
'spam' => $spam,
'virus' => $virus,
);
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);