Monitor Windows Service stats from Linux

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

Moderators: Developers, Moderators

Post Reply
qishine
Posts: 2
Joined: Mon Jul 15, 2013 9:24 pm

Re: Monitor Windows Service stats from Linux

Post by qishine »

I have another problem, cacti A (CentOS 6.3 x64 + Cacti 0.8.8a ), it seems missing some MIBS

/usr/bin/php -q /var/www/cacti/scripts/win_services.php compuerFQDN public 2 2 index

it will get

19.101.114
14.118.101.114
16.108.111.103.111.110

But on another cacti B (CactiEZ 0.8.8a)

it returns
5.80.111.119.101.114
6.83.101.114.118.101.114
8.78.101.116.108.111.103.111.110

the red part missing on Cacti A, this caused it get status failed

[root@cacti-win ~]# /usr/bin/php -q /var/www/cacti/scripts/win_services.php serverFQDN public 2 2 get servstate 19.101.114
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: .1.3.6.1.4.1.77.1.2.3.1.2.19.101.114

0[root@cacti-win ~]# /usr/bin/php -q /var/www/cacti/scripts/win_services.php serverFQDN public 2 2 get servstate 5.80.111.119.101.114
1[root@cacti-win ~]#

I compare the /usr/bin/php win_services.php winservices.xml /etc/php.ini /include/config.php /include/global.php
they are same,


is there anyone can help me? Thanks a log
PepeSilvia
Posts: 2
Joined: Thu Aug 15, 2013 1:20 pm

Re: Monitor Windows Service stats from Linux

Post by PepeSilvia »

I also need assistance, I have the graphs formed and represented and nothing is showing up. When I use the realtime plugin though to view my graphs I get a result with an active state and it graphs, any explanation for this?
skullbox15
Posts: 9
Joined: Tue Jul 23, 2013 2:02 pm

Re: Monitor Windows Service stats from Linux

Post by skullbox15 »

on latest release of CactiEZ (0.8.8A), I tried everything in this thread and tried using values 35,25 and 37,27 (currently using 35 and 25) but both give me the same result when I run:

Code: Select all

[root@localhost scripts]# php -q win_services.php 172.16.250.250 public 2 2 index
PHP Parse error:  syntax error, unexpected ':' in /var/www/html/scripts/win_services.php on line 65

Parse error: syntax error, unexpected ':' in /var/www/html/scripts/win_services.php on line 65
Line 65 is just a } How can I fix this? Currently I am getting a blank graph (results showing are -nan).
qishine
Posts: 2
Joined: Mon Jul 15, 2013 9:24 pm

Re: Monitor Windows Service stats from Linux

Post by qishine »

Finally, I change the php file
change the red part from 36 to 26 and it works.

/var/www/cacti/scripts/win_services.php

if (substr($return_arr[$i]['oid'],0,2) != "1.")
print substr($return_arr[$i]['oid'],26) . "\n";
else
User avatar
michaelcheung
Posts: 15
Joined: Wed Sep 21, 2016 8:38 pm
Contact:

Re:

Post by michaelcheung »

cigamit wrote: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.
I got this error message: (How to fix it? )

Data Query Debug Information
+ Running data query [10].
+ Found type = '6' [Script Query - Script Server].
+ Found data query XML file at 'D:/wamp/www/cacti/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 '"D:\wamp\bin\php\php5.4.12\php.exe" -q D:\wamp\www\cacti\scripts\win_services.php mon-srv01 public 2 2 index' Index Count: 9
+ Found index:
+ Found index: Fatal error: Call to undefined function read_config_option() in D:\wamp\www\cacti\lib\snmp.php on line 267
+ Found index:
+ Found index: Call Stack:
+ Found index: 0.0003 255376 1. {main}() D:\wamp\www\cacti\scripts\win_services.php:0
+ Found index: 0.0014 437392 2. call_user_func_array() D:\wamp\www\cacti\scripts\win_services.php:13
+ Found index: 0.0014 438056 3. win_services() D:\wamp\www\cacti\scripts\win_services.php:13
+ Found index: 0.0015 439336 4. cacti_snmp_walk() D:\wamp\www\cacti\scripts\win_services.php:24
+ Found index:
+ Executing script query '"D:\wamp\bin\php\php5.4.12\php.exe" -q D:\wamp\www\cacti\scripts\win_services.php mon-srv01 public 2 2 query index'
Thanks,
Michael
User avatar
michaelcheung
Posts: 15
Joined: Wed Sep 21, 2016 8:38 pm
Contact:

Re: Re:

Post by michaelcheung »

michaelcheung wrote:
cigamit wrote: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.
I got this error message: (How to fix it? )

