1 | <?php |
||
2 | |||
3 | // Polls MailScanner statistics from script via SNMP |
||
4 | |||
5 | use LibreNMS\RRD\RrdDefinition; |
||
6 | |||
7 | $options = '-Oqv'; |
||
8 | $oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.11.109.97.105.108.115.99.97.110.110.101.114'; |
||
9 | |||
10 | $mailscanner = snmp_get($device, $oid, $options); |
||
11 | |||
12 | echo ' mailscanner'; |
||
13 | |||
14 | [$msg_recv, $msg_rejected, $msg_relay, $msg_sent, $msg_waiting, $spam, $virus] = explode("\n", $mailscanner); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
15 | |||
16 | $name = 'mailscannerV2'; |
||
17 | $app_id = $app['app_id']; |
||
18 | $rrd_name = ['app', $name, $app_id]; |
||
19 | $rrd_def = RrdDefinition::make() |
||
20 | ->addDataset('msg_recv', 'COUNTER', 0, 125000000000) |
||
21 | ->addDataset('msg_rejected', 'COUNTER', 0, 12500000000) |
||
22 | ->addDataset('msg_relay', 'COUNTER', 0, 125000000000) |
||
23 | ->addDataset('msg_sent', 'COUNTER', 0, 125000000000) |
||
24 | ->addDataset('msg_waiting', 'COUNTER', 0, 125000000000) |
||
25 | ->addDataset('spam', 'COUNTER', 0, 125000000000) |
||
26 | ->addDataset('virus', 'COUNTER', 0, 125000000000); |
||
27 | |||
28 | $fields = [ |
||
29 | 'msg_recv' => $msg_recv, |
||
30 | 'msg_rejected' => $msg_rejected, |
||
31 | 'msg_relay' => $msg_relay, |
||
32 | 'msg_sent' => $msg_sent, |
||
33 | 'msg_waiting' => $msg_waiting, |
||
34 | 'spam' => $spam, |
||
35 | 'virus' => $virus, |
||
36 | ]; |
||
37 | |||
38 | $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); |
||
39 | data_update($device, 'app', $tags, $fields); |
||
40 | update_application($app, $mailscanner, $fields); |
||
41 |