Librenms is not showing Fan status for Nexus devices as Nexus5010

Hi,

Librenms is not showing Fan status for Nexus devices as Nexus5010

  • The output of ./validate.php
    ./validate.php
    ====================================
    Component | Version
    --------- | -------
    LibreNMS | 1.65.1
    DB Schema | 2020_06_23_00522_alter_availability_perc_column (170)
    PHP | 7.3.18
    Python | 3.6.8
    MySQL | 5.5.65-MariaDB
    RRDTool | 1.7.2
    SNMP | NET-SNMP 5.7.2
    ====================================

[OK] Composer Version: 1.10.9
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] IPv6 is disabled on your server, you will not be able to add IPv6 devices.

state of other components as power supply:

Can anybody help me Pleaseeeeee

Hi,

Looks like or your nexus doesnt report it or is missing in LibreNMS.

Take a look to https://docs.librenms.org/Developing/Sensor-State-Support/

Hi TheGreatDoc,

The device I am using is NX-OS, and OID should be configured by default I did not change or edit it. it is configured in:
/includes/discovery/sensors/state/nxos.inc.php

The configuration looks like:

<?php /* * LibreNMS NX-OS Fan state * * Copyright (c) 2016 Dave Bell * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ $fan_tray_oid = '.1.3.6.1.4.1.9.9.117.1.4.1.1.1'; $fan_trays = snmpwalk_cache_oid_num($device, $fan_tray_oid, []); /* CISCO-ENTITY-FRU-CONTROL-MIB cefcFanTrayOperStatus * unknown(1), * up(2), * down(3), * warning(4) */ if (is_array($fan_trays)) { foreach ($fan_trays as $oid => $array) { $state = current($array); $split_oid = explode('.', $oid); $index = $split_oid[(count($split_oid) - 1)]; $current_oid = "$fan_tray_oid.$index"; $entity_oid = '.1.3.6.1.2.1.47.1.1.1.1.7'; $descr = trim(snmp_get($device, "$entity_oid.$index", '-Ovq'), '"'); $state_name = "cefcFanTrayOperStatus"; $states = [ ['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'], ['value' => 2, 'generic' => 0, 'graph' => 1, 'descr' => 'up'], ['value' => 3, 'generic' => 2, 'graph' => 1, 'descr' => 'down'], ['value' => 4, 'generic' => 1, 'graph' => 1, 'descr' => 'warning'], ]; create_state_index($state_name, $states); discover_sensor($valid['sensor'], 'state', $device, $current_oid, $index, $state_name, $descr, 1, 1); create_sensor_to_state_index($device, $state_name, $index); } }

Manually run ./discovery.php -d -h device_id -m sensors

You will see what your device is returning via snmp, which is(or should be) what LibreNMS show in the webui

I am not sure what is the meaning of the output. Here is what I got:

SQL[select migration from migrations order by id desc limit 1 [] 0.44ms]

SQL[select count(*) as aggregate from migrations limit 1 [] 0.29ms]

SQL[SELECT version() [] 0.68ms]

===================================
Version info:
Commit SHA: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Commit Date: 159…
DB Schema: 2020_05_30_162638_remove_mib_polling_tables (171)
PHP: 7.3.18
MySQL: 5.5.65-MariaDB
RRDTool: 1.7.2
SNMP: NET-SNMP 5.7.2
==================================DEBUG!
Updating os_def.cache
SQL[SELECT * FROM devices WHERE disabled = 0 AND snmp_disable = 0 AND hostname LIKE ‘xxxx’ ORDER BY device_id DESC [] 0.73ms]

./discovery.php xxxx 2020-08-11 07:10:06 - 0 devices discovered in 0.230 secs
MySQL [1/0.00s]: Cell[1/0.00s] Row[-1/-0.00s] Rows[1/0.00s] Column[0/0.00s] Update[0/0.00s] Insert[0/0.00s] Delete[0/0.00s] RRD [0/0.00s]:

I just want to mention that sensor is polling information as you can see in the below screenshot but not FAN info.

In the command I told you, you have to change device_id with the correct device_id in librenms (you can see it in the url, when in device overview)

