Check_iis_conn "Unknown"


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

Default Web Site Connections

Notifications for this service have been disabled

UNKNOWN 06-01-2018 12:36:11 1d 17h 59m 3s 10/10 Get-Counter : Unable to access the desired computer or service. Check the

(for 1d 17h 59m 36s) 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: (:slight_smile: [Get-Counter], Exception
  • FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.Ge tCounterCommand

CONNECTIONS UNKNOWN Default Web Site not found Performance Data:
Current Attempt: 10/10 (HARD state) Last Check Time: 06-01-2018 12:36:11 Check Type: ACTIVE Check Latency / Duration: 0.000 / 1.881 seconds Next Scheduled Check: 06-01-2018 13:36:11 Last State Change: 05-30-2018 19:27:11 Last Notification: N/A (notification 0) Is This Service Flapping? NO
(0.00% state change) In Scheduled Downtime? NO

Last Update: 06-01-2018 13:26:40 ( 0d 0h 0m 7s ago)

Active Checks: ENABLED

Passive Checks: ENABLED

Obsessing: ENABLED

Notifications: DISABLED

Event Handler: ENABLED

Flap Detection: ENABLED

My config file

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.

From my command line on the nagios server root:/usr/local/nagios/etc/objects/windowsservers# /usr/local/nagios/libexec/./check_nrpe -H xx.x.x.xx -t 60 -c check_iis_conn -a ‘SERV014-N1’ ‘Default Web Site’ ‘25’ '50’ CONNECTIONS OK Default Web Site connections 0 |‘connections’=0;25;50

this also works .

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

NOTE: I have since uninstalled nsclient 5.1 from the server restarted and then installed NSCLIENT 4.4.23 copied the nsclient.ini from a working server with same exact check and still have the issue.