SNMP Data Query with regex processing

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
RaduAlexandru
Posts: 33
Joined: Mon Mar 28, 2005 5:06 pm
Location: Bucharest, Romania
Contact:

SNMP Data Query with regex processing

#1 Post by RaduAlexandru » Mon Sep 30, 2019 7:19 pm

Hello!
I was wondering if anyone could help me with a issue I have with a snmp data query.

I attempted to make my own graphs for a qnap device, using this (somewhat dated) tutorial: https://docs.cacti.net/manual:100:3a_ad ... alkthrough
I did manage to make another graph template for the fans, but for the hdd temps I kind of hit an wall... I get strange data back and I can't figure out why.

I pasted here snmptable output:

Code: Select all

[email protected]:~$ snmptable -m ALL -v2c -c public 10.1.0.10 .1.3.6.1.4.1.24681.1.2.11
Bad operator (INTEGER): At line 73 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
SNMP table: NAS-MIB::systemHdTable

 hdIndex hdDescr hdTemperature hdStatus              hdModel hdCapacity hdSmartInfo
       1  "HDD1"   "-- C/-- F"   noDisk                 "--"       "--"        "--"
       2  "HDD2"   "-- C/-- F"   noDisk                 "--"       "--"        "--"
       3  "HDD3"   "-- C/-- F"   noDisk                 "--"       "--"        "--"
       4  "HDD4"   "-- C/-- F"   noDisk                 "--"       "--"        "--"
       5  "HDD5"   "29 C/84 F"    ready "WD2002FFSX-68PF8N0"  "1.82 TB"      "GOOD"
       6  "HDD6"   "29 C/84 F"    ready "WD2002FFSX-68PF8N0"  "1.82 TB"      "GOOD"
       7  "HDD7"   "29 C/84 F"    ready "WD2002FFSX-68PF8N0"  "1.82 TB"      "GOOD"
       8  "HDD8"   "28 C/82 F"    ready "WD2002FFSX-68PF8N0"  "1.82 TB"      "GOOD"
And yet my graphs show temperatures between 2.8k an 3.0k (yes, 3000 degrees Celsius). I can't figure out what I did wrong...
Image

This is my snmp data query xml

Code: Select all

<interface>
    <name>Get NAS-MIB::systemHdTable Information</name>
    <description>Get SNMP based Fan Information out of NAS-MIB::systemHdTable</description>
    <index_order>hdDescr:hdIndex</index_order>
    <index_order_type>numeric</index_order_type>
    <oid_index>.1.3.6.1.4.1.24681.1.2.11.1.1</oid_index>
    <oid_num_indexes>.1.3.6.1.4.1.24681.1.2.10.0</oid_num_indexes>

    <fields>
        <hdIndex>
            <name>Index</name>
            <method>walk</method>
            <source>value</source>
            <direction>input</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.1</oid>
        </hdIndex>
        <hdDescr>
            <name>Description</name>
            <method>walk</method>
            <source>value</source>
            <direction>input</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.2</oid>
        </hdDescr>
        <hdTemperature>
            <!-- Sample value: "27 C/80 F" -->
            <name>Temperature</name>
            <method>walk</method>
            <source>value</source>
            <direction>input-output</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.3</oid>
        </hdTemperature>
        <hdTemperatureC>
            <!-- Sample value: "27 C/80 F" -->
            <name>Temperature in Celsius</name>
            <method>walk</method>
            <source>VALUE/REGEX:((?:\+|-)?\s*\d+(?:\.\d+)?)\s*C\/(?:\+|-)?\s*(?:\+|-)?\s*\d+(?:\.\d+)?\s*F</source>
            <direction>input-output</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.3</oid>
        </hdTemperatureC>
        <hdTemperatureF>
            <!-- Sample value: "27 C/80 F" -->
            <name>Temperature in Fahrenheit</name>
            <method>walk</method>
            <source>VALUE/REGEX:(?:\+|-)?\s*\d+(?:\.\d+)?\s*C\/((?:\+|-)?\s*(?:\+|-)?\s*\d+(?:\.\d+)?)\s*F</source>
            <direction>input-output</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.3</oid>
        </hdTemperatureF>
        <hdStatus>
            <name>Status</name>
            <method>walk</method>
            <source>value</source>
            <direction>input</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.4</oid>
        </hdStatus>
        <hdModel>
            <name>Model</name>
            <method>walk</method>
            <source>value</source>
            <direction>input</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.5</oid>
        </hdModel>
        <hdCapacity>
            <name>Capacity</name>
            <method>walk</method>
            <source>value</source>
            <direction>input</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.6</oid>
        </hdCapacity>
        <hdSmartInfo>
            <name>Smart Info</name>
            <method>walk</method>
            <source>value</source>
            <direction>input</direction>
            <oid>.1.3.6.1.4.1.24681.1.2.11.1.7</oid>
        </hdSmartInfo>
    </fields>
</interface>

Any help or suggestions would be greatly appreciated.

Post Reply