2018-02-08 05:36:33 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Usage: $0 <MIB name>" >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
gc(){
|
|
|
|
test -f $F && rm $F
|
|
|
|
}
|
|
|
|
trap gc EXIT
|
|
|
|
|
|
|
|
F=$(mktemp)
|
2018-05-19 23:38:39 +02:00
|
|
|
|
|
|
|
if wget -qO $F "http://www.circitor.fr/Mibs/Mib/${1:0:1}/$1.mib"; then
|
|
|
|
if ! grep "<html" $F >/dev/null; then
|
|
|
|
mv $F mibs/$1.mib
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo "MIB not found on circutor.fr" >&2
|
|
|
|
fi
|
|
|
|
|
2018-02-08 05:36:33 +01:00
|
|
|
if wget -qO $F "https://iphostmonitor.com/mib/$1.html"; then
|
2018-05-19 23:38:39 +02:00
|
|
|
if ! grep "<html" $F >/dev/null; then
|
|
|
|
mv $F mibs/$1.mib
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo "MIB not found on iphostmonitor.com" >&2
|
2018-02-08 05:36:33 +01:00
|
|
|
fi
|
|
|
|
|
2018-05-19 23:38:39 +02:00
|
|
|
echo "ERROR: Unable to find $1" >&2
|
2018-02-08 05:36:33 +01:00
|
|
|
exit 1
|