Monitor Windows Service stats from Linux

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
grax
Posts: 5
Joined: Fri Feb 27, 2009 9:02 am

Re: Monitor Windows Service stats from Linux

Post by grax »

Why all services i have green (Active)? When i stopped Windows Update Service i have green alltime. hmm help please.

Image
User avatar
fourhouses
Posts: 3
Joined: Thu Apr 07, 2011 4:39 am

Re: Monitor Windows Service stats from Linux

Post by fourhouses »

Maybe services which you're stopping don't belong to graphs above.
I suggest you test with print spooler, help &techincal service or windows audio.
Additionally, you can check real state using snmpwalk.
Cacti Version 0.8.7g; Cacti OS unix; SNMP Version NET-SNMP version: 5.3.2.2;
RRDTool Version RRDTool 1.4.x; Poller Information; Interval 300;
Type spine; Concurrent Processes 1; Max Threads 1; PHP Servers 1; Script Timeout 25; Max OID 10;
PHP Version 5.1.6; PHP OS Linux; PHP uname Linux 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686;
PHP SNMP Installed; max_execution_time 60; memory_limit 128M
4erka
Posts: 6
Joined: Tue Nov 08, 2011 10:31 am

Re: Monitor Windows Service stats from Linux

Post by 4erka »

Hello,

I used files from cigamit's zip file on page 6. Running Cacti 0.8.7h. Templates imported succesfully. But when i add data query to the host and run verbose Query for Win Services i get following Data Query Debug Information and no Items are added in Status column:

+ Running data query [15].
+ Found type = '6' [Script Query - Script Server].
+ Found data query XML file at '/var/www/html/cacti-0.8.7h/resource/script_server/win_services.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' not supported
+Executing script for list of indexes '"/usr/bin/php" -q /var/www/html/cacti-0.8.7h/scripts/win_services.php servername 2:161:900:public:::::: index' Index Count: 0
+ Executing script query '"/usr/bin/php" -q /var/www/html/cacti-0.8.7h/scripts/win_services.php servername 2:161:900:public:::::: query index'

Please let me know if i can provide more information to get this issue resolved.
4erka
Posts: 6
Joined: Tue Nov 08, 2011 10:31 am

Re: Monitor Windows Service stats from Linux

Post by 4erka »

Hello,
Tried to use files from igorx1972 services.rar file at page#9. At this time Verbose Query returns the information below and no Items in Status column:

+ Running data query [15].
+ Found type = '6' [Script Query - Script Server].
+ Found data query XML file at '/var/www/html/cacti-0.8.7h/resource/script_server/win_services.xml'
+ XML file parsed ok.
+ <arg_num_indexes> missing in XML file, 'Index Count Changed' not supported
+ Executing script for list of indexes '"/usr/bin/php" -q /var/www/html/cacti-0.8.7h/scripts/win_services.php servername 2:161:900:public:::::: index' Index Count: 2
+ Found index: ERROR: Invalid Parameters
+ Found index:
+ Executing script query '"/usr/bin/php" -q /var/www/html/cacti-0.8.7h/scripts/win_services.php servername 2:161:900:public:::::: query index'


At the same moment in /etc/httpd/logs/error_log following is logged:

[color=#800080]PHP Warning: Missing argument 2 for win_services() in /var/www/html/cacti-0.8.7h/scripts/win_services.php on line 16
PHP Warning: Missing argument 3 for win_services() in /var/www/html/cacti-0.8.7h/scripts/win_services.php on line 16
PHP Notice: Undefined variable: snmp_auth in /var/www/html/cacti-0.8.7h/scripts/win_services.php on line 31
PHP Notice: Undefined offset: 1 in /var/www/html/cacti-0.8.7h/scripts/win_services.php on line 33
PHP Notice: Undefined offset: 2 in /var/www/html/cacti-0.8.7h/scripts/win_services.php on line 34
PHP Notice: Undefined offset: 3 in /var/www/html/cacti-0.8.7h/scripts/win_services.php on line 52
sh: line 1: 2:161:900:public::::::: command not found


I'm running 0.8.7h. Please advise which way this issue can be fixed.
4erka
Posts: 6
Joined: Tue Nov 08, 2011 10:31 am

Re: Monitor Windows Service stats from Linux

Post by 4erka »

Running following command manually returns a long list of paramaters without any error:

"/usr/bin/php" -q /var/www/html/cacti-0.8.7h/scripts/win_services.php servername 2:161:900:public:::::: index

What does this mean that i can run command from CLI and get a result but running a verbose query from Device Settings page returns me:

+ Found index: ERROR: Invalid Parameters

Please let me know what additional steps can be done to troubleshoout this issue and get it fixed.
User avatar
TheWitness
Developer
Posts: 16997
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Monitor Windows Service stats from Linux

Post by TheWitness »

There are/were some bugs in H on Windows servers. I prefer to use HMIB to track application use.
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?
4erka
Posts: 6
Joined: Tue Nov 08, 2011 10:31 am

Re: Monitor Windows Service stats from Linux

Post by 4erka »

Thank you TheWitness for your reply. Having this Template working is one of the requirement for using Manage plugin to work. So there is no way for me to get fully functional Manage plugin on 0.8.7h in this case?
User avatar
TheWitness
Developer
Posts: 16997
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Monitor Windows Service stats from Linux

Post by TheWitness »

Well, seek out Gilles as he owns Manage. All the service/process information is available from HMIB. He might find it so useful that he does a major update to his Manage plugin.

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?
4erka
Posts: 6
Joined: Tue Nov 08, 2011 10:31 am

Re: Monitor Windows Service stats from Linux

Post by 4erka »

OK, thank you. Will make a post in his "Manage Plugin 0.6.2 for monitoring networks, servers..." topic. Hopefully he has time to make this change.
computer_guru
Cacti User
Posts: 141
Joined: Thu Apr 10, 2008 6:52 pm

Re: Monitor Windows Service stats from Linux

Post by computer_guru »

a moderator of these forums really needs to delete the attachment on page1 and add a note to see page 6 for the download. or some action to prevent confusion with two attachments 5 pages apart.
computer_guru
Cacti User
Posts: 141
Joined: Thu Apr 10, 2008 6:52 pm

Re: Monitor Windows Service stats from Linux

Post by computer_guru »

I thought I posted this file yesterday, but it must not have gone through


here is the win_services.php file I am using. It has the substring bug fixed (26 => 25 and 36 =>35) and the index command will show items in alphabetical order.
Attachments
win_services.php.txt
replace the other one.
(4.05 KiB) Downloaded 1181 times
AllertGen
Posts: 37
Joined: Mon Mar 26, 2012 1:27 pm

Re: Monitor Windows Service stats from Linux

Post by AllertGen »

Hello to all.
I has a little problem with this script. Becouse my windows is not english, I get names of services in this way (url encode):

Code: Select all

D0:96:D1:83:D1:80:D0:BD:D0:B0:D0:BB:20:D1:81:D0:BE:D0:B1:D1:8B:D1:82:D0:B8:D0:B9	
D0:A0:D0:B0:D0:B1:D0:BE:D1:87:D0:B0:D1:8F:20:D1:81:D1:82:D0:B0:D0:BD:D1:86:D0:B8:D1:8F	
D0:A1:D0:BB:D1:83:D0:B6:D0:B1:D0:B0:20:D1:81:D0:BE:D0:BE:D0:B1:D1:89:D0:B5:D0:BD:D0:B8:D0:B9	
D0:A3:D0:B4:D0:B0:D0:BB:D0:B5:D0:BD:D0:BD:D1:8B:D0:B9:20:D1:80:D0:B5:D0:B5:D1:81:D1:82:D1:80	
D0:A1:D0:BB:D1:83:D0:B6:D0:B1:D1:8B:20:D1:82:D0:B5:D1:80:D0:BC:D0:B8:D0:BD:D0:B0:D0:BB:D0:BE:D0:B2	
D0:A1:D0:B8:D1:81:D1:82:D0:B5:D0:BC:D0:B0:20:D1:81:D0:BE:D0:B1:D1:8B:D1:82:D0:B8:D0:B9:20:43:4F:4D:2B
Can someone say what to write in php script to make changes in servise names:
1. Change ":" symbols to "%"
2. Make URL decode
SeSchi77
Posts: 2
Joined: Thu Apr 04, 2013 12:35 pm

Re: Monitor Windows Service stats from Linux

Post by SeSchi77 »

AllertGen wrote:Hello to all.
I has a little problem with this script. Becouse my windows is not english, I get names of services in this way (url encode):

Code: Select all

D0:96:D1:83:D1:80:D0:BD:D0:B0:D0:BB:20:D1:81:D0:BE:D0:B1:D1:8B:D1:82:D0:B8:D0:B9	
D0:A0:D0:B0:D0:B1:D0:BE:D1:87:D0:B0:D1:8F:20:D1:81:D1:82:D0:B0:D0:BD:D1:86:D0:B8:D1:8F	
D0:A1:D0:BB:D1:83:D0:B6:D0:B1:D0:B0:20:D1:81:D0:BE:D0:BE:D0:B1:D1:89:D0:B5:D0:BD:D0:B8:D0:B9	
D0:A3:D0:B4:D0:B0:D0:BB:D0:B5:D0:BD:D0:BD:D1:8B:D0:B9:20:D1:80:D0:B5:D0:B5:D1:81:D1:82:D1:80	
D0:A1:D0:BB:D1:83:D0:B6:D0:B1:D1:8B:20:D1:82:D0:B5:D1:80:D0:BC:D0:B8:D0:BD:D0:B0:D0:BB:D0:BE:D0:B2	
D0:A1:D0:B8:D1:81:D1:82:D0:B5:D0:BC:D0:B0:20:D1:81:D0:BE:D0:B1:D1:8B:D1:82:D0:B8:D0:B9:20:43:4F:4D:2B
Can someone say what to write in php script to make changes in servise names:
1. Change ":" symbols to "%"
2. Make URL decode
I fixed your and my problem. :wink:
Change the line 80 in win_services.php from

Code: Select all

print $arr_index2[$i] . " !" . $arr[$i] . "\n";
to

Code: Select all

if (strpos($arr[$i], ":") > 0){
print $arr_index2[$i] . " !" . urldecode(str_replace(":", "%", "%" . $arr[$i])) . "\n";
}
else{
print $arr_index2[$i] . " !" . $arr[$i] . "\n";
}
or use the attached file.
Attachments
win_services.php.txt
fixed for german windows version
(4.25 KiB) Downloaded 477 times
Last edited by SeSchi77 on Fri Apr 05, 2013 3:44 pm, edited 1 time in total.
SeSchi77
Posts: 2
Joined: Thu Apr 04, 2013 12:35 pm

Re: Monitor Windows Service stats from Linux

Post by SeSchi77 »

Hello I found an other error in the win_services.php.
On query and query index part return is the substring of the oid to long.
I changed it from:

Code: Select all

for ($i=0; $i < sizeof($return_arr); $i++) {
	  if (substr($return_arr[$i]['oid'],0,4) == "SNMP")
	                    print substr($return_arr[$i]['oid'],35) . "\n";
	  else
	                    print substr($return_arr[$i]['oid'],25) . "\n";
}
to

Code: Select all

for ($i=0; $i < sizeof($return_arr); $i++) {
          if (substr($return_arr[$i]['oid'],0,4) == "SNMP")
                            print substr($return_arr[$i]['oid'], 37) . "\n";
          else
                            print substr($return_arr[$i]['oid'], 27) . "\n";
}
I fixed it and now my services shows the correct state.
This works fine for german windows server. Other language version not tested yet.
Attachments
win_services.php.txt
substring oid to long fixed
for german windows version
(4.72 KiB) Downloaded 742 times
pioli1011
Posts: 1
Joined: Mon Jul 15, 2013 9:27 am

Re: Monitor Windows Service stats from Linux

Post by pioli1011 »

hello,

I am using 0.8.8a cati, I need to monitor windows services, I modified the php file win_service.php but can not see services.

Please help.

thanks
Attachments
servicios.JPG
servicios.JPG (104.61 KiB) Viewed 17893 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest