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  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Mon Jul 02, 2007 9:17 am    Post subject: Reply with quote

Ok, I upgraded my installation from the I version that was on the CactiEZ ISO to the J version from the distribution site. Since then, I've lost the Win Services option under devices. I've followed what I read here in the thread, about importing the XML file and making sure the other two files are in their correct locations. But I still don't have an option for Win Services under my devices. Upon looking through the database table 'graph_templates' Win Services is not list. I have the Graph Template and Data Template for it, but I cannot add it to a device.

Any idea how to get it back?
Back to top
tonzy0907



Joined: 30 May 2007
Posts: 18

PostPosted: Fri Jul 27, 2007 9:17 am    Post subject: one graph Reply with quote

is it possible to use one graph in all services i monitored?
Back to top
ainesophaur



Joined: 03 Aug 2007
Posts: 5

PostPosted: Tue Aug 14, 2007 9:12 pm    Post subject: Reply with quote

Hello to all

I'm running cactiez (cacti-h) (was running this before with no problem) and recently upgraded to j -- and now my graphs for win_Services are broken.

When I look at the graph, it's just a red x (like image missing) -- so I decided to look a little deeper and seen there was no rrd for the hostname - service.

I went as far as running chmod 777 on the rra directory.

My RRA timing is all right (according to the picture in page 4)

I'm not sure how to 'debug' this issue as I've never ran into it before, so I apologize in advance for a lack of detail.

All other graphs are fine.

I don't know why it isn't creating the rrd =\


Debug mode displays


/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-60 \
--title="RTSW DC1 - Services -" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
DEF:a="/var/www/html/rra/rtsw_dc1_service_state_41.rrd":service_state:LAST \
DEF:b="/var/www/html/rra/rtsw_dc1_service_state_41.rrd":service_state:AVERAGE \
AREA:a#EA8F00:"Service State" \
GPRINT:a:LAST:"%8.0lf\n" \
COMMENT:"(1 = Running, 0 = Stopped)"
RRDTool Says:

ERROR: opening '/var/www/html/rra/rtsw_dc1_service_state_41.rrd': No such file or directory



dc1-services.jpg
 Description:
 Filesize:  6.78 KB
 Viewed:  4459 Time(s)

dc1-services.jpg


Back to top
justinchudgar



Joined: 19 Oct 2006
Posts: 9
Location: Weed, Siskiyou County, CA, USA

PostPosted: Fri Nov 02, 2007 8:46 pm    Post subject: No Services Returned... Reply with quote

Everything seems to be working fine; but, when I do a verbose query I get:
Code:
+ Running data query [20].
+ Found type = '6 '[script query].
+ Found data query XML file at '/usr/share/cacti/site/resource/script_server/win_services.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /usr/share/cacti/site/scripts/win_services.php 192.168.112.200 public 2 6 index'
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/win_services.php 192.168.112.200 public 2 6 query index'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_server/win_services.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_server/win_services.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_server/win_services.xml'


I have tried the 36/26-->35/25 fix mentioned above; but, get no data either way. I tried to see where to make the varchar(250) to text() change; but am stumped. Thanks in advance for the help.
Back to top
KyRoo



Joined: 19 Oct 2007
Posts: 47

PostPosted: Mon Nov 05, 2007 4:14 am    Post subject: Reply with quote

Has anyone got this to work under 0.7.8 ?

i get this when i start this:

Code:
 php -q win_services.php <ip> public 1 2 query index

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



Thx
kyRoo
Back to top
cigamit
Developer


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

PostPosted: Mon Nov 05, 2007 10:29 pm    Post subject: Reply with quote

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.



services.zip
 Description:
Windows Services Script for Cacti v0.8.7

Download
 Filename:  services.zip
 Filesize:  4.36 KB
 Downloaded:  679 Time(s)

Back to top
frdt



Joined: 09 Aug 2007
Posts: 13

PostPosted: Wed Nov 07, 2007 7:48 am    Post subject: how to setup this template Reply with quote

hello , I new on cacti. Template is correctly imported but now where to go ?
In data query, associated graph under Data Template - Win Services , what to put in the fields name and field name ?
It's a basic question I know but .. don't understand how to configure a host to display this graph.
I have 150 devices monitored with standard plugin , for these hosts I just go to "new graph", select a host and then select the graph template in a drop down list. Here I don't have this template in the list.
can everyone help me to ..understand what to do
thanks and best regards
Back to top
warnesj
Cacti User


Joined: 29 May 2005
Posts: 163

PostPosted: Wed Nov 07, 2007 11:31 pm    Post subject: Reply with quote

Hey cigamit, thanks for the new scripts. But for whatever reason the script wasn't working for me on my Linux install. I had to make a couple of changes to the win_service.php file that I wanted to run by you for you're comments (just in case I did something stupid),

Here are a list of the changes I made,
  1. Original code,
    Code:
       if ((func_num_args() <= "4") && (func_num_args() >= "3")) {
          if ($cmd == "index") {

    Changed code,
    Code:
       if ((func_num_args() <= "5") && (func_num_args() >= "3")) {
          if ($cmd == "index") {

    For some reason when the "get" command went to check the servstate my server was passing 5 arguments (hostname, snmp connection info, snmp command, argument 1, and argument 2 - the oid of the service). With the "if" statement looking for 3 or 4 arguments my system wasn't able to actually get into the subroutine to query the service status.

  2. Original code,
    Code:
             for ($i=0; $i < sizeof($return_arr); $i++) {
                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";
             }

    Changed code,
    Code:
             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";
             }

    The first digit of the OID's of the service index was getting trimmed off so Cacti was unable to query the service status. For example, if the service index was 19.84.83.77.32.67.108.105.101.110.116.32.65.99.99.101.112.116.111.114, the win_services.php script was querying 9.84.83.77.32.67.108.105.101.110.116.32.65.99.99.101.112.116.111.114. So what I did was decrease the character position that the substr command was starting at by 1.

  3. Original code,
    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'],36);
                else
                   $arr_index2[$i] =  substr($arr_index[$i]['oid'],26);
             }

    Changed code,
    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'],35);
                else
                   $arr_index2[$i] =  substr($arr_index[$i]['oid'],25);
             }

    Similarly to above, the first digit of the OID of the service index was getting trimmed, so I decreased the position where the substr command started at by 1.


Anyway with those changes this works great on my Cacti install now. Thanks a million for it!
Back to top
frdt



Joined: 09 Aug 2007
Posts: 13

PostPosted: Wed Nov 14, 2007 7:46 am    Post subject: nobody to help me to explain the usage of this script ? Reply with quote

I come back an dhope some explaination on how to use this script
thanks
best regards
Back to top
old8xp



Joined: 27 Jul 2006
Posts: 4

PostPosted: Wed Dec 12, 2007 1:55 pm    Post subject: Reply with quote

I use the scripts,bu it can't graph something .

turn on debug, it show this:

RRDTool Command:

/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-60 \
--title="gxdcb77 - Service State - SNMP Service" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/shine/htdocs/client/cacti/rra/gxdcb77_service_state_26.rrd":service_state:LAST \
DEF:b="/shine/htdocs/client/cacti/rra/gxdcb77_service_state_26.rrd":service_state:AVERAGE \
AREA:a#EA8F00:"Service State" \
GPRINT:a:LAST:"%8.0lf\n" \
COMMENT:"(1 = Running, 0 = Stopped)"
RRDTool Says:

ERROR: the RRD does not contain an RRA matching the chosen CF

Can I solve it?



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
old8xp



Joined: 27 Jul 2006
Posts: 4

PostPosted: Sun Dec 16, 2007 11:09 pm    Post subject: Reply with quote

I change the scripts like U,but it work incorret.
how Can I solve it?

error message is:
12/17/2007 06:29:22 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT snmp_query.id, snmp_query.name, snmp_query.xml_path FROM (snmp_query,host_snmp_query) WHERE host_snmp_query.snmp_query_id=snmp_query.id AND host_snmp_query.host_id= ORDER BY snmp_query.name"
12/17/2007 06:29:22 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT graph_local.graph_template_id FROM (graph_local,host_graph) WHERE graph_local.graph_template_id=host_graph.graph_template_id AND graph_local.host_id=host_graph.host_id AND graph_local.host_id= GROUP BY graph_local.graph_template_id"
12/17/2007 06:29:22 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT snmp_query.id, snmp_query.name, snmp_query.xml_path FROM (snmp_query,host_snmp_query) WHERE host_snmp_query.snmp_query_id=snmp_query.id AND host_snmp_query.host_id= ORDER BY snmp_query.name"

warnesj wrote:
Hey cigamit, thanks for the new scripts. But for whatever reason the script wasn't working for me on my Linux install. I had to make a couple of changes to the win_service.php file that I wanted to run by you for you're comments (just in case I did something stupid),

Here are a list of the changes I made,
  1. Original code,
    Code:
       if ((func_num_args() <= "4") && (func_num_args() >= "3")) {
          if ($cmd == "index") {

    Changed code,
    Code:
       if ((func_num_args() <= "5") && (func_num_args() >= "3")) {
          if ($cmd == "index") {

    For some reason when the "get" command went to check the servstate my server was passing 5 arguments (hostname, snmp connection info, snmp command, argument 1, and argument 2 - the oid of the service). With the "if" statement looking for 3 or 4 arguments my system wasn't able to actually get into the subroutine to query the service status.

  2. Original code,
    Code:
             for ($i=0; $i < sizeof($return_arr); $i++) {
                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";
             }

    Changed code,
    Code:
             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";
             }

    The first digit of the OID's of the service index was getting trimmed off so Cacti was unable to query the service status. For example, if the service index was 19.84.83.77.32.67.108.105.101.110.116.32.65.99.99.101.112.116.111.114, the win_services.php script was querying 9.84.83.77.32.67.108.105.101.110.116.32.65.99.99.101.112.116.111.114. So what I did was decrease the character position that the substr command was starting at by 1.

  3. Original code,
    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'],36);
                else
                   $arr_index2[$i] =  substr($arr_index[$i]['oid'],26);
             }

    Changed code,
    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'],35);
                else
                   $arr_index2[$i] =  substr($arr_index[$i]['oid'],25);
             }

    Similarly to above, the first digit of the OID of the service index was getting trimmed, so I decreased the position where the substr command started at by 1.


Anyway with those changes this works great on my Cacti install now. Thanks a million for it!
Back to top
padawan



Joined: 30 Nov 2007
Posts: 25

PostPosted: Thu Dec 20, 2007 7:46 am    Post subject: Reply with quote

Quote:

ERROR: the RRD does not contain an RRA matching the chosen CF

Can I solve it?


You have to change your graph template like this :
Item # 1 (service_state): Service State AREA AVERAGE
Back to top
old8xp



Joined: 27 Jul 2006
Posts: 4

PostPosted: Mon Dec 24, 2007 7:13 pm    Post subject: Reply with quote

padawan wrote:
Quote:

ERROR: the RRD does not contain an RRA matching the chosen CF

Can I solve it?


You have to change your graph template like this :
Item # 1 (service_state): Service State AREA AVERAGE


I had changed the Service Stat as AREA , the graph is work.
but the graph is incorrect. It say which state is "nan".

when I look the cacti log, it say:
12/25/2007 08:14:01 AM - CMDPHP: Poller[0] Host[2] DS[9] WARNING: Result from SERVER not valid. Partial Result: U
which DS[9] is the state which I want to monitor.
Back to top
slech
Cacti User


Joined: 06 Nov 2007
Posts: 90

PostPosted: Sat Dec 29, 2007 5:50 am    Post subject: Reply with quote

I have the same problem

RRDTool Says:

ERROR: the RRD does not contain an RRA matching the chosen CF


12/29/2007 12:49:14 PM - CMDPHP: Poller[0] Host[25] DS[617] WARNING: Result from SERVER not valid. Partial Result: U
Back to top
lupick



Joined: 28 Nov 2006
Posts: 8

PostPosted: Sat Jan 05, 2008 6:58 am    Post subject: Reply with quote

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.
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  Next
Page 6 of 7

 



Powered by phpBB © 2001, 2005 phpBB Group