Using ! in check_command - part 2

Michael Eck meck at chilitech.net
Fri Jun 18 18:03:45 CEST 2004


You misread.  The device's community string is definitely correct - it 
works with snmpget.  I was just giving you an example of how my $USERn$ 
macro doesn't even work with a string of public - on a device that 
definitely has that string blahdy blah...

Now, what I am doing differently is using my $USER3$ maco in my 
services.cfg rather than my checkcommands.cfg  Perhaps that's my 
problem?  I'll have to play.


On Jun 18, 2004, at 11:05 AM, Cook, Garry wrote:

> Michael Eck wrote:
>> Interestingly enough, I can't seem to make my $USERn$ macros work at
>> all - although I assume $USER1$ is working as my libexec path. Even
>> with the !, I can't get a check to return OK when using my macro as
>> the community string
>>
>> I've got
>> resource.cfg:
>> $USER2$=public
>>
>> services.cfg:
>> check_command check_plugin!$USER2$!75!85
>>
>> All is well when $USER2$ is replaced with "public"
>
> Unless I've misread your post, you are saying that using the community 
> string 'public' works when checking the device.
> So, I have to ask, are you sure that you have the community string 
> containing the '!' setup on the agent/device?
> If so, I would think that you would have removed the 'public' string, 
> unless it was put back for testing purposes.
>
> In my resource.cfg '$USERn$' is set to the community string containing 
> the '!' without backslash escaping the character like so (not my real 
> string, but you get the point...):
> $USER6$=public!
>
> In my checkcommands.cfg I have the following to check CPU usage on a 
> Cisco router (the command_line is going to word wrap):
> # 'cisco_cpu' command definition
> define command{
>         command_name    cisco_cpu
>         command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -o 
> .1.3.6.1.4.1.9.2.1.58.0 -w 84:70 -c 100:85 -C $USER6$ -l CPU\ 
> Utilization -u%
>
> Finally, in my services.cfg I just call the 'cisco_cpu' plugin and 
> voila!, instant CPU utilization checking.
>
> If a setup like this does not work for you, I would go back to what I 
> said earlier - check your device and make sure that the community 
> string is actually configured properly at that end as well.
>
> Also, read these docs about macros:
> http://nagios.sourceforge.net/docs/1_0/macros.html
>
> Make sure permissions are set correctly for your resource file, as 
> outlined by:
> http://nagios.sourceforge.net/docs/1_0/configmain.html#resource_file
>
>
>> On Jun 17, 2004, at 6:34 PM, Cook, Garry wrote:
>>
>>
>> 
>> SNMP checks work for me with a '!' in the community string. Now, I
>> don't remember if I needed to escape it or not, and I can't get to
>> the box to check it right now, so you may need to try it both ways.
>> However, I did NOT put the community string in the services.cfg or
>> checkcommands.cfg. I wanted to be a little bit more safe, so I
>> assigned it to one of the user variables in resource.cfg. I then
>> added this variable (ie. $USER9$) to my check command as an argument.
>>
>> Whether or not this should really be considered 'safe' might be
>> disputed by some. It's never been compromised and it works in my
>> check commands, so I'm happy.
>>
>> HTH.
>> -g
>> -----Original Message-----
>> From: nagios-users-admin at lists.sourceforge.net on behalf of Michael
>> Eck
>> Sent: Thu 6/17/2004 12:20 PM
>> To: nagios-users
>> Cc:
>> Subject: [Nagios-users] Using ! in check_command - part 2
>>
>> Original Post:
>> Greetings,
>> Is there a trick than anybody knows of the use a ! as a character in a
>> password for a check_command?
>> The obvious problem is that it's also the field delimiter.
>>
>>
>> Ok, I got lots of replies suggesting that I try to escape my !.  I
>> didn't mention it in my first post but I did indeed try that.  I tried
>> quotes of several varieties with no luck as well.
>>
>> Has anybody actually gotten this to work or does anybody know that
>> this
>> will work or were they just shots in the dark?  Of course I can change
>> the community strings but that's just a cop-out.
>>
>> Any ideas?
>>
>>
----
Michael Eck
Chilitech Internet Solutions
Network Operations Center
570-323-2166
http://www.chilitech.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2365 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20040618/9b209b85/attachment.bin>


More information about the Users mailing list