Indexed Queries and Data Source/Graph naming hints

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

Moderators: Developers, Moderators

Post Reply
FauxPasIII
Posts: 6
Joined: Wed Feb 13, 2008 11:42 pm

Indexed Queries and Data Source/Graph naming hints

Post by FauxPasIII »

I'm having some trouble getting my indexed queries to work the way I want them. I have defined the snmp query below. I have created a data template and a graph template to graph the foundryConnections datum, and I have registered the graph template with my query. I added a hint to the data template for "name":

Code: Select all

|host_description| - Foundry Connections - |query_foundryIP| port |query_foundryPort|
and an identical hint for "title" to the graph template. I've registered the query with the relevant device, and a "Verbose Query" test looks perfect. However, when I go to create graphs, select the ones I want and commit, the graphs and data sources created have literal "|query_foundryIP|" and "|query_foundryPort|" in them; they are not substituted as I expect. "|host_description|" is substituted correctly.

Can anyone point out what I'm doing wrong? Many thanks in advance!

Code: Select all

<foundryConnections>
        <name>Foundry Real Connections</name>
        <oid_index>.1.3.6.1.4.1.1991.1.1.4.24.1.1.8</oid_index>
        <oid_index_parse>OID/REGEXP:\.1\.3\.6\.1\.4\.1\.1991\.1\.1\.4\.24\.1\.1\.8\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)</oid_index_parse>
        <fields>
                <foundryIP>
                        <name>Real IP Address</name>
                        <method>walk</method>
                        <source>OID/REGEXP:\.1\.3\.6\.1\.4\.1\.1991\.1\.1\.4\.24\.1\.1\.8\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.1991.1.1.4.24.1.1.8</oid>
                </foundryIP>
                <foundryPort>
                        <name>Real Port</name>
                        <method>walk</method>
                        <source>OID/REGEXP:\.1\.3\.6\.1\.4\.1\.1991\.1\.1\.4\.24\.1\.1\.8\.[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.([0-9]+)</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.1991.1.1.4.24.1.1.8</oid>
                </foundryPort>
                <foundryConnections>
                        <name>Connections</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.1991.1.1.4.24.1.1.8</oid>
                </foundryConnections>
        </fields>
</foundryConnections>
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

wrong forum, moving.

Looks like you've almost got it down. In the Data Query for this foundryConnections, you've associated a graph template right? You've also set up Suggested Values for the graph title, right? Look at what the SNMP - Interface Statistics does in these regards, to see what I mean.

I believe that this is the only way in which data retrieved from xml scripts can be dynamically placed into graph titles. Simply having |query_foundryIP| in a graph template will NOT result in it getting filled out.
FauxPasIII
Posts: 6
Joined: Wed Feb 13, 2008 11:42 pm

Post by FauxPasIII »

BSOD2600 wrote:wrong forum, moving.
Thanks. =)
BSOD2600 wrote:Looks like you've almost got it down. In the Data Query for this foundryConnections, you've associated a graph template right?
Yes.
BSOD2600 wrote:You've also set up Suggested Values for the graph title, right?
Yeah, that's what I meant when I said "hints". I've added the snippet above as a suggested value for "title" to the graph template, and for "name" to the data template.
BSOD2600 wrote:Look at what the SNMP - Interface Statistics does in these regards, to see what I mean.
Yeah, that's what I was using as a reference... can't figure out what I'm doing differently. =(

Thanks for taking a look!
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Look in the snmp cache for that device, do you see the the foundryIP and foundryPort?

For testing, switch the direction for foundryPort/ip to OUT and then use the verbose query in cacti. Did it return the correct data?

Last thing, try using the 'reapply suggested names' in graph management for the foundry templates. Work?
FauxPasIII
Posts: 6
Joined: Wed Feb 13, 2008 11:42 pm

Post by FauxPasIII »

BSOD2600 wrote:Look in the snmp cache for that device, do you see the the foundryIP and foundryPort?
Yes, and I see foundryConnections when I've tuned it to be an input rather than an output. One slight nit that might be a clue: the OID value listed in SNMP Cache is strange. The actual layout in an snmp walk is

Code: Select all

<prefix>.<ip>.<port> = <connections>
so I'm walking prefix to get keys of <ip>.<port>, as defined in the query above.

The OID values in SNMP cache look like <prefix>.<ip> for foundryIP, <prefix>.<port> for foundryPort, and the correct <prefix>.<ip>.<port> for foundryConnections. I suspect this is just a quirk of using OID/REGEXP to get the values, but just thought I'd mention it.
BSOD2600 wrote:For testing, switch the direction for foundryPort/ip to OUT and then use the verbose query in cacti. Did it return the correct data?
I get no results, which is what I expected based on comparison with the Interfaces built-in query... did you mean change foundryConnections to "input" also? I've done that and it does appear to be getting the data correctly.
BSOD2600 wrote:Last thing, try using the 'reapply suggested names' in graph management for the foundry templates. Work?
Nope, it left them unchanged. =(
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

In your data query, in the Associated Data Templates section, make sure you've got that checkbox to the far right checked.

As for the snmp cache, mind posting some of the sample data?

You said the data being collected from this template was correct (and/or verified the data in the associated rrd file) ?
FauxPasIII
Posts: 6
Joined: Wed Feb 13, 2008 11:42 pm

Post by FauxPasIII »

BSOD2600 wrote:In your data query, in the Associated Data Templates section, make sure you've got that checkbox to the far right checked.
Yes.
BSOD2600 wrote:As for the snmp cache, mind posting some of the sample data?
There are many entries like this:

Code: Select all

Host: fakehostname04 , SNMP Query: Foundry Real Connections
Index: 10.0.0.28.65535 , Field Name: foundryIP , Field Value: 10.0.0.28
OID: .1.3.6.1.4.1.1991.1.1.4.24.1.1.8.10.0.0.28
and many like this:

Code: Select all

Host: fakehostname04 , SNMP Query: Foundry Real Connections
Index: 10.0.0.28.65535 , Field Name: foundryPort , Field Value: 65535
OID: .1.3.6.1.4.1.1991.1.1.4.24.1.1.8.65535
BSOD2600 wrote:You said the data being collected from this template was correct (and/or verified the data in the associated rrd file) ?
When I run a "verbose query" from the device view, it shows reasonable looking data for everything I have designated an "input" field, including foundryConnections when I set it to input for testing purposes.

Thanks a lot for your help so far, by the way!
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Hmm, well I'm stumped, because it all appears to me that it should work.

Guess a dev will need to look into it since all the obvious issues have been covered, IMO.

Mind posting a screenshot of the data query's associated graph template page (the one with the suggested values).
FauxPasIII
Posts: 6
Joined: Wed Feb 13, 2008 11:42 pm

Post by FauxPasIII »

BSOD2600 wrote:Mind posting a screenshot of the data query's associated graph template page (the one with the suggested values).
Here are some screenshots that might help:

http://www.flickr.com/photos/44698435@N00/tags/cacti/

Thanks again!
FauxPasIII
Posts: 6
Joined: Wed Feb 13, 2008 11:42 pm

Post by FauxPasIII »

Curiouser and curiouser... changing the template to the below makes everything snap into place. Many test configs too numerous to post are making me lean toward the following analysis: any time I close the parenthetical capture block in the OID/REGEXP clause for the data field _before the end of the line_, it makes the substitute_snmp_query_data thing either not happen or not work.

I will put some more analysis into this in a few days; since I have a workaround I now have to actually put some freaking graphs up. ;)

Thanks!

Code: Select all

<foundryConnections>
        <name>Foundry Real Connections</name>
        <oid_index>.1.3.6.1.4.1.1991.1.1.4.24.1.1.8</oid_index>
        <oid_index_parse>OID/REGEXP:\.1\.3\.6\.1\.4\.1\.1991\.1\.1\.4\.24\.1\.1\.8\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)</oid_index_parse>
        <fields>
                <foundryIP>
                        <name>Real IP Address</name>
                        <method>walk</method>
                        <source>OID/REGEXP:\.1\.3\.6\.1\.4\.1\.1991\.1\.1\.4\.24\.1\.1\.8\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)</source>
                        <direction>input</direction>
                        <oid>.1.3.6.1.4.1.1991.1.1.4.24.1.1.8</oid>
                </foundryIP>
                <foundryConnections>
                        <name>Connections</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.1991.1.1.4.24.1.1.8</oid>
                </foundryConnections>
        </fields>
</foundryConnections>
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

hmm weird. If you believe it to be a bug, http://www.cacti.net/bugs.php
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests