|
|
| Author |
Message |
oakfan52
Joined: 02 Jan 2006 Posts: 25 Location: Sacramento, CA
|
Posted: Wed Jan 04, 2006 7:49 pm Post subject: 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.
|
|
| Back to top |
|
 |
elnino Cacti User
Joined: 08 Mar 2005 Posts: 205
|
Posted: Wed Jan 04, 2006 11:36 pm Post subject: |
|
|
| I know it's possible to monitor processes running on Compaq/HP servers running Insight Manager. As far as monitoring certain services, I'm not sure if that is possible via SNMP.
|
|
| Back to top |
|
 |
BSOD2600 Cacti Moderator
Joined: 08 May 2004 Posts: 6568 Location: WA, USA
|
Posted: Thu Jan 05, 2006 1:06 am Post subject: |
|
|
| 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.
|
|
| Back to top |
|
 |
oakfan52
Joined: 02 Jan 2006 Posts: 25 Location: Sacramento, CA
|
Posted: Thu Jan 05, 2006 2:37 am Post subject: |
|
|
| I have already found a script9s) to show all running processes. I am looking for services not processes.
|
|
| Back to top |
|
 |
elnino Cacti User
Joined: 08 Mar 2005 Posts: 205
|
Posted: Thu Jan 05, 2006 11:05 am Post subject: |
|
|
| Thats not going to be possible through SNMP. You'll probably need to run something locally on the server to check the status and then a script on the Cacti machine to grab that data
|
|
| Back to top |
|
 |
BSOD2600 Cacti Moderator
Joined: 08 May 2004 Posts: 6568 Location: WA, USA
|
Posted: Thu Jan 05, 2006 1:37 pm Post subject: |
|
|
| 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.
|
|
| Back to top |
|
 |
cigamit Developer
Joined: 07 Apr 2005 Posts: 894 Location: B/CS Texas
|
Posted: Fri Jan 06, 2006 12:56 am Post subject: |
|
|
| 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. |
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).
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.
|
|
| Back to top |
|
 |
cigamit Developer
Joined: 07 Apr 2005 Posts: 894 Location: B/CS Texas
|
Posted: Fri Jan 06, 2006 2:27 am Post subject: |
|
|
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.
| Description: |
|
 Download |
| Filename: |
services.zip |
| Filesize: |
4.12 KB |
| Downloaded: |
3726 Time(s) |
Last edited by cigamit on Mon Nov 06, 2006 9:50 am; edited 3 times in total |
|
| Back to top |
|
 |
BSOD2600 Cacti Moderator
Joined: 08 May 2004 Posts: 6568 Location: WA, USA
|
Posted: Fri Jan 06, 2006 3:46 am Post subject: |
|
|
| oh yea, completely forgot about the lanmanager OID stuff.
|
|
| Back to top |
|
 |
oakfan52
Joined: 02 Jan 2006 Posts: 25 Location: Sacramento, CA
|
Posted: Fri Jan 06, 2006 11:08 am Post subject: |
|
|
Thanks,
I will work on it tonight.
|
|
| Back to top |
|
 |
Scipio
Joined: 12 Oct 2004 Posts: 22 Location: Switzerland
|
Posted: Tue May 09, 2006 8:54 am Post subject: |
|
|
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: | Code: |
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 |
instead of: | Code: |
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 |
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.
|
|
| Back to top |
|
 |
lex8009
Joined: 18 May 2006 Posts: 35
|
Posted: Wed May 24, 2006 11:30 am Post subject: 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?
|
|
| Back to top |
|
 |
cigamit Developer
Joined: 07 Apr 2005 Posts: 894 Location: B/CS Texas
|
Posted: Wed May 24, 2006 8:35 pm Post subject: Re: service monitoring |
|
|
| 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? |
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.
|
|
| Back to top |
|
 |
mories
Joined: 30 Dec 2005 Posts: 8
|
Posted: Tue May 30, 2006 5:12 pm Post subject: |
|
|
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.
Last edited by mories on Fri Jun 16, 2006 12:55 pm; edited 1 time in total |
|
| Back to top |
|
 |
qwertz Cacti User
Joined: 16 Feb 2006 Posts: 98
|
Posted: Wed May 31, 2006 3:40 am Post subject: |
|
|
What a beautiful template!
Everything worked perfectly on my ubuntu machine
THANKS
Qwertz
|
|
| Back to top |
|
 |
|