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.

Re: Plugin check not working

Postby scottwilkerson » Mon Jun 04, 2018 2:17 pm

kwhogster wrote:The command works from the nagios server via command line


Can you re-share the current configuration for the service (copy/paste)?

We need to verify it is running exactly what you are running from the CLI

Also your command definition for check_nrpe

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

Re: Plugin check not working

Postby kwhogster » Mon Jun 04, 2018 7:42 pm

My Service

define service{
use generic-service
host_name TGCS014-N1
service_description Default Web Site Connections
check_interval 60
notification_interval 60
check_command check_nrpe!Check_iis_conn! -a 'TGCS014-N1' 'Default Web Site' '5' '9'
servicegroups WEBServices
}

My NRPE Command

define command{
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 120 -c $ARG1$ $ARG2$ $ARG3$ $ARG4$
}

From the CLI
root@tgcs017:/usr/local/nagios/etc/objects# /usr/local/nagios/libexec/./check_nrpe -H xx.x.x.x -t 60 -c check_iis_conn -a 'TGCS014-N1' 'Default Web Site' '5' '10'
CONNECTIONS OK Default Web Site connections 0 |'connections'=0;5;10


From Powershell on the server
PS C:\program files\nsclient++\scripts\powershell> .\check_iis_connections.ps1 tgcs014-n1 'default web site' 5 9
CONNECTIONS OK default web site connections 0 | connections=0;5;9;
PS C:\program files\nsclient++\scripts\powershell>

HTH
Thanks

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

Re: Plugin check not working

Postby scottwilkerson » Tue Jun 05, 2018 8:53 am

These do not match
Code: Select all
check_command check_nrpe!Check_iis_conn! -a 'TGCS014-N1' 'Default Web Site' '5' '9'


Code: Select all
/usr/local/nagios/libexec/./check_nrpe -H xx.x.x.x -t 60 -c check_iis_conn -a 'TGCS014-N1' 'Default Web Site' '5' '10'


If the config you have Check_iis_conn
run from the command line check_iis_conn

Note the capital C in the config
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
CTO
 
Posts: 9639
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Plugin check not working

Postby kwhogster » Tue Jun 05, 2018 2:06 pm

Command line with upper case C works

root@tgcs017:/usr/local/nagios/etc/objects/windowsservers# /usr/local/nagios/libexec/./check_nrpe -H 10.2.8.28 -t 60 -c Check_iis_conn -a 'TGCS014-N1' 'Default Web Site' '5' '10'
CONNECTIONS OK Default Web Site connections 0 |'connections'=0;5;10


Also changed it to lower case in the cfg file still same error
kwhogster
 
Posts: 474
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA

Re: Plugin check not working

Postby npolovenko » Tue Jun 05, 2018 3:43 pm

@kwhogster, Let's try the following. On the remote server please change the command to look like this:
Code: Select all
check_iis_conn = cmd /c echo scripts\\powershell\\check_iis_connections.ps1 -a "$ARG1$" "$ARG2$" "$ARG3$" "$ARG4$";

And restart the nrpe/nsclient service.

On the Nagios server change your command to this:
Code: Select all
check_command check_nrpe!Check_iis_conn!TGCS014-N1!Default Web Site!5!10


And restart nagios with:
Code: Select all
service nagios restart


Let me know if this works for you.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 1779
Joined: Mon May 15, 2017 5:00 pm

Re: Plugin check not working

Postby kwhogster » Tue Jun 05, 2018 7:12 pm

Well that made the service go green

but here is the output


Default Web Site Connections

Notifications for this service have been disabled

OK 06-05-2018 20:06:22 0d 0h 4m 21s 1/10 C:Program FilesNSClient++scriptspowershellcheck_iis_connections.ps1 :

Why does it format the command with out the slashes? is this the problem?

c:\Program Files\NSCLient++\scripts\powershell is the path

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

Re: Plugin check not working

Postby npolovenko » Wed Jun 06, 2018 2:21 pm

@kwhogster , Can you remove -a from this command:
Code: Select all
check_iis_conn = cmd /c echo scripts\\powershell\\check_iis_connections.ps1 -a "$ARG1$" "$ARG2$" "$ARG3$" "$ARG4$";

Restart the nsclient and try one more time?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 1779
Joined: Mon May 15, 2017 5:00 pm

Re: Plugin check not working

Postby kwhogster » Wed Jun 06, 2018 3:49 pm

made the change restarted the nscp service same results here is the details


OK
(for 0d 20h 41m 19s)
Status Information: C:Program FilesNSClient++scriptspowershellcheck_iis_connections.ps1 :
Cannot process argument transformation on parameter 'warning_value'. Cannot
convert value "$" to type "System.Int32". Error: "Input string was not in a
correct format."
At line:1 char:66
+ ... ershell\\check_iis_connections.ps1 "$ARG1$" "$ARG2$" "$ARG3$" "$ARG4$ ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [check_iis_connections.ps1], Pa
rameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,check_iis_c
onnections.ps1
Performance Data:
Current Attempt: 1/10 (HARD state)
Last Check Time: 06-06-2018 16:46:11
Check Type: ACTIVE
Check Latency / Duration: 0.000 / 0.707 seconds
Next Scheduled Check: 06-06-2018 17:46:11
Last State Change: 06-05-2018 20:06:22
Last Notification: N/A (notification 0)
Is This Service Flapping?
NO
(0.00% state change)
In Scheduled Downtime?
NO

Last Update: 06-06-2018 16:47:40 ( 0d 0h 0m 1s ago)




Active Checks:
ENABLED

Passive Checks:
ENABLED

Obsessing:
DISABLED

Notifications:
DISABLED

Event Handler:
ENABLED

Flap Detection:
ENABLED





Service Commands


Disable Active Checks Of This Service Disable active checks of this service
Re-schedule Next Service Check Re-schedule the next check of this service
Submit Passive Check Result For This Service Submit passive check result for this service
Stop Accepting Passive Checks For This Service Stop accepting passive checks for this service
Start Obsessing Over This Service Start obsessing over this service
Enable Notifications For This Service Enable notifications for this service
Send Custom Notification Send custom service notification
Schedule Downtime For This Service Schedule downtime for this service
Disable Event Handler For This Service Disable event handler for this service
Disable Flap Detection For This Service Disable flap detection for this service
Clear Flapping State For This Service Clear flapping state for this service



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

Re: Plugin check not working

Postby npolovenko » Thu Jun 07, 2018 3:55 pm

@kwhogster, I guess the goal is to find out how the plugin wants us to pass the parameters. Whether they should be separated by spaces, whether some flags should be before arguments and so on.
Can you run the plugin locally on the windows server using a PowerShell console with all the arguments and let us know if it works locally? If it does please copy the command and output. That way I will know how to adjust the nrpe command.
Can you also upload the plugin here? That way I can test it out.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 1779
Joined: Mon May 15, 2017 5:00 pm

Re: Plugin check not working

Postby kwhogster » Thu Jun 07, 2018 4:51 pm

From the server using powershell as administrator
PS C:\program files\nsclient++\scripts\powershell> .\check_iis_connections.ps1 tgcs014-n1 'default web site' 5 9
CONNECTIONS OK default web site connections 0 | connections=0;5;9;
PS C:\program files\nsclient++\scripts\powershell>

Guess what I think might be it I then tried to run in power shell as the local user


PS C:\Users\sqladmin> cd "/program files/nsclient++/scripts/powershell"
PS C:\program files\nsclient++\scripts\powershell> .\check_iis_connections.ps1 tgcs014-n1 'default web site' 5 9
Get-Counter : The \\tgcs014-n1\Web Service(default web site)\Current Connections performance counter path is not
valid.
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 : CounterPathIsInvalid,Microsoft.PowerShell.Commands.GetCounterCommand

CONNECTIONS UNKNOWN default web site not found
PS C:\program files\nsclient++\scripts\powershell>

Bare i mind of have four other powershell scripts that work in nagios on this same server

Wonder why this command does not work

Added the powershell plugin script as a txt file
Attachments
check_iis_connections.txt
plug script
(1.62 KiB) Downloaded 10 times
kwhogster
 
Posts: 474
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA

PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 34 guests