Data Query Debug Information
+ Running data query [10].
+ Found type = '6' [Script Query - Script Server].
+ Found data query XML file at 'D:/wamp/www/cacti/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 '"D:\wamp\bin\php\php5.4.12\php.exe" -q D:\wamp\www\cacti\scripts\win_services.php mon-srv01 public 2 2 index' Index Count: 9
+ Found index:
+ Found index: Fatal error: Call to undefined function read_config_option() in D:\wamp\www\cacti\lib\snmp.php on line 267
+ Found index:
+ Found index: Call Stack:
+ Found index: 0.0003 255376 1. {main}() D:\wamp\www\cacti\scripts\win_services.php:0
+ Found index: 0.0014 437392 2. call_user_func_array() D:\wamp\www\cacti\scripts\win_services.php:13
+ Found index: 0.0014 438056 3. win_services() D:\wamp\www\cacti\scripts\win_services.php:13
+ Found index: 0.0015 439336 4. cacti_snmp_walk() D:\wamp\www\cacti\scripts\win_services.php:24
+ Found index:
+ Executing script query '"D:\wamp\bin\php\php5.4.12\php.exe" -q D:\wamp\www\cacti\scripts\win_services.php mon-srv01 public 2 2 query index'
I am using cacti-0.8.8h , any available scripts for it?
Thanks,
Michael
makcf07
Posts: 4
Joined: Thu Aug 02, 2012 2:11 pm

Re: Monitor Windows Service stats from Linux

Post by makcf07 »

Is there an updated version of Windows Service stats template for Cacti version 1.1.26?

Thank you in advance,
Mark
zetoo
Cacti User
Posts: 68
Joined: Wed Nov 23, 2016 2:42 am

Re: Monitor Windows Service stats from Linux

Post by zetoo »

I am trying to get this template to work with thold, but i could not find the configuration for it to be detect whether the windows service is disable/stopped and send mail notification to me.

anyone have an idea to en-light me?
hillda01
Posts: 16
Joined: Sun Jan 20, 2019 9:04 am

Re: Monitor Windows Service stats from Linux

Post by hillda01 »

Hi,

Do you have a step 1, step2, step3.... etc guide I can follow to get this working on my Ubuntu / Cacti server?

Regards,

Dave.
mrossTTX
Cacti User
Posts: 114
Joined: Wed Dec 07, 2022 12:49 pm

Re: Monitor Windows Service stats from Linux

Post by mrossTTX »

im trying to use this , (and i hope it can be used in 1.2.22), and I am getting this in my error logs
2022-12-27 10:20:15 - CMDPHP PHP ERROR NOTICE Backtrace: (C:\inetpub\wwwroot\cacti\scripts\win_services.php[13]:win_services(), C:\inetpub\wwwroot\cacti\scripts\win_services.php[52]:CactiErrorHandler())
2022-12-27 10:20:15 - ERROR PHP NOTICE: Undefined offset: 3 in file: C:\inetpub\wwwroot\cacti\scripts\win_services.php on line: 52
2022-12-27 10:20:15 - CMDPHP PHP ERROR NOTICE Backtrace: (C:\inetpub\wwwroot\cacti\scripts\win_services.php[13]:win_services(), C:\inetpub\wwwroot\cacti\scripts\win_services.php[34]:CactiErrorHandler())
2022-12-27 10:20:15 - ERROR PHP NOTICE: Undefined offset: 2 in file: C:\inetpub\wwwroot\cacti\scripts\win_services.php on line: 34
2022-12-27 10:20:15 - CMDPHP PHP ERROR NOTICE Backtrace: (C:\inetpub\wwwroot\cacti\scripts\win_services.php[13]:win_services(), C:\inetpub\wwwroot\cacti\scripts\win_services.php[33]:CactiErrorHandler())
2022-12-27 10:20:15 - ERROR PHP NOTICE: Undefined offset: 1 in file: C:\inetpub\wwwroot\cacti\scripts\win_services.php on line: 33

lines 33 and 34 are
$snmp_port = $snmp[1];
$snmp_timeout = $snmp[2];


line 52 is
$snmp_community = $snmp[3];


thoughts?
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 »

I would just simply use the HMIB plugin. That's what I wrote it for.
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?
mrossTTX
Cacti User
Posts: 114
Joined: Wed Dec 07, 2022 12:49 pm

Re: Monitor Windows Service stats from Linux

Post by mrossTTX »

TheWitness wrote: Wed Dec 28, 2022 10:57 am I would just simply use the HMIB plugin. That's what I wrote it for.
i actually have that finally working, and its pretty neat, but there's no way to create a thold or notification if a service stops from the HMIB plug in..
yes, you can go to the graphs, and\or processes, and on the graphs create a thold, but it looks, as far as i can tell, at the PID, and when a service restarts, it gets a new PID.
When looking at the processes from HMIB, i dont see anywhere to create a thold from that screen either.
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 »

That would be a nice feature request. What type of service are you trying to interrogate?
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?
mrossTTX
Cacti User
Posts: 114
Joined: Wed Dec 07, 2022 12:49 pm

Re: Monitor Windows Service stats from Linux

Post by mrossTTX »

essentially what I am looking for, (and this should be platform agnostic from the cacti server standpoint) is to be able to monitor ANY service on a windows machine, and perform actions when it sees that it's not running.
1) Email a list, or person, it discovered the service is down, and that it's actively trying to start the service
2) restart that service remotely, and if it cannot, email those from #1 above that it could not start the service
3) Email groups from #1 above that the service was successfully started
4) If at all possible, read the event log from the server to determine any troubleshooting and open a ticket. we use ServiceNow, and i know a lot of systems can integrate with it.. but that may be way beyond the scope of anything in Cacti. (Opening a ticket via an email does work, but adding in any and all information such as the event log data would be great).
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 »

If you deploy the various graph templates and then create graphs for these services, you can do much of that with thold.
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?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests