Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Monitor Windows Service stats from Linux
Goto page Previous  1, 2, 3, 4, 5, 6, 7
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
lupick



Joined: 28 Nov 2006
Posts: 8

PostPosted: Mon Jan 07, 2008 3:21 am    Post subject: Reply with quote

lupick wrote:
cigamit wrote:
You are going to find that a lot of your old scripts no longer work in v0.8.7, since instead of including config.php, you need to include global.php. Also, certain functions have changed and require more arguments to support SNMP v3.

Attached is a version that should work in v0.8.7.

I've tried with cacti 0.87a ver on RHEL linuxbox.

if I run:

[root@linuxbox scripts]# php ./win_services.php winhost.domain.name public 2 9 index

PHP Fatal error: Call to undefined function read_config_option() in /var/www/html/cacti/lib/snmp.php on line 233

Any Ideas how to solve it?!?

thanks
L.



Full debug:

PHP Notice: Undefined variable: config in /var/www/html/cacti/lib/snmp.php on line 33
PHP Notice: Use of undefined constant SNMP_POLLER - assumed 'SNMP_POLLER' in /var/www/html/cacti/scripts/win_services_ori.php on line 24
PHP Warning: Missing argument 10 for cacti_snmp_walk(), called in /var/www/html/cacti/scripts/win_services_ori.php on line 24 and defined in /var/www/html/cacti/lib/snmp.php on line 225
PHP Notice: Use of undefined constant SNMP_POLLER - assumed 'SNMP_POLLER' in /var/www/html/cacti/lib/snmp.php on line 225
PHP Fatal error: Call to undefined function read_config_option() in /var/www/html/cacti/lib/snmp.php on line 233
Back to top
anemisti



Joined: 05 Jan 2008
Posts: 1

PostPosted: Mon Jan 07, 2008 6:34 am    Post subject: win_service.php problem Reply with quote

Hi Lupick

I solved by adding the following string to the file win_service.php

include_once(dirname(__FILE__) . "/../include/global.php");

seems to be that work correctly.

A.
Back to top
mrloon



Joined: 31 May 2006
Posts: 12

PostPosted: Wed Jan 23, 2008 10:04 am    Post subject: Still unable to get the XML to read results Reply with quote

I've grabbed the latest zip of the services query, and made the change from 36 to 35 for position (tried at 36 also), as well as the change for adding the global.php file, but still no results:

+ Running data query [26].
+ Found type = '6 '[script query].
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/win_services.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'c:\php\php.exe -q C:\Inetpub\wwwroot\cacti\scripts\win_services.php localhost 1:161:500:xxx:::MD5::DES: index'
+ Executing script query 'c:\php\php.exe -q C:\Inetpub\wwwroot\cacti\scripts\win_services.php localhost 1:161:500:xxx:::MD5::DES: query index'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/win_services.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/win_services.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/win_services.xml'

Is there any other reason for it? When I run the script noted above manually from a command prompt, I do see the index OIDs, as well as the second line providing the names of the services.

What else should I attempt?

Quote:
Cacti Version - 0.8.7a
Plugin Architecture - 1.4
Poller Type - CMD.php
Server Info - Windows NT 5.2
Web Server - Microsoft-IIS/6.0
PHP - 5.2.4
PHP Extensions - bcmath, calendar, com_dotnet, ctype, session, filter, ftp, hash, iconv, json, odbc, pcre, Reflection, date, libxml, standard, tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter, ISAPI, gd, mysql, snmp, sockets, RRDTool
MySQL - 5.0.45-community-nt
RRDTool - 1.2.15
Plugins
    Network Discovery (discovery - v0.8.3)
    Documents (docs - v0.1)
    Host Info (hostinfo - v0.2)
    PHP Network Managing (manage - v0.5.1)
    Device Monitoring (monitor - v0.8.2)
    Global Plugin Settings (settings - v0.3)
    Thresholds (thold - v0.3.9)
    Network Tools (tools - v0.2)
    Update Checker (update - v0.4)
    ReportIt (ReportIt - v0.5.1)
    Report Creator (reports - v0.3)
Back to top
ato



Joined: 14 Feb 2008
Posts: 3

PostPosted: Fri Feb 15, 2008 6:57 am    Post subject: Reply with quote

I've got a blank graph in cacti 8.7b under windows 2003 SP2, and I resolv my problem.

winservice.php :


line 51:
Code:

   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";
         }


line 61:
Code:

         for ($i = 0; $i < sizeof($arr_index); $i++) {
            if (substr($arr_index[$i]['oid'],0,4) == "SNMP")
               $arr_index2[$i] =  substr($arr_index[$i]['oid'],37);
            else
               $arr_index2[$i] =  substr($arr_index[$i]['oid'],27);
         }
Back to top
old8xp



Joined: 27 Jul 2006
Posts: 4

PostPosted: Sat Mar 01, 2008 12:13 pm    Post subject: Reply with quote

I have use the template in RHL 8.0 . But It can't graph a blank . "nan"

when I look the cacti log:
"03/02/2008 01:27:01 AM - CMDPHP: Poller[0] Host[2] DS[8] WARNING: Result from SERVER not valid. Partial Result: U "

it seem the template can't work well in Linux.

how can I solve it?

