Plugin check not working

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Plugin check not working

Postby kwhogster » Tue May 29, 2018 7:14 pm

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
kwhogster
 
Posts: 484
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA

Re: Plugin check not working

Postby kwhogster » Tue May 29, 2018 9:00 pm

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?
kwhogster
 
Posts: 484
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA

Re: Plugin check not working

Postby scottwilkerson » Wed May 30, 2018 1:23 pm

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" ?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12053
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Plugin check not working

Postby kwhogster » Wed May 30, 2018 1:44 pm

Scott

Yes my IIS is setup with just Default Web Site

See attached
Capture.PNG
Perfmon


Capture2.PNG
IIS



HTH

Tom
kwhogster
 
Posts: 484
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA

Re: Plugin check not working

Postby scottwilkerson » Wed May 30, 2018 2:00 pm

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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12053
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Plugin check not working

Postby kwhogster » Wed May 30, 2018 2:15 pm

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
kwhogster
 
Posts: 484
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA

Re: Plugin check not working

Postby scottwilkerson » Wed May 30, 2018 2:32 pm

lets see the definition for check_nrpe on your system...

that has to be the issue if you can run it from the CLI
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12053
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Plugin check not working

Postby kwhogster » Wed May 30, 2018 2:36 pm

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
kwhogster
 
Posts: 484
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA

Re: Plugin check not working

Postby scottwilkerson » Wed May 30, 2018 2:40 pm

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'"

As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12053
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Plugin check not working

Postby kwhogster » Wed May 30, 2018 2:55 pm

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
kwhogster
 
Posts: 484
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA

Next

Return to Nagios Core

Who is online

Users browsing this forum: Google [Bot] and 12 guests