Walk method for Script Query

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

Moderators: Developers, Moderators

Post Reply
henkwiedig
Posts: 8
Joined: Thu Aug 06, 2009 1:32 pm
Location: Germany

Walk method for Script Query

Post by henkwiedig »

Hi,

i'm wondering if it's possible to use the

Code: Select all

<method>walk</method>
tag in a Scripted Indexed Data Query method.

Currently my Scripts are called for each Output field and each Index separatly.
Deviloper
Cacti User
Posts: 256
Joined: Tue Jul 07, 2009 8:03 am

Post by Deviloper »

Yes you can use a walk instead of a get
take a look at the (faulty) examples of Eric Wall for CPU-Load.

You can implement your
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
in your ss_*.php however you like.

It only is important that your return-value match what the script_server expect.

You can for example buffer data in a file, too.
henkwiedig
Posts: 8
Joined: Thu Aug 06, 2009 1:32 pm
Location: Germany

Post by henkwiedig »

I use a script_query not a script_server script.

I will explain more details:

I use this xml for my Script Query

Code: Select all

<interface>
        <name>Get Nmon AIX CPU System Data</name>
        <script_path>|path_cacti|/scripts/nmonaixcpu.sh</script_path>
        <arg_prepend>|host_hostname|</arg_prepend>
        <arg_index>index</arg_index>
        <arg_query>query</arg_query>
        <arg_get>get</arg_get>
        <output_delimeter>:</output_delimeter>
        <index_order>cpuIndex</index_order>
        <index_order_type>numeric</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>

        <fields>
                <cpuIndex>
                        <name>cpuIndex</name>
                        <direction>input</direction>
                        <query_name>index</query_name>
                </cpuIndex>
                <cpuDescription>
                        <name>Description</name>
                        <direction>input</direction>
                        <query_name>cpudescription</query_name>
                </cpuDescription>
                <cpuUser>
                        <name>User</name>
                        <direction>output</direction>
                        <query_name>cpuuser</query_name>
                </cpuUser>
                <cpuSys>
                        <name>System</name>
                        <direction>output</direction>
                        <query_name>cpusys</query_name>
                </cpuSys>
                <cpuWait>
                        <name>Wait</name>
                        <direction>output</direction>
                        <query_name>cpuwait</query_name>
                </cpuWait>
                <cpuIdle>
                        <name>Idle</name>
                        <direction>output</direction>
                        <query_name>cpuidle</query_name>
                </cpuIdle>
        </fields>
</interface>
The script is call 4 Times to get all data for one CPU.
Like this

Code: Select all

/opt/pware/htdocs/cacti/scripts/nmonaixcpu.sh host1 get cpusys CPU01
/opt/pware/htdocs/cacti/scripts/nmonaixcpu.sh host1 get cpuwait CPU01
/opt/pware/htdocs/cacti/scripts/nmonaixcpu.sh host1 get cpuidle CPU01
/opt/pware/htdocs/cacti/scripts/nmonaixcpu.sh host1 get cpuuser CPU01
I'm thinking of a way to make the poller call the script just once to get all data, like:

Code: Select all

/opt/pware/htdocs/cacti/scripts/nmonaixcpu.sh host1 walk CPU01
cpuuser:50 cpusys:2.2 cpuwait:0 cpuidle:47.8
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests