nagios core command size

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
TcoUpLoad
Posts: 7
Joined: Wed Oct 20, 2021 6:40 am

nagios core command size

Post 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?
User avatar
danderson
Posts: 111
Joined: Wed Aug 09, 2023 10:05 am

Re: nagios core command size

Post 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?
TcoUpLoad
Posts: 7
Joined: Wed Oct 20, 2021 6:40 am

Re: nagios core command size

Post 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?
User avatar
swolf
Developer
Posts: 302
Joined: Tue Jun 06, 2017 9:48 am

Re: nagios core command size

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy
TcoUpLoad
Posts: 7
Joined: Wed Oct 20, 2021 6:40 am

Re: nagios core command size

Post 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.
User avatar
danderson
Posts: 111
Joined: Wed Aug 09, 2023 10:05 am

Re: nagios core command size

Post 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
TcoUpLoad
Posts: 7
Joined: Wed Oct 20, 2021 6:40 am

Re: nagios core command size

Post by TcoUpLoad »

Hi,

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