Monitor Windows Service stats from Linux
Moderators: Developers, Moderators
Monitor Windows Service stats from Linux
What I want to do is monitor windows service stats from my Linux cacti. For example I just want to know the current state of the spooler service on my print server. so i can set the threshold to alert me if the spooler srevice stops.
Look at the OID .1.3.6.1.2.1.25.4.2.1.7. It maintains the list of all processes and if they're running, paused, etc.
| 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 |
Well since the running processes are the services running, thats the closest you're going to be able to get. Otherwise, you're going to need to use WMI to get more detail.
| 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 |
Actually, there is a way to monitor Services from Linux. The OID is .1.3.6.1.4.1.77.1.2.3.1.1 for the index for the services. There is another OID for the service state, which basically returns 0 for stopped, and 4 for running (paused, etc... seem to return 0 instead of what they are suppose to).BSOD2600 wrote:Well since the running processes are the services running, thats the closest you're going to be able to get. Otherwise, you're going to need to use WMI to get more detail.
I actually have been monitoring Services at work using this for the last 8 months or so, I already have the script and templates setup, I'll post them here once I get back to work tomorrow.
Actually, here it is now. I had to do a few changes to it, since it was originally used for Cacti v0.8.6c (which is what our production server still runs, way too many modifications to upgrade at this time) but this was exported from v0.8.6i so you shouldn't have any issues with it.
If someone could verify that it works for them also, then I will go ahead and create some instructions for it.
If someone could verify that it works for them also, then I will go ahead and create some instructions for it.
- Attachments
-
- services.zip
- (4.12 KiB) Downloaded 13753 times
Last edited by cigamit on Mon Nov 06, 2006 9:50 am, edited 3 times in total.
oh yea, completely forgot about the lanmanager OID stuff.
| 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 |
Hello,
I could not make this work. So I started debugging. The PHP code was OK but something was wrong. I always had 0 state for every services. After digging in the logs drinking a few coffees, I realize that the oid in the DB was too short... the field was cutting of a little bit of the OID. Here is an exemple:
instead of:
So here is the fix:
In the table poller_item, the field arg1 is a varchar(250). I changed it to TEXT. Then in cacti I cleared the poller cache. Then It was working
I dont know if this fix generate some troubles with the rest of cacti but I saw nothing wrong for the moment.
I could not make this work. So I started debugging. The PHP code was OK but something was wrong. I always had 0 state for every services. After digging in the logs drinking a few coffees, I realize that the oid in the DB was too short... the field was cutting of a little bit of the OID. Here is an exemple:
Code: Select all
d:\webserver\cacti2.xxxx.com\scripts\win_services.php win_services 192.168.1.21 public 1 130 get servstate 49.72.101.114.107.105.109.101.114.32.67.97.98.108.101.69.97.115.121.32.46.78.101.116.32.83.99.104.101.100.117.108.101.114.32.67.111.110.116.114.111.108.108.101
Code: Select all
d:\webserver\cacti2.xxxx.com\scripts\win_services.php win_services 192.168.1.21 public 1 130 get servstate 49.72.101.114.107.105.109.101.114.32.67.97.98.108.101.69.97.115.121.32.46.78.101.116.32.83.99.104.101.100.117.108.101.114.32.67.111.110.116.114.111.108.108.101.114.32.86.49.46.50
In the table poller_item, the field arg1 is a varchar(250). I changed it to TEXT. Then in cacti I cleared the poller cache. Then It was working
I dont know if this fix generate some troubles with the rest of cacti but I saw nothing wrong for the moment.
Tiago Coimbra
Gruyère Energie
Gruyère Energie
service monitoring
Cigamit, the service monitoring that script and template you created, is that specific for linux, or can be used for cacti on windows?
Re: service monitoring
Its just polling using SNMP, so it does not matter if you base cacti machine is Linux or Windows. The machine you are monitoring has to be windows ofcourse.lex8009 wrote:Cigamit, the service monitoring that script and template you created, is that specific for linux, or can be used for cacti on windows?
cigamit,
i was having some trouble getting this to work.
at first i changed the arg1 field to text as mentioned before.
then i noticed that the index of the services was one character to short.
in the 'view poller cache' screen i saw that the action for the datasource was
"Action: 2, Script: /var/www/html/scripts/win_services.php win_services charlie public 1 14 get servstate 1.77.83.83.81.76.83.69.82.86.69.82"
where it should be .... "11.77.83.83.81.76.83.69.82.86.69.82"
so after some looking around i found that this statement which was there twice was causing the problem.
-------
if (substr($return_arr[$i]['oid'],0,4) == "SNMP")
print substr($return_arr[$i]['oid'],36) . "\n";
else
print substr($return_arr[$i]['oid'],26) . "\n";
-----
i changed the values 36 and 26 to 35 and 25 in both occurences, recreated some graphs and they are working now.
i do not have the knowledge to see what happens exactly. i am running this on cactiez beta 3.
Thanks for you great work on the plugins and CactiEZ.
i was having some trouble getting this to work.
at first i changed the arg1 field to text as mentioned before.
then i noticed that the index of the services was one character to short.
in the 'view poller cache' screen i saw that the action for the datasource was
"Action: 2, Script: /var/www/html/scripts/win_services.php win_services charlie public 1 14 get servstate 1.77.83.83.81.76.83.69.82.86.69.82"
where it should be .... "11.77.83.83.81.76.83.69.82.86.69.82"
so after some looking around i found that this statement which was there twice was causing the problem.
-------
if (substr($return_arr[$i]['oid'],0,4) == "SNMP")
print substr($return_arr[$i]['oid'],36) . "\n";
else
print substr($return_arr[$i]['oid'],26) . "\n";
-----
i changed the values 36 and 26 to 35 and 25 in both occurences, recreated some graphs and they are working now.
i do not have the knowledge to see what happens exactly. i am running this on cactiez beta 3.
Thanks for you great work on the plugins and CactiEZ.
Last edited by mories on Fri Jun 16, 2006 12:55 pm, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 2 guests