Angel_Lopez_116
Apr 01, 2014Altostratus
Exec of awk to return value of custom snmp oid
Hi,
I've defined a custom oid in /config/snmp/custom_mib.tcl as follows:
register_mib ".1" limitconn GAUGE
proc limitconn {} { set status [catch {exec tail -1 /var/log/irule_limitconn | tr -s \ | cut -d\ -f11} result] return $result }
It works fine, but when I redefine the command to use awk (to handling easily the whitespace as field separator):
exec tail -1 /var/log/irule_limitconn | awk '{print $11}'
It doesn't work, I always get 0 as result.
I've tried different escape sequences for the ' and { in the awk command as:
exec tail -1 /var/log/irule_limitconn | awk \'{print $11}\'
without any luck... can't I use awk here?
Thanks!