The Cacti Manual
Prev | Chapter 10. Data Queries | Next

# Script Query XML Syntax

    <query>
       <name>Get Unix Mounted Partitions</name>
       <description>Queries a list of mounted partitions on a unix-based host with the 'df' command.</description>
       <script_path>perl |path_cacti|/scripts/query_unix_partitions.pl</script_path>
       <arg_index>index</arg_index>
       <arg_query>query</arg_query>
       <arg_get>get</arg_get>
       <output_delimeter>:</output_delimeter>

       <fields>
          <dskDevice>
             <name>Device Name</name>
             <direction>input</direction>
             <query_name>device</query_name>
          </dskDevice>
       </fields>
    </query>

Table 10-5. Script Query XML Field Reference

Field | Description
--- | ---
query->name | (Optional) You can enter a "friendly name" for the script query here. It will not be used by Cacti, and is for identification only.
query->description | (Optional) You can enter a description for the script query here. It will not be used by Cacti, and is for identification only.
query->script_path | Enter the complete path to the script or executable that is going to handle your script query. When in doubt, specify the pull path to all binaries referenced in this path, the query may not execute otherwise.
query->arg_index | Enter the argument that is to be passed to the script to retrieve a list of indexes.
query->arg_query | Enter the argument that is to be passed to the script to retrieve a list of values given a field name.
query->arg_get | Enter the argument that is to be passed to the script to retrieve a single value given a field name and index value.
query->output_delimeter | Enter the one character delimiter that will be used to separate output values. This is only used when you "query" the script in which case it outputs 'index(delimiter)value'.
query->fields | Each field contained within the script query must be defined under this tag.
query->fields->dskDevice | Each defined field in the script query must have a unique name given to it. Do not use spaces or any non-alphanumeric characters, this name must be identifiable within Cacti.
query->fields->dskDevice->name | Here you can specify a "friendly name" for the field. This name will be used by Cacti to help the user identify this field.
query->fields->dskDevice->direction | There are two types of fields when dealing with an script query, 'input' and 'output'. Input values are the "known" values that you will use to derive the output values, this is where the "query" part of script query comes in. When you create a graph based on an script query, Cacti will prompt you to choose the input value to base the graph on. A rule of thumb is that input fields contain semi-static data that is not graphable, while the output fields contain the data that will be graphed.
query->fields->dskDevice->query_name | Enter the name that Cacti must use when asking the script for information about this field. For instance, the following should return values: '(script_name) query (query_name)'.

Prev | Home | Next
SNMP Query XML Syntax | Up | Templates