Hi,
I've looked around in the docs and on the forums but can't seem to get my script query to function as it should. I'm sure it is something small and significant. If somebody could lend their expertise I would be grateful.
I wrote a script query and corresponding XML to calculate disk usage for specific domain names on a qmail server. It gathers this data through the unix 'du' command. I based it on the unix_disk.xml and query_unix_partitions.pl scripts that come with Cacti 0.6.8h.
My script functions as you see here:
sip:~/cacti/scripts$ perl qmail-mailboxes.pl index
domain1.com
domain2.com
domain3.com
domain4.com
sip:~/cacti/scripts$ perl qmail-mailboxes.pl get usage domain1.com
193720
sip:~/cacti/scripts$ perl qmail-mailboxes.pl query usage
domain1.com:193720
domain2.com:93008
domain3.com:443368
domain4.com:58176
Pretty basic. I think it is outputting what cacti will require. Here is my XML file:
<interface>
<name>Get Disk Usage Stats on Qmail Server</name>
<description>Queries the qmail server for disk usage stats by domain</description>
<script_path>perl |path_cacti|/scripts/qmail-mailboxes.pl</script_path>
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
<arg_num_indexes>num_indexes</arg_num_indexes>
<output_delimeter>:</output_delimeter>
<index_order>domain</index_order>
<index_order_type>alphabetic</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<domain>
<name>Domain Name</name>
<direction>input</direction>
<query_name>domain</query_name>
</domain>
<domainUsage>
<name>Disk Usage</name>
<direction>output</direction>
<query_name>usage</query_name>
</domainUsage>
</fields>
</interface>
I could be wrong, but I think these are both ok. I think my problem is somewhere in my data template definition or data query definition.
My Verbose data query debug looks like this (many domain's removed or changed for privacy and brevity:
+ Running data query [13].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/qmail.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'perl /var/www/cacti-0.8.6h/scripts/qmail-mailboxes.pl index'
+ Executing script query 'perl /var/www/cacti-0.8.6h/scripts/qmail-mailboxes.pl query domain'
+ Found item [domain='domain1.com'] index: domain1.com
+ Found item [domain='domain2.com'] index: domain2.com
+ Found item [domain='domain3.com'] index: domain3.com
+ Found item [domain='domain4.com'] index: domain4.com
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/qmail.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/qmail.xml'
+ Found data query XML file at '/var/www/cacti-0.8.6h/resource/script_queries/qmail.xml'
I am unclear as to why cacti is polling for 'domain' when I want it to poll for 'usage' as defined in my data templates. I am stuck. Any suggestions? Screenshots are attached.
As always, Thank you.
Dan
Script Query assistance
Moderators: Developers, Moderators
Script Query assistance
- Attachments
-
- Data Queries screen
- data query.png (8.32 KiB) Viewed 2589 times
-
- Data template screen
- data template.png (18.14 KiB) Viewed 2589 times
-
- Associated graph templates screen
- associated-graph-templates.png (13.29 KiB) Viewed 2589 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
To my shame, I currently do know very little of this. So, in fact, I would try to get through this using an example and compile the HowTo at the same time.
But currently my work is ONLY driven by the fun I have. So my "next tasks" change; sometimes from day to day. And a good HowTo takes about 2 weeks = some 20 hours as I (and my wife ) can judge from the last ones I did.
So I cannot promise to complete this within February. The strategy was explained above; I do not have more than that at the moment
Reinhard
But currently my work is ONLY driven by the fun I have. So my "next tasks" change; sometimes from day to day. And a good HowTo takes about 2 weeks = some 20 hours as I (and my wife ) can judge from the last ones I did.
So I cannot promise to complete this within February. The strategy was explained above; I do not have more than that at the moment
Reinhard
dpoulsen,
it is doing query domain because that is what you have it defined to do in your XML document. I'm still trying to work through these but this might help you. Try changing
to
Hopefully that helps
it is doing query domain because that is what you have it defined to do in your XML document. I'm still trying to work through these but this might help you. Try changing
Code: Select all
<fields>
<domain>
<name>Domain Name</name>
<direction>input</direction>
<query_name>domain</query_name>
</domain>
Code: Select all
<fields>
<domain>
<name>Domain Name</name>
<direction>input</direction>
<query_name>usage</query_name>
</domain>
Who is online
Users browsing this forum: No registered users and 0 guests