Illegal arguments detected

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Illegal arguments detected

Post 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??
Everybody is somebody else’s weirdo
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Illegal arguments detected

Post by tmcdonald »

What version of NSClient++ are you using?
Former Nagios employee
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: Illegal arguments detected

Post 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
Everybody is somebody else’s weirdo
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Illegal arguments detected

Post 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
Last edited by WillemDH on Mon Sep 14, 2015 12:11 pm, edited 1 time in total.
Nagios XI 5.8.1
https://outsideit.net
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: Illegal arguments detected

Post by JohnFLi »

Code: Select all

[root@G1VPNAG03 libexec]# ./check_nrpe -H g1vpdocave01 -t 120 -c check_ms_netstat -a '-H localhost'
Arguments not allowed
Everybody is somebody else’s weirdo
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Illegal arguments detected

Post 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.

?
Last edited by WillemDH on Mon Sep 14, 2015 1:18 pm, edited 1 time in total.
Nagios XI 5.8.1
https://outsideit.net
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: Illegal arguments detected

Post 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 -
Everybody is somebody else’s weirdo
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Illegal arguments detected

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: Illegal arguments detected

Post 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 :(
Everybody is somebody else’s weirdo
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Illegal arguments detected

Post by tgriep »

Any chance that you can upload your full nsclient.ini file so we can review it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked