mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: small fixes for cisco-voice code (#4719)
This commit is contained in:
@@ -34,5 +34,5 @@ if ($device['os_group'] == "cisco") {
|
||||
* Cisco XCode
|
||||
* This module graphs the used and total Transcoder resources on a Cisco Voice Gateway
|
||||
*/
|
||||
include "cisco-voice/cisco-xcode.inc.php";
|
||||
include "cisco-voice/cisco-iosxcode.inc.php";
|
||||
}
|
||||
|
||||
@@ -14,32 +14,35 @@
|
||||
if ($device['os_group'] == "cisco") {
|
||||
// Total
|
||||
$total = 0;
|
||||
foreach (snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.2.1.1.6", null) as $key => $value) {
|
||||
$total += $value[''];
|
||||
}
|
||||
|
||||
if (isset($total) && ($total != "") && ($total != 0)) {
|
||||
// Active
|
||||
$active = 0;
|
||||
foreach (snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.2.1.1.7", null) as $key => $value) {
|
||||
$active += $value[''];
|
||||
$output = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.2.1.1.6", null);
|
||||
if (is_array($output)) {
|
||||
foreach ($output as $key => $value) {
|
||||
$total += $value[''];
|
||||
}
|
||||
|
||||
$rrd_def = array(
|
||||
'DS:total:GAUGE:600:0:U',
|
||||
'DS:active:GAUGE:600:0:U'
|
||||
);
|
||||
if (isset($total) && $total > 0) {
|
||||
// Active
|
||||
$active = 0;
|
||||
foreach (snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.2.1.1.7", null) as $key => $value) {
|
||||
$active += $value[''];
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'total' => $total,
|
||||
'active' => $active,
|
||||
);
|
||||
$rrd_def = array(
|
||||
'DS:total:GAUGE:600:0:U',
|
||||
'DS:active:GAUGE:600:0:U'
|
||||
);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cisco-iosdsp', $tags, $fields);
|
||||
$fields = array(
|
||||
'total' => $total,
|
||||
'active' => $active,
|
||||
);
|
||||
|
||||
$graphs['cisco-iosdsp'] = true;
|
||||
echo (" Cisco IOS DSP ");
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cisco-iosdsp', $tags, $fields);
|
||||
|
||||
$graphs['cisco-iosdsp'] = true;
|
||||
echo(" Cisco IOS DSP ");
|
||||
}
|
||||
unset($rrd_def, $total, $active, $tags, $fields);
|
||||
}
|
||||
unset($rrd_def, $total, $active, $tags, $fields);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ if ($device['os_group'] == "cisco") {
|
||||
$total = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.6.4.1.3", null);
|
||||
$total = $total['1.3.6.1.4.1.9.9.86.1.6.4.1.3'][''];
|
||||
|
||||
if (isset($total) && ($total != "") && ($total != 0)) {
|
||||
if (isset($total) && $total > 0) {
|
||||
// Available
|
||||
$available = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.6.4.1.4", null);
|
||||
$available = $available['1.3.6.1.4.1.9.9.86.1.6.4.1.4'][''];
|
||||
|
||||
@@ -16,33 +16,36 @@ if ($device['os_group'] == "cisco") {
|
||||
|
||||
// Total
|
||||
$total = 0;
|
||||
foreach (snmpwalk_cache_oid_num($device, "1.3.6.1.2.1.2.2.1.3", null) as $key => $value) {
|
||||
// 81 is the ifType for DS0's
|
||||
if ($value[''] == "81") {
|
||||
$total++;
|
||||
$output = snmpwalk_cache_oid_num($device, "1.3.6.1.2.1.2.2.1.3", null);
|
||||
if (is_array($output)) {
|
||||
foreach ($output as $key => $value) {
|
||||
// 81 is the ifType for DS0's
|
||||
if ($value[''] == "81") {
|
||||
$total++;
|
||||
}
|
||||
}
|
||||
|
||||
// Active
|
||||
$active = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.10.19.1.1.4.0", null);
|
||||
$active = $active['1.3.6.1.4.1.9.10.19.1.1.4.0'];
|
||||
|
||||
if (isset($active) && $active > 0) {
|
||||
$rrd_def = array(
|
||||
'DS:total:GAUGE:600:0:U',
|
||||
'DS:active:GAUGE:600:0:U'
|
||||
);
|
||||
|
||||
$fields = array(
|
||||
'total' => $total,
|
||||
'active' => $active,
|
||||
);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cisco-iospri', $tags, $fields);
|
||||
|
||||
$graphs['cisco-iospri'] = true;
|
||||
echo(" Cisco IOS PRI ");
|
||||
}
|
||||
unset($rrd_def, $total, $active, $fields, $tags);
|
||||
}
|
||||
|
||||
// Active
|
||||
$active = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.10.19.1.1.4.0", null);
|
||||
$active = $active['1.3.6.1.4.1.9.10.19.1.1.4.0'][''];
|
||||
|
||||
if (isset($active) && ($active != "") && ($total != 0)) {
|
||||
$rrd_def = array(
|
||||
'DS:total:GAUGE:600:0:U',
|
||||
'DS:active:GAUGE:600:0:U'
|
||||
);
|
||||
|
||||
$fields = array(
|
||||
'total' => $total,
|
||||
'active' => $active,
|
||||
);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'cisco-iospri', $tags, $fields);
|
||||
|
||||
$graphs['cisco-iospri'] = true;
|
||||
echo (" Cisco IOS PRI ");
|
||||
}
|
||||
unset($rrd_def, $total, $active, $fields, $tags);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ if ($device['os_group'] == "cisco") {
|
||||
$total = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.7.1.0", null);
|
||||
$total = $total['1.3.6.1.4.1.9.9.86.1.7.1.0'][''];
|
||||
|
||||
if (isset($total) && ($total != "") && ($total != 0)) {
|
||||
if (isset($total) && $total > 0) {
|
||||
// Available
|
||||
$available = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.7.2.0", null);
|
||||
$available = $available['1.3.6.1.4.1.9.9.86.1.7.2.0'][''];
|
||||
@@ -35,7 +35,7 @@ if ($device['os_group'] == "cisco") {
|
||||
);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
dat_update($device, 'cisco-iosxcode', $tags, $fields);
|
||||
data_update($device, 'cisco-iosxcode', $tags, $fields);
|
||||
|
||||
$graphs['cisco-iosxcode'] = true;
|
||||
echo (" Cisco IOS Transcoder ");
|
||||
|
||||
Reference in New Issue
Block a user