init III
This commit is contained in:
43
Linux STP changes/STP_changes.sh
Normal file
43
Linux STP changes/STP_changes.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
pushd /opt/observium/rrd/ > /dev/null
|
||||
|
||||
echo "<html>
|
||||
<head>
|
||||
<meta http-equiv='refresh' content='60; URL=STP_changes.html'>
|
||||
</head>
|
||||
<body>
|
||||
Table sorted by 'Timeticks ago'. Most recent top. <br><br>
|
||||
<table border=1>"
|
||||
|
||||
perl -e 'printf "<tr><td> %-30s </td><td> %-13s </td><td> %-20s </td><td> %-20s </td><td> %s </td></tr>\n", "Devices", "Changes total", "Timeticks ago", "Hours ago", "last change at"'
|
||||
for I in `ls | grep switch-catalyst`
|
||||
do
|
||||
RET1=`snmpget -LE 0 -r2 -t0.1 -v2c -ccon $I .1.3.6.1.2.1.17.2.4.0 2>&1`
|
||||
|
||||
if [[ "$RET1" =~ "Counter" ]]
|
||||
then
|
||||
perl -e 'printf "<tr><td> %-30s </td>", $ARGV[0]' $I
|
||||
CHG=`echo -n $RET1 | awk -F= '{print $2}' | awk -F':' '{print $2}' | tr -d '\n' | tr -d " "`
|
||||
perl -e 'printf "<td> %-13s </td>", $ARGV[0]' $CHG
|
||||
|
||||
RET2=`snmpget -LE 0 -r2 -t0.1 -v2c -ccon $I .1.3.6.1.2.1.17.2.3.0 2>&1`
|
||||
TT=`echo -n $RET2 | awk -F= '{print $2}' | awk -F' ' '{print $2}' | tr -d '\n' | tr -d '() '`
|
||||
perl -e 'printf "<td> %-20s </td>", $ARGV[0]' $TT
|
||||
|
||||
TTC=`perl -e 'printf "%.2f", $ARGV[0] / 100 / 3600' $TT`
|
||||
perl -e 'printf "<td> %-20s </td>", $ARGV[0]' $TTC
|
||||
|
||||
TTC=`perl -e 'printf "%d", $ARGV[0] / 100' $TT`
|
||||
TS=`date -d "now - $TTC sec"`
|
||||
echo "<td> $TS </td></tr>"
|
||||
fi
|
||||
done | sort -n --key 6,6
|
||||
|
||||
echo "</table>
|
||||
</body>
|
||||
</html>
|
||||
"
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
Reference in New Issue
Block a user