Help needed to create Input Method / Data query

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

Moderators: Developers, Moderators

Post Reply
rvk
Posts: 10
Joined: Mon Feb 24, 2020 11:48 am

Help needed to create Input Method / Data query

Post by rvk »

Hi everyone!

I have trouble creating an XML for this SNMP data, because i fail to see the relation to a table. Maybe someone here can help?

I have two snmp-extension scripts, they return data on these oids:

Code: Select all

NET-SNMP-EXTEND-MIB::nsExtendOutLine."sharefree" or  .1.3.6.1.4.1.8072.1.3.2.4.1.2.9.115.104.97.114.101.102.114.101.101
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp" or .1.3.6.1.4.1.8072.1.3.2.4.1.2.8.100.105.115.107.116.101.109.112
The returned data looks like this:
sharefree oid

Code: Select all

NET-SNMP-EXTEND-MIB::nsExtendOutLine."sharefree".6 = STRING: appdata: 101541265408
NET-SNMP-EXTEND-MIB::nsExtendOutLine."sharefree".7 = STRING: books: 1980409716736
NET-SNMP-EXTEND-MIB::nsExtendOutLine."sharefree".8 = STRING: domains: 1980409716736
disktemp oid

Code: Select all

NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".1 = STRING: WDC_WD40EFRX-68WT0N0_WD-WCC4E1ZDD69Z: 43
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".2 = STRING: WDC_WD30EFRX-68N32N0_WD-WCC7K4TZPPRA: 43
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".3 = STRING: SAMSUNG_HD103SJ_S246J90B156984: 39
I realize that these probably should be two distinct data queries. one for disktemp, one for sharefree.

this is the XML i have so far:

Code: Select all

<interface>
        <name>Get Unraid Shares</name>
        <oid_index>.1.3.6.1.4.1.8072.1.3.2.4.1.2.9.115.104.97.114.101.102.114.101.101</oid_index>
        <description>Get info on Unraid Shares via SNMP</description>
        <index_order>shareName</index_order>
        <index_order_type>numeric</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>

        <fields>
                <shareName>
                        <name>Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.8072.1.3.2.4.1.2.9.115.104.97.114.101.102.114.101.101</oid>
                </shareName>
        </fields>
</interface>
Running a verbose query with this reveals, that the cacti regards the whole returned string as a value.
So now my big question is: how to i tell cacti that these fields contain and index and a value?
rvk
Posts: 10
Joined: Mon Feb 24, 2020 11:48 am

Re: Help needed to create Input Method / Data query

Post by rvk »

i figured it out for the sharefree part:

Code: Select all

<interface>
        <name>Get Unraid Shares</name>
        <oid_index>.1.3.6.1.4.1.8072.1.3.2.4.1.2.9.115.104.97.114.101.102.114.101.101</oid_index>
        <description>Get info on Unraid Shares via SNMP</description>
        <index_order>shareName</index_order>
        <index_order_type>numeric</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>

        <fields>
                <shareName>
                        <name>Share Name</name>
                        <method>walk</method>
                        <source>VALUE/REGEXP:^([a-zA-Z.\s]*)(: )([0-9]{1,})$</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.8072.1.3.2.4.1.2.9.115.104.97.114.101.102.114.101.101</oid>
                </shareName>
                <shareFree>
                        <name>Free Disk Space</name>
                        <method>walk</method>
                        <source>VALUE/REGEXP:^.*: ([0-9]{1,})$</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.8072.1.3.2.4.1.2.9.115.104.97.114.101.102.114.101.101</oid>
                </shareFree>
        </fields>
</interface>
rvk
Posts: 10
Joined: Mon Feb 24, 2020 11:48 am

Re: Help needed to create Input Method / Data query

Post by rvk »

and this is the disk temperature query

Code: Select all

<interface>
        <name>Get Unraid Disk Temperature</name>
        <oid_index>.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.100.105.115.107.116.101.109.112</oid_index>
        <description>Get temperature of HDDs in Unraid via SNMP</description>
        <index_order>diskMaker:diskIdentifier</index_order>
        <index_order_type>numeric</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>

        <fields>
                <diskMaker>
                        <name>HDD Vendor</name>
                        <method>walk</method>
                        <source>VALUE/REGEXP:^([a-zA-Z]*)(_.*)([0-9]{1,})$</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.100.105.115.107.116.101.109.112</oid>
                </diskMaker>
                <diskIdentifier>
                        <name>HDD Serial Number</name>
                        <method>walk</method>
                        <source>VALUE/REGEXP:^[A-Z]*_([a-zA-Z0-9-_]*)(.*)([0-9]{1,})$</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.100.105.115.107.116.101.109.112</oid>
                </diskIdentifier>
                <diskTemperature>
                        <name>Disk Temperature</name>
                        <method>walk</method>
                        <source>VALUE/REGEXP:^.*: ([0-9]{1,})$</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.100.105.115.107.116.101.109.112</oid>
                </diskTemperature>
        </fields>
</interface>
rvk
Posts: 10
Joined: Mon Feb 24, 2020 11:48 am

Re: Help needed to create Input Method / Data query

Post by rvk »

I would still apreciate some help since i am not receiving any data when cacti runs the query with the poller. what am i missing?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest