Data Query With WMI Script & Multiple Data Source Items

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
jjcce
Posts: 3
Joined: Wed Oct 12, 2005 9:05 am

Data Query With WMI Script & Multiple Data Source Items

Post by jjcce »

I have been working for several days now to create a graph template (using WMI) for my Windows servers. I have used examples from the forum.

The graph only display 1 output (free space). I would like the graph to display 2 outputs (free space and total size).

I cannot figure out what I am doing wrong.

The following is an excerpt from the debug log for the relevant host.

10/12/2005 09:45:53 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: c:/php/php-win.exe, ARGS: -q c:/cacti/poller_export.php]
10/12/2005 09:45:53 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: c:/php/php-win.exe, ARGS: -q c:/cacti/poller_commands.php]
10/12/2005 09:45:53 AM - SYSTEM STATS: Time:3.2746 Method:cmd.php Processes:1 Threads:N/A Hosts:5 HostsPerProcess:5 DataSources:61 RRDsProcessed:40
10/12/2005 09:45:53 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update c:\cacti\rra\gtglalafav01_windowscpu_102.rrd --template windowscpu 1129128349:19
10/12/2005 09:45:53 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update c:\cacti\rra\gtglalafav01_winmempagefaults_117.rrd --template winmempagefaults 1129128349:1418
10/12/2005 09:45:53 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update c:\cacti\rra\gtglalafav01_winmeminstalled_116.rrd --template winmeminstalled 1129128349:490964
10/12/2005 09:45:53 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update c:\cacti\rra\gtglalafav01_winmemavailable_114.rrd --template winmemavailable 1129128349:136716288
10/12/2005 09:45:53 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update c:\cacti\rra\gtglalafav01_winmemcacheresident_115.rrd --template winmemcacheresident 1129128349:75227136
10/12/2005 09:45:53 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update c:\cacti\rra\gtglalafav01_wmilhddtotal_119.rrd --template wmilhddfree:wmilhddtotal 1129128349:33282674688:40007729152
10/12/2005 09:45:52 AM - CMDPHP: Poller[0] Time: 2.7066 s, Theads: N/A, Hosts: 4
10/12/2005 09:45:52 AM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown request received, exiting
10/12/2005 09:45:52 AM - CMDPHP: Poller[0] Host[6] DS[119] CMD: c:\perl\bin\perl.exe c:\cacti\scripts\w32_query_logicaldisk.pl 192.168.0.7 get FreeSpace C:, output: 33282674688
10/12/2005 09:45:52 AM - CMDPHP: Poller[0] Host[6] DS[115] SNMP: v1: 192.168.0.7, dsname: winmemcacheresident, oid: .1.3.6.1.4.1.9600.1.1.2.14.0, output: 75227136
10/12/2005 09:45:52 AM - CMDPHP: Poller[0] Host[6] DS[114] SNMP: v1: 192.168.0.7, dsname: winmemavailable, oid: .1.3.6.1.4.1.9600.1.1.2.1.0, output: 136716288
10/12/2005 09:45:52 AM - CMDPHP: Poller[0] Host[6] DS[116] SNMP: v1: 192.168.0.7, dsname: winmeminstalled, oid: .1.3.6.1.2.1.25.2.2.0, output: 490964
10/12/2005 09:45:52 AM - CMDPHP: Poller[0] Host[6] DS[117] SNMP: v1: 192.168.0.7, dsname: winmempagefaults, oid: .1.3.6.1.4.1.9600.1.1.2.7.0, output: 1418
10/12/2005 09:45:52 AM - CMDPHP: Poller[0] Host[6] DS[102] SNMP: v1: 192.168.0.7, dsname: windowscpu, oid: .1.3.6.1.4.1.9600.1.1.5.1.5.1.48, output: 19
10/12/2005 09:45:52 AM - CMDPHP: Poller[0] Host[6] DS[119] CMD: c:\perl\bin\perl.exe c:\cacti\scripts\w32_query_logicaldisk.pl 192.168.0.7 get Size C:, output: 40007729152
10/12/2005 09:45:51 AM - CMDPHP: Poller[0] Host[6] RECACHE: Processing 2 items in the auto reindex cache for '192.168.0.7'.
10/12/2005 09:45:51 AM - CMDPHP: Poller[0] Host[6] SNMP: Host responded to SNMP
10/12/2005 09:45:50 AM - CMDPHP: Poller[0] PHP Script Server Started Properly
10/12/2005 09:45:50 AM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is cmd
10/12/2005 09:45:50 AM - PHPSVR: Poller[0] DEBUG: FILENM: c:\cacti\script_server.php
10/12/2005 09:45:50 AM - PHPSVR: Poller[0] DEBUG: DIRNAM: c:/cacti
10/12/2005 09:45:50 AM - PHPSVR: Poller[0] DEBUG: GETCWD: c:/cacti
10/12/2005 09:45:50 AM - PHPSVR: Poller[0] DEBUG: SERVER: cmd
10/12/2005 09:45:49 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: c:/php/php-win.exe, ARGS: -q c:/cacti/cmd.php 0 6]
Attachments
cacti_graph_template_wmi_logical_disk_utilization.xml
Graph Template
(10.23 KiB) Downloaded 107 times
W32_LogicalDisk.xml
Data Query XML
(1016 Bytes) Downloaded 122 times
w32_query_LogicalDisk.pl.txt
Perl Script
(5.88 KiB) Downloaded 329 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

1) your disk disktemplate is wrong. You've specified that it returns both Available Bytes and Total Bytes in one shot. Looking at its output, it does not. I'd modify the perl script so it returns both values in one shot, instead of running two separate queries (it also speeds things up).

2) Once you've modified your script, then you'll need to modify the data template you've created to include the fields added.
jjcce
Posts: 3
Joined: Wed Oct 12, 2005 9:05 am

Post by jjcce »

Unfortunately for me, I am not very good (no good at all actually) with Perl.

I am also not sure I completely follow what you are saying.

The script (from the command line) will pull multiple values in one shot. I noticed in the debug logs that two queries were listed (one for size and one for freespace). Are you saying this should be 1 query that has both size and freespace? Is it possible to tell Cacti to pull both values at once since the script can handle it?

I am sure one of these hours the lightbulb over my head is going to come on, but for now I am soooo confused.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

jjcce wrote:Are you saying this should be 1 query that has both size and freespace? Is it possible to tell Cacti to pull both values at once since the script can handle it?
Yes.

Although, I'm not sure why you want to write a script that polls the disk usage, when there already is one that comes with cacti that does this via SNMP.
jjcce
Posts: 3
Joined: Wed Oct 12, 2005 9:05 am

Post by jjcce »

I got it working. I started the graph over from scratch. I not completely sure what I did.

I have some disk type WMI information I want to graph and started with this information so I could compare it to the SNMP disk usage graph to make sure I had everything working properly.

Thanks for the help.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest