Hello,
I need some help to understand the syntax for the script file and the xml file for script queries with Index Count Changed re-index method. Indeed, after reading the documentation, many messages on the forum and the examples given with Cacti installation, it is not clear for me.
For the re-index method Index Count Changed to work, there must be a field <arg_num_indexes> in the xml file. The value of this field (num_indexes in the example for Get Unix Mounted Partitions) is used by Cacti as an argument for the script file to retrieve the value of the index (a number of partitions for instance). I imagine Cacti will launched a command such as "perl xx.pl num_indexes" and if the return value is different from the previous one, the re-indexation will be performed. Am I right ?
I have 2 questions :
- why is there no "function" num_indexes in the corresponding script file query_unix_partitions.pl ?
- how is the re-indexation performed ? where should that function be ?
Thanks
Kevin
Problem with script query and Index Count Changed re-index
Moderators: Developers, Moderators
Re: Problem with script query and Index Count Changed re-ind
Basically, yes.youlzz wrote:I imagine Cacti will launched a command such as "perl xx.pl num_indexes" and if the return value is different from the previous one, the re-indexation will be performed. Am I right ?
Because disk/partitions counts typically don't change often between reboots?youlzz wrote:- why is there no "function" num_indexes in the corresponding script file query_unix_partitions.pl ?
If the previous index count is different from the current, then a reindex is performed. For example, \cacti\resource\snmp_queries\interface.xml contains oid_num_indexes. So does my 'monitor processes' script. When cacti detects the process count has changed, one sees something like the following in the log:youlzz wrote:- how is the re-indexation performed ? where should that function be ?
Code: Select all
CMDPHP: Poller[0] ASSERT: '52=51' failed. Recaching host 'quad', data query #14
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Maybe I did not choose the best example...- why is there no "function" num_indexes in the corresponding script file query_unix_partitions.pl ?
Because disk/partitions counts typically don't change often between reboots?
Imagine a router that never reboots with many interfaces, SNMP deactivated but another way retrieve the indexes, the data and the number of indexes by a script (perl, bash, ...).
Interfaces can be added or deleted without reboot so that the Index Count Changed re-index method seems the best ?
In that case, how is Cacti doing the re-indexation ? do I have to code it ?
If I have to code it : where ? how ?
I'm not a programmer and in the code, but if the oid_num_indexes field is present in the XML script file, cacti stores the index count for that data query in the db. Then on the next polling pass, it compares the previous to the current index counts. If they're different, it'll issue a reindex for that data query (as shown in my previous post excerpt).
Looking through the existing cacti scripts and documentation, I'm not sure any script besides the SNMP XML ones can use the reindex logic from cacti. I think they leave it up to the script writer to do it...
Looking through the existing cacti scripts and documentation, I'm not sure any script besides the SNMP XML ones can use the reindex logic from cacti. I think they leave it up to the script writer to do it...
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
There is a surprising thing in Cacti database : the table host_snmp_cache does not contain only SNMP queries cache values but also script queries cache values !!!
Indeed BSOD2600, the table poller_reindex contains the number of indexes used for the re-index method Index Count Changed.
It seems difficult to write a method to do the re-indexation and I could not find any example except the one here http://docs.cacti.net/manual:087:3a_adv ... alkthrough but that script query uses SNMP (function cacti_snmp_walk) for the re-indexation !!!
Does someone know where I can find examples of re-indexation scripts which do not require SNMP ?
Thanks
Kevin
Indeed BSOD2600, the table poller_reindex contains the number of indexes used for the re-index method Index Count Changed.
It seems difficult to write a method to do the re-indexation and I could not find any example except the one here http://docs.cacti.net/manual:087:3a_adv ... alkthrough but that script query uses SNMP (function cacti_snmp_walk) for the re-indexation !!!
Does someone know where I can find examples of re-indexation scripts which do not require SNMP ?
Thanks
Kevin
Who is online
Users browsing this forum: No registered users and 1 guest