Script Data Query not indexing
Moderators: Developers, Moderators
Script Data Query not indexing
I final needed to write my first Data Query and cannot seem to get it to index.
I first wrote it as an SNMP Query, which indexed, but realized I couldn't get the data I needed with that method.
So I wrote a script and compared it and the xml file to a couple different tutorials.
However, it will not index.
Verbose query looks like this:
+ Running data query [29].
+ Found type = '4 '[script query].
+ Found data query XML file at '<cacti_path>/resource/script_queries/juniper_queue_monitor.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 index'
+ Executing script query '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifIndex'
+ Executing script query '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifDescr'
+ Executing script query '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifName'
+ Executing script query '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifAlias'
+ Found data query XML file at '<cacti_path>/cacti/resource/script_queries/juniper_queue_monitor.xml'
+ Found data query XML file at '<cacti_path>/resource/script_queries/juniper_queue_monitor.xml'
+ Found data query XML file at '<cacti_path>/resource/script_queries/juniper_queue_monitor.xml'
When I run the script with through cli I get:
[user@host ~]$ /usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 index
24
30
31
32
33
34
35
36
37
38
50
51
52
53
and for one of the queries:
[user@host ~]$ /usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifIndex
24!24
30!30
31!31
32!32
33!33
34!34
35!35
36!36
37!37
38!38
50!50
51!51
52!52
53!53
My first thoughts were unix permissions, but these are the same as every other script on the system that is run through the browser, and they all work.
At this point I'm just not sure what else to try.
I first wrote it as an SNMP Query, which indexed, but realized I couldn't get the data I needed with that method.
So I wrote a script and compared it and the xml file to a couple different tutorials.
However, it will not index.
Verbose query looks like this:
+ Running data query [29].
+ Found type = '4 '[script query].
+ Found data query XML file at '<cacti_path>/resource/script_queries/juniper_queue_monitor.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 index'
+ Executing script query '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifIndex'
+ Executing script query '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifDescr'
+ Executing script query '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifName'
+ Executing script query '/usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifAlias'
+ Found data query XML file at '<cacti_path>/cacti/resource/script_queries/juniper_queue_monitor.xml'
+ Found data query XML file at '<cacti_path>/resource/script_queries/juniper_queue_monitor.xml'
+ Found data query XML file at '<cacti_path>/resource/script_queries/juniper_queue_monitor.xml'
When I run the script with through cli I get:
[user@host ~]$ /usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 index
24
30
31
32
33
34
35
36
37
38
50
51
52
53
and for one of the queries:
[user@host ~]$ /usr/local/bin/php -q <cacti_path>/scripts/juniper_queue_monitoring.php <host> <string> 2 query ifIndex
24!24
30!30
31!31
32!32
33!33
34!34
35!35
36!36
37!37
38!38
50!50
51!51
52!52
53!53
My first thoughts were unix permissions, but these are the same as every other script on the system that is run through the browser, and they all work.
At this point I'm just not sure what else to try.
Code: Select all
<interface>
<name>Get Juniper Queue Statistics</name>
<script_path>|path_php_binary| -q |path_cacti|/scripts/juniper_queue_monitoring.php</script_path>
<arg_prepend>|host_hostname| |host_snmp_community| |host_snmp_version|</arg_prepend>
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
<output_delimeter>!</output_delimeter>
<index_order>ifIndex</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<ifIndex>
<name>Index</name>
<direction>input</direction>
<query_name>ifIndex</query_name>
</ifIndex>
<ifDescr>
<name>Description</name>
<direction>input</direction>
<query_name>ifDescr</query_name>
</ifDescr>
<ifName>
<name>Name</name>
<direction>input</direction>
<query_name>ifName</query_name>
</ifName>
<ifAlias>
<name>Alias</name>
<direction>input</direction>
<query_name>ifAlias</query_name>
</ifAlias>
<jnxCosQstatQedPkts-bestEffort>
<name>Best Effort Queue - Packets Queued</name>
<direction>output</direction>
<query_name>jnxCosQstatQedPkts-bestEffort></query_name>
</jnxCosQstatQedPkts-bestEffort>
<jnxCosQstatTxedPkts-bestEffort>
<name>Best Effort Queue - Packets Transmitted</name>
<direction>output</direction>
<query_name>jnxCosQstatTxedPkts-bestEffort</query_name>
</jnxCosQstatTxedPkts-bestEffort>
<jnxCosQstatTailDropPkts-bestEffort>
<name>Best Effort Queue - Packets Droppped</name>
<direction>output</direction>
<query_name>jnxCosQstatTailDropPkts-bestEffort</query_name>
</jnxCosQstatTailDropPkts-bestEffort>
<jnxCosQstatQedPkts-assuredForwarding>
<name>Assured Forwarding Queue - Packets Queued</name>
<direction>output</direction>
<query_name>jnxCosQstatQedPkts-assuredForwarding</query_name>
</jnxCosQstatQedPkts-assuredForwarding>
<jnxCosQstatTxedPkts-assuredForwarding>
<name>Assured Forwarding Queue - Packets Transmitted</name>
<direction>output</direction>
<query_name>jnxCosQstatTxedPkts-assuredForwarding</query_name>
</jnxCosQstatTxedPkts-assuredForwarding>
<jnxCosQstatTailDropPkts-assuredForwarding>
<name>Assured Forwarding Queue - Packets Droppped</name>
<direction>output</direction>
<query_name>jnxCosQstatTailDropPkts-assuredForwarding</query_name>
</jnxCosQstatTailDropPkts-assuredForwarding>
<jnxCosQstatQedPkts-expeditedForwarding>
<name>Expedited Forwarding - Packets Queued</name>
<direction>output</direction>
<query_name>jnxCosQstatQedPkts-expeditedForwarding</query_name>
</jnxCosQstatQedPkts-expeditedForwarding>
<jnxCosQstatTxedPkts-expeditedForwarding>
<name>Expedited Forwarding - Packets Transmitted</name>
<direction>output</direction>
<query_name>jnxCosQstatTxedPkts-expeditedForwarding</query_name>
</jnxCosQstatTxedPkts-expeditedForwarding>
<jnxCosQstatTailDropPkts-expeditedForwarding>
<name>Expedited Forwarding - Packets Droppped</name>
<direction>output</direction>
<query_name>jnxCosQstatTailDropPkts-expeditedForwarding</query_name>
</jnxCosQstatTailDropPkts-expeditedForwarding>
<jnxCosQstatQedPkts-networkControl>
<name>Network Control - Packets Queued</name>
<direction>output</direction>
<query_name>jnxCosQstatQedPkts-networkControl</query_name>
</jnxCosQstatQedPkts-networkControl>
<jnxCosQstatTxedPkts-networkControl>
<name>Network Control - Packets Transmitted</name>
<direction>output</direction>
<query_name>jnxCosQstatTxedPkts-networkControl</query_name>
</jnxCosQstatTxedPkts-networkControl>
<jnxCosQstatTailDropPkts-networkControl>
<name>Network Control - Packets Droppped</name>
<direction>output</direction>
<query_name>jnxCosQstatTailDropPkts-networkControl</query_name>
</jnxCosQstatTailDropPkts-networkControl>
</fields>
</interface>
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
The query_name XML field is wrong. There's an additional ">" in there. Please check all other XML fields as wellmarnues wrote:Code: Select all
<jnxCosQstatQedPkts-bestEffort> <name>Best Effort Queue - Packets Queued</name> <direction>output</direction> <query_name>jnxCosQstatQedPkts-bestEffort></query_name> </jnxCosQstatQedPkts-bestEffort>
Reinhard
I'm down to this
Still no luck.
I've started crawling through the code to see if I can find anything, but if anyone out there has any ideas, please let me know
Code: Select all
<interface>
<name>Get Juniper Queue Statistics</name>
<script_path>|path_php_binary| -q |path_cacti|/scripts/juniper_queue_monitoring.php</script_path>
<arg_prepend>|host_hostname| |host_snmp_community| |host_snmp_version|</arg_prepend>
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
<output_delimeter>!</output_delimeter>
<index_order>ifIndex</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<ifIndex>
<name>Index</name>
<direction>input</direction>
<query_name>ifIndex</query_name>
</ifIndex>
</fields>
</interface>
I've started crawling through the code to see if I can find anything, but if anyone out there has any ideas, please let me know
I've traqcked the problem to the function exec_into_array() in lib/functions.php
it gets the correct variable, but for some reason exec is erroring out
I get no output and the return status is 255 (which I don't know how to interpret, but it must be a php return status)
seems like it must be a system problem and not a cacti problem though
it gets the correct variable, but for some reason exec is erroring out
I get no output and the return status is 255 (which I don't know how to interpret, but it must be a php return status)
seems like it must be a system problem and not a cacti problem though
ok, I've further tracked the error to something in include/config.php
is there any reason that config.php is different if called in a webbrowser even though I have right before my include statements?
I'm going to start going through config.php, but this seems like a very odd issue
is there any reason that config.php is different if called in a webbrowser even though I have
Code: Select all
$no_http_headers = true;
I'm going to start going through config.php, but this seems like a very odd issue
alright, now I have found that its erroring on the db_connect_real() function call
I printed out the function arguments before it makes the call and they are all set properly
why would a script fail on a function like this when run from exec off of a web browser when it runs fine from the cli
running the webpage (I made a simple php script for debugging purposes) from the cli even works fine
its just strange
I guess I should say that I'm using the `h' release, if that makes any difference
I printed out the function arguments before it makes the call and they are all set properly
why would a script fail on a function like this when run from exec off of a web browser when it runs fine from the cli
running the webpage (I made a simple php script for debugging purposes) from the cli even works fine
its just strange
I guess I should say that I'm using the `h' release, if that makes any difference
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
I'm not aware of any difference between h and j version when it comes to |arg_prepend| handling of XML files. You may want to scan CHANGELOG documents. I'm not using arg_prepend that often but I'm not aware of know issues here. So you may want to open a bug record at http://bugs.cacti.net
Reinhard
Reinhard
OK, well now I think I fixed something as I looked in the error log again and found
how does mysql_pconnect become undefined?
and yes, connecting to the database works fine through any other means in Cacti
the more I get into this, the more I am just mystified with whats happening
Code: Select all
PHP Fatal error: Call to undefined function mysql_pconnect() in [path_to_cacti]/lib/adodb/drivers/adodb-mysql.inc.php on line 355
and yes, connecting to the database works fine through any other means in Cacti
the more I get into this, the more I am just mystified with whats happening
I decided that I could just bypass this whole mess by using php's own snmp functions
however, I tried using snmprealwalk() and it comes back as undefined
I ran a `php -m` through php's exec function and I only get this:
I'm not finding a whole lot of answers as to why php ran through php's own exec() function loses most of the installed modules
any help on how to have modules when using php in this fashion or even just how to load a php module in a script would be immensely appreciated
however, I tried using snmprealwalk() and it comes back as undefined
I ran a `php -m` through php's exec function and I only get this:
Code: Select all
[PHP Modules]
date
libxml
Reflection
SPL
standard
[Zend Modules]
any help on how to have modules when using php in this fashion or even just how to load a php module in a script would be immensely appreciated
Who is online
Users browsing this forum: No registered users and 1 guest