#!/bin/bash
while read line
do
device_ip=$line
#device_ip=192.168.10.199
ifType_list=snmpwalk -v 2c -c XXXX $device_ip ifType |grep ppp |cut -d= -f 1 |cut -d. -f 2
ipAdEntIfIndex=snmpwalk -v 2c -c XXXX $device_ip ipAdEntIfIndex |cut -d= -f 2|cut -d: -f 2
ip_date=date +"%Y/%m/%d %H:%M:%S"
date_txt=$(date +"%Y%m")
#echo
d
a
t
e
t
x
t
t
x
t
p
a
t
h
=
"
/
h
o
m
e
/
"
date_txt txt_path="/home/"
datetxttxtpath="/home/"device_ip"_"$date_txt".csv"
#echo $txt_path
echo -n
i
p
d
a
t
e
"
"
>
>
ip_date " " >>
ipdate"">>txt_path
for i in $ifType_list
do
for j in $ipAdEntIfIndex
do
# echo $j
if [ $i == $j ]; then
#echo
i
+
i+
i+j
ppp_ip="snmpwalk -v 2c -c XXXX $device_ip ipAdEntIfIndex |grep ": $j" |grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
"
# last_ppp_ip=cat $txt_path |awk 'END {print}' |grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
# if [$ppp_ip != $last_ppp_ip];then
echo -n $ppp_ip " " >> $txt_path
# fi
#echo $last_ppp_ip
fi
done
done
echo >>$txt_path
done < /home/device_ip.txt