Error Argument exchange-serverhealth
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Error Argument exchange-serverhealth
I'm not sure how long this has been an issue, but looking at https://www.nagios.org/projects/nagios-core/history/4x/, 4.2.2 fixed a specific bug related to September!
Re: Error Argument exchange-serverhealth
I have changed and continues to fail
ejecutado desde servidor windows exchange, todo ok
PS C:\Program Files\NSClient++\scripts> .\check_exchangehealth.ps1 OWA
OK: OWA - 3 checks are OK
but from the nagios server prompts you to enter the argument and the argument is OWA and still says that target the argument
[Nagios @ servernagios libexec] $ ./check_nrpe serverwindows H-exchange-serverhealth reere c -t 50
You must specify to health in September to this script via an argument
ejecutado desde servidor windows exchange, todo ok
PS C:\Program Files\NSClient++\scripts> .\check_exchangehealth.ps1 OWA
OK: OWA - 3 checks are OK
but from the nagios server prompts you to enter the argument and the argument is OWA and still says that target the argument
[Nagios @ servernagios libexec] $ ./check_nrpe serverwindows H-exchange-serverhealth reere c -t 50
You must specify to health in September to this script via an argument
Re: Error Argument exchange-serverhealth
The issue is probably in your definition for how it's defined, please post your nsclient.ini file for us to review.
Former Nagios Employee
Re: Error Argument exchange-serverhealth
Hello,
I wrote this script, and it (did) work. Unfortunately, I haven't used it in a significant period of time - so it might be worthwhile me doing a revision of it (which i'll do in the coming days).
However, it's unlikely the script if it is working when you perform a manual check. The response you're getting seems to indicate that the param isn't making its way through from Nagios, to NSClient, and in to the Script.
As mentioned by @rkennedy, we really would need to have a look at your nsclient.ini file. Now there was a working example of what you need to add to the nsclient.ini file on the script download page, but it's best to be sure.
What you can do as a temporary work around, if you only want to monitor one health set, is manually code the default param in to the PS1 file.
To do this, change the following;
To be
If you want to monitor multiple different healthsets, just copy the ps1 in to different PS1's and set up config for that within NSCLIENT/Nagios appropriately
This is a workaround while we figure out the problem.
I wrote this script, and it (did) work. Unfortunately, I haven't used it in a significant period of time - so it might be worthwhile me doing a revision of it (which i'll do in the coming days).
However, it's unlikely the script if it is working when you perform a manual check. The response you're getting seems to indicate that the param isn't making its way through from Nagios, to NSClient, and in to the Script.
As mentioned by @rkennedy, we really would need to have a look at your nsclient.ini file. Now there was a working example of what you need to add to the nsclient.ini file on the script download page, but it's best to be sure.
What you can do as a temporary work around, if you only want to monitor one health set, is manually code the default param in to the PS1 file.
To do this, change the following;
Code: Select all
Param(
[string]$HealthSet
)
Code: Select all
Param(
[string]$HealthSet="OWA"
)
This is a workaround while we figure out the problem.
Re: Error Argument exchange-serverhealth
Thank you @cammj! Helps a lot when the original author joins in the conversation. 
@nagiosjam - I'll watch for your nsclient.ini / nsc.ini and we'll work through it.
@nagiosjam - I'll watch for your nsclient.ini / nsc.ini and we'll work through it.
Former Nagios Employee
Re: Error Argument exchange-serverhealth
This is my nsclient.ini
And this is the definition of service
define service{
use windowsmbx-service,srv-pnp
host_name servermbx
servicegroups windowsmbx-service
service_description COMPONENTNAME HealthSet OWA
check_command check_nrpe!exchange_serverhealth!OWA
}
I attached the image file with Nagios frontend. Does not display the error screen
If I run the plugin from the Nagios console, I get this error
[Nagios @ servernagios libexec] $ ./check_nrpe servermbx -c -H exchange_serverhealth servermbx OWA -t60
SCRIPT EXCEPTION The term 'get-serverhealth' is not recognized as the name of a cmdlet, function, script file or executable program. Check if you misspell the name or, if you include a path, verify that the path is correct and try again.
And from the windows server if I run from powershell plugin, if I work
PS C: \ Program Files \ NSClient ++ \ scripts> \ exchange-serverhealth.ps1 OWA.
OK: OWA - 18 checks are OK
I tried what it says cammy
health monitor multiple different sets, just copy the ps1 in to different PS1
and it's the same
Thank you very much
Code: Select all
# If you want to fill this file with all avalible options run the following command:
# nscp settings --generate --add-defaults --load-all
# If you want to activate a module and bring in all its options use:
# nscp settings --activate-module <MODULE NAME> --add-defaults
# For details run: nscp settings --help
; Undocumented section
[/modules]
; Undocumented key
NSClientServer = 1
; Undocumented key
CheckDisk = 1
; Undocumented key
CheckEventLog = 1
; Undocumented key
CheckExternalScripts = 1
; Undocumented key
CheckHelpers = 1
; Undocumented key
CheckNSCP = 1
; Undocumented key
CheckSystem = 1
; Undocumented key
CheckWMI = 1
; Undocumented key
NRPEServer = 1
; Section for NSClient (NSClientServer.dll) (check_nt) protocol options.
[/settings/NSClient/server]
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = 0
; PERFORMANCE DATA - Send performance data back to Nagios (set this to 0 to remove all performance data).
performance data = 1
; PORT NUMBER - Port to use for check_nt.
port = 12489
[/settings/NRPE/server]
allow arguments = 1
; Section for NSClient (NSClientServer.dll) (check_nt) protocol options.
[/settings/NSClient/server]
; Undocumented section
[/settings/default]
; Undocumented key
allowed hosts = 172.17.10.10
; Undocumented key
password = xxxxxx
[/settings/external scripts]
allow arguments = true
allow nasty characters = true
timeout = 90
[/settings/external scripts/wrappings]
bat = scripts\\%SCRIPT% %ARGS%
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
vbs = cscript.exe //T:90 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
exe = cmd /c %SCRIPT% %ARGS%
[/settings/external scripts/wrapped scripts]
test_bat = check_ok.bat
test_ps = check_test.ps1
test_vbs = check_test.vbs
test_ping = check_ping.bat
test_files = check_files.vbs
test_battery = check_battery.vbs
test_printers = check_printer.vbs
alias_process = checkProcState "$ARG1$=started"
check_test = check_test.ps1
exchange_serverhealth= exchange-serverhealth.ps1 -HealthSet $ARG1$
define service{
use windowsmbx-service,srv-pnp
host_name servermbx
servicegroups windowsmbx-service
service_description COMPONENTNAME HealthSet OWA
check_command check_nrpe!exchange_serverhealth!OWA
}
I attached the image file with Nagios frontend. Does not display the error screen
If I run the plugin from the Nagios console, I get this error
[Nagios @ servernagios libexec] $ ./check_nrpe servermbx -c -H exchange_serverhealth servermbx OWA -t60
SCRIPT EXCEPTION The term 'get-serverhealth' is not recognized as the name of a cmdlet, function, script file or executable program. Check if you misspell the name or, if you include a path, verify that the path is correct and try again.
And from the windows server if I run from powershell plugin, if I work
PS C: \ Program Files \ NSClient ++ \ scripts> \ exchange-serverhealth.ps1 OWA.
OK: OWA - 18 checks are OK
I tried what it says cammy
health monitor multiple different sets, just copy the ps1 in to different PS1
and it's the same
Thank you very much
Re: Error Argument exchange-serverhealth
There is no way that is the command you executed because NRPE will not accept those invalid arguments.[Nagios @ servernagios libexec] $ ./check_nrpe servermbx -c -H exchange_serverhealth servermbx OWA -t60
SCRIPT EXCEPTION The term 'get-serverhealth' is not recognized as the name of a cmdlet, function, script file or executable program. Check if you misspell the name or, if you include a path, verify that the path is correct and try again.
Code: Select all
[root@localhost libexec]# ./check_nrpe servermbx -c -H exchange_serverhealth servermbx OWA -t60
Incorrect command line arguments supplied
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
As for your configuration files, there are a few things that need to be changed.
Code: Select all
exchange_serverhealth= exchange-serverhealth.ps1 -HealthSet $ARG1$
PS C: \ Program Files \ NSClient ++ \ scripts> \ exchange-serverhealth.ps1 OWA.
Code: Select all
exchange_serverhealth=cmd /c echo scripts\\exchange-serverhealth.ps1 $ARG1$; exit($lastexitcode) | powershell.exe -command -
Former Nagios Employee
Re: Error Argument exchange-serverhealth
I changed my settings file nsclient.ini
Run the command from the console nagios
[Nagios @ servernagios libexec] $ ./check_nrpe -t60 -c -H serverexchange exchange_serverhealth
SCRIPT EXCEPTION The term 'get-serverhealth' is not recognized as the name of a cmdlet, function, script file or executable program. Check if you misspell the name or, if you include a path, verify that the path is correct and try again.
and continues to give me the same error
Code: Select all
[/settings/external scripts/scripts]
exchange_serverhealth=cmd /c echo scripts\\exchange-serverhealth.ps1 $ARG1$; exit($lastexitcode) | powershell.exe -command -[Nagios @ servernagios libexec] $ ./check_nrpe -t60 -c -H serverexchange exchange_serverhealth
SCRIPT EXCEPTION The term 'get-serverhealth' is not recognized as the name of a cmdlet, function, script file or executable program. Check if you misspell the name or, if you include a path, verify that the path is correct and try again.
and continues to give me the same error
Re: Error Argument exchange-serverhealth
I have other plugins in the same server as if they work well
nsclient.ini
[/ Settings / external scripts / scripts]
check_ex2013dag = cmd / c I miss scripts \ CheckEX2013DAG.ps1; exit ($ lastexitcode) | powershell.exe -command -
run from the console and all ok nagios
[Nagios @ servernagios libexec] $ ./check_nrpe -t60 -c -H serverexchange check_ex2013dag
DB-1: Mounted - DB-2: Mounted - DB-3: Mounted - DB-4: Mounted - DB-TEST: Mounted
nsclient.ini
[/ Settings / external scripts / scripts]
check_ex2013dag = cmd / c I miss scripts \ CheckEX2013DAG.ps1; exit ($ lastexitcode) | powershell.exe -command -
run from the console and all ok nagios
[Nagios @ servernagios libexec] $ ./check_nrpe -t60 -c -H serverexchange check_ex2013dag
DB-1: Mounted - DB-2: Mounted - DB-3: Mounted - DB-4: Mounted - DB-TEST: Mounted
Re: Error Argument exchange-serverhealth
There are multiple issues going on at once here. Let's focus on one at a time, and get the command working over the CLI first.
Please show us the ACTUAL commands you are running over the command line to achieve working results. The ones you have posted are not valid.
Please show us the ACTUAL commands you are running over the command line to achieve working results. The ones you have posted are not valid.
Code: Select all
[Nagios @ servernagios libexec] $ ./check_nrpe -t60 -c -H serverexchange exchange_serverhealth
Code: Select all
[Nagios @ servernagios libexec] $ ./check_nrpe -t60 -c -H serverexchange check_ex2013dag
Former Nagios Employee