Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Jun 25, 2019 11:41 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 38 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: At last - Windows Services monitoring with WMI!
PostPosted: Tue May 16, 2006 4:25 am 
Offline
Cacti User
User avatar

Joined: Tue Mar 08, 2005 9:50 am
Posts: 84
Hi all,

Please find enclosed a way that WORKS to monitor Windows services from a Windows cacti box.

You must pay attention to the exact service short-name which is case sensitive when entered in the new graph wizard.

Cheers :)

PS: Find the re-exported graph template below in this post


Attachments:
File comment: Script to be run with the cscript Windows tool (already provided with your OS)
Win32_Services.vbs.txt [376 Bytes]
Downloaded 5769 times

_________________
mrh | cacti 0.8.6h | plugin architecture | thold | monitor | iis6


Last edited by mrh on Wed May 24, 2006 5:54 am, edited 1 time in total.
Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 10:21 am 
Offline
Cacti Moderator
User avatar

Joined: Sat May 08, 2004 12:44 pm
Posts: 12160
Location: USA
Nice... you might want to post a few graphs of it too.

_________________

| 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 |


Top
 Profile  
 
 Post subject: No resutls in graph
PostPosted: Wed May 17, 2006 7:46 am 
Offline

Joined: Wed May 17, 2006 4:45 am
Posts: 2
Hi, I added the template and i'm getting no results in my graph.
Is this the right input string: cscript <nologo> <path_cacti>/scripts/Win32_Services.vbs <hostname><servicename>


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 20, 2006 9:12 am 
Offline
Cacti User
User avatar

Joined: Tue Mar 08, 2005 9:50 am
Posts: 84
Please, find attached an image of the graph you should get, when the service stops, a white gap is showed. Also you can set a high threshold of -1 to get an alert when it stops -if you're using thold plugin-.

Regarding the problem you have, nitraat, have you checked from the command prompt that you can use "cscript Win32_Services.vbs hostname shortservicename (case sensitive)" and you get a value? Once you achieve this bear in mind the scheduled task account needs to have admin privileges on target hosts.

Hope to be of help :D


Attachments:
Win32 Services.PNG
Win32 Services.PNG [ 21.23 KiB | Viewed 56255 times ]

_________________
mrh | cacti 0.8.6h | plugin architecture | thold | monitor | iis6
Top
 Profile  
 
 Post subject: Re: No resutls in graph
PostPosted: Mon May 22, 2006 12:38 pm 
Offline

Joined: Wed May 17, 2006 4:45 am
Posts: 2
nitraat wrote:
Hi, I added the template and i'm getting no results in my graph.
Is this the right input string: cscript <nologo> <path_cacti>/scripts/Win32_Services.vbs <hostname><servicename>


Problem was a space was needed between hostname and servicename!
Works perfectly, even the alerting when it goes to 0.
Thanks!!


Top
 Profile  
 
 Post subject: need help
PostPosted: Tue May 23, 2006 11:21 pm 
Offline

Joined: Thu May 18, 2006 4:30 pm
Posts: 37
i've followed the instruction but it's not displaying the line on the graph and the service status shows NaN on the graph.

running the cscript command on the command line returns a -1 value.

C:\WINNT>cscript c:/inetpub/wwwroot/cacti/scripts/win32_services.vbs localhost W32Time

-1

Any idea is greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 4:37 am 
Offline
Cacti User
User avatar

Joined: Tue Mar 08, 2005 9:50 am
Posts: 84
-1 is a good response! That means the service is running. Try to stop it and you'll get a 0 instead.

Also, make sure the data input method is this way: cscript <nologo> <path_cacti>/scripts/Win32_Services.vbs <hostname> <servicename>

I think the export I did is not fully working as is, so you need to change manually the <> characters. Nevertheless I post another export again (find enclosed).

Cheers


Attachments:
cacti_graph_template_win32_services.xml [8.59 KiB]
Downloaded 3377 times

_________________
mrh | cacti 0.8.6h | plugin architecture | thold | monitor | iis6
Top
 Profile  
 
 Post subject: monitoring
PostPosted: Wed May 24, 2006 11:38 am 
Offline

Joined: Thu May 18, 2006 4:30 pm
Posts: 37
mrh, I re-imported the the script (thanks by the way), recreated the graph setting in the device profile and saved it. The service is running on the server, got a -1 after running the script from the command line.

it creates the graph, but no line. also on the graph, the service state shows 0.


Top
 Profile  
 
 Post subject: error in cmd
PostPosted: Wed May 24, 2006 5:07 pm 
Offline

Joined: Thu May 18, 2006 4:30 pm
Posts: 37
seem that when it creates the cscript cmd, it combines the hostname and the service name (output from cacti.log file):

CMD: cscript //nologo C:/Inetpub/wwwroot/cacti/scripts/win_services.vbs localhostW32Time, output: U


even though in the xml template file, there's a space in between and i've added another space, so there's actually 2 spaces.

<input_string>cscript //nologo &lt;path_cacti&gt;/scripts/win_services.vbs &lt;hostname&gt; &lt;servicename&gt;</input_string>


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 28, 2006 5:57 am 
Offline
Cacti User
User avatar

Joined: Tue Mar 08, 2005 9:50 am
Posts: 84
lex, change the lt and gt symbols for < and >, so your input method should keep this way:

cscript <nologo> <path_cacti>/scripts/Win32_Services.vbs <hostname> <servicename>

the problem is that //nologo variable cannot be put directly in the input method, so I needed to define an input variable <nologo> and associate to a fixed value (//nologo).

maybe my export is still wrong, but you should able to make it working by taking a glance to similar input methods in your cacti installation.

hope you get it working! ;)

_________________
mrh | cacti 0.8.6h | plugin architecture | thold | monitor | iis6


Top
 Profile  
 
 Post subject: error in cmd
PostPosted: Sun May 28, 2006 8:47 pm 
Offline

Joined: Thu May 18, 2006 4:30 pm
Posts: 37
thanks, mrh. that did the trick


Top
 Profile  
 
 Post subject: Windows Service Monitoring with WMI
PostPosted: Wed Jun 14, 2006 4:34 am 
Offline

Joined: Wed Jun 07, 2006 9:06 am
Posts: 9
Could somebody please post how the correct string that should be used in the XML to add the necessary space, at the minute I've got:-

<input_string>cscript //nologo &lt;path_cacti&gt;/scripts/win_services.vbs &lt;hostname&gt; &lt;servicename&gt;</input_string>

Is this correct ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 3:29 am 
Offline
Cacti User
User avatar

Joined: Tue Mar 08, 2005 9:50 am
Posts: 84
&lt = <
&gt = >

This error happens many times when importing/exporting templates ;)

_________________
mrh | cacti 0.8.6h | plugin architecture | thold | monitor | iis6


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 3:52 am 
Offline
Cacti User
User avatar

Joined: Tue Mar 08, 2005 9:50 am
Posts: 84
ops, you also need to remove the ";"

_________________
mrh | cacti 0.8.6h | plugin architecture | thold | monitor | iis6


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 8:09 am 
Offline

Joined: Wed Jun 07, 2006 9:06 am
Posts: 9
mrh,

Thanks for the info although I'm still struggling could you post me an
example of the xml string that works ok for ?

Cheers

-Mike


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 38 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group