Powershell script->no output returned from the command

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sannatar16
Posts: 8
Joined: Thu Jun 28, 2018 2:03 am

Powershell script->no output returned from the command

Post by sannatar16 »

Hello team,

I have created a simple powershell script to test mirroring status, it works as expected from the powershell prompt. I have created a service in nagios for that and it always shows OK, with the output "no output available from command(check_mirroring_status)"

My code returns db name along with status and exit code when i run in the server. Please help

I have installed nsclient 0.5.62 version



Regards,
sannatar
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Powershell script->no output returned from the command

Post by npolovenko »

Hello, @sannatar16. Are you using the NSClient to run this PowerShell script? Can you show me the command definition on the Nagios server as well as in the NSclient.ini file.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sannatar16
Posts: 8
Joined: Thu Jun 28, 2018 2:03 am

Re: Powershell script->no output returned from the command

Post by sannatar16 »

Hi Please find the details. I have only one db mirrored so I have hard-coded that in the script itself. So i have no arguments to be passed
Service definition:
define service {
host_name xxxxxxxxx
service_description mirroring_status
check_command check_mssql_mirroring_status
initial_state u
max_check_attempts 1
check_interval 1
retry_interval 1
check_period 24x7
notification_period 24x7
notification_options w,c,r,
register 1
}

Command definition:

define command {
command_name check_mssql_mirroring_status
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c check_mirroring_status

}

NSclient.ini entry in external scripts:
check_mirroring_status = cmd /c echo scripts\\mirroring.ps1;exit($lastexitcode) | powershell.exe -command -
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Powershell script->no output returned from the command

Post by npolovenko »

@sannatar16. Thank you. Could you upload the script and the nsclinet.ini file here as well?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked