Monitor Windows Service stats from Linux
Moderators: Developers, Moderators
- streaker69
- Cacti Pro User
- Posts: 712
- Joined: Mon Mar 27, 2006 10:35 am
- Location: Psychic Amish Network Administrator
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?
Any idea how to get it back?
-
- Posts: 5
- Joined: Fri Aug 03, 2007 9:40 pm
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" \
GPRINTLAST:"%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
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" \
GPRINTLAST:"%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
- Attachments
-
- dc1-services.jpg (6.78 KiB) Viewed 17836 times
-
- Posts: 9
- Joined: Thu Oct 19, 2006 7:59 pm
- Location: Weed, Siskiyou County, CA, USA
- Contact:
No Services Returned...
Everything seems to be working fine; but, when I do a verbose query I get:
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.
Code: Select all
+ 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'
Has anyone got this to work under 0.7.8 ?
i get this when i start this:
Thx
kyRoo
i get this when i start this:
Code: Select all
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
kyRoo
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.
Attached is a version that should work in v0.8.7.
- Attachments
-
- services.zip
- Windows Services Script for Cacti v0.8.7
- (4.36 KiB) Downloaded 2779 times
how to setup this template
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
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
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,
Here are a list of the changes I made,
- Original code,
Changed code,
Code: Select all
if ((func_num_args() <= "4") && (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.Code: Select all
if ((func_num_args() <= "5") && (func_num_args() >= "3")) { if ($cmd == "index") {
- Original code,
Changed code,
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'],36) . "\n"; else print substr($return_arr[$i]['oid'],26) . "\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.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"; }
- Original code,
Changed code,
Code: Select all
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); }
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.Code: Select all
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); }
nobody to help me to explain the usage of this script ?
I come back an dhope some explaination on how to use this script
thanks
best regards
thanks
best regards
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" \
GPRINTLAST:"%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?
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" \
GPRINTLAST:"%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.
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"
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,Anyway with those changes this works great on my Cacti install now. Thanks a million for it!
- Original code,
Changed code,Code: Select all
if ((func_num_args() <= "4") && (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.Code: Select all
if ((func_num_args() <= "5") && (func_num_args() >= "3")) { if ($cmd == "index") {
- Original code,
Changed code,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'],36) . "\n"; else print substr($return_arr[$i]['oid'],26) . "\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.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"; }
- Original code,
Changed code,Code: Select all
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); }
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.Code: Select all
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); }
I had changed the Service Stat as AREA , the graph is work.padawan wrote:You have to change your graph template like this :ERROR: the RRD does not contain an RRA matching the chosen CF
Can I solve it?
Item # 1 (service_state): Service State AREA AVERAGE
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.
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
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
[size=75]
[color=green]|Cacti 0.87|[/color][color=green]|PA 1.3|[/color][color=green]|Poller cmd.php|[/color][color=green]|IIS 6.0|[/color][color=green]|PHP Version 5.2.4|[/color][color=green]|MySQL 5.0.27|[/color][color=green]|RRDtool 1.2.15|[/color][/size]
[color=brown]|Thold 0.3.8 |[/color] [color=red]|Zond 0.34 |[/color]
[url=http://forums.cacti.net/viewtopic.php?t=15067][size=75]Complete List of Cacti Scripts and Templates[/size][/url]
[url=http://forums.cacti.net/viewtopic.php?t=14985][size=75]Currently Known Plugins[/size][/url]
[color=green]|Cacti 0.87|[/color][color=green]|PA 1.3|[/color][color=green]|Poller cmd.php|[/color][color=green]|IIS 6.0|[/color][color=green]|PHP Version 5.2.4|[/color][color=green]|MySQL 5.0.27|[/color][color=green]|RRDtool 1.2.15|[/color][/size]
[color=brown]|Thold 0.3.8 |[/color] [color=red]|Zond 0.34 |[/color]
[url=http://forums.cacti.net/viewtopic.php?t=15067][size=75]Complete List of Cacti Scripts and Templates[/size][/url]
[url=http://forums.cacti.net/viewtopic.php?t=14985][size=75]Currently Known Plugins[/size][/url]
I've tried with cacti 0.87a ver on RHEL linuxbox.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.
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.
Who is online
Users browsing this forum: No registered users and 2 guests