check_nt -s: what is the password for?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

check_nt -s: what is the password for?

Post 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!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post 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.
Former Nagios employee
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

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

Post 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?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

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

Post 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?
Former Nagios Employee
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

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

Post 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$
}
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

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

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

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

Post 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>
You do not have the required permissions to view the files attached to this post.
Last edited by tmcdonald on Mon Jul 11, 2016 1:49 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

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

Post 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
}
You do not have the required permissions to view the files attached to this post.
Locked