macemoneta |
06-22-2005 07:57 PM |
Well, you could modify the bwbar to display load instead of network usage.
You can also create a bar-like chart using just HTML. For example, this shell CGI script extract is one I created for status on my firewall, which is then included by the target page:
Code:
#-----------------------------------------------------------
# Create a bar chart to relate the rolling number of entries
# in the datafile to virus/hack activity
#-----------------------------------------------------------
ENTRIES=`/bin/cat /var/www/html/datafile | /usr/bin/wc -l`
REALENTRIES=$ENTRIES
if [ $ENTRIES -gt 450 ]
then
ENTRIES=450
fi
PAD=$((450-$ENTRIES))
BAR="darkgreen"
if [ $ENTRIES -ge 180 ]
then
BAR="yellow"
fi
if [ $ENTRIES -ge 250 ]
then
BAR="darkred"
fi
echo "<font color=blue>" > /var/www/html/virus.html
echo "72-hour rolling automatic firewall subnet block list summary:" >> /var/www/html/virus.html
echo "</font>" >> /var/www/html/virus.html
echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>" >> /var/www/html/virus.html
echo "<TR bgcolor=#AAAAAA><TH align=left WIDTH=150>Virus/Hack Activity:</TH>" >> /var/www/html/virus.html
echo " <TH align=left WIDTH=150><font color=darkgreen>Low</TH>" >> /var/www/html/virus.html
echo " <TH align=left WIDTH=150><font color=yellow>Normal</TH>" >> /var/www/html/virus.html
echo " <TH align=left WIDTH=150><font color=darkred>High</TH>" >> /var/www/html/virus.html
echo "</TR>" >> /var/www/html/virus.html
echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>" >> /var/www/html/virus.html
echo "<TR bgcolor=#AAAAAA><TH align=right WIDTH=150>${REALENTRIES} </TH>" >> /var/www/html/virus.html
echo " <TH bgcolor=${BAR} align=left WIDTH=${ENTRIES}> </TH>" >> /var/www/html/virus.html
echo " <TH bgcolor=#AAAAAA align=left WIDTH=${PAD}></TH>" >> /var/www/html/virus.html
echo "</TR>" >> /var/www/html/virus.html
echo "</TABLE>" >> /var/www/html/virus.html
/bin/chmod 644 /var/www/html/virus.html
/bin/chown nobody.nobody /var/www/html/virus.html
You can see the result here. The bar changes from green to yellow to red as thresholds are passed, and the bar gets longer. It's a very simplistic way of doing it, but it gets the job done.
|