How to graph this WMI script

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

Moderators: Developers, Moderators

Post Reply
jimbob8483
Posts: 3
Joined: Thu Jan 20, 2005 11:26 am

How to graph this WMI script

Post by jimbob8483 »

Hey Everyone,

I am stumped. I have this script here:

***********************************************************
dim iEventCode
dim iNumEvents
iEventCode = 1073

Set EventSet = GetObject("winmgmts:").ExecQuery _
("select * from Win32_NTLogEvent where EventCode=" & _
iEventCode)

iNumEvents = EventSet.Count

Wscript.Echo iNumEvents
************************************************************

What it does is will return how many occurences there are of that EventID in the event logs. The problem I have is that I did the walkthrough on the website and I have it run the .vbs script every 5 minutes. I have a graph created but I get no results whatsoever. Now on the forums I see stuff with XML and I am wondering if that is what I am doing wrong or what steps I need to take so that I can have Cacti graph the results from my WMI scripts.

Thanks for all your help!!

- Jimbob8483
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

You should associate a text tag with the output. change the output to: Wscript.Echo "Val:" & iNumEvents

That way, when you create the data input method, you can specify "Val" as an output field. Which in tern, cacti will take and store into the rra file.

Using this method would allow you to output the count on many eventID's all at once.
jimbob8483
Posts: 3
Joined: Thu Jan 20, 2005 11:26 am

Post by jimbob8483 »

Ok here is the script now:

dim iEventCode
dim iNumEvents
iEventCode = 1073

Set EventSet = GetObject("winmgmts:").ExecQuery _
("select * from Win32_NTLogEvent where EventCode=" & _
iEventCode)

iNumEvents = EventSet.Count

Wscript.Echo "Val:" & iNumEvents

**********************************
This in turn outputs Val:7 when I run it manually.

I created a Data Input Method with the name of EventID which is a script/command input type and points to the script. For an output field I tried both Val and Val: but neither of these seem to work and produce results on the graph..it always sits at 0 when it should show 7. Is there something I am missing..also is it a problem trying to query the localhost..does it have to be a remote machine?

Thanks again!!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests