Page 1 of 2

check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 11:00 am
by gormank
Sorry, this is probably up there on my dumb question scale, but what is the password in the -s argument for? There's no user supplied so it doesn't know the service user name.

/usr/local/nagios/libexec/check_nt -H sqlhost-s "" -p 12489 -v COUNTER -l "\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio","Buffer cache hit ratio"
NSClient - ERROR: Invalid password.

This service was defined using the wizard, and is my first time using check_nt... It may not work even with the -s value yet.

Thanks!

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 11:05 am
by tmcdonald
Think of it more as a token than a password, the difference being that a token does not always necessarily mean there is an associated user. It's just something that NSClient requires for authorization purposes (but not authentication, which would be a user:password combination). You will define the password during setup of NSClient on the remote machine.

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 11:42 am
by gormank
Ok, fixing that gets me to the error below.

OUTPUT: NSClient - ERROR: Invalid return from command: check_pdh

As suspected there's a problem w/ my perfdata agrs... Any suggestions there?

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 11:49 am
by rkennedy
I believe the issue is with the colon, is that the actual counter name or are you attempting to rename the counter?

Try escaping the : with \: or \\: - does that help at all?

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 12:00 pm
by gormank
Same result on both.

# /usr/local/nagios/libexec/check_nt -H sqlhost -s "nsclientpasswd" -p 12489 -v COUNTER -l "\\txslm2mwsql001\\Buffer Manager\\Buffer cache hit ratio","Buffer cache hit ratio"
NSClient - ERROR: Invalid return from command: check_pdh

# /usr/local/nagios/libexec/check_nt -H sqlhost -s "nsclientpasswd" -p 12489 -v COUNTER -l "\\SQLServer\:Buffer Manager\\Buffer cache hit ratio","Buffer cache hit ratio"
NSClient - ERROR: Invalid return from command: check_pdh

I used values I found in some post on the internet combined with the wizard since something was missing from the example. The example:

http://serverfault.com/questions/301703 ... erver-2008

define service {
service_description SQL Buffer Cache Hit Ratio
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!BufferCacheHitRatio!\\SQLServer:Buffer Manager\\Buffer cache hit ratio!100!200
}

Looks like I need to define check_nrpe_counter and try using NRPE...

define command {
command_name check_nrpe_counter
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckCounter -a "Counter:$ARG1$=$ARG2$" ShowAll MaxWarn=$ARG3$ MaxCrit=$ARG4$
}

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 12:35 pm
by gormank
I defined the command to use NRPE and get the following:

COMMAND: /usr/local/nagios/libexec/check_nrpe -H txslm2mwsql001 -c CheckCounter -a "Counter:BufferCacheHitRatio=\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio" ShowAll MaxWarn=100 MaxCrit=200
OUTPUT: Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.

It could be that perfmon needs to counter defined on the SQL server before it can be used... I've never used perfmon.

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 12:41 pm
by lmiltchev
Open the "Performance Monitor", click on "Add", select your performance counter, and add it. Right-click on it, go to "Properties", and show us a screenshot of the "Performance Monitor Properties" window.

Restart the NSClient++ service, run your check one more time, and show us the output.

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 1:42 pm
by gormank
No real change. By now I have 3 variants of the service, plus reying to escape the colon, or replace it w/ a backslash, so things get ugly below.

Code: Select all

# /usr/local/nagios/libexec/check_nrpe -H wsql001 -c CheckCounter -a "Counter:BufferCacheHitRatio=\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio" ShowAll MaxWarn=100 MaxCrit=200
Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.

# /usr/local/nagios/libexec/check_nrpe -H wsql001 -c CheckCounter -a "Counter:BufferCacheHitRatio=\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio" ShowAll MaxWarn=100 MaxCrit=200
Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.

# /usr/local/nagios/libexec/check_nrpe -H wsql001 -c CheckCounter -a "Counter:BufferCacheHitRatio=\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio" ShowAll MaxWarn=100 MaxCrit=200
Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.

# /usr/local/nagios/libexec/check_nrpe -H txslm2mwsql001 -c CheckCounter -a "Counter:BufferCacheHitRatio=\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio" ShowAll MaxWarn=100 MaxCrit=200
Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.

# /usr/local/nagios/libexec/check_nt -H wsql001 -s "frAQBc8Wsa1xVPfv" -p 12489 -v COUNTER -l "\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio","Buffer cache hit ratio"
NSClient - ERROR: Invalid return from command: check_pdh

# /usr/local/nagios/libexec/check_nrpe -H wsql001 -u -t 45 -c BufferCacheHitRatio \\SQLServer:Buffer Manager\\Buffer cache hit ratio
Unknown command(s): buffercachehitratio

# /usr/local/nagios/libexec/check_nrpe -H wsql001 -c CheckCounter -a "Counter:BufferCacheHitRatio=\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio" ShowAll MaxWarn=100 MaxCrit=200
Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.

# /usr/local/nagios/libexec/check_nrpe -H wsql001 -c CheckCounter -a "Counter\:BufferCacheHitRatio=\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio" ShowAll MaxWarn=100 MaxCrit=200
No counters specified: add counter=<name of counter>

# /usr/local/nagios/libexec/check_nrpe -H wsql001 -c CheckCounter -a "Counter\\BufferCacheHitRatio=\\\\SQLServer:Buffer Manager\\\\Buffer cache hit ratio" ShowAll MaxWarn=100 MaxCrit=200
No counters specified: add counter=<name of counter>

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 1:57 pm
by lmiltchev
Right-click on the "Database Cache % Hit" counter, go to "Properties", and show us a screenshot of the "Performance Monitor Properties" window?

Example with a different performance counter:
example01.PNG

Re: check_nt -s: what is the password for?

Posted: Mon Jul 11, 2016 2:14 pm
by gormank
Looks like the name has changed, but still no luck. I'm ising the password value from nsclient.ini for the arg to -s...

# /usr/local/nagios/libexec/check_nt -H txslm2mwsql001 -s "frAQBc8Wsa1xVPfv" -p 12489 -v COUNTER -l "\\\\Database\(svchost\)\\Database Cache % Hit"
NSClient - ERROR: Invalid return from command: check_pdh


define service {
service_description Buffer_cache_hit_ratio
use xiwizard_windowsserver_nsclient_service
hostgroup_name MS_SQL_Servers
check_command check_xi_service_nsclient!frAQBc8Wsa1xVPfv!COUNTER!-l "\\Database(svchost)\Database Cache % Hit"!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
_xiwizard windowsserver
register 1
}