mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #1661 from mmarchand/issue-1641
Update IOS-XR watts to be dbm sensor as well
This commit is contained in:
@@ -23,7 +23,7 @@ Contributors to LibreNMS:
|
||||
- Stuart Henderson <stu@spacehopper.org> (sthen)
|
||||
- Filippo Giunchedi <filippo@esaurito.net> (filippog)
|
||||
- Lasse Leegaard <lasse@brandbil.dk> (lasseleegaard)
|
||||
- Mickael Marchand <mmarchand@corp.free.fr> (mmarchand)
|
||||
- Mickael Marchand <mmarchand@corp.free.fr> (mmarchand)
|
||||
- Mohammad Al-Shami <mohammad@al-shami.net> (mohshami)
|
||||
- Rudy Hardeman <zarya@gigafreak.net> (zarya)
|
||||
- Arjit Chaudhary (arjit.c@gmail.com) (arjitc)
|
||||
|
@@ -163,8 +163,21 @@ if ($device['os_group'] == 'cisco') {
|
||||
} //end if
|
||||
|
||||
if ($ok) {
|
||||
// echo("\n".$valid['sensor'].", $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current");
|
||||
discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity']);
|
||||
#Cisco IOS-XR : add a fake sensor to graph as dbm
|
||||
if ($type == "power" and $device['os'] == "iosxr" and preg_match ("/Transceiver (R|T)x/i", $descr) ) {
|
||||
// convert Watts to dbm
|
||||
$type = "dbm";
|
||||
$limit_low = 10 * log10($limit_low*1000);
|
||||
$warn_limit_low = 10 * log10($warn_limit_low*1000);
|
||||
$warn_limit = 10 * log10($warn_limit*1000);
|
||||
$limit = 10 * log10($limit*1000);
|
||||
$current = round(10 * log10($current*1000),3);
|
||||
$multiplier = 1;
|
||||
$divisor = 1;
|
||||
//echo("\n".$valid['sensor'].", $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current");
|
||||
discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity']);
|
||||
}
|
||||
}
|
||||
|
||||
$cisco_entity_temperature = 1;
|
||||
|
@@ -44,6 +44,13 @@ function poll_sensor($device, $class, $unit) {
|
||||
else if ($class == 'state') {
|
||||
$sensor_value = trim(str_replace('"', '', snmp_walk($device, $sensor['sensor_oid'], '-Oevq', 'SNMPv2-MIB')));
|
||||
}
|
||||
else if ($class == 'dbm') {
|
||||
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib")));
|
||||
//iosxr does not expose dbm values through SNMP so we convert Watts to dbm to have a nice graph to show
|
||||
if ($device['os'] == "iosxr") {
|
||||
$sensor_value = round(10*log10($sensor_value/1000),3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($sensor['sensor_type'] == 'apc') {
|
||||
$sensor_value = trim(str_replace('"', '', snmp_walk($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB:PowerNet-MIB$mib")));
|
||||
|
Reference in New Issue
Block a user