think U a lot.

cigamit wrote:
You are going to find that a lot of your old scripts no longer work in v0.8.7, since instead of including config.php, you need to include global.php. Also, certain functions have changed and require more arguments to support SNMP v3.

Attached is a version that should work in v0.8.7.
Back to top
YoMarK
Cacti User


Joined: 02 Feb 2007
Posts: 69
Location: Eindhoven/The Netherlands

PostPosted: Fri Apr 18, 2008 8:33 am    Post subject: Reply with quote

Hi old8xp: I did have the same problem(I think).

"Solved" it by replacing
Code:
if ((func_num_args() <= "4") && (func_num_args() >= "3")) {
on line 46 by
Code:
if ( 1==1) {


Don't know why this check is even in, because there are always 5 arguments in my case:
Quote:
C:\wamp\www>php C:\wamp\www\scripts\win_services.php 10.1.14.147(1) 2:161:1000:publ
ic:::MD5::DES:(2) get(3) servstate(4) .17.65.117.116.111.109.97.116.105.99.32.85.112.100.
97.116.101234234234(5)


Also, i needed to apply the changes from mories on the first page.
Back to top
rlund



Joined: 11 Apr 2008
Posts: 14

PostPosted: Tue May 13, 2008 2:21 pm    Post subject: Reply with quote

I had to change my SNMP to version 1, and they it worked.

FYI
Back to top
bharmon



Joined: 04 Jun 2008
Posts: 2

PostPosted: Wed Jun 04, 2008 9:41 am    Post subject: Service State 0 for running services Reply with quote

I have read thru this entire post and have solved many of my problems.

So thanks for everyone's input.

The problem I am having now is that when I monitor a service it always shows "service state 0" even though the service is running.

Does anyone have any ideas?

Thanks
Back to top
bharmon



Joined: 04 Jun 2008
Posts: 2

PostPosted: Wed Jun 04, 2008 10:00 am    Post subject: Service State 0 for running services Reply with quote

Service Graphs started working.

Maybe I just need a little patience.

Thanks
Back to top
gueutzilla



Joined: 13 Jul 2008
Posts: 9

PostPosted: Fri Sep 12, 2008 11:00 am    Post subject: Reply with quote

Hi,

Thanks for this template. This work perfectly after make some modifications in win_service.php.

I have a question... Do you know how can we restart a windows service if it reply output : 0 for 2 times???

for exemple, if my service fail, I would like to send a query to force restrating service on the remote host like "net start MyService".

Is it possible???

Thanks ;o)
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 978
Location: B/CS Texas

PostPosted: Tue Oct 07, 2008 3:16 pm    Post subject: Reply with quote

A future version of thold will support this... but not yet.
Back to top
thebull



Joined: 30 Sep 2008
Posts: 5

PostPosted: Tue Oct 21, 2008 4:21 pm    Post subject: Windows Service Monitoring need assistance Reply with quote

I made the changes and i have the same config mentioned below and same problem. I would love to know do i need to make any changes apart from this.


ato wrote:
I've got a blank graph in cacti 8.7b under windows 2003 SP2, and I resolv my problem.

winservice.php :


line 51:
Code:

   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";
         }


line 61:
Code:

         for ($i = 0; $i < sizeof($arr_index); $i++) {
            if (substr($arr_index[$i]['oid'],0,4) == "SNMP")
               $arr_index2[$i] =  substr($arr_index[$i]['oid'],37);
            else
               $arr_index2[$i] =  substr($arr_index[$i]['oid'],27);
         }
Back to top
N3NCY
Cacti User


Joined: 22 Sep 2005
Posts: 242
Location: Landenberg, PA

PostPosted: Mon Oct 27, 2008 7:00 pm    Post subject: Reply with quote

Any thoughts on this error?

[root@FreeBSD /usr/local/www/data/cacti/scripts]# php win_services.php 172.28.0.21 public 2

Notice: Undefined offset: 1 in /usr/local/www/data/cacti/scripts/win_services.php on line 24

Notice: Undefined offset: 2 in /usr/local/www/data/cacti/scripts/win_services.php on line 25

Notice: Undefined offset: 3 in /usr/local/www/data/cacti/scripts/win_services.php on line 43

What is a simple / valid command line test to see if win_services.php is working?
Back to top
cspenpen



Joined: 05 Dec 2006
Posts: 19

PostPosted: Wed Nov 19, 2008 5:01 am    Post subject: Reply with quote

Hello

I install this version, but the graph still show service state is 0.
I modify win_services.php refer to those discuss, but I still get 0.
How can I do to fix this issue?

thx

cigamit wrote:
You are going to find that a lot of your old scripts no longer work in v0.8.7, since instead of including config.php, you need to include global.php. Also, certain functions have changed and require more arguments to support SNMP v3.

Attached is a version that should work in v0.8.7.



winservices.PNG
 Description:
 Filesize:  15.66 KB
 Viewed:  583 Time(s)

winservices.PNG


Back to top
colaandice



Joined: 04 Dec 2008
Posts: 1

PostPosted: Thu Dec 04, 2008 1:42 am    Post subject: Reply with quote

thanks much
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7
Page 7 of 7

 



Powered by phpBB © 2001, 2005 phpBB Group