Page 1 of 2
Illegal arguments detected
Posted: Mon Sep 14, 2015 11:02 am
by JohnFLi
I am trying to do a check that will return the amount of open tcp connections.
I found a plug-in that looks like it would work
http://outsideit.net/check-ms-netstat/
per the directions, I setup the powershell line in the ini file just like this:
Code: Select all
check_ms_netstat=cmd /c echo scripts/powershell/check_ms_netstat.ps1 $ARG1$; exit $LastExitCode | powershell.exe -command -
The .ps1 file is where it is suppose to be and is found.
from the command line on the nagios server I tried the following:
Code: Select all
[root@G1VPNAG03 libexec]# ./check_nrpe -H g1vpdocave01 -t 120 -c check_ms_netstat
UNKNOWN: Illegal arguments detected: $
[root@G1VPNAG03 libexec]# ./check_nrpe -H g1vpdocave01 -t 120 -c check_ms_netstat -a '-wl 2 -wh 10 -ch15'
Arguments not allowed
[root@G1VPNAG03 libexec]#
Any ideas??
Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 11:07 am
by tmcdonald
What version of NSClient++ are you using?
Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 11:12 am
by JohnFLi
version is 0.4.1.105
oh, and I do have this set:
Code: Select all
[/settings/NRPE/server]
; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = true
; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = true
Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 12:05 pm
by WillemDH
Hello,
-ch15 is the wrong argument in one of the examples. (needs a space) The other example has no arguments. Due to the fact that when specifying $ARG1$ in the NSClient++ command, you need to specify at least one argument. I suggest you try to add -H localhost; I have a solution for this problems since recently, but I need to update the code on all my plugins, which can take some time... (as I'm working on 26 GitHub projects atm)
So try
Code: Select all
./check_nrpe -H g1vpdocave01 -t 120 -c check_ms_netstat -a '-H localhost'
Let me know if this works for you.
Grtz
Willem
Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 12:07 pm
by JohnFLi
Code: Select all
[root@G1VPNAG03 libexec]# ./check_nrpe -H g1vpdocave01 -t 120 -c check_ms_netstat -a '-H localhost'
Arguments not allowed
Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 12:14 pm
by WillemDH
Ah weird.
Arguments not allowed
That is not an error I defined in my script. So it should be something in NSCLient config.
Do you have:
Code: Select all
[/settings/NRPE/server]
allow arguments=true
[/settings/external scripts]
allow arguments=true
Restart nscp service if you make any changes to nsclient.ini.
?
Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 12:21 pm
by JohnFLi
yup, i restarted the service before i tested.
Code: Select all
[/settings/NRPE/server]
; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = true
; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = true
.....
[/settings/external scripts/scripts]
windows_updates=cmd /c echo C:\scripts\check_win_updates.ps1; exit $LastExitCode | powershell.exe -command -
check_top20memory=cmd /c echo C:\scripts\top20memoryprocess.ps1; exit $LastExitCode | powershell.exe -command -
check_ms_netstat=cmd /c echo scripts/powershell/check_ms_netstat.ps1 $ARG$; exit $LastExitCode | powershell.exe -command -
Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 12:26 pm
by tgriep
It looks like you are missing the 1 in the $ARG1$ variable. Can you edit your nsclient.ini file and change this from
Code: Select all
check_ms_netstat=cmd /c echo scripts/powershell/check_ms_netstat.ps1 $ARG$; exit $LastExitCode | powershell.exe -command -
to
Code: Select all
check_ms_netstat=cmd /c echo scripts/powershell/check_ms_netstat.ps1 $ARG1$; exit $LastExitCode | powershell.exe -command -
Save it out and restart the nsclient++ service and see if that resolves it.
If not, can you post the full nsclient.ini file?
Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 12:31 pm
by JohnFLi
good catch!!
[/settings/external scripts/scripts]
windows_updates=cmd /c echo C:\scripts\check_win_updates.ps1; exit $LastExitCode | powershell.exe -command -
check_top20memory=cmd /c echo C:\scripts\top20memoryprocess.ps1; exit $LastExitCode | powershell.exe -command -
check_netstat=cmd /c echo C:\scripts\check_ms_netstat.ps1; exit $LastExitCode | powershell.exe -command -
check_ms_netstat=cmd /c echo scripts/powershell/check_ms_netstat.ps1 $ARG$; exit $LastExitCode | powershell.exe -command -
saved, restarted teh client.....same result

Re: Illegal arguments detected
Posted: Mon Sep 14, 2015 12:52 pm
by tgriep
Any chance that you can upload your full nsclient.ini file so we can review it?