using awk in check commands

Kevin D. Thompson Kevin.Thompson at duluth.k12.mn.us
Fri Apr 2 20:44:36 CEST 2004


?
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?
N¬HS^µéšŠX¬²š'²ŠÞu¼ˆÂâžìSºÚ+‰©l·ž.)îÆÛ­¢¸š–šÞ±éíyÖò
©âzThm¸§°úÞ²'^žÖ§t!¡ñž:(µç!ž‰h‚'¬-櫝ëÞ¯+aŠx®‰ŸºwZ™éíj[-¢Ì¬µéšvh§ŠËkjبžm§ÿÚvÊ,vw(›ö‰ÝxïF¥–‡"w~·òŠ


More information about the Users mailing list