Data Queries - Scripts

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
meekon
Posts: 2
Joined: Mon Jul 19, 2004 4:42 am
Contact:

Data Queries - Scripts

Post by meekon »

Finally getting to grips with cacti and have some of my own scripts working fine to graph Win2k CPU & RAM utilization via WMI.

However, I'm trying to setup a data query with a script and I'm really struggling as there seem to be some gaps int he documentation and few other posts relating to this.

As I understand it the data queries are used when setting up new hosts to determine how many of something that needs to be monitored. i.e. if the network device/server has several interfaces it can be used to setup graphs for each interface.

Where I'm struggling a bit is with the development of the script. From the documentation I understand there is an XML file describing the inputs and outputs from the script, and it should be able to handle indexing, querying and getting values. What I'm not sure about is the syntax of the output from the script.

For example, if the script is called to do an index of a value (as an example, win2k hard disks), it must output a unique index for each drive (in my case volume signature). But what format is this output in, would it be the relevant output field (e.g. volSignature) which is defined in the xml file followed by the seperator followed by the value?

And then if a query is called, the value should be retrieved for each item (in this case each hard disk) so how is this output?

volSignature:signature1
volFreeSpace:freespace1
volSignature:signature2
volFreeSpace:freespace2

something like that?

.. I hope that makes some kind of sense, and I appreciate any help you guys have got for me.
melchandra
Cacti User
Posts: 311
Joined: Tue Jun 29, 2004 12:52 pm
Location: Indiana

Post by melchandra »

I don't know, put perhaps manually running the discover scripts from the terminal can give you an idea of what you need. Here is a sample output I made:

[root@nmsrv2 script_queries]# /usr/bin/php -q /var/www/html/cacti/scripts/query_host_cpu.php nmsrv1.campus.tayloru.edu taylor-p 1 query usage
0!2
1!3
[root@nmsrv2 script_queries]#


So perhaps you output lines with exclamation points seperating the fields - I'm not quite sure.
Dave
meekon
Posts: 2
Joined: Mon Jul 19, 2004 4:42 am
Contact:

Post by meekon »

yeah the problem I have is i don;t have any unix boxes to use those scripts on, and none of them are designed for windows.

What you;ve given me there has helped a lot, any chance you can give me the output of the index & get commands too?
melchandra
Cacti User
Posts: 311
Joined: Tue Jun 29, 2004 12:52 pm
Location: Indiana

Post by melchandra »

[root@nmsrv2 script_queries]# /usr/bin/php -q /var/www/html/cacti/scripts/query_host_cpu.php nmsrv1.campus.tayloru.edu taylor-p 1 query index
0!0
1!1
[root@nmsrv2 script_queries]# /usr/bin/php -q /var/www/html/cacti/scripts/query_host_cpu.php nmsrv1.campus.tayloru.edu taylor-p 1 query usage
0!16
1!23
[root@nmsrv2 script_queries]# /usr/bin/php -q /var/www/html/cacti/scripts/query_host_cpu.php nmsrv1.campus.tayloru.edu taylor-p 1 query get
[root@nmsrv2 script_queries]#


Is that what you needed?
Dave
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest