Issues (2963)

includes/polling/cisco-voice/cisco-ip.inc.php (1 issue)

1
<?php
2
/*
3
 * LibreNMS module to IP active connections in a Cisco Voice Router
4
 *
5
 * Copyright (c) 2019 PipoCanaja
6
 *
7
 * This program is free software: you can redistribute it and/or modify it
8
 * under the terms of the GNU General Public License as published by the
9
 * Free Software Foundation, either version 3 of the License, or (at your
10
 * option) any later version.  Please see LICENSE.txt at the top level of
11
 * the source code distribution for details.
12
 */
13
14
use LibreNMS\RRD\RrdDefinition;
15
16
if ($device['os_group'] == 'cisco') {
17
    $output = snmpwalk_cache_oid($device, 'cvCallVolConnActiveConnection', [], 'CISCO-VOICE-DIAL-CONTROL-MIB');
18
    d_echo($output);
19
    if (is_array($output)) {
0 ignored issues
show
The condition is_array($output) is always true.
Loading history...
20
        $rrd_def = RrdDefinition::make()
21
            ->addDataset('h323', 'GAUGE', 0)
22
            ->addDataset('sip', 'GAUGE', 0)
23
            ->addDataset('mgcp', 'GAUGE', 0)
24
            ->addDataset('sccp', 'GAUGE', 0)
25
            ->addDataset('multicast', 'GAUGE', 0);
26
27
        $fields = [
28
            'h323' => $output['h323']['cvCallVolConnActiveConnection'],
29
            'sip' => $output['sip']['cvCallVolConnActiveConnection'],
30
            'mgcp' => $output['mgcp']['cvCallVolConnActiveConnection'],
31
            'sccp' => $output['sccp']['cvCallVolConnActiveConnection'],
32
            'multicast' => $output['multicast']['cvCallVolConnActiveConnection'],
33
        ];
34
        d_echo($fields);
35
        $tags = compact('rrd_def');
36
        data_update($device, 'cisco-voice-ip', $tags, $fields);
37
38
        $os->enableGraph('cisco-voice-ip');
39
        echo ' Cisco IOS Voice IP ';
40
        unset($rrd_def, $active, $fields, $tags);
41
    }
42
}
43