Monitor Windows Services from Linux Cacti

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

Moderators: Developers, Moderators

kernelphr34k
Posts: 46
Joined: Tue Jul 24, 2007 6:23 pm
Location: Oregon

Post by kernelphr34k »

AWESOME! Thanks for your hard work! I'll be getting this going as soon as I can!
Cybergod
Posts: 4
Joined: Mon Sep 24, 2007 9:39 pm

Post by Cybergod »

I deleted the windows_chk.pl file and transferred it from my windows machine, instead of creating the file and pasting the contents.
That seems to have fixed the error. When i run the command now i get:

snmp:0.2 dns:0.2 wins:0.2 spoolsv:0.2 dhcp:0.2 :0.2 :0.2 :0.2 :0.2
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

Cybergod wrote:I deleted the windows_chk.pl file and transferred it from my windows machine, instead of creating the file and pasting the contents.
That seems to have fixed the error. When i run the command now i get:

snmp:0.2 dns:0.2 wins:0.2 spoolsv:0.2 dhcp:0.2 :0.2 :0.2 :0.2 :0.2
Ahh, the hidden character problem. I bet you opened the file up Windows Notepad and then pasted the contents? That puts hidden characters in the file that screw things up.

The output is what you should be seeing now.
Cybergod
Posts: 4
Joined: Mon Sep 24, 2007 9:39 pm

Post by Cybergod »

I installed the nsclient on my windows xp test box and ran the following command from my cacti server:
/usr/bin/perl /usr/local/cacti/scripts/windows_chk.pl jho

Which gave me the following:
snmp:1 dns:0.2 wins:0.2 spoolsv:1 dhcp:0.2

However when i go to my graphs i dont have any data and i get "nan" next to all of my services.
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

Cybergod wrote:I installed the nsclient on my windows xp test box and ran the following command from my cacti server:
/usr/bin/perl /usr/local/cacti/scripts/windows_chk.pl jho

Which gave me the following:
snmp:1 dns:0.2 wins:0.2 spoolsv:1 dhcp:0.2

However when i go to my graphs i dont have any data and i get "nan" next to all of my services.
I'm assuming you let it run for at least three polling cycles before posting?

Did you double check that the Data Queries were imported properly?

Did you double check the Data Input Method was imported properly, and that you changed the path to your script as I you're not using the same directory structure that I'm using.
lerwin
Posts: 9
Joined: Thu Mar 20, 2008 9:40 am
Location: Texas

Windows Service monitoring

Post by lerwin »

This looks like another of those addons that I could use. I have installed and imported everything. I have changed scripts and data input method to my paths. When I run the script from the command line, it returns the proper value. In cacti, it does not build the graph. And it does not up the rrd file in /rra.

Do I need to add the call to the scripts in cmd.php or somewhere else?

info:
cacti dir => /usr/share/cacti


Thanks,
Loren
Loren Erwin
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Re: Windows Service monitoring

Post by streaker69 »

lerwin wrote:This looks like another of those addons that I could use. I have installed and imported everything. I have changed scripts and data input method to my paths. When I run the script from the command line, it returns the proper value. In cacti, it does not build the graph. And it does not up the rrd file in /rra.

Do I need to add the call to the scripts in cmd.php or somewhere else?

info:
cacti dir => /usr/share/cacti


Thanks,
Loren
No, you don't have to do anything in cmd.php.

Did you chown the file to whatever user is running cacti?

Double check your path statements in the Data Input Method for each script that was imported. I know that when I posted it, I had a really funky path listed in there.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
lerwin
Posts: 9
Joined: Thu Mar 20, 2008 9:40 am
Location: Texas

Post by lerwin »

Thanks for the response.
Did you chown the file to whatever user is running cacti?
They are the same as all of the files in my /scripts dir. root|root. I don't seem to be having any issues with the others. Apache is running as www-data|www-data, should I change the /scripts folder to www-data? I have verified the Data Input Method and changed them to my cacti path, which is /usr/share/cacti.

