Page 1 of 5

Plugin check not working

Posted: Tue May 29, 2018 7:14 pm
by kwhogster
Nagios 4.3.4 Core
I found this check and have it working on 4 other servers only difference is this server is running nsclient 5.144 other 4.4.23

The error is
Default Web Site Connections Notifications for this service have been disabled
CRITICAL 05-29-2018 20:03:16 0d 0h 9m 6s 10/10 (No output on stdout) stderr: /bin/sh: 1: Syntax error: EOF in backquote substitution

Code: Select all

define service{
        use                     generic-service
        host_name               SERV014-N1
        service_description     Default Web Site Connections
        check_interval          60
        notification_interval   60
        check_command           check_nrpe!Check_iis_conn!` -a 'SERV014-N1' 'Default Web Site' '25' '50'
        servicegroups           WEBServices
        }
From the nsclient.ini
; Check IIS Connections
check_iis_conn = cmd /c echo scripts\\powershell\\check_iis_connections.ps1 "$ARG1$" "$ARG2$" "$ARG3$" "$ARG4$"; exit($lastexitcode) | powershell.exe -command -

from the powershell console on serv014
PS C:\program files\nsclient++\scripts\powershell> .\check_iis_connections.ps1

cmdlet check_iis_connections.ps1 at command pipeline position 1
Supply values for the following parameters:
server: serv014-n1
website: default web site
warning_value: 5
critical_value: 7
CONNECTIONS OK default web site connections 0 | connections=0;5;7;


The powershell script runs fine from the server but not from the config on Nagios.

This is on a Windows 2012 R2 Cluster 2 Node Server running SQL Server
NODE 1 is nsclient 5.144
NODE 2 is nsclient 4.4.23

Thanks

Tom

Re: Plugin check not working

Posted: Tue May 29, 2018 9:00 pm
by kwhogster
update

Found a quote on the line in the cfg file removed the quote

Now get this warning


UNKNOWN
(for 0d 0h 0m 19s)
Status Information: Get-Counter : Unable to access the desired computer or service. Check the
permissions and authentication of the log service or the interactive user
session against those on the computer or service being monitored.
At C:\Program Files\NSClient++\scripts\powershell\check_iis_connections.ps1:40
char:12
+ $counter = Get-Counter "\\$server\Web Service($website)\Current Conne ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.Ge
tCounterCommand

CONNECTIONS UNKNOWN Default Web Site not found

any ideas?

Re: Plugin check not working

Posted: Wed May 30, 2018 1:23 pm
by scottwilkerson
so you are sending "Default Web Site" as the name of one of the servers, is that what it is called?

If on the windows server you open perfmon add a counter and go to Web Service
What's in the list for choices? Is one of them "Default Web Site" ?

Re: Plugin check not working

Posted: Wed May 30, 2018 1:44 pm
by kwhogster
Scott

Yes my IIS is setup with just Default Web Site

See attached
Perfmon
Perfmon
IIS
IIS

HTH

Tom

Re: Plugin check not working

Posted: Wed May 30, 2018 2:00 pm
by scottwilkerson
I think your command should be something like this

Code: Select all

check_command           check_nrpe!Check_iis_conn! -a "'SERV014-N1' 'Default Web Site' '25' '50'"
Although I don't know what SERV014-N1 is

It depends on your plugin

Can you run the plugin from a powershell CLI?

Can you run it from the command line in nagios with check_nrpe?

Re: Plugin check not working

Posted: Wed May 30, 2018 2:15 pm
by kwhogster
SERV014-N1 is the Host that this is running on.

In my first post I show the results from running it it powershell that works.

from the console

root@:/usr/local/nagios/libexec# ./check_nrpe -H xx.xx.xx.xx -c check_iis_conn -a 'SERV014-N1' 'Default Web Site' '25' '50'
CONNECTIONS OK Default Web Site connections 0 |'connections'=0;25;50
root@tgcs017:/usr/local/nagios/libexec#

that works too not from the config very strange.

Any ideas?

thank you,
Tom

Re: Plugin check not working

Posted: Wed May 30, 2018 2:32 pm
by scottwilkerson
lets see the definition for check_nrpe on your system...

that has to be the issue if you can run it from the CLI

Re: Plugin check not working

Posted: Wed May 30, 2018 2:36 pm
by kwhogster
this is my check_nrpe command definition
define command{
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 120 -c $ARG1$ $ARG2$ $ARG3$ $ARG4$
}
this the same for all my hosts and services

Re: Plugin check not working

Posted: Wed May 30, 2018 2:40 pm
by scottwilkerson
That looks normal....

This is the only thing I can think, did you try this?
scottwilkerson wrote:I think your command should be something like this

Code: Select all

check_command           check_nrpe!Check_iis_conn! -a "'SERV014-N1' 'Default Web Site' '25' '50'"

Re: Plugin check not working

Posted: Wed May 30, 2018 2:55 pm
by kwhogster
Well that made it go Green and Ok but the results are strnage


Default Web Site Connections

Notifications for this service have been disabled

OK 05-30-2018 15:50:31 0d 0h 0m 38s 1/10 C:Program FilesNSClient++scriptspowershellcheck_iis_connections.ps1 :

this is from another another server that is working

Default Web Site Connections
OK 05-30-2018 15:43:59 3d 3h 33m 50s 1/10 CONNECTIONS OK Default Web Site connections 0

I think we are getting closer now
Thanks