Windows Disk utilization script and template

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

Moderators: Developers, Moderators

sidewinder
Cacti User
Posts: 66
Joined: Sat Dec 06, 2003 12:44 pm
Location: Winchester, MA

Windows Disk utilization script and template

Post by sidewinder »

A Perl script that uses WMI to get both total and free disk space for a w32 host. It can be used as a template for other indexed WMI classes and or return other values. Just type the script name at a dos prompt for info on usage.

I also have a data query/indexed version of this, but it requires IIS and also has some configuration requirements. If you are interested let me know and i'll post it too.
Attachments
cacti_graph_template_w32_hard_drive_space.xml
(11.79 KiB) Downloaded 1511 times
w32_query_LogicalDisk.pl.txt
(5.3 KiB) Downloaded 2184 times
Sunksat
Posts: 2
Joined: Thu Sep 09, 2004 10:29 am
Location: DK
Contact:

Post by Sunksat »

Great things you make happen with cacti
Could you post the "data query/indexed version" I have IIS installed
and want to fool around :)
sidewinder
Cacti User
Posts: 66
Joined: Sat Dec 06, 2003 12:44 pm
Location: Winchester, MA

Post by sidewinder »

Sunksat wrote:Great things you make happen with cacti
Could you post the "data query/indexed version" I have IIS installed
and want to fool around :)
Sure thing, leme get my 8.6 installation working and i'll post it.
sidewinder
Cacti User
Posts: 66
Joined: Sat Dec 06, 2003 12:44 pm
Location: Winchester, MA

Post by sidewinder »

This would be the query/indexed version of the script. The readme file contains instructions on how to install it.

Let me know if you have any questions regarding the changes to IIS.

Cheers
Attachments
w32-disk space.zip
data query/indexed version
(6.01 KiB) Downloaded 1144 times
User avatar
Scipio
Posts: 22
Joined: Tue Oct 12, 2004 4:49 am
Location: Switzerland
Contact:

Post by Scipio »

Hi

I'm asking for help here, cause I cannot get my values recorded in the rrd file...

The poller log in debug mode displays theses lines:

Code: Select all

10/12/2004 03:10:10 PM - CMDPHP: Poller[0] Host[131] CMD: perl D:\www\cacti33/scripts/w32_query_LogicalDisk.pl 192.168.1.16 get freespace,size c:, output: freespace:9746927616 size:15208509440 
Well, It seems to work, but the rrd file is not update.. the graph always displays "-1.#J"

In the Graph Management page, with the debug mode on, RRDTools says "ok".. so, I don't know what goes wrong....

Help !! :)
Tiago Coimbra
Gruyère Energie
sidewinder
Cacti User
Posts: 66
Joined: Sat Dec 06, 2003 12:44 pm
Location: Winchester, MA

Post by sidewinder »

I would suggest you verify that the graph and graph template are correct as in the graph items match up to the correct data source. If you don't see any problems there then let me know what version of cacti you are running and post the output of the graph debug.

-Sidewinder
User avatar
Scipio
Posts: 22
Joined: Tue Oct 12, 2004 4:49 am
Location: Switzerland
Contact:

Post by Scipio »

Hi !

Thanks for you quick answer...

I checked the items datasource names, and they match witch the datasources in the rrd file. Here is the datasource debug print:

Code: Select all

d:/rrdtool/src/tool_release/rrdtool.exe create \
D:\www\cacti33/rra/websudback_w32_hdd_free_672.rrd \
--step 300  \
DS:w32_hdd_size:GAUGE:600:0:U \
DS:w32_hdd_free:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
RRA:LAST:0.5:1:600 \
RRA:LAST:0.5:6:700 \
RRA:LAST:0.5:24:775 \
RRA:LAST:0.5:288:797 \
The graph debug just says "ok"

The graph source properties (5min) displays:

Code: Select all

d:/rrdtool/src/tool_release/rrdtool.exe graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Websud-Back - Drive Space - C" \
--base=1024 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
DEF:a="D\:\www\cacti33/rra/websudback_w32_hdd_free_672.rrd":w32_hdd_size:AVERAGE \
DEF:b="D\:\www\cacti33/rra/websudback_w32_hdd_free_672.rrd":w32_hdd_free:AVERAGE \
AREA:a#0000FF:"Total"  \
GPRINT:a:LAST:"Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
AREA:b#F24AC8:"Free"  \
GPRINT:b:LAST:" Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s" 
The file is created and all seems to be ok... I checked with the rrdtool command line (info) and the datasources are correct....

I'm using cacti 0.8.6, php 4.3.8 and rrdtool 1.0.48...

don't know what's wrong :-/

Hope you can help.. thanks !!
Tiago Coimbra
Gruyère Energie
sidewinder
Cacti User
Posts: 66
Joined: Sat Dec 06, 2003 12:44 pm
Location: Winchester, MA

Post by sidewinder »

Looks like there is a subtle change in 8.6, the output field names need to match the output from the script. If you edit the Data Input Method and change the output field names to FreeSpace and Size that should correct the problem you are having.

-Sidewinder
User avatar
Scipio
Posts: 22
Joined: Tue Oct 12, 2004 4:49 am
Location: Switzerland
Contact:

Post by Scipio »

Thanks !!

It works now :)

Well, fo those who have the same problem, just change in the output method the command line. Cacti is now Case-sensitive with the values name.

Here is the line:

Code: Select all

perl <path_cacti>/scripts/w32_query_LogicalDisk.pl <hostname> get FreeSpace,Size <driveletter>
Tiago Coimbra
Gruyère Energie
shreekarthik
Posts: 13
Joined: Thu Sep 16, 2004 12:32 pm

Re:

Post by shreekarthik »

Hi,
Can you post the graph on the forum?

Thanks,
Jaya.
shreekarthik
Posts: 13
Joined: Thu Sep 16, 2004 12:32 pm

Post by shreekarthik »

Hi,
I am having the same problem as scipio : The rrd files are not getting updated. When I try to execute the program from command prompt I get the following error :"unable to talk to WMI for get". My WMI is turned on and functioning well. Can anyone help me out in this?

Thanks,
Jaya.
shreekarthik
Posts: 13
Joined: Thu Sep 16, 2004 12:32 pm

Post by shreekarthik »

Now the program is running well in the command prompt and is able to return the available space on drive C. But in Cacti the rrd files are not getting updated. Does anyone have any solutions? I checked the output fields and they match those in the script.

Thanks,
Jaya.
User avatar
Scipio
Posts: 22
Joined: Tue Oct 12, 2004 4:49 am
Location: Switzerland
Contact:

Post by Scipio »

Try to delete your datasource and recreate it.
Tiago Coimbra
Gruyère Energie
shreekarthik
Posts: 13
Joined: Thu Sep 16, 2004 12:32 pm

Re:

Post by shreekarthik »

Thanks Scipio. I recreated the data source and also made some changes in the data input methods to match the code. As said in the earlier post cacti is case sensitive. Graph is working!

Thanks,
Jaya.
shadow1975
Posts: 32
Joined: Wed Mar 02, 2005 11:58 am

Post by shadow1975 »

I have a noob question in regards to this answer you have given in xml and perl format. In the xml file it has a whole lot of "hash" figures which cannot seem to figure out where its pulling those numbers from and what they mean. Can anyone help me out please.


thanks in advance
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests