Snort mailing list archives

Re: Snort-users digest, Vol 1 #1522 - 12 msgs


From: Fernando Miguelez Palomo <jtbmipaf () bipt106 bi ehu es>
Date: Sat, 26 Jan 2002 02:06:52 +0100 (CET)

We use top in batch mode:
top i b d 1 > datafile

And then process it with the attached script:
./sacamed datafile

You will need to install rascal (a shell scientific calculator), which can 
be found in:
http://rascal.sourceforge.net

Regards, 
Fernando

===========================================================================
#!/bin/bash
# Program: sacamed
# Written by Fernando Miguélez Palomo

NUM_LIN=`cat $1 | grep CPU[0-9] | wc -l`

echo "Number of lines is: $NUM_LIN"

CONT=1

TOTAL_USER=0
TOTAL_SYS=0

while [ $CONT -le $NUM_LIN ]
do
    TEMP=`cat $1 | grep CPU[0-9] | sed -n "$CONT"p | sed "s/  */ /g" | cut 
-f 3 -d " " | cut -d "%" -f 1 | sed "s/,/./g"`
    TOTAL_USER=`rascal -e "$TOTAL_USER + $TEMP" | grep -v rascal`
    TEMP=`cat $1 | grep CPU[0-9] | sed -n "$CONT"p | sed "s/  */ /g" | cut 
-f 5 -d " " | cut -d "%" -f 1 | sed "s/,/./g"`
    TOTAL_SYS=`rascal -e "$TOTAL_SYS + $TEMP" | grep -v rascal`
    CONT=`expr $CONT + 1`
done

echo "Total user: $TOTAL_USER"
echo "Total system: $TOTAL_SYS"

MED_USER=`rascal -nq -e "$TOTAL_USER / $NUM_LIN * 1.0"`
MED_SYS=`rascal -nq -e "$TOTAL_SYS / $NUM_LIN * 1.0"`

echo "Average user rate: $MED_USER"
echo "Average system rate: $MED_SYS"



_______________________________________________
Snort-users mailing list
Snort-users () lists sourceforge net
Go to this URL to change user options or unsubscribe:
https://lists.sourceforge.net/lists/listinfo/snort-users
Snort-users list archive:
http://www.geocrawler.com/redir-sf.php3?list=snort-users


Current thread: