My version of Win32 Disk Stats

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

Moderators: Moderators, Developers

Author
Message
africanw
Cacti User
Posts: 124
Joined: Thu Mar 31, 2005 4:24 pm
Location: Sydney, Asutralia
Contact:

My version of Win32 Disk Stats

#1 Post by africanw » Thu Nov 16, 2006 7:03 am

Hi,

My script is similair to an earlier post (http://forums.cacti.net/viewtopic.php?t ... statistics). Instead of using SNMP I have used WMI.

Recreated it as the one in the post did not work very well.

If you are going to montior other servers on the network you will need to modify a section of the script to include a local account common to all the machines or a domain account. This account needs admin access.

Networkusername="username"
Networkpassword="password"

OR

Networkusername="DOMAIN\username"
Networkpassword="password"

This script is only for Windows and has been tested on Windows 2003.

Enjoy
Attachments
Disk Stats.zip
(33.1 KiB) Downloaded 2281 times
DiskStats.gif
DiskStats.gif (25.23 KiB) Viewed 29320 times

tbaror
Cacti User
Posts: 55
Joined: Mon Jun 05, 2006 6:54 am

Disk stat issues

#2 Post by tbaror » Thu Dec 07, 2006 10:52 am

Hi
doesnt work cant import the graph and data template
please advise
Tanks

africanw
Cacti User
Posts: 124
Joined: Thu Mar 31, 2005 4:24 pm
Location: Sydney, Asutralia
Contact:

#3 Post by africanw » Thu Dec 07, 2006 7:22 pm

What version of Cacti are you using?

africanw
Cacti User
Posts: 124
Joined: Thu Mar 31, 2005 4:24 pm
Location: Sydney, Asutralia
Contact:

#4 Post by africanw » Thu Dec 07, 2006 7:31 pm

mmm If you are using the latest open the templates in IE and fix any errors.

I use " alot in my templates and it subsitues it for &#34 when when you export and does not like to reimport them

For example -

<value>&#34localhost&#34</value>
---------------^

I have attached the two templates that will import.
Attachments
cacti_data_template_windows_disk_stats_wmi.xml
(11.02 KiB) Downloaded 1725 times
cacti_graph_template_windows_disk_stats_wmi.xml
(35.42 KiB) Downloaded 1789 times

tbaror
Cacti User
Posts: 55
Joined: Mon Jun 05, 2006 6:54 am

Disk stat issues

#5 Post by tbaror » Thu Dec 14, 2006 3:40 am

Hi,

thanks now the import part is working ,but where and how should use the vbs script?
thanks in advanced.

africanw
Cacti User
Posts: 124
Joined: Thu Mar 31, 2005 4:24 pm
Location: Sydney, Asutralia
Contact:

#6 Post by africanw » Thu Dec 14, 2006 5:14 am

You put it in your cacti scripts folder.

tbaror
Cacti User
Posts: 55
Joined: Mon Jun 05, 2006 6:54 am

Disk stst issue

#7 Post by tbaror » Thu Dec 14, 2006 8:40 am

Hi again,

Even tough I have placed the script in scripts folder and filled the user/pass section with admin right still no data "Nan" and I get error in cacti log
Also I have tried to run the script manually and i get error you can see on attached screenshot
Attachments
disk-error.png
error screen shoot
disk-error.png (14.6 KiB) Viewed 28838 times

Fleabag
Posts: 8
Joined: Thu Dec 21, 2006 4:14 pm

Disk WMI problems - Help.

#8 Post by Fleabag » Thu Dec 21, 2006 4:39 pm

New Cacti User,
I am having the same problem and if I run poller from CMD prompt I get the following error. I have confirmed user/passwd, The cscript cmd runs fine from the CMD prompt.


C:\Inetpub\wwwroot\cacti\scripts\w32_WMI_logical_disks.vbs
Data Input String = C:/WINDOWS/system32/cscript.exe //Nologo <path_cacti>/scripts/w32_WMI_logical_disks.vbs <Hostname><diskname>




Cacti Log;
12/21/2006 04:30:03 PM - CMDPHP: Poller[0] Host[2] DS[126] WARNING: Result from CMD not valid. Partial Result:



C:\php>php C:\Inetpub\wwwroot\Cacti\poller.php
OK u:0.00 s:0.00 r:0.12
OK u:0.00 s:0.00 r:0.12
OK u:0.00 s:0.00 r:0.14
OK u:0.00 s:0.00 r:0.14
OK u:0.00 s:0.00 r:0.16
OK u:0.00 s:0.00 r:0.16
OK u:0.00 s:0.00 r:0.16
OK u:0.00 s:0.00 r:0.17
OK u:0.00 s:0.00 r:0.17
OK u:0.00 s:0.00 r:0.17
ERROR: Not enough arguments
OK u:0.00 s:0.03 r:0.19


It seems a lot of people provide this but I am not sure why... :)
Data Source Debug

c:/rrdtool/rrdtool.exe create \
c:/Inetpub/wwwroot/cacti/rra/localhost_avgdisksecperread_126.rrd \
--step 300 \
DS:AvgDiskReadQueueLen:GAUGE:600:0:100 \
DS:FreeMegabytes:GAUGE:600:0:U \
DS:AvgDiskWriteQueueLe:GAUGE:600:0:100 \
DS:PercentFreeSpace:GAUGE:600:0:100 \
DS:PercentDiskWriteTim:GAUGE:600:0:100 \
DS:AvgDiskSecPerRead:GAUGE:600:0:U \
DS:AvgDiskSecPerWrite:GAUGE:600:0:U \
DS:PercentDiskReadTime:GAUGE:600:0:100 \
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:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN: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 \

Fleabag
Posts: 8
Joined: Thu Dec 21, 2006 4:14 pm

SubScript out of range from CMD line

#9 Post by Fleabag » Thu Dec 21, 2006 4:42 pm

You do not have all the Arguments in the CMD line

cscript w32_WMI_logical_disks.vbs localhost C:

africanw
Cacti User
Posts: 124
Joined: Thu Mar 31, 2005 4:24 pm
Location: Sydney, Asutralia
Contact:

#10 Post by africanw » Thu Dec 21, 2006 7:02 pm

Your data input has taken the spaces out -

w32_WMI_logical_disks.vbs <Hostname><diskname>

Should read -

w32_WMI_logical_disks.vbs <Hostname> <diskname>

If you want to run it from the command line do something like -

cscript w32_WMI_logical_disks.vbs localhost C:

You will always need two arguements after the script

Fleabag
Posts: 8
Joined: Thu Dec 21, 2006 4:14 pm

Error is still there DISK WMI - ERROR: Not enough arguments

#11 Post by Fleabag » Thu Dec 21, 2006 9:36 pm

I have fixed this. (I must have changed it when troubleshooting)

However the problem is still there... If I delete the Data Input for this WMI the "ERROR: Not enough arguments" no longer appears.

C:/WINDOWS/system32/cscript.exe //Nologo <path_cacti>/scripts/w32_WMI_logical_disks.vbs <Hostname> <diskname>

C:\php>php C:\Inetpub\wwwroot\Cacti\poller.php
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.03
OK u:0.00 s:0.00 r:0.03
OK u:0.00 s:0.00 r:0.03
OK u:0.01 s:0.00 r:0.05
OK u:0.01 s:0.00 r:0.05
OK u:0.01 s:0.00 r:0.05
ERROR: Not enough arguments
OK u:0.01 s:0.00 r:0.06
OK u:0.01 s:0.00 r:0.06



My end goal is to monitor the same Disk values via WMI so if someone can assist. please do.



Thanks for the help in advance.

africanw
Cacti User
Posts: 124
Joined: Thu Mar 31, 2005 4:24 pm
Location: Sydney, Asutralia
Contact:

#12 Post by africanw » Thu Dec 21, 2006 9:45 pm

can you post the bit from your cacti log for this error.

Also what happens when you run it from the command line?

cscript w32_WMI_logical_disks.vbs localhost C: for example.

Also check the data source for the graph and check it has a space.

Fleabag
Posts: 8
Joined: Thu Dec 21, 2006 4:14 pm

#13 Post by Fleabag » Thu Dec 21, 2006 11:02 pm

Cacti Log regarding this issue;
12/21/2006 10:57:30 PM - CMDPHP: Poller[0] Host[2] DS[126] WARNING: Result from CMD not valid. Partial Result:



When run from CMD lline;
C:\Inetpub\wwwroot\cacti\scripts>cscript //nologo 32_WMI_logical_disks.vbs localhost C:

FreeMegabytes:60 AvgDiskReadQueueLength:0 AvgDiskWriteQueueLength:0 PercentDiskR
eadTime:0 PercentDiskWriteTime:0 PercentFreeSpace:89 AvgDiskSecPerRead:0 AvgDisk
SecPerWrite:0



Thanks

africanw
Cacti User
Posts: 124
Joined: Thu Mar 31, 2005 4:24 pm
Location: Sydney, Asutralia
Contact:

#14 Post by africanw » Thu Dec 21, 2006 11:17 pm

your cacti logging level is not high enough.

Make sure it is at least on MEDIUM. Am sure its your graph data source that is wrong. Try and delete the current one and start a new one.

Fleabag
Posts: 8
Joined: Thu Dec 21, 2006 4:14 pm

#15 Post by Fleabag » Fri Dec 22, 2006 10:34 am

africanw, I thank you for your help.

I am not too sure on your statement. "graph data source that is wrong. Try and delete the current one and start a new one."


How do I delete the Graph Data, I see template, but I do not think this is what you mean.

THanks

Post Reply