Understanding Data Query Question

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

Moderators: Developers, Moderators

denis.king
Cacti User
Posts: 67
Joined: Thu Nov 29, 2007 6:21 pm

Post by denis.king »

So I have played a little more and it looks like most things are working in so far as when I go to "New Graphs", all my indexes and values are listed under the Data Query box.


However, once I create the Graph Template and go to the Query that I have setup to associate the Data Sources & Graph, I still can't get the drop down boxes to be populated next to each DS.

I have attached my Data Template and my Graph Template.

Have a look and let me know if there is anything obvious.

Thanks,
DK
Attachments
cacti_data_template_cns_subscriber_dataplane_stats_query.xml
(8.31 KiB) Downloaded 103 times
cacti_graph_template_cns_subscriber_dataplane_stats.xml
(10.67 KiB) Downloaded 78 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

You didn't attach the Data Query you created. No worries, created one myself and saw what you mean by no dropdowns.

I played around with the XML file. Basically grouped the inputs and outputs together. Corrected the typo in index_title_format. Then the dropdowns in the Data Query were populated!

Attached is the fixed xml file I used.
Attachments
subscriber_stats.xml
(3.11 KiB) Downloaded 98 times
denis.king
Cacti User
Posts: 67
Joined: Thu Nov 29, 2007 6:21 pm

Post by denis.king »

Yes, you are correct, the changing of the inputs and outputs seemed to be causing issues in how the XML file was getting read in. Good catch. not sure if the requirement for the all the inputs and all the outputs to be together in the XML file is documented, but it should be. I did a stuipid copy and paste and mis-grouped the index input outside of the rest of the inputs, so I suspect most people would not get impacted by this.
I had corrected the Typo awhile back from when one of the other admins wrote to this thread and caught it. Strange that the typo did not seem to help/hurt anything anyway.

I have one more question (I hope so anyway). I have put some values in the "suggested values" boxes accroding to the examples that I have looked at. Things like |query_xxxxx| where xxxxx is one of the XML outputs. Honestly, I have no idea what, how, where, etc this suggested value will get used. I put some values in to see where the values would be when I create a graph, but I don't see them anywhere. So, could you give me a quick prose on what this "suggested value" is all about and what I should be thinking about when I go to put entries in there.

Now that I have this working(sort of), I do have some more general questions that will close all the open thoughts that I have on "Query's", but will leave them until I have this Query working as expected.

Your help has been invaluable. Thanks.

DK
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

denis.king wrote:Yes, you are correct, the changing of the inputs and outputs seemed to be causing issues in how the XML file was getting read in. Good catch. not sure if the requirement for the all the inputs and all the outputs to be together in the XML file is documented, but it should be.
Correct, it should be. I never realized the inputs/outputs had to be grouped together. I always just duplicated with the existing templates did. gandalf is the documentation person who should be made aware of this needed change.
denis.king wrote:I have put some values in the "suggested values" boxes accroding to the examples that I have looked at. Things like |query_xxxxx| where xxxxx is one of the XML outputs. Honestly, I have no idea what, how, where, etc this suggested value will get used.
I believe only input values (defined in the xml file) can be used for the query_xxx fields. Have you looked at other examples of how they are used, like the "SNMP - Interface Statistics" data query?

It's probably not very clear in the 'Suggested Values' section of the data query. Basically the Field Name, corresponds with names of the fields in the Data/Graph templates. So for example in the SNMP Interface stats query, has a suggested value for the graph template's Title field of: |host_description| - Traffic - |query_ifName|, it overwrites the default specified in the template.

For your case, I'd try overwriting the Title on the graph template with: |host_description| - |query_SubIndexID|. See where that gets you. Granted, the query_ names only get properly filled in when you go through the 'create graphs for this host' screen.

I'd play more around with your templates, but it's to the point where I'd need a real device with data. I think you'll be able to figure it out though.
denis.king
Cacti User
Posts: 67
Joined: Thu Nov 29, 2007 6:21 pm

Post by denis.king »

Thanks.

It seems that since I have changed my XML file to align inputs and outputs (it could have been something else) my "verbose Query" has changed to:


Running data query [15].
+ Found type = '4 '[script query].
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_queries/subscriber_stat.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'c:\Inetpub\wwwroot\cacti\scripts\Solace\SubscriberGenStats.pl 192.168.130.50 index'
+ Executing script query 'c:\Inetpub\wwwroot\cacti\scripts\Solace\SubscriberGenStats.pl 192.168.130.50 query index'
+ Found item [SubIndexID='alexsub'] index: alexsub
+ Found item [SubIndexID='denis'] index: denis
+ Found item [SubIndexID='jack'] index: jack
+ Found item [SubIndexID='john'] index: john
+ Found item [SubIndexID='king'] index: king
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_queries/subscriber_stat.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_queries/subscriber_stat.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_queries/subscriber_stat.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_queries/subscriber_stat.xml'


It no longer query's each of the input stats as it did before with the same the XML file. (what I was getting from the verbose Query can be seen earlier in this thread).

Does this ring any bells or is this for sure an XML file problem?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Assuming the perl script hasn't changed, then I'd guess it's something with the XML file.

Does the xml file still parse correctly in IE (I'd use that because in the past, Firefox has parsed xml files fine, while IE has not along with Cacti) ?
denis.king
Cacti User
Posts: 67
Joined: Thu Nov 29, 2007 6:21 pm

Post by denis.king »

yeah I tried that, no dice.....still investigating. stay tuned
denis.king
Cacti User
Posts: 67
Joined: Thu Nov 29, 2007 6:21 pm

Post by denis.king »

Wanted to let you know that I did get this working.


The problem turned out to be in the XML file, but not something that I would have expected. I had the xml file setup such that I had a bunch of inputs and outputs in the XML file. I had the inputs and outputs defined with the same XML element. The verbose query would replace the input element with the output element and not display the value duirng the verbose query. Therefore, for every input that had an output with the same name, I would not see it in verbose query. Once I made the element names unique accross inputs and outputs, it worked fine.


I have one more question that I hope is my last on this topic.

Once the Query is setup and working. When you go to the device and the "setup graphs for the device", you can see the query index and all the values there. From that you can select the box on the right and the graph will be added. The selected line becomes greyed out (as you would expect) and the graph is added.

However, if I go to "graph management" where the graph got placed and delete the graph, I would have expected the greyed out line back at the device (setup graphs for device" to be removed, and the line become selectable again. Does not seem like the case.....so I get stuck in a position where I can't re-add the graph, but the graph was deleted and is not there......What is the problem?

My second question is, when the number of index's changes, when is that updated within the tool....is that every poll? Meaning, if during a poll there are now 11 indexes instead of 10 from the last poll, that index will automaticially become another graph that can be added. Correct?

DK
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

denis.king wrote:However, if I go to "graph management" where the graph got placed and delete the graph, I would have expected the greyed out line back at the device (setup graphs for device" to be removed, and the line become selectable again.
I believe this is because the data source is still present for that index. Once you delete that too, it should become 'ungreyed'.
denis.king wrote:My second question is, when the number of index's changes, when is that updated within the tool....is that every poll?
Yes, every polling cycle, assuming you've set the Re-Index Method to Index Count Changed.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests