Help with new Data Query

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

cewood
Posts: 13
Joined: Thu Mar 25, 2010 11:09 pm
Location: Sydney, Australia

Help with new Data Query

Post by cewood »

Hello
hopefully someone can help me with a Data Query I have been trying to create to simplify adding some devices to my Cacti installs.


The type of device I am trying to create a Data Query for is an ADVA Optical Multiplexer. I have all the OID's and I am actually graphing these OID's already, but have had to make them the hard way.

Below is the SNMP OID's that I am trying to pull, with an interface listing at the top...

Code: Select all

+ Found item [ifDescr='CH-1-5-C1'] index: 269092097 [from value] 1
+ Found item [ifDescr='CH-1-5-NE'] index: 269092162 [from value] 2
+ Found item [ifDescr='CH-1-6-C1'] index: 269092353 [from value] 3
+ Found item [ifDescr='CH-1-6-C2'] index: 269092354 [from value] 4
+ Found item [ifDescr='CH-1-6-NE'] index: 269092418 [from value] 5
+ Found item [ifDescr='CH-1-6-NW'] index: 269092419 [from value] 6




VALUE intervalPhysPerfOpticalInputPwr15minMean OBJECT-TYPE (
  Syntax: [UNIVERSAL 2] INTEGER (-2147483648..2147483647)
  Units: 0.1 dBm
  Access: read-only
  Status: current
  Description: Optical Input Power Received
)
    ::= 1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3

1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3.269092097.1
1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3.269092162.1
1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3.269092353.1
1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3.269092354.1
1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3.269092418.1
1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3.269092419.1



VALUE intervalPhysPerfOpticalOutputPwr15minMean OBJECT-TYPE (
  Syntax: [UNIVERSAL 2] INTEGER (-2147483648..2147483647)
  Units: 0.1 dBm
  Access: read-only
  Status: current
  Description: Optical Output Power Transmitted
)
    ::= 1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3

1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3.269092097.1
1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3.269092162.1
1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3.269092353.1
1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3.269092354.1
1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3.269092418.1
1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3.269092419.1



Now be kind and try not to laugh to hard, but I thought something like the following would fit the bill, but I guessed that after a while of trying the REGEX's and such I wasn't going to get anywhere, and instead just tried a single FIELD statement with a hardcoded OID and still couldn't get it working...

Code: Select all

<interface>
        <name>ADVA Optical Data Query Template</name>
        <description>Queries an ADVA FSP3000 host for a list of monitorable interfaces</description>
        <index_order_type>index</index_order_type>
        <oid_index>.1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3</oid_index>
        <fields>
                <intervalPhysPerfOpticalInputPwr15minMean>
                        <name>Input Power</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3.[INTERFACE-ID-HERE:].1</oid>
                </intervalPhysPerfOpticalInputPwr15minMean>
        </fields>
        <fields>
                <intervalPhysPerfOpticalOutputPwr15minMean>
                        <name>Output Power</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3.[INTERFACE-ID-HERE:].1</oid>
                </intervalPhysPerfOpticalOutputPwr15minMean>
        </fields>
</interface>



If any of you are able to make sense of this easily and could give me a hand with it, or give me a good nudge in the right direction I would greatly appreciate it.

Kind regards
Cameron.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Due to that trailing .1 in the OID, you're going to have to use a regex to split off "269092097.1" to make it the index cacti will use. I'd suggest something like...

Code: Select all

<interface>
        <name>ADVA Optical Data Query Template</name>
        <description>Queries an ADVA FSP3000 host for a list of monitorable interfaces</description>
        <oid_index>.1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3</oid_index>
	<oid_index_parse>OID/REGEXP:.*\.([0-9].[0-9])$</oid_index_parse> 
        <index_order_type>index</index_order_type>
        <fields>
		<Index>
                        <name>Index</name>
                        <source>index</source>
                        <direction>input</direction>
		</Index>
                <intervalPhysPerfOpticalInputPwr15minMean>
                        <name>Input Power</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3</oid>
                </intervalPhysPerfOpticalInputPwr15minMean>
                <intervalPhysPerfOpticalOutputPwr15minMean>
                        <name>Output Power</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3</oid>
                </intervalPhysPerfOpticalOutputPwr15minMean>
        </fields>
</interface> 
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

A small error. Use

Code: Select all

<oid_index_parse>OID/REGEXP:.*\.([0-9]*.[0-9]*)$</oid_index_parse> 
because the indexes will have more than 1 figure
R.
cewood
Posts: 13
Joined: Thu Mar 25, 2010 11:09 pm
Location: Sydney, Australia

Post by cewood »

Gentlemen
thanks greatly for the prompt assistance, it definitely got me pointed down the right track.


I certainly had things in the wrong perspective with my prior attempts, as there was a normal interface index that I could use. I have since corrected this error in my approach as you will see below...

Code: Select all

<interface>
        <name>ADVA Optical Data Query Template</name>
        <description>Queries an ADVA FSP3000 host for a list of monitorable interfaces</description>
        <oid_index>.1.3.6.1.2.1.2.2.1.1</oid_index>
        <index_order_type>index</index_order_type>
        <fields>
                <ifIndex>
                        <name>Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.2.1.2.2.1.1</oid>
                </ifIndex>
                <ifDescr>
                        <name>Description</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.2.1.2.2.1.2</oid>
                </ifDescr>
                <ifAlias>
                        <name>Alias</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.2.1.31.1.1.1.18</oid>
                </ifAlias>
                <inputPower>
                        <name>Input Power</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3</oid>
                </inputPower>
                <outputPower>
                        <name>Output Power</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3</oid>
                </outputPower>
        </fields>
</interface>


However the inputPower and outputPower fields still fail to return data, and I would also like to know if there is some kind of wildcard I can include in their OID values to limit the walk to a single OID, ie. <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3.[INDEX-ID-HERE:].1</oid> as there are 96 records for each index/interface and I am only concerned with returning the first one.


Also these devices do have an ifDescr value at <oid>.1.3.6.1.2.1.2.2.1.2 </oid> and I was wondering if there is some way to include that dynamically in the Graph and Data template names/fields. I already tried the |query_ifDescr| that I saw in the SNMP Interfaces Data Query Template, but unfortunately this hasn't been working either.



As always any help is greatly appreciated.


Kind regards,
Cameron.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

This is called OID suffix. Please see http://docs.cacti.net/manual:088:3a_adv ... ta_queries (docs for upcoming 088)
R.
cewood
Posts: 13
Joined: Thu Mar 25, 2010 11:09 pm
Location: Sydney, Australia

Post by cewood »

gandalf wrote:This is called OID suffix. Please see http://docs.cacti.net/manual:088:3a_adv ... ta_queries (docs for upcoming 088)
R.

Thanks for the suggestion, I have just tried this and still can't get this query working correctly.

I have tried searching for more documentation regarding debugging and such, I have already enabled DEBUG level in the Poller Logging Level, but it doesn't seem to log the Debugging Verbose Query attempts when I am attempting to test my Data Query.

How can I view what query Cacti is constructing when I invoke the Verbose Query command?
cewood
Posts: 13
Joined: Thu Mar 25, 2010 11:09 pm
Location: Sydney, Australia

Post by cewood »

I just experimented adding some additional random OID's into my Data Query and these were at least mentioned in the Verbose Query output... leading me to believe that Cacti is not even trying to walk/get these OID's below...

.1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3

.1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3



Is there anything that can explain this?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Then please follow the steps mentioned in my walkthrough. Post results of each step, e.g. snmpwalks, Verbose Queries and stuff.
R.
cewood
Posts: 13
Joined: Thu Mar 25, 2010 11:09 pm
Location: Sydney, Australia

Re:

Post by cewood »

gandalf wrote:Then please follow the steps mentioned in my walkthrough. Post results of each step, e.g. snmpwalks, Verbose Queries and stuff.
R.

It's been a while, previously I ran out of time and was forced to create manual/static resources to get everything graphed as required.

Sure enough though, I have a few more of these devices to administer now, so rather than manually doing it again I want to try and work through it and get some reuse from it.


I started working through your SNMP Data Query Walkthrough, but I only get so far as the "Building Raw XML File"...

Code: Select all

<interface>
        <name>ADVA Optical Power Levels</name>
        <description>Queries a ADVA device for a list of power levels</description>
        <oid_index>.1.3.6.1.2.1.2.2.1.1</oid_index>

        <fields>
                <ifIndex>
                        <name>Index</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.2.1.2.2.1.1</oid>
                </ifIndex>

                <intervalPhysPerfOpticalInputPwr15minLow>
                        <name>Optical Input Power Received 15min Low</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.36.1.2</oid>
                        <oid_suffix>0</oid_suffix>
                </intervalPhysPerfOpticalInputPwr15minLow>

                <intervalPhysPerfOpticalInputPwr15minMean>
                        <name>Optical Input Power Received 15min Mean</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.33.1.3</oid>
                        <oid_suffix>0</oid_suffix>
                </intervalPhysPerfOpticalInputPwr15minMean>

                <intervalPhysPerfOpticalInputPwr15minHigh>
                        <name>Optical Input Power Received 15min High</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.2.1.31.1.1.1.1</oid>
                        <oid_suffix>0</oid_suffix>
                </intervalPhysPerfOpticalInputPwr15minHigh>

                <intervalPhysPerfOpticalOutputPwr15minLow>
                        <name>Optical Input Power Received 15min Low</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.36.1.2</oid>
                        <oid_suffix>0</oid_suffix>
                </intervalPhysPerfOpticalOutputPwr15minLow>

                <intervalPhysPerfOpticalOutputPwr15minMean>
                        <name>Optical Input Power Received 15min Mean</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.36.1.3</oid>
                        <oid_suffix>0</oid_suffix>
                </intervalPhysPerfOpticalOutputPwr15minMean>

                <intervalPhysPerfOpticalInputPwr15minHigh>
                        <name>Optical Input Power Received 15min High</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2544.1.11.2.6.2.33.1.4</oid>
                        <oid_suffix>0</oid_suffix>
                </intervalPhysPerfOpticalInputPwr15minHigh>
        </fields>
