Snmpwalk Linux Bash doesn't return an array -


i running nagios server on opensuse linux linking via snmp esx 3.5 server

i trying snmpwalk return array returns single value.

on esx box ahve following shell find sizes of of snapshots-

/usr/bin/find /vmfs/volumes/ -name '*delta*.vmdk' -printf %f' '%s'\n'  

this returns following when ran on esx box-

[root@localhost root]# /bin/sh /etc/snmp/snmp_snapshots.sh testnag01-000001-delta.vmdk 16840704 testnag01-000002-delta.vmdk 167835648 testnag01-000003-delta.vmdk 151058432 

on nagios box have following shell-

declare -a result=$(/usr/bin/snmpwalk -v 2c -c public 10.10.0.20 .1.3.6.1.4.1.6876.57.101.2 | grep vmdk | awk {' print $4,$5 '} | sed 's/ /_size:/g' | sed 's/\"//g')  echo "snapshot 1" ${result[0]} echo "snapshot 2" ${result[1]} 

this returns single value, (the second 1 on list)-

snapshot 1 testnag01-000002-delta.vmdk:167835648 snapshot 2 

when run command on own-

/usr/bin/snmpwalk -v 2c -c public 10.10.0.20 .1.3.6.1.4.1.6876.57.101.2 

i following return-

snmpv2-smi::enterprises.6876.57.101.2 = string: "testnag01-000002-delta.vmdk 167835648" 

so looks command failing return more 1 result?

i'm noob here missing obvious...

thanks in advance

i got answer elsewhere thought i'd post here in case else has same issue-

the last number in oid returns record number- .2 returns second value

once removed .2 , used command-

/usr/bin/snmpwalk -v 2c -c public 10.10.0.20 .1.3.6.1.4.1.6876.57.101

it worked fine!


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -