VBS Help
Moderators: Developers, Moderators
- pshankland
- Cacti User
- Posts: 247
- Joined: Fri Dec 31, 2004 7:07 am
- Location: UK
VBS Help
Have been using Cacti for a while now and find it brilliant for collecting SNMP info but know, after reading through this forum, that it can do so much more.
I have downloaded the NT Scripts that use WMI to collect Win32 data through VBS and then via PHP deliver the info to Cacti. Could someone please take me through the steps needed to have IISUtils.vbs and IISUtils.php sitting on my desktop to them running within a brand new install of Cacti?
I need this noddy information once and I then feel I can create my own scripts - this info would probably be useful to a lot of other people as well.
Thanks.
Pete.
I have downloaded the NT Scripts that use WMI to collect Win32 data through VBS and then via PHP deliver the info to Cacti. Could someone please take me through the steps needed to have IISUtils.vbs and IISUtils.php sitting on my desktop to them running within a brand new install of Cacti?
I need this noddy information once and I then feel I can create my own scripts - this info would probably be useful to a lot of other people as well.
Thanks.
Pete.
- pshankland
- Cacti User
- Posts: 247
- Joined: Fri Dec 31, 2004 7:07 am
- Location: UK
After looking through the forum 'a lot' I have got the following VBS file which has the following usage: cscript.exe w32_PhysicalDisk.vbs <server_name>
This now gives me an input of the server name and an output. Could someone help me with the required *.pl file needed to run this vbs? Also, how to get the vbs and pl working within Cacti?
Thanks.
Code: Select all
strComputer=Wscript.Arguments.Item(0)
Set objWMIService=GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objPhysicalDisk=objWMIService.instancesof("Win32_PerfRawData_PerfDisk_PhysicalDisk")
For Each objItem in objPhysicalDisk
CurrentDiskQueueLength=objItem.CurrentDiskQueueLength
Next
Wscript.Echo CurrentDiskQueueLength
Thanks.
A .pl file is a perl script. You'll need to install that on your server.
To get it working in cacti, you'll need to create a Data Input Method. In the input string, put something like: perl <path_cacti>/scripts/hddhealth.pl <HDDReport> <HDDData>. I also suggest you read the cacti manual, as it covers some of this. Also look at other working examples in cacti.
To get it working in cacti, you'll need to create a Data Input Method. In the input string, put something like: perl <path_cacti>/scripts/hddhealth.pl <HDDReport> <HDDData>. I also suggest you read the cacti manual, as it covers some of this. Also look at other working examples in cacti.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
- pshankland
- Cacti User
- Posts: 247
- Joined: Fri Dec 31, 2004 7:07 am
- Location: UK
Right, this is what I have got so far:
- 1-- Created the VBS file with 1 input and 1 output
2-- Created a new Data Input Method, with cscript.exe <path_cacti>/scripts/w32_PhysicalDisk.vbs <strComputer> as the input string (Script/Command as input type) and an Input Field called strComputer and an Output Field called CurrentDiskQueueLength
3-- Then, created a new Data Template using the above Data Input Method, a new Data Source and the field |host_hostname| in as the Data Input
4-- Then, a very simply Graph Template at the moment with a Line1 and GPRINT items both reporting the DS created before
5-- I then finally added the graph template to a couple of my Win2000 machines but although the graphs get generated I get a value of 0 all the time.
Sounds good... just need to debug what is going on.
1) Turn up the logging level in cacti and look for your script running. Does it return anything? If so,
2) Dump your rrd file the script is using and verify the data is going into that (rrdtool dump filename.rrd > filename.xml). If so,
3) Verify your graph template has the correct DS name you assigned in the data template for this script. disable any web accelerating programs and take a look at the working graph.
1) Turn up the logging level in cacti and look for your script running. Does it return anything? If so,
2) Dump your rrd file the script is using and verify the data is going into that (rrdtool dump filename.rrd > filename.xml). If so,
3) Verify your graph template has the correct DS name you assigned in the data template for this script. disable any web accelerating programs and take a look at the working graph.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
- pshankland
- Cacti User
- Posts: 247
- Joined: Fri Dec 31, 2004 7:07 am
- Location: UK
I created another script and other templates based on something I know would have a value - Current CPU Voltage but am still getting the same issues, no info.
Have set Cacti to DEBUG log level and am getting the following:
I exported the RRD file as well and am getting no data in there either (a small sample):
Stuck again now, thought I was getting somewhere
Have set Cacti to DEBUG log level and am getting the following:
Code: Select all
11/23/2005 07:12:21 PM - CACTID: Poller[0] Host[14] ERROR: Empty result [172.29.2.23]: 'cscript.exe //nologo D:/Cacti/scripts/w32_CPU.vbs 172.29.2.23'
11/23/2005 07:12:21 PM - CACTID: Poller[0] Host[14] DS[43] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/23/2005 07:12:21 PM - CACTID: Poller[0] Host[14] ERROR: Empty result [172.29.2.23]: 'cscript.exe //nologo D:/Cacti/scripts/w32_PhysicalDisk.vbs |host_hostname|'
11/23/2005 07:12:21 PM - CACTID: Poller[0] Host[14] DS[42] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/23/2005 07:12:21 PM - CACTID: Poller[0] Host[14] DS[38] WARNING: Result from SERVER not valid. Partial Result: ...
Code: Select all
<!-- Round Robin Database Dump -->
<rrd>
<version> 0003 </version>
<step> 300 </step> <!-- Seconds -->
<lastupdate> 1132773900 </lastupdate> <!-- 2005-11-23 19:25:00 GMTST -->
<ds>
<name> ds_wmi_cpuvolts </name>
<type> GAUGE </type>
<minimal_heartbeat> 600 </minimal_heartbeat>
<min> 0.0000000000e+00 </min>
<max> 1.0000000000e+02 </max>
<!-- PDP Status -->
<last_ds> UNKN </last_ds>
<value> 0.0000000000e+00 </value>
<unknown_sec> 0 </unknown_sec>
</ds>
<!-- Round Robin Archives -->
<rra>
<cf> AVERAGE </cf>
<pdp_per_row> 24 </pdp_per_row> <!-- 7200 seconds -->
<params>
<xff> 5.0000000000e-01 </xff>
</params>
<cdp_prep>
<ds>
<primary_value> 0.0000000000e+00 </primary_value>
<secondary_value> 0.0000000000e+00 </secondary_value>
<value> 0.0000000000e+00 </value>
<unknown_datapoints> 16 </unknown_datapoints>
</ds>
</cdp_prep>
<database>
<!-- 2005-05-27 21:00:00 GMTDT / 1117224000 --> <row><v> NaN </v></row>
<!-- 2005-05-27 23:00:00 GMTDT / 1117231200 --> <row><v> NaN </v></row>
<!-- 2005-05-28 01:00:00 GMTDT / 1117238400 --> <row><v> NaN </v></row>
<!-- 2005-05-28 03:00:00 GMTDT / 1117245600 --> <row><v> NaN </v></row>
<!-- 2005-05-28 05:00:00 GMTDT / 1117252800 --> <row><v> NaN </v></row>
<!-- 2005-05-28 07:00:00 GMTDT / 1117260000 --> <row><v> NaN </v></row>
- pshankland
- Cacti User
- Posts: 247
- Joined: Fri Dec 31, 2004 7:07 am
- Location: UK
To show the exact steps I have taken with screenshots, please take a look at the following PDF file:
My WMI Problems
Let me know.
Thanks.
My WMI Problems
Let me know.
Thanks.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Does is run properly from the command line? If so, please try the Cactid from the following link: http://forums.cacti.net/viewtopic.php?p ... ght=#49066
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
With that version, you will have to provide the full path to cscript.exe in your data input method and then clear your poller cache.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- pshankland
- Cacti User
- Posts: 247
- Joined: Fri Dec 31, 2004 7:07 am
- Location: UK
TheWitness,
I have used the pre-Beta CatiD G version, used the full path to cscript (c:\windows\system32\cscript.exe), and also cleared the poller cache - unfortunatly still don't get any results and am getting the following in the logfile:
Any more suggestions - has it got anything to do with the |host_hostname| bit?
PS - as the pre-beta CactiD didn't work should I put it back to the current release?
Thanks.
I have used the pre-Beta CatiD G version, used the full path to cscript (c:\windows\system32\cscript.exe), and also cleared the poller cache - unfortunatly still don't get any results and am getting the following in the logfile:
Code: Select all
11/23/2005 09:48:19 PM - CACTID: Poller[0] Host[14] ERROR: Empty result [172.29.2.23]: 'C:\Windows\System32\cscript.exe //nologo D:/Cacti/scripts/w32_CPU.vbs |host_hostname|'
11/23/2005 09:48:19 PM - CACTID: Poller[0] Host[14] DS[43] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/23/2005 09:48:19 PM - CACTID: Poller[0] Host[14] DS[43] SCRIPT: C:\Windows\System32\cscript.exe //nologo D:/Cacti/scripts/w32_CPU.vbs |host_hostname|, output: U
11/23/2005 09:48:19 PM - CACTID: Poller[0] Host[14] DEBUG: The POPEN returned the following File Descriptor 9
11/23/2005 09:48:26 PM - CACTID: Poller[0] Host[14] ERROR: Empty result [172.29.2.23]: 'C:\Windows\System32\cscript.exe //nologo D:/Cacti/scripts/w32_PhysicalDisk.vbs |host_hostname|'
11/23/2005 09:48:26 PM - CACTID: Poller[0] Host[14] DS[42] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/23/2005 09:48:26 PM - CACTID: Poller[0] Host[14] DS[42] SCRIPT: C:\Windows\System32\cscript.exe //nologo D:/Cacti/scripts/w32_PhysicalDisk.vbs |host_hostname|, output: U
11/23/2005 09:48:26 PM - PHPSVR: Poller[0] DEBUG: INCLUDE: 'D:\Cacti\scripts\ss_host_cpu.php' SCRIPT: 'ss_host_cpu' CMD: '172.29.2.23 14 1:161:500:public:::MD5::[None] get usage 0'
11/23/2005 09:48:27 PM - PHPSVR: Poller[0] SERVER: D:\Cacti\scripts\ss_host_cpu.php ss_host_cpu 172.29.2.23 14 1:161:500:public:::MD5::[None] get usage 0 output U
11/23/2005 09:48:27 PM - CACTID: Poller[0] Host[14] DS[38] WARNING: Result from SERVER not valid. Partial Result: ...
11/23/2005 09:48:27 PM - CACTID: Poller[0] Host[14] DS[38] SERVER: D:\Cacti\scripts\ss_host_cpu.php ss_host_cpu 172.29.2.23 14 1:161:500:public:::MD5::[None] get usage 0, output: U
PS - as the pre-beta CactiD didn't work should I put it back to the current release?
Thanks.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Use forward slashes in your cscript path.
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
can you run strace while running cactid from the command line and let me know what happens.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
command is (from source directory) "strace cactid host_id host_id" where the host_id is the one with the bugger script.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Personally, I'd try to get the script to work on cmd.php before moving to cactid, since as you've experianced, it has problems some times.
As per your rrd file output, notice you posted the logs from around 2005-05-28. Today is 2005-11-23. Scroll down in the xml file and take a look. This of course will only apply once the script actually sucessfully runs in Cacti...
As per your rrd file output, notice you posted the logs from around 2005-05-28. Today is 2005-11-23. Scroll down in the xml file and take a look. This of course will only apply once the script actually sucessfully runs in Cacti...
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
- pshankland
- Cacti User
- Posts: 247
- Joined: Fri Dec 31, 2004 7:07 am
- Location: UK
TheWitness -- could you please explain the strace and host_id a bit more to me as I am having a few problems understanding completly
BSOD2600 - have just changed to using cmd.php and am basically getting the same results as with cactid:
The XML dump was massive so didn't bother listing it all here
Both -- I have changed to using forward slashes (/'s) within the Script/Command but it dosn't seem to show!
Thanks.
BSOD2600 - have just changed to using cmd.php and am basically getting the same results as with cactid:
Code: Select all
11/23/2005 10:25:01 PM - CMDPHP: Poller[0] Host[14] DS[42] WARNING: Result from CMD not valid. Partial Result:
11/23/2005 10:25:01 PM - CMDPHP: Poller[0] Host[14] DS[42] CMD: C:\Windows\System32\cscript.exe //nologo D:/Cacti/scripts/w32_PhysicalDisk.vbs |host_hostname|, output: U
11/23/2005 10:25:01 PM - CMDPHP: Poller[0] Host[14] DS[43] WARNING: Result from CMD not valid. Partial Result:
11/23/2005 10:25:01 PM - CMDPHP: Poller[0] Host[14] DS[43] CMD: C:\Windows\System32\cscript.exe //nologo D:/Cacti/scripts/w32_CPU.vbs |host_hostname|, output: U
Both -- I have changed to using forward slashes (/'s) within the Script/Command but it dosn't seem to show!
Code: Select all
C:/Windows/System32/cscript.exe //nologo <path_cacti>/scripts/w32_CPU.vbs <strComputer>
Who is online
Users browsing this forum: No registered users and 2 guests