Problem with community containing special characters

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ppalaguachi1976
Posts: 15
Joined: Wed Apr 09, 2014 7:57 am

Problem with community containing special characters

Post by ppalaguachi1976 »

hello
Nagios Xi I'm testing in our company snmp community standard contains special characters, nagios xi having trouble adapting to plug check_ifoperstatus

Try editing the file command.cfg by placing the variable $ ARG1 $ in single quotes, but every time you run the program is removed. Is there any way to make nagios Xi accept special characters in the snmp community?


reviewing the console and verify that this type of check I can see doing that changes the snmp community, my community is $1$3.v/q/$; but notes $1$3.v/q/$$; why it gives me the error that is not recognized snmp

nagios 4917 4916 1 07:52 ? 00:00:00 /usr/bin/perl -w /usr/local/nagios/libexec/check_ifoperstatus -H 10.101.11.228 -C $1$3.v/q/$$ -k 9
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Problem with community containing special characters

Post by abrist »

1) You could attempt to escape the dollar signs ($):
http://support.nagios.com/wiki/index.ph ... ck_Command

2) Or you could use resource.cfg:
Your community string includes 'illegal' meta characters. You will need to use the file /usr/local/nagios/etc/resource.cfg. Edit it to include (we will use $USER9$ for this example):

Code: Select all

$USER9$=$1$3.v/q/$$
Then change your command to:

Code: Select all

$USER1$/check_ifoperstatus -H $HOSTADDRESS$ -C $USER9$ -k 9
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ekarajica
Posts: 1
Joined: Fri Oct 14, 2016 11:12 am

Re: Problem with community containing special characters

Post by ekarajica »

My SNMP comunity name has $ in it. I tired defining $USER9$=communityname in /usr/local/nagios/etc/resource.cfg but that didn't work. Could you please help?

Thank you
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problem with community containing special characters

Post by tgriep »

Did you try to escape the $ in the password like the example shows?

Also, you can try and surround the password with a single quote and see if that works as well.

Code: Select all

$USER9$='pass$word'
Be sure to check out our Knowledgebase for helpful articles and solutions!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Problem with community containing special characters

Post by rkennedy »

In addition to what @tgriep mentioned, if it does not work -

Could you please show us your entire check_command, and related command definition? What error are you seeing?

This document is pretty useful if you haven't seen it yet - https://assets.nagios.com/downloads/nag ... Macros.pdf
Former Nagios Employee
Locked