Anything else to check? I have one rdd file that was created yesterday afternoon, cacti is not even creating the png for the graph.
Loren Erwin
lerwin
Posts: 9
Joined: Thu Mar 20, 2008 9:40 am
Location: Texas

Getting Closer

Post by lerwin »

streaker69,

I had built my graphs on your scripts with your paths. I deleted my graph after I made my changes to the path. It now runs and I see it completing in the log. The rdd file is updating, however I am not seeing a graph image.

The log file is showing

/usr/bin/perl /usr/share/cacti/scripts/windows_chk.pl vautils, output: snmp:1 spoolsv:1

So I know it is getting good data. I have let it run for 45 minutes, which is 9 iterations of cmd.php.

I am unsure what else to check.

Thanks for the assistance,
Loren
Attachments
Here is my "graph".
Here is my "graph".
ScreenHunter_01 Apr. 10 15.49.jpg (9.53 KiB) Viewed 6693 times
Loren Erwin
lerwin
Posts: 9
Joined: Thu Mar 20, 2008 9:40 am
Location: Texas

Post by lerwin »

I am sorry. I keep working through this and keep coming up with more information. When I run the graph management for the windows service in debug mode, this is what cacti gives me.

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Utilities Server - Windows Services" \
--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="/usr/share/cacti/rra/utilities_server_snmp_qry_307.rrd":snmp_qry:LAST \
DEF:b="/usr/share/cacti/rra/utilities_server_snmp_qry_307.rrd":snmp_qry:AVERAGE \
DEF:c="/usr/share/cacti/rra/utilities_server_snmp_qry_307.rrd":spoolsv_qry:LAST \
DEF:d="/usr/share/cacti/rra/utilities_server_snmp_qry_307.rrd":spoolsv_qry:AVERAGE \
AREA:a#4444FF:"SNMP Service" \
GPRINT:a:LAST:" %8.0lf\n" \
AREA:c#F51D30:"Spooler Service":STACK \
GPRINT:c:LAST:"%8.0lf\n" \
COMMENT:"1 = Running 0 = Not Running"

RRDTool Says:

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

I found a thread http://forums.cacti.net/viewtopic.php?t ... sc&start=0
that discusses the error above. I changed my CF from Last to Average and it graphs. I understand the need for this to be the last, since you want to know the status of the service at the polling. Is there another way to get past this without changing from last to average.

Loren
Loren Erwin
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

You'll have to add the LAST to your RRA, and then delete the existing RRD file and recreate it.

In the newer versions of Cacti, LAST wasn't included by default in the RRA like when I wrote that template. I actually just got around to fixing my installation here the other day regarding the missing CF.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
lerwin
Posts: 9
Joined: Thu Mar 20, 2008 9:40 am
Location: Texas

Post by lerwin »

Streaker69,

I last questions, or at least until the next one. I am trying to copy your xml template files and change them to have templates for Domain Controllers, Standard Windows Server, and App servers. I took your windows services and created a dc services one. I imported it and it overwrote the window services. Do I have to change something other than the name? I see something <hash_......>. Do I need to change the hash number or is there a way within cacti to get the <hash...> number?

Again, this is a big help.

Loren
Loren Erwin
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

lerwin wrote:Streaker69,

I last questions, or at least until the next one. I am trying to copy your xml template files and change them to have templates for Domain Controllers, Standard Windows Server, and App servers. I took your windows services and created a dc services one. I imported it and it overwrote the window services. Do I have to change something other than the name? I see something <hash_......>. Do I need to change the hash number or is there a way within cacti to get the <hash...> number?

Again, this is a big help.

Loren
I wouldn't try to edit the XML file directly. I would just import it as it stands and then edit it as you need via the normal editing methods in cacti. You will need to edit the script itself to give it the names of the services that you're monitoring though. There should be two lines near the top of the script, one is the actual service file that check_nt looks for, and the other is a 'friendly' name of the service. You'll need to edit those.

Hope this helps.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests