Page 1 of 1

nagios core command size

Posted: Tue Nov 07, 2023 2:07 pm
by TcoUpLoad
Hi,

Can anyone tell me the maximum size of a command in Nagios Core? I have this command but whatever I put at the end, Nagios will say it's missing, I've already tested it.

Code: Select all

$USER1$/check_snmp -H $HOSTADDRESS$ -o $ARG1$ -P 3 -U $USER3$ -L authPriv -a SHA -A $USER4$ -x AES-128 -X $USER5$  
If you enter the hostadress it gives an error saying that the host is missing, if you enter the OID it says that the OID is missing.

At this time is saying "Required parameter: privpasswd".

Any idea of solving this?

Re: nagios core command size

Posted: Tue Nov 07, 2023 5:25 pm
by danderson
Thanks for reaching out @TcoUpLoad,

Could you provide some clarification? The command length shouldn't be the problem here. What were some combinations you tried and what were their corresponding outputs?

Re: nagios core command size

Posted: Wed Nov 08, 2023 6:21 am
by TcoUpLoad
Hi,

I already test some variants of this line to get that conclution.
1st i try

Code: Select all

$USER1$/check_snmp  -o $ARG1$ -P 3 -U $USER3$ -L authPriv -a SHA -A $USER4$ -x AES-128 -X $USER5$ -H $HOSTADDRESS$ 
with host name at the end and it return with "No Host defined" error. I didn't get it the first time and tried check_ifstatus that return with a missing module error.
I return the this check and alter it to

Code: Select all

$USER1$/check_snmp -H $HOSTADDRESS$  -P 3 -U $USER3$ -L authPriv -a SHA -A $USER4$ -x AES-128 -X $USER5$ -o $ARG1$ 
with OID at the end and the error was "no OID defined". So i thought "it seems like there is a pattern here".
I tried the last variant (the origin of this post) and create the post to try find a solution or the reason for the problem.
The error at this time is "Required parameter: privpasswd"

Any ideas?

Re: nagios core command size

Posted: Wed Nov 08, 2023 10:29 am
by swolf
Hi @TcoUpLoad,

Nagios Core doesn't limit command size. If you're using something to export to a database (e.g. NDO/NDOUtils for export to Nagios XI), you could hypothetically see truncation there, but that won't stop the command from running inside of Core.

The first thing I would check for here is whether all of your strings are terminated properly. if one of your macros has a ' or " with no matching quote, that will cause the check_snmp script to see all of the following text as "part of" the preceding argument.

Hopefully that helps - let us know if you can find anything.

Re: nagios core command size

Posted: Wed Nov 08, 2023 1:01 pm
by TcoUpLoad
Hi,

More stange!
if i run the command on shell with the user that run nagios server, the command works great and respond what should to be.

The command has been giving the error always after the priv pass, the last char of priv pass is $. it need to be escaped at some how?
At the macros all have " with the matching at the other end.

Re: nagios core command size

Posted: Wed Nov 08, 2023 5:53 pm
by danderson
Yes, some characters need to be escaped. Here is an article about this.

https://support.nagios.com/kb/article/n ... s-580.html

Re: nagios core command size

Posted: Fri Nov 10, 2023 6:07 am
by TcoUpLoad
Hi,

Thanks @danderson.
Even with " at the USERx macros it need to be escaped. work perfectly.