diff --git a/includes/definitions/fs-net-pdu.yaml b/includes/definitions/fs-net-pdu.yaml new file mode 100644 index 0000000000..e2456801ce --- /dev/null +++ b/includes/definitions/fs-net-pdu.yaml @@ -0,0 +1,13 @@ +os: fs-net-pdu +text: 'FS.COM monitored pdu' +type: power +icon: fs +group: fs +over: + - { graph: device_voltage, text: Voltage } + - { graph: device_current, text: Current } +discovery: + - sysObjectID: + - .1.3.6.1.4.1.30966 + - sysDescr: + - 'net-pdu' diff --git a/includes/discovery/sensors/current/fs-net-pdu.inc.php b/includes/discovery/sensors/current/fs-net-pdu.inc.php new file mode 100644 index 0000000000..1d92b4bebf --- /dev/null +++ b/includes/discovery/sensors/current/fs-net-pdu.inc.php @@ -0,0 +1,30 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Neil Lathwood + * @author Neil Lathwood + */ + +$oid = '.1.3.6.1.4.1.30966.10.3.2.4.0'; +$current = snmp_get($device, $oid, '-Oqv')/10; +if ($current > 0) { + discover_sensor($valid['sensor'], 'current', $device, $oid, 0, 'PDU L1', 'Current', 10, 1, null, null, null, null, $current); +} diff --git a/includes/discovery/sensors/voltage/fs-net-pdu.inc.php b/includes/discovery/sensors/voltage/fs-net-pdu.inc.php new file mode 100644 index 0000000000..55a7e5811b --- /dev/null +++ b/includes/discovery/sensors/voltage/fs-net-pdu.inc.php @@ -0,0 +1,30 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Neil Lathwood + * @author Neil Lathwood + */ + +$oid = '.1.3.6.1.4.1.30966.10.3.2.1.0'; +$voltage = snmp_get($device, $oid, '-Oqv'); +if ($voltage > 0) { + discover_sensor($valid['sensor'], 'voltage', $device, $oid, 0, 'PDU L1', 'Voltage', 1, 1, null, null, null, null, $voltage); +} diff --git a/tests/data/fs-net-pdu.json b/tests/data/fs-net-pdu.json new file mode 100644 index 0000000000..33ee2d4be1 --- /dev/null +++ b/tests/data/fs-net-pdu.json @@ -0,0 +1,316 @@ +{ + "os": { + "discovery": { + "devices": [ + { + "sysName": "", + "sysObjectID": ".1.3.6.1.4.1.30966", + "sysDescr": "net-pdu", + "sysContact": null, + "version": null, + "hardware": null, + "features": null, + "os": "fs-net-pdu", + "type": "power", + "serial": null, + "icon": "fs.svg", + "location": null + } + ] + }, + "poller": { + "devices": [ + { + "sysName": "", + "sysObjectID": ".1.3.6.1.4.1.30966", + "sysDescr": "net-pdu", + "sysContact": "", + "version": null, + "hardware": null, + "features": null, + "os": "fs-net-pdu", + "type": "power", + "serial": null, + "icon": "fs.svg", + "location": "" + } + ] + } + }, + "ports": { + "discovery": { + "ports": [ + { + "port_descr_type": null, + "port_descr_descr": null, + "port_descr_circuit": null, + "port_descr_speed": null, + "port_descr_notes": null, + "ifDescr": "e0", + "ifName": "e0", + "portName": null, + "ifIndex": 1, + "ifSpeed": null, + "ifConnectorPresent": null, + "ifPromiscuousMode": null, + "ifHighSpeed": null, + "ifOperStatus": null, + "ifOperStatus_prev": null, + "ifAdminStatus": null, + "ifAdminStatus_prev": null, + "ifDuplex": null, + "ifMtu": null, + "ifType": "0", + "ifAlias": "e0", + "ifPhysAddress": null, + "ifHardType": null, + "ifLastChange": 0, + "ifVlan": "", + "ifTrunk": null, + "counter_in": null, + "counter_out": null, + "ignore": 0, + "disabled": 0, + "detailed": 0, + "deleted": 0, + "pagpOperationMode": null, + "pagpPortState": null, + "pagpPartnerDeviceId": null, + "pagpPartnerLearnMethod": null, + "pagpPartnerIfIndex": null, + "pagpPartnerGroupIfIndex": null, + "pagpPartnerDeviceName": null, + "pagpEthcOperationMode": null, + "pagpDeviceId": null, + "pagpGroupIfIndex": null, + "ifInUcastPkts": null, + "ifInUcastPkts_prev": null, + "ifInUcastPkts_delta": null, + "ifInUcastPkts_rate": null, + "ifOutUcastPkts": null, + "ifOutUcastPkts_prev": null, + "ifOutUcastPkts_delta": null, + "ifOutUcastPkts_rate": null, + "ifInErrors": null, + "ifInErrors_prev": null, + "ifInErrors_delta": null, + "ifInErrors_rate": null, + "ifOutErrors": null, + "ifOutErrors_prev": null, + "ifOutErrors_delta": null, + "ifOutErrors_rate": null, + "ifInOctets": null, + "ifInOctets_prev": null, + "ifInOctets_delta": null, + "ifInOctets_rate": null, + "ifOutOctets": null, + "ifOutOctets_prev": null, + "ifOutOctets_delta": null, + "ifOutOctets_rate": null, + "poll_prev": null, + "ifInNUcastPkts": null, + "ifInNUcastPkts_prev": null, + "ifInNUcastPkts_delta": null, + "ifInNUcastPkts_rate": null, + "ifOutNUcastPkts": null, + "ifOutNUcastPkts_prev": null, + "ifOutNUcastPkts_delta": null, + "ifOutNUcastPkts_rate": null, + "ifInDiscards": null, + "ifInDiscards_prev": null, + "ifInDiscards_delta": null, + "ifInDiscards_rate": null, + "ifOutDiscards": null, + "ifOutDiscards_prev": null, + "ifOutDiscards_delta": null, + "ifOutDiscards_rate": null, + "ifInUnknownProtos": null, + "ifInUnknownProtos_prev": null, + "ifInUnknownProtos_delta": null, + "ifInUnknownProtos_rate": null, + "ifInBroadcastPkts": null, + "ifInBroadcastPkts_prev": null, + "ifInBroadcastPkts_delta": null, + "ifInBroadcastPkts_rate": null, + "ifOutBroadcastPkts": null, + "ifOutBroadcastPkts_prev": null, + "ifOutBroadcastPkts_delta": null, + "ifOutBroadcastPkts_rate": null, + "ifInMulticastPkts": null, + "ifInMulticastPkts_prev": null, + "ifInMulticastPkts_delta": null, + "ifInMulticastPkts_rate": null, + "ifOutMulticastPkts": null, + "ifOutMulticastPkts_prev": null, + "ifOutMulticastPkts_delta": null, + "ifOutMulticastPkts_rate": null + } + ] + }, + "poller": { + "ports": [ + { + "port_descr_type": null, + "port_descr_descr": null, + "port_descr_circuit": null, + "port_descr_speed": null, + "port_descr_notes": null, + "ifDescr": "e0", + "ifName": "e0", + "portName": null, + "ifIndex": 1, + "ifSpeed": 0, + "ifConnectorPresent": null, + "ifPromiscuousMode": null, + "ifHighSpeed": null, + "ifOperStatus": "up", + "ifOperStatus_prev": null, + "ifAdminStatus": "up", + "ifAdminStatus_prev": null, + "ifDuplex": null, + "ifMtu": 1500, + "ifType": "0", + "ifAlias": "e0", + "ifPhysAddress": "2c265f333091", + "ifHardType": null, + "ifLastChange": 0, + "ifVlan": "", + "ifTrunk": null, + "counter_in": null, + "counter_out": null, + "ignore": 0, + "disabled": 0, + "detailed": 0, + "deleted": 0, + "pagpOperationMode": null, + "pagpPortState": null, + "pagpPartnerDeviceId": null, + "pagpPartnerLearnMethod": null, + "pagpPartnerIfIndex": null, + "pagpPartnerGroupIfIndex": null, + "pagpPartnerDeviceName": null, + "pagpEthcOperationMode": null, + "pagpDeviceId": null, + "pagpGroupIfIndex": null, + "ifInUcastPkts": 0, + "ifInUcastPkts_prev": 0, + "ifInUcastPkts_delta": null, + "ifInUcastPkts_rate": null, + "ifOutUcastPkts": 0, + "ifOutUcastPkts_prev": 0, + "ifOutUcastPkts_delta": null, + "ifOutUcastPkts_rate": null, + "ifInErrors": 0, + "ifInErrors_prev": 0, + "ifInErrors_delta": null, + "ifInErrors_rate": null, + "ifOutErrors": 0, + "ifOutErrors_prev": 0, + "ifOutErrors_delta": null, + "ifOutErrors_rate": null, + "ifInOctets": 0, + "ifInOctets_prev": 0, + "ifInOctets_delta": null, + "ifInOctets_rate": null, + "ifOutOctets": 0, + "ifOutOctets_prev": 0, + "ifOutOctets_delta": null, + "ifOutOctets_rate": null, + "poll_prev": null, + "ifInNUcastPkts": 0, + "ifInNUcastPkts_prev": 0, + "ifInNUcastPkts_delta": null, + "ifInNUcastPkts_rate": null, + "ifOutNUcastPkts": 0, + "ifOutNUcastPkts_prev": 0, + "ifOutNUcastPkts_delta": null, + "ifOutNUcastPkts_rate": null, + "ifInDiscards": 0, + "ifInDiscards_prev": 0, + "ifInDiscards_delta": null, + "ifInDiscards_rate": null, + "ifOutDiscards": 0, + "ifOutDiscards_prev": 0, + "ifOutDiscards_delta": null, + "ifOutDiscards_rate": null, + "ifInUnknownProtos": 0, + "ifInUnknownProtos_prev": 0, + "ifInUnknownProtos_delta": null, + "ifInUnknownProtos_rate": null, + "ifInBroadcastPkts": 0, + "ifInBroadcastPkts_prev": 0, + "ifInBroadcastPkts_delta": null, + "ifInBroadcastPkts_rate": null, + "ifOutBroadcastPkts": 0, + "ifOutBroadcastPkts_prev": 0, + "ifOutBroadcastPkts_delta": null, + "ifOutBroadcastPkts_rate": null, + "ifInMulticastPkts": 0, + "ifInMulticastPkts_prev": 0, + "ifInMulticastPkts_delta": null, + "ifInMulticastPkts_rate": null, + "ifOutMulticastPkts": 0, + "ifOutMulticastPkts_prev": 0, + "ifOutMulticastPkts_delta": null, + "ifOutMulticastPkts_rate": null + } + ] + } + }, + "sensors": { + "discovery": { + "sensors": [ + { + "sensor_deleted": 0, + "sensor_class": "current", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.4.1.30966.10.3.2.4.0", + "sensor_index": "0", + "sensor_type": "PDU L1", + "sensor_descr": "Current", + "group": null, + "sensor_divisor": 10, + "sensor_multiplier": 1, + "sensor_current": 6, + "sensor_limit": null, + "sensor_limit_warn": null, + "sensor_limit_low": null, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": null, + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "state_name": null + }, + { + "sensor_deleted": 0, + "sensor_class": "voltage", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.4.1.30966.10.3.2.1.0", + "sensor_index": "0", + "sensor_type": "PDU L1", + "sensor_descr": "Voltage", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 229, + "sensor_limit": 263.35, + "sensor_limit_warn": null, + "sensor_limit_low": 194.65, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": null, + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "state_name": null + } + ], + "state_indexes": [] + }, + "poller": "matches discovery" + } +} diff --git a/tests/snmpsim/fs-net-pdu.snmprec b/tests/snmpsim/fs-net-pdu.snmprec new file mode 100644 index 0000000000..554e5ca5b8 --- /dev/null +++ b/tests/snmpsim/fs-net-pdu.snmprec @@ -0,0 +1,118 @@ +1.3.6.1.2.1.1.1.0|4|net-pdu +1.3.6.1.2.1.1.2.0|6|.1.3.6.1.4.1.30966 +1.3.6.1.2.1.1.3.0|67|0 +1.3.6.1.2.1.1.4.0|4| +1.3.6.1.2.1.1.5.0|4| +1.3.6.1.2.1.1.6.0|4| +1.3.6.1.2.1.2.2.1.1.1|2|1 +1.3.6.1.2.1.2.2.1.2.1|4|e0 +1.3.6.1.2.1.2.2.1.3.1|2|0 +1.3.6.1.2.1.2.2.1.4.1|2|1500 +1.3.6.1.2.1.2.2.1.5.1|66|0 +1.3.6.1.2.1.2.2.1.6.1|4x|2C265F333091 +1.3.6.1.2.1.2.2.1.7.1|2|1 +1.3.6.1.2.1.2.2.1.8.1|2|1 +1.3.6.1.2.1.2.2.1.9.1|67|0 +1.3.6.1.2.1.2.2.1.10.1|65|0 +1.3.6.1.2.1.2.2.1.11.1|65|0 +1.3.6.1.2.1.2.2.1.12.1|65|0 +1.3.6.1.2.1.2.2.1.13.1|65|0 +1.3.6.1.2.1.2.2.1.14.1|65|0 +1.3.6.1.2.1.2.2.1.15.1|65|0 +1.3.6.1.2.1.2.2.1.16.1|65|0 +1.3.6.1.2.1.2.2.1.17.1|65|0 +1.3.6.1.2.1.2.2.1.18.1|65|0 +1.3.6.1.2.1.2.2.1.19.1|65|0 +1.3.6.1.2.1.2.2.1.20.1|65|0 +1.3.6.1.2.1.2.2.1.21.1|66|0 +1.3.6.1.2.1.2.2.1.22.1|6|0.0 +1.3.6.1.2.1.4.3.0|65|1656497 +1.3.6.1.2.1.4.4.0|65|0 +1.3.6.1.2.1.4.5.0|65|191 +1.3.6.1.2.1.4.6.0|65|0 +1.3.6.1.2.1.4.7.0|65|0 +1.3.6.1.2.1.4.8.0|65|191 +1.3.6.1.2.1.4.9.0|65|1656305 +1.3.6.1.2.1.4.10.0|65|1647825 +1.3.6.1.2.1.4.11.0|65|0 +1.3.6.1.2.1.4.12.0|65|0 +1.3.6.1.2.1.4.14.0|65|0 +1.3.6.1.2.1.4.15.0|65|0 +1.3.6.1.2.1.4.16.0|65|0 +1.3.6.1.2.1.4.17.0|65|0 +1.3.6.1.2.1.4.18.0|65|0 +1.3.6.1.2.1.4.19.0|65|0 +1.3.6.1.2.1.4.20.1.2.172.16.152.3|2|1 +1.3.6.1.2.1.4.20.1.3.172.16.152.3|64|255.255.255.0 +1.3.6.1.2.1.4.22.1.2.1.172.16.152.1|4x|001647AEB243 +1.3.6.1.2.1.5.1.0|65|22897 +1.3.6.1.2.1.5.2.0|65|0 +1.3.6.1.2.1.5.3.0|65|0 +1.3.6.1.2.1.5.4.0|65|0 +1.3.6.1.2.1.5.5.0|65|0 +1.3.6.1.2.1.5.6.0|65|0 +1.3.6.1.2.1.5.7.0|65|0 +1.3.6.1.2.1.5.8.0|65|0 +1.3.6.1.2.1.5.9.0|65|0 +1.3.6.1.2.1.5.10.0|65|0 +1.3.6.1.2.1.5.11.0|65|0 +1.3.6.1.2.1.5.12.0|65|0 +1.3.6.1.2.1.5.13.0|65|0 +1.3.6.1.2.1.5.14.0|65|22897 +1.3.6.1.2.1.5.15.0|65|0 +1.3.6.1.2.1.5.16.0|65|0 +1.3.6.1.2.1.5.17.0|65|0 +1.3.6.1.2.1.5.18.0|65|0 +1.3.6.1.2.1.5.19.0|65|0 +1.3.6.1.2.1.5.20.0|65|0 +1.3.6.1.2.1.5.21.0|65|0 +1.3.6.1.2.1.5.22.0|65|22897 +1.3.6.1.2.1.5.23.0|65|0 +1.3.6.1.2.1.5.24.0|65|0 +1.3.6.1.2.1.5.25.0|65|0 +1.3.6.1.2.1.5.26.0|65|0 +1.3.6.1.2.1.6.5.0|65|0 +1.3.6.1.2.1.6.6.0|65|8428 +1.3.6.1.2.1.6.7.0|65|0 +1.3.6.1.2.1.6.8.0|65|8428 +1.3.6.1.2.1.6.9.0|66|0 +1.3.6.1.2.1.6.10.0|65|50665 +1.3.6.1.2.1.6.11.0|65|25633 +1.3.6.1.2.1.6.12.0|65|0 +1.3.6.1.2.1.6.14.0|65|0 +1.3.6.1.2.1.6.15.0|65|7982 +1.3.6.1.2.1.7.1.0|65|1582796 +1.3.6.1.2.1.7.2.0|65|0 +1.3.6.1.2.1.7.3.0|65|0 +1.3.6.1.2.1.7.4.0|65|1582664 +1.3.6.1.2.1.11.1.0|65|1582755 +1.3.6.1.2.1.11.2.0|65|1582623 +1.3.6.1.2.1.11.3.0|65|97 +1.3.6.1.2.1.11.4.0|65|35 +1.3.6.1.2.1.11.5.0|65|0 +1.3.6.1.2.1.11.6.0|65|0 +1.3.6.1.2.1.11.8.0|65|0 +1.3.6.1.2.1.11.9.0|65|0 +1.3.6.1.2.1.11.10.0|65|0 +1.3.6.1.2.1.11.11.0|65|0 +1.3.6.1.2.1.11.12.0|65|0 +1.3.6.1.2.1.11.13.0|65|2136814 +1.3.6.1.2.1.11.14.0|65|0 +1.3.6.1.2.1.11.15.0|65|423767 +1.3.6.1.2.1.11.16.0|65|1158870 +1.3.6.1.2.1.11.17.0|65|0 +1.3.6.1.2.1.11.18.0|65|0 +1.3.6.1.2.1.11.19.0|65|0 +1.3.6.1.2.1.11.20.0|65|0 +1.3.6.1.2.1.11.21.0|65|332825 +1.3.6.1.2.1.11.22.0|65|0 +1.3.6.1.2.1.11.24.0|65|0 +1.3.6.1.2.1.11.25.0|65|0 +1.3.6.1.2.1.11.26.0|65|0 +1.3.6.1.2.1.11.27.0|65|0 +1.3.6.1.2.1.11.28.0|65|1582647 +1.3.6.1.2.1.11.29.0|65|0 +1.3.6.1.2.1.11.30.0|2|2 +1.3.6.1.4.1.30966.10.3.1.1.0|4|PDU-R1-S +1.3.6.1.4.1.30966.10.3.2.1.0|2|229 +1.3.6.1.4.1.30966.10.3.2.4.0|2|60