Debugging Script Data Queries
Moderators: Developers, Moderators
Script-based data query doesn't work
Hi, I hope you can help me out here. I am struggling to graph traffic going through IPSec connections on some routers. I followed your howto (thanks a lot by the way) without any obvious problems.
I created the the new data input query with corresponding xml file, the data templates and associated some graph templates and added the query and graphs to a device.
I can see that my script was called when I created the data input query twice, to get the index and to query the only input field.
But after that Cacti never attempted to start the script and to actual gather some data. On the graph side I can see some references for graphs, but without pictures.
Do you have any idea why Cacti is not gathering any data?
Any help appreciated. Dirk
I created the the new data input query with corresponding xml file, the data templates and associated some graph templates and added the query and graphs to a device.
I can see that my script was called when I created the data input query twice, to get the index and to query the only input field.
But after that Cacti never attempted to start the script and to actual gather some data. On the graph side I can see some references for graphs, but without pictures.
Do you have any idea why Cacti is not gathering any data?
Any help appreciated. Dirk
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Script-based data query doesn't work
Due to the general aspects to be discussed here, I created a new topic.
- index
- query ...
- get ...
Next, goto the device that you associated this new Data Query with. Run the Verbose Query for that query and post the textual output.
Reinhard
Please refer to Howto: from snmptable to XML Graphs (Data Query walkthrough). This should be the better starting point.tianye wrote:Hi, I hope you can help me out here. I am struggling to graph traffic going through IPSec connections on some routers. I followed your howto (thanks a lot by the way) without any obvious problems.
Fine. For debugging purpose, it is best to post the XML file along with the output of a run of each of the following:I created the the new data input query with corresponding xml file, the data templates and associated some graph templates and added the query and graphs to a device.
I can see that my script was called when I created the data input query twice, to get the index and to query the only input field.
- index
- query ...
- get ...
Next, goto the device that you associated this new Data Query with. Run the Verbose Query for that query and post the textual output.
Reinhard
Debug information
Okay, here we go. The XML file is attached. Here is the script output for "index" and "query index". The parameter "get" is not supported yet. First I wanted to figure out how Cacti is working.
And the output from "verbose query"root@gtlnmicmw0001:/var/www/cacti/scripts/test# ./cisco-ipsec-traffic.pl vpn-router index
80146186186
62180131131
21361155200
root@gtlnmicmw0001:/var/www/cacti/scripts/test# ./cisco-ipsec-traffic.pl vpn-router query index
80146186186:80.146.186.186
62180131131:62.180.131.131
21361155200:213.61.155.200
root@gtlnmicmw0001:/var/www/cacti/scripts/test#
I can see in the script log that the script is started twice for the "verbose query", but not again. As I already mentioned+ Running data query [12].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'perl /var/www/cacti-0.8.6h/scripts/test/cisco-ipsec-traffic.pl vpn-router index'
+ Executing script query 'perl /var/www/cacti-0.8.6h/scripts/test/cisco-ipsec-traffic.pl vpn-router query index'
+ Found item [remIpAddress='80.146.186.186'] index: 80146186186
+ Found item [remIpAddress='62.180.131.131'] index: 62180131131
+ Found item [remIpAddress='213.61.155.200'] index: 21361155200
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
- Attachments
-
- cisco-ipsec-traffic.xml
- (1.85 KiB) Downloaded 261 times
I will add the full path to perl, however I don't think that is the problem, the "verbose query" is working fine.
I need the the |host_description| stuff in the <arg *> area to pass over some information for the device to work with. This seems to be the only way. Later I found the parameter <arg_prepend> in some XML file, but I didn't find any proper documentation on the exact use. I'm just guessing that it is for the same purpose.
I need the the |host_description| stuff in the <arg *> area to pass over some information for the device to work with. This seems to be the only way. Later I found the parameter <arg_prepend> in some XML file, but I didn't find any proper documentation on the exact use. I'm just guessing that it is for the same purpose.
Okay, here we go with the advised changes. The XML file is attached.
The verbose query output
The verbose query output
And the script output+ Running data query [12].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/perl /var/www/cacti-0.8.6h/scripts/test/cisco-ipsec-traffic.pl index'
+ Executing script query '/usr/bin/perl /var/www/cacti-0.8.6h/scripts/test/cisco-ipsec-traffic.pl query index'
+ Found item [remIpAddress='80.146.186.186'] index: 80146186186
+ Found item [remIpAddress='62.180.131.131'] index: 62180131131
+ Found item [remIpAddress='213.61.155.200'] index: 21361155200
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/cisco-ipsec-traffic.xml'
www-data@gtlnmicmw0001:~/cacti/scripts/test$ ./cisco-ipsec-traffic.pl index
80146186186
62180131131
21361155200
www-data@gtlnmicmw0001:~/cacti/scripts/test$ ./cisco-ipsec-traffic.pl query index
80146186186:80.146.186.186
62180131131:62.180.131.131
21361155200:213.61.155.200
- Attachments
-
- cisco-ipsec-traffic.xml
- (1.78 KiB) Downloaded 217 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Yep, I know. But you will want this to work with cactid as well, I suppose.tianye wrote:I will add the full path to perl, however I don't think that is the problem, the "verbose query" is working fine.
Yep, you're right (even when it comes to the "documentation" bit of your statement). arg_prepend should be used. Hope, documentation comes up with thisI need the the |host_description| stuff in the <arg *> area to pass over some information for the device to work with. This seems to be the only way. Later I found the parameter <arg_prepend> in some XML file, but I didn't find any proper documentation on the exact use. I'm just guessing that it is for the same purpose.
Reinhard
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
No need to get crazy if things got working The other way round is found more oftentianye wrote:I'm going crazy here. Seems like it is working now. But I have no clue why the changes had this effect. I have to do some further checking. Thanks a lot so far! Dirk
Ah, BTB, would you please mind posting your results (perhaps along with a bit of text and a nice screenshot) at the "Scripts and Templates" forum?
Reinhard
I'm beyond going crazy, close to a nervous breakdownlvm wrote:No need to get crazy if things got working The other way round is found more often
It was working just as long as it took to post the message...
My data gathering script was a couple of times called with the parameter "get". I would have expected to see some "query". However, suddenly it stopped working again I thought that maybe my database is messed up, so I exported all relevant templates, rebuilt the database from a backup and imported the templates again. No change. The debug information I gave before are still valid.
Is there a way to see if Cacti attempted to gather some data? I set the log level to "debug", but didn't found any relevant data.
Does anyone have a working an index script query at all? Is it possible that there is a general problem? I'm using Cacti 0.8.6h.
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Script Queries are seldom used, do not perform that well and (hmmm) not that good documented. AFAIK, you do already know all debugging stuff; last resort would be code debugging, sorry.tianye wrote:Is there a way to see if Cacti attempted to gather some data? I set the log level to "debug", but didn't found any relevant data.
Does anyone have a working an index script query at all? Is it possible that there is a general problem? I'm using Cacti 0.8.6h.
Reinhard
Even if it is an embarrassment I have to admit that the problem was in front of the computer and not inside. I messed up the file permissions and now everything is working. Yet one question remains: I can see that there is an entry to call the script with the parameter 'get' in the table 'poller_item' for every data source item. I guess the 'query' option would be much more efficient. Any ideas how the cacti will asked the script to do a query?
btw, thanks to lvm who already spent some time to help me with the other stuff
btw, thanks to lvm who already spent some time to help me with the other stuff
Who is online
Users browsing this forum: No registered users and 4 guests