Skip to content

Instantly share code, notes, and snippets.

@fapestniegd
Created September 9, 2011 16:58
Show Gist options
  • Select an option

  • Save fapestniegd/1206733 to your computer and use it in GitHub Desktop.

Select an option

Save fapestniegd/1206733 to your computer and use it in GitHub Desktop.
snmp_extend_oid (){
oid=$1; tag=$2;
taglen=$(expr length $tag)
tag_oid=$(
echo "${tag}"| sed 's/\(.\)/\1\n/g'| while read char ;do
if [ ! -z "${char}" ];then
echo -n .
echo -n $(( ( 256 + $(printf '%d' "'$char"))%256 ));
fi
done
)
echo ${oid}.4.1.2.${taglen}${tag_oid}.1
}
swalk eir $(snmp_extend_oid .1.3.6.1.4.1.32372.1.1.2.1.1.1.1 w.time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment