Ad Widget

Collapse

Cisco Nexus 9000 Template issues

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Nelson
    Junior Member
    • Feb 2024
    • 3

    #1

    Cisco Nexus 9000 Template issues

    Hello, running Zabbix 6.4.14, and using the Cisco Nexus 9000 template and having some issue with values returned for temperature. I have it monitoring Module Temperature Sensor however the value that is returned when I run a test is (as an example), 257, when the actual temperature when looking at the Nexus is 25.7 so it seems there is a missing decimal point in the returned value. So I set up a pre-processing rule of 0.1 which I applied and it works by returning the correct value. The problem is that for other temperature monitors for the Nexus return correct values from the Nexus but the pre-processing rule gets applied to it so gives a very low value causing low temperature alarms (for example outlet/inlet temperature and hotspot temperature). Has anyone else seen this issue? Any ideas of a way around the issue? I can only think of having two nexus templates with one having the pre-processing rule and monitoring the module temperature sensor and the other not having the pre-processing rule.

    Any help appreciated
  • PeterLustig1337
    Junior Member
    • Jan 2025
    • 1

    #2
    Hello Kevin Nelson,
    we faced the same issue with this template today.
    Somehow the module temperature is a floating-point number but hotspot/inlet/outlet are normal decimal numbers.
    I fixed it by editing the Template "Cisco Nexus 9000 Series by SNMP" > Discovery List > "Temperature sensors discovery" > Preprocessing > #1 Javascript
    and added 0 with a scaling of 0.1 to scales like:
    Code:
    var scales = {'9': 1, '8': 0.001, '7': 0.000001, '0': 0.1};
    and additionally added a if-else condition to the main logic:
    Code:
    if (sensor['{#SNMPVALUE}'].match('^Te.*')) {
        sensor['{#SENSOR_SCALE}'] = scales['0'];
    } else {
        sensor['{#SENSOR_SCALE}'] = scales[sensor['{#SENSOR_SCALE}']];
    }
    where .match('^Te.*') matches all the TenGib Interface Modules, you maybe have to change that to fit your needs.

    Comment


    • 32pv
      32pv commented
      Editing a comment
      I can't get it to work, where do I insert it into the main logic? It doesn't matter where I put it. Can you share the script?
  • 32pv
    Junior Member
    • Apr 2025
    • 2

    #3
    I have solved the problem. Also added Gi interface to the script. Attaching the script in case anyone else gets stuck.

    try {
    var sensors = JSON.parse(value);
    } catch (e) {
    throw "Failed to parse JSON of temperature discovery.";
    }

    var scales = { '9': 1, '8': 0.001, '7': 0.000001, '0': 0.1 };
    var result = sensors.filter(function (sensor) {
    if (sensor['{#SENSOR_TYPE}'] !== '8' || typeof (scales[sensor['{#SENSOR_SCALE}']]) === 'undefined') {
    return false;
    }

    sensor['{#SENSOR_SCALE}'] = scales[sensor['{#SENSOR_SCALE}']];

    if (sensor['{#SNMPVALUE}'].match('^Te.*') || sensor['{#SNMPVALUE}'].match('^Gi.*')) {
    sensor['{#SENSOR_SCALE}'] = scales['0'];
    }

    return true;
    });

    return JSON.stringify(result);

    Comment

    Working...