oh sorry I replaced it with device IP first time. ok,this time I replaced it with object id. here is what I got

./discovery.php -d -h .1.3.6.1.4.1.9.12.3.1.3.798 device_id -m sensors
LibreNMS Discovery
SQL[select migration from migrations order by id desc limit 1 [] 0.43ms]

SQL[select count(*) as aggregate from migrations limit 1 [] 0.32ms]

SQL[SELECT version() [] 0.24ms]

===================================
Version info:
Commit SHA: xxxxxxxxxxxxxxxxxxxxxxxx
Commit Date: 1596087334
DB Schema: 2020_05_30_162638_remove_mib_polling_tables (171)
PHP: 7.3.18
MySQL: 5.5.65-MariaDB
RRDTool: 1.7.2
SNMP: NET-SNMP 5.7.2
==================================DEBUG!
Updating os_def.cache
SQL[SELECT * FROM devices WHERE disabled = 0 AND snmp_disable = 0 AND hostname LIKE ‘.1.3.6.1.4.1.9.12.3.1.3.798’ ORDER BY device_id DESC [] 0.8ms]

./discovery.php .1.3.6.1.4.1.9.12.3.1.3.798 2020-08-11 11:55:12 - 0 devices discovered in 0.238 secs
MySQL [1/0.00s]: Cell[1/0.00s] Row[-1/-0.00s] Rows[1/0.00s] Column[0/0.00s] Update[0/0.00s] Insert[0/0.00s] Delete[0/0.00s]
RRD [0/0.00s]:

No, thats not the device id. In the URL you have something like http://librenms/device/X

That X is the device ID

Great, I ran it and I see that fan are discovered, so why do you think it is not listed in UI?

entPhysicalName.342 = FanBay-1

entPhysicalName.343 = FanBay-2

entPhysicalName.470 = PowerSupply-1

entPhysicalName.471 = PowerSupply-2

entPhysicalName.534 = FanModule-1

entPhysicalName.536 = PowerSupply-1 Fan-1

entPhysicalName.537 = PowerSupply-1 Fan-2

entPhysicalName.538 = PowerSupply-2 Fan-1

entPhysicalName.539 = PowerSupply-2 Fan-2

additional output:
Discover Inventory Item: 534, FanModule-1, fan, FanModule-1, N5K-C5010-FAN, , 342, Cisco Systems, 1, cevFanN5kC5010Fan, , , , true, , ,

Did you ever find a conclusion for this? I’ve got the same issue. The Discovery.php reports the values, but the libreNMS system does not do anything with them.

SNMP[’/usr/bin/snmpbulkwalk’ ‘-v2c’ ‘-c’ ‘COMMUNITY’ ‘-OQUn’ ‘-M’ ‘/opt/librenms/mibs:/opt/librenms/mibs/cisco’ ‘udp:HOSTNAME:161’ ‘.1.3.6.1.4.1.9.9.117.1.4.1.1.1’]

...*.1.1.534 = 2

...*.1.1.535 = 3

...*.1.1.536 = 2

...*.1.1.537 = 2

I had the same issue.

From what I understand, it comes from the way the oid is split here : librenms/snmp.inc.php at 63b9896ac4a89bf59fb335f5b712f12647eef66f · librenms/librenms · GitHub
When calling this function with the snmpwalk flag -n, the oid will looks like .1.1.xxxx, so the explode will return an empty oid.

So I’ve replaced snmpwalk_cache_oid_num( with snmpwalk_cache_oid( here :

It fixed my issue.

Not sure if this is the correct way to fix the issue, or if there is a deeper issue with the explode() in the snmpwalk_cache_oid() function.

Bonjour @e-caille
Please open a pull request with your changed code.

  • It will allow the community to see and understand your patch
  • It will run non-regression tests over the complete test database, and help convince you and the community that the patch is not breaking anything else.

Bon WE

I’ve opened the pull request : Use non numeric snmpwalk for nxos fan trays by e-caille · Pull Request #13048 · librenms/librenms · GitHub

If anyone with the issue want to test it, to check if it also solve their issue, that would be nice.

This topic was automatically closed 730 days after the last reply. New replies are no longer allowed.