Files
librenms-librenms/includes/polling/applications/mailscanner.inc.php
T
Neil Lathwood fad5aca1b7 feature: Allow customisation of rrd step/heartbeat when creating new rrd files (#5947)
* feature: Allow customisation of rrd step/heartbeat when creating new rrd files

* revert defaults

* added docs + webui config option

* Move RrdDefinition to an Object to make them easier to create and remove the possibility of typos.

* Fix style/lint issues and missing use statements

* 3 more missing use statements

* updated doc + moved schema file
2017-02-23 22:45:50 +00:00

40 lines
1.2 KiB
PHP

<?php
// Polls MailScanner statistics from script via SNMP
use LibreNMS\RRD\RrdDefinition;
$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 = RrdDefinition::make()
->addDataset('msg_recv', 'COUNTER', 0, 125000000000)
->addDataset('msg_rejected', 'COUNTER', 0, 12500000000)
->addDataset('msg_relay', 'COUNTER', 0, 125000000000)
->addDataset('msg_sent', 'COUNTER', 0, 125000000000)
->addDataset('msg_waiting', 'COUNTER', 0, 125000000000)
->addDataset('spam', 'COUNTER', 0, 125000000000)
->addDataset('virus', 'COUNTER', 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);