32 lines
989 B
Bash
32 lines
989 B
Bash
#!/bin/bash
|
|
cd /home/rancid/var/rancid/network/configs
|
|
|
|
echo "<html>
|
|
<head>
|
|
<!--
|
|
Script
|
|
rancid@10.101.0.11:/scripts/rancid/tunnel_usage/overview.sh
|
|
|
|
crontab rancid@10.101.0.11
|
|
0 * * * * bash /scripts/rancid/tunnel_usage/overview.sh
|
|
-->
|
|
</head>
|
|
<body>" > /scripts/rancid/tunnel_usage/tunnel_overview.html
|
|
|
|
|
|
fws=$(echo 'select distinct hostname from cisco_asa_vpn_last' | mysql -u 'conetadm' -p'Conet12#' -Dscripts -h 10.99.0.199 | grep -v hostname | tr "\n" " ")
|
|
|
|
for fw in `echo $fws`
|
|
do
|
|
asa=$fw
|
|
str1="select hostname,peerip,last_used from cisco_asa_vpn_last where (peerip='"
|
|
str2=$(cat $asa | grep 'set peer' | awk '{print $7}' | tr "\n" " " | sed "s/ /' or peerip='/g")
|
|
str3="xyz') and hostname='$asa'"
|
|
str=$(echo "$str1""$str2""$str3" | tr "\n" " ")
|
|
echo $str | mysql -u 'conetadm' -p'Conet12#' -Dscripts -h 10.99.0.199 -H
|
|
done >> /scripts/rancid/tunnel_usage/tunnel_overview.html
|
|
|
|
echo "
|
|
</body>
|
|
</html>" >> /scripts/rancid/tunnel_usage/tunnel_overview.html
|