Powershell script->no output returned from the command

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.

Powershell script->no output returned from the command

Postby sannatar16 » Fri Jul 13, 2018 10:05 am

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
sannatar16
 
Posts: 8
Joined: Thu Jun 28, 2018 2:03 am

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

Postby npolovenko » Fri Jul 13, 2018 4:01 pm

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.
User avatar
npolovenko
Support Tech
 
Posts: 2013
Joined: Mon May 15, 2017 5:00 pm

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

Postby sannatar16 » Mon Jul 16, 2018 6:45 am

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 -
sannatar16
 
Posts: 8
Joined: Thu Jun 28, 2018 2:03 am

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

Postby npolovenko » Mon Jul 16, 2018 3:09 pm

@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.
User avatar
npolovenko
Support Tech
 
Posts: 2013
Joined: Mon May 15, 2017 5:00 pm


Return to Nagios Core

Who is online

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