</interface>
then creating the new "Data Query"...
Cacti Data Query
Cacti Data Query
cacti-data-query.jpg (56.48 KiB) Viewed 3292 times

at which point when I go to add this to a host and check/debug it I get...
Cacti Data Query Debug
Cacti Data Query Debug
cacti-data-query-debug.jpg (74.64 KiB) Viewed 3292 times

Below is the snmpwalk output from the "Index Base"...

Code: Select all

snmpwalk -On -v 2c -c V6jcxxLEVYajf9CR4LKVn7YnV 192.168.242.242 .1.3.6.1.2.1.2.2.1.1
.1.3.6.1.2.1.2.2.1.1.269092097 = INTEGER: 269092097
.1.3.6.1.2.1.2.2.1.1.269092162 = INTEGER: 269092162
.1.3.6.1.2.1.2.2.1.1.269092353 = INTEGER: 269092353
.1.3.6.1.2.1.2.2.1.1.269092354 = INTEGER: 269092354
.1.3.6.1.2.1.2.2.1.1.269092418 = INTEGER: 269092418
.1.3.6.1.2.1.2.2.1.1.269092419 = INTEGER: 269092419
.1.3.6.1.2.1.2.2.1.1.554311937 = INTEGER: 554311937
.1.3.6.1.2.1.2.2.1.1.554311938 = INTEGER: 554311938
.1.3.6.1.2.1.2.2.1.1.571089153 = INTEGER: 571089153

I tried simplifying things a bit and made a straight copy of the interfaces.xml query and attempted to add just one new field, but with no luck, even a straight copy of the query wouldn't work, with no modifications. Am I missing something? I checked file permissions, everything is identical from what I can see.

Any help would be greatly appreciated.

Regards
Cameron.
--
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Help with new Data Query

Post by gandalf »

Why did you define "Script Query"? It looks very much like a standard SNMP Query.
R.
cewood
Posts: 13
Joined: Thu Mar 25, 2010 11:09 pm
Location: Sydney, Australia

Re: Help with new Data Query

Post by cewood »

gandalf wrote:Why did you define "Script Query"? It looks very much like a standard SNMP Query.
R.
Thanks for pointing that out, my fat fingers... don't know how I missed that :-?

With that fixed I get data now, [108 Items, 9 Rows]... but using <direction>input</direction> :(

When I correct these to <direction>output</direction> I don't get data for that OID anymore. Is there still a bug with oid_suffix with regard to this?


Thanks again for your help, greatly appreciated.

Regards
Cameron.
--
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Help with new Data Query

Post by gandalf »

If I remember correctly, there was indeed an issue with one of those when using oid_suffix.
This was fixed in 087g:
-bug#0001747: oid_suffix do not work correctly for input direction on data queries
R.
cewood
Posts: 13
Joined: Thu Mar 25, 2010 11:09 pm
Location: Sydney, Australia

Re: Help with new Data Query

Post by cewood »

I stumbled across that bug earlier when searching for oid_suffix, but it didn't seem to affect output direction, only input.

I'm a little lost how to proceed, with the correct directions set in my SNMP Query, said fields are completely ignored by Cacti, and without them working as output items I wont be able to graph them :(

I've turned on the debugging and set it to debug and there are no entries pertaining to the SNMP Query in those logs, or for the host in question.

Is there some way I can manually run this process that Cacti goes through when it runs an SNMP Query against a host, so that I might watch what is happening?


Regards
Cameron.
--
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Help with new Data Query

Post by gandalf »

We will enhance "Verbose Query" with upcoming 087h. It will test for more corner cases and increases verbosity slightly. Apart from my howto this is all I can tell from remote. As we have ADVA devices in place, I may test on our system; only time is missing ...
R.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Help with new Data Query

Post by gandalf »

Unfortunately, those OIDs are not present on our devices. So I can't help without having access to the system
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest