Guest User

Untitled

a guest
May 16th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. LINHAS=$(snmpwalk -v1 -c gerente localhost 1.3.6.1.2.1.4.22.1.1 | wc -l)
  4.  
  5. IP=`snmpgetnext -v1 -c gerente localhost 1.3.6.1.2.1.4.22.1.2 | cut -d = -f 1 | cut -d . -f 3-6`
  6.  
  7. for i in $(seq $LINHAS)
  8. do
  9.  
  10. HW=`snmpget -v1 -c gerente localhost 1.3.6.1.2.1.4.22.1.2.2.$IP | cut -d : -f 4-9`
  11. INDICE=`snmpget -v1 -c gerente localhost 1.3.6.1.2.1.4.22.1.1.2.$IP | cut -d : -f 4`
  12. IND=`echo $INDICE | tr -d ' '`
  13. DESCR=`snmpget -v1 -c gerente localhost 1.3.6.1.2.1.2.2.1.2.$IND | cut -d : -f 4`
  14. echo "IP: $IP HW: $HW If: $DESCR"
  15.  
  16. PROXIMO=`snmpgetnext -v1 -c gerente localhost 1.3.6.1.2.1.4.22.1.2.2.$IP | cut -d = -f 1 | cut -d . -f 3-6`
  17.  
  18. IP=`echo $PROXIMO | tr -d ' '`
  19.  
  20. done
Add Comment
Please, Sign In to add comment