Code: Select all
<query>
<name>Get ZFS Pool Stats</name>
<description>Queries a list of ZFS pools on a host, returning some stats.</description>
<script_path>ruby |path_cacti|/scripts/zfs_cacti.rb</script_path>
<arg_prepend>|host_hostname|</arg_prepend>
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
<arg_num_indexes>num_indexes</arg_num_indexes>
<output_delimiter>:</output_delimiter>
<index_order>zpoolName</index_order>
<index_order_type>alphabetic</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<zpoolName>
<name>zpool Name</name>
<direction>input</direction>
<query_name>pools</query_name>
</zpoolName>
<zpoolReadBytes>
<name>zpool Read Bytes</name>
<direction>output</direction>
<query_name>read_bytes</query_name>
</zpoolReadBytes>
<zpoolReadOps>
<name>zpool Read Operations</name>
<direction>output</direction>
<query_name>read_opts</query_name>
</zpoolReadOps>
<zpoolWriteBytes>
<name>zpool Write Bytes</name>
<direction>output</direction>
<query_name>write_bps</query_name>
</zpoolWriteBytes>
<zpoolWriteOps>
<name>zpool Write Operations</name>
<direction>output</direction>
<query_name>write_opts</query_name>
</zpoolWriteOps>
<zpoolUsed>
<name>zpool Used space</name>
<direction>output</direction>
<query_name>used</query_name>
</zpoolUsed>
<zpoolAvail>
<name>zpool Available space</name>
<direction>output</direction>
<query_name>avail</query_name>
</zpoolAvail>
</fields>
</query>
ruby /usr/share/cacti/scripts/zfs_cacti.rb xxx.xxx.xxx.xxx index
migpool
ruby /usr/share/cacti/scripts/zfs_cacti.rb xxx.xxx.xxx.xxx query pools
migpool:migpool
ruby /usr/share/cacti/scripts/zfs_cacti.rb xxx.xxx.xxx.xxx query avail
migpool:2122057441607
ruby /usr/share/cacti/scripts/zfs_cacti.rb xxx.xxx.xxx.xxx get avail migpool
2155042790440
script queries are executed throu ssh with nopasswd keys
last this is the output from a verbose query in cacti
+ Running data query [12].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/share/cacti/resource/script_queries/zfs_cacti.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'ruby /usr/share/cacti/scripts/zfs_cacti.rb xxx.xxx.xxx.xxx index'
+ Executing script query 'ruby /usr/share/cacti/scripts/zfs_cacti.rb xxx.xxx.xxx.xxx query pools'
+ Found data query XML file at '/usr/share/cacti/resource/script_queries/zfs_cacti.xml'
+ Found data query XML file at '/usr/share/cacti/resource/script_queries/zfs_cacti.xml'
+ Found data query XML file at '/usr/share/cacti/resource/script_queries/zfs_cacti.xml'