Thanks for all who helped me with how to monitor a Windows counter without 
having to do customization on the client side (other than a stock Opsview 
agent).

It was the "\\" escaping slashes thing that I was getting stuck on.  

So these 2 examples work on a stock Opsview Windows client but as Aero 
mentioned the command would for a stock NSClient++ would be "check_counter" 
instead of "nsc_checkcounter".

Service Win08_Web_Current_Anonymous 
check_nrpe -H $HOSTADDRESS$ -c nsc_checkcounter -a '"\\Web 
Service(_Total)\\Current Anonymous Users" MaxWarn=100 MaxCrit=300 ShowAll'


Service Win08_Web_Current_Connections 
check_nrpe -H $HOSTADDRESS$ -c nsc_checkcounter -a '"\\Web 
Service(_Total)\\Current Connections" MaxWarn=100 MaxCrit=300 ShowAll'


Also from Aero's examples I didn't realize I could do 1 check to check all 
fixed drives, so I'll have to try that out as well.
check_nrpe -H $HOSTADDRESS$ -c check_drivesize -a 'MaxWarnUsed=90% 
MaxCritUsed=95% CheckAll FilterType=FIXED ShowAll=long'


James Whittington
VC3, Inc.









From: [email protected] 
[mailto:[email protected]] On Behalf Of aero
Sent: Friday, October 29, 2010 1:29 AM
To: Opsview Users
Subject: Re: [opsview-users] Having issues checking counter in Win08 server

Hello

We are monitoring Windows servers with own customized NSClient++  without using 
offered by opsview.

How do we monitor Windows servers?
We are using NSClient++ ver. 0.3.6 now( Opsview is offering .msi packaged 
NClient++ ver. 0.3.5.? )
We seperated common configuration and per-host customized configuration like 
these.

<nsc.ini>
[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
;FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NRPEListener.dll
;SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
CheckWMI.dll
CheckExternalScripts.dll


[Settings]
allowed_hosts=

;# USE THIS FILE
;  Use the INI file as opposed to the registry if this is 0 and the use_reg in 
the registry is set to 1 
;  the registry will be used instead.
use_file=1

[log]
;# LOG DEBUG
;  Set to 1 if you want debug message printed in the log file (debug messages 
are always printed to stdout when run with -test)
;debug=1

;# LOG FILE
;  The file to print log statements to
file=nsclient.log

[NSClient]
;


[Check System]
;# CPU BUFFER SIZE
;  Can be anything ranging from 1s (for 1 second) to 10w for 10 weeks. Notice 
that a larger buffer will waste memory 
;  so don't use a larger buffer then you need (ie. the longest check you do +1).
;CPUBufferSize=1h

;# CHECK RESOLUTION
;  The resolution to check values (currently only CPU).
;  The value is entered in 1/10:th of a second and the default is 10 (which 
means ones every second)
;CheckResolution=10

;-----------------------------------------------------------------
[NRPE]
;# NRPE PORT NUMBER
;  This is the port the NRPEListener.dll will listen to.
port=5666

;# COMMAND ARGUMENT PROCESSING
;  This option determines whether or not the NRPE daemon will allow clients to 
specify arguments to commands that are executed.
allow_arguments=1

;# COMMAND ALLOW NASTY META CHARS
;  This option determines whether or not the NRPE daemon will allow clients to 
specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow_nasty_meta_chars=1

;# USE SSL SOCKET
;  This option controls if SSL should be used on the socket.
use_ssl=1


[NRPE Handlers]
;NSClient++ checks
;nsc_checkdrivesize=inject CheckDriveSize $ARG1$
;nsc_checkfilesize=inject CheckFileSize $ARG1$
;Old Style





[External Script]
;# COMMAND TIMEOUT
;  This specifies the maximum number of seconds that the NRPE daemon will allow 
plug-ins to finish executing before killing them off.
;command_timeout=60
;
;# COMMAND ARGUMENT PROCESSING
;  This option determines whether or not the NRPE daemon will allow clients to 
specify arguments to commands that are executed.
allow_arguments=1
;
;# COMMAND ALLOW NASTY META CHARS
;  This option determines whether or not the NRPE daemon will allow clients to 
specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow_nasty_meta_chars=1
;
;# COMMAND ALLOW NASTY META CHARS
;  This option determines whether or not the NRPE daemon will allow clients to 
specify nasty (as in |`&><'"\[]{}) characters in arguments.
;script_dir=c:\my\script\dir

[External Scripts]
;check_es_long=scripts\long.bat
;check_es_ok=scripts\ok.bat
;check_es_nok=scripts\nok.bat
;check_vbs_sample=cscript.exe //T:30 //NoLogo scripts\check_vb.vbs
;check_powershell_warn=cmd /c echo scripts\powershell.ps1 | powershell.exe 
-command -

check_hostname=scripts\check_hostname.bat

[External Alias]
;---CheckDisk
check_filesize=CheckFileSize $ARG1$
check_drivesize=CheckDriveSize $ARG1$
check_file=CheckFile $ARG1$

;---CheckEventLog
check_eventlog=CheckEventLog $ARG1$

;---CheckSystem
check_cpu=CheckCPU $ARG1$
check_uptime=CheckUpTime $ARG1$
check_servicestate=CheckServiceState $ARG1$
check_procstate=CheckProcState $ARG1$
check_mem=CheckMem $ARG1$
check_counter=CheckCounter $ARG1$

;---CheckHelpers
check_multiple=CheckMultiple $ARG1$
check_version=CheckVersion

;---CheckWMI
check_wmi=CheckWMI $ARG1$
check_wmivalue=CheckWMIValue $ARG1$



[EventLog]
;buffer_size=151009

[includes]
;For custom setting of each server
custom.ini

<custom.ini>
; add custom settings here
[External Scripts]


[External Alias]



----------------
Here are some sample servicecheck configuration for windows servers.


Win CPU Usage    check_nrpe -H $HOSTADDRESS$ -c check_cpu -a 'warn=95 crit=100 
time=1 time=5 time=15 ShowAll=long'
          
Win Disk Queue Length    check_nrpe -H $HOSTADDRESS$ -c check_counter -a 
'"Counter=\\PhysicalDisk(_Total)\\Avg. Disk Queue Length" ShowAll'
          
Win Disk Usage   check_nrpe -H $HOSTADDRESS$ -c check_drivesize -a 
'MaxWarnUsed=90% MaxCritUsed=95% CheckAll FilterType=FIXED ShowAll=long'
          
Win Disk Write Bytes/sec    check_nrpe -H $HOSTADDRESS$ -c check_counter -a 
'"Counter=\\PhysicalDisk(_Total)\\Disk Write Bytes/sec" ShowAll'
          
Win Memory Pages/sec   check_nrpe -H $HOSTADDRESS$ -c check_counter -a 
'"\\Memory\\Pages/sec" ShowAll'

Win Memory Usage    check_nrpe -H $HOSTADDRESS$ -c check_mem -a 'MaxWarn=99% 
MaxCrit=100% type=physical ShowAll=long'
          
Win PageFile Usage    check_nrpe -H $HOSTADDRESS$ -c check_mem -a 'MaxWarn=90% 
MaxCrit=95% type=page ShowAll=long'

Win TCP Established    check_nrpe -H $HOSTADDRESS$ -c check_counter -a 
'"\\TCPv4\\Connections Established" MaxWarn=8000 MaxCrit=10000 ShowAll'
          
Win Web Service Current Connections   check_nrpe -H $HOSTADDRESS$ -c 
check_counter -a '"\\Web Service(_Total)\\Current Connections" ShowAll'



Things that you should be cautious of

When you test in unix shell, you should do like this.

check_nrpe -H 10.10.10.10 -c check_counter -a '"\Memory\Pages/sec" ShowAll'


but When you configure servicechecks in opsview WEB UI, you shoud do like this

check_nrpe -H $HOSTADDRESS$ -c check_counter -a '"\\Memory\\Pages/sec" ShowAll'

Watch out blackslash !!!

I hope this will be helpful for you.


On Fri, Oct 29, 2010 at 3:44 AM, Matt White <[email protected]> wrote:
Hi James,
 
This is an extract from my running Opsview config to check disk queues:
 
check_nrpe -H $HOSTADDRESS$ -p 5666 -c checkCounter -u -a "Counter:Average 
Queue Length=\\PhysicalDisk(_Total)\\Avg. Disk Queue Length" ShowAll MaxWarn=1 
MaxCrit=2
 
One of the pre-defined Opsview checks is:
 
check_nrpe -H $HOSTADDRESS$ -c nsc_checkcounter -a '"\\MSExchangeTransport 
Queues(_total)\\Largest Delivery Queue Length" MaxWarn=100 MaxCrit=200 ShowAll'
 
Hope this helps
 
M
 
From: [email protected] 
[mailto:[email protected]] On Behalf Of James Whittington
Sent: 28 October 2010 19:00

To: Opsview Users
Subject: Re: [opsview-users] Having issues checking counter in Win08 server
 
Matt,
 
"James - have you tried putting double slashes in the Opsview service 
definition:"
I'm pretty sure I tested that as well, but at the time I was under a major time 
crunch to get this thing in place.
For the short term I just added it as a custom command in NSC.ini on the 
Windows server.
 
So that line would look like this:
web_curr_conn=inject CheckCounter "Counter:connections=\Web 
Service(_Total)\Current Connections" ShowAll MaxWarn=40 MaxCrit=100
 
With service check looking like this:
 
check_nrpe -H $HOSTADDRESS$ -c nsc_checkcounter -c web_curr_conn -a ShowAll
 
It worked but I like to keep the remote servers Opsview agents as generic as I 
can so folks don't have to know to add custom lines as new servers are 
monitored. 
 
If I get it solved I'll be sure to post the solution.
 
James
 
From: [email protected] 
[mailto:[email protected]] On Behalf Of Matt White
Sent: Thursday, October 28, 2010 3:03 AM
To: Opsview Users
Subject: Re: [opsview-users] Having issues checking counter in Win08 server
 
James - have you tried putting double slashes in the Opsview service definition:
 
"\\Web Service(_Total)\\Current Connections" - I had a similar thing with file 
sizes have to be stored as D:\\MDBDATA\\priv1.edb etc
 
Matt
 
From: [email protected] 
[mailto:[email protected]] On Behalf Of James Whittington
Sent: 26 October 2010 18:26
To: Opsview Users
Subject: [opsview-users] Having issues checking counter in Win08 server
 
I am trying to create a Service check to check web connections on my Windows 
2008 web servers.
I check service state through Opsview Agent/nsclient++ already on the same 
server so I figured checking some counters would be pretty easy.
 
This command works properly as user nagios from the Opsview monitoring node 
doing the polling:
./check_nrpe -H xxx.xxx.xxx.xxx -c nsc_checkcounter -a '"\Web 
Service(_Total)\Current Connections" MaxWarn=100 MaxCrit=300 ShowAll'
 
"OK: \Web Service(_Total)\Current Connections: 1|'\Web Service(_Total)\Current 
Connections'=1;100;300;"
 
The service definition I created in Opsview looks like this:
check_nrpe -H $HOSTADDRESS$ -c nsc_checkcounter -a '"\Web 
Service(_Total)\Current Connections" MaxWarn=100 MaxCrit=300 ShowAll'
 
 
 
This is the error that appears in Opsview:
ERROR: Web Service(_Total)Current Connections: PdhAddCounter failed: 
-1073738816: Unable to parse the counter path. Check the format and syntax of 
the specified path.
 
I figure others out there has come across this previously (maybe something 
needs to be escaped?) so I figured I'd post it to the group.
 
 
James Whittington
VC3, Inc.
 
 

_______________________________________________
Opsview-users mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-users

_______________________________________________
Opsview-users mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-users

Reply via email to