using awk in check commands

Clint Sulis clint at misinc.net
Fri Apr 2 21:26:11 CEST 2004


Try backslashing the dollar sign.  Hope that works!

On Friday, April 2, 2004, at 11:44 AM, Kevin D. Thompson wrote:

> ?
> Hi all,
> I want to make a simple check command that will return the serial  
> number of my Cisco routers.
> I run this command from the command line
>
> /usr/local/bin/snmpget -v 2c -c *snmpremoved central-2621-1
> 1.3.6.1.4.1.9.3.6.3.0 | awk -F'"' '{print $2}'
>
> and I get the appropriate response.  So then I added that to my
> checkcommands.cfg file, as the following entry
> define command{
>         command_name    get_router_serial_number
>         command_line    /usr/local/bin/snmpget -v 2c -c *snmpremoved  
> $HOSTADDRESS$
> 1.3.6.1.4.1.9.3.6.3.0 | awk -F'"' '{print $2}'
>         }
> when I run Nagios, I keep getting errors from awk,
> awk: cmd. line:2: {print $2}$
> awk: cmd. line:2:            ^ unexpected newline
>
> Any thoughts on why this works from the command line, but not in the
> check command I made?
> ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÓ†+ó^µéšŠX¬²š'²ŠÞu¼ÿ  
> 
Š{±Nëh®&¥°ZÞx¸§»n¶ŠâjZkzǧµç[È6§‰éQ¡¶âžÏÏ­ 
> ë"uéíjwBêéÓ¢‹^rè–ˆ"zÏËyªçz÷«ÊØbžë¢gîÖ¦z{Z–Ëh³+- 
> zfš)â²ÚÚ¶*'þm§ÿÿiÛÿ¢ÇgýÊ&ÿöþ'׎ôý©e¡ÏâßÏè‰Éÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 
> ÿÿÿÿÿÿÿÿÿÿóZ‚*,þë
®ÉšŠX§‚X¬´Ö Š‹ÿºÇ«³ùb²Ûÿ²‹«qçè®ÿëa¶ÚlÿÿåŠËlþÊ.­ 
> ÇŸ¢¸
þw­ 
> þX¬¶ÏåŠËbú?¨"¢Ïî±êìÿÿÏ•æ¬z)Ü–ç^5¨"¢ËޮȨŸúeº§½ê슉ÿþÿڝӒ§­ 
> êh®Ø§©òŠË.{ÿÿüǬ±¨
³­†‹­²êi¢»bž§~Œ"–Zâ²FÞŠx,z{m£÷^¿ùî
>
>
Clint Sulis
====================
System Administrator
PHP/MySQL Programmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1563 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20040402/ea044bca/attachment.bin>


More information about the Users mailing list