Kaspars Zibarts

Log rate calculator for MDS / MLM

Discussion created by Kaspars Zibarts on Nov 29, 2017
Latest reply on Nov 29, 2017 by Dameon Welch Abernathy

There are two great SKs out there, so this is just re-inventing the wheel

sk120341 - How to monitor the Log Receive Rate on Management Server

sk88681 - How to calculate/count the total amount of FireWall Logs per second that arrive to Security Management Server

I simply bastardised the script from the second article to make it faster (it runs parallel instead of sequential through all CMAs) and output is more easy to read. But all the credits go to CP!

 

log rate calculator

 

Here's your script, a you can see you can supply time that you want to run it for, by default 5secs

 

#!/bin/sh
# Print log rate data on all Domains

# execute the script that defines Check Point environment variables
source /opt/CPshared/5.0/tmp/.CPprofile.sh
total=0

if [ "x$1" = "x" ]; then
   SLEEP_TIME=5
else
   SLEEP_TIME=$1
fi

echo
echo "Log rate per second, measuring for ${SLEEP_TIME}s"
echo "----------------------------------"
ls -l /var/log/mds_logs/*/log/fw.logptr > BEFORE
sleep $SLEEP_TIME
ls -l /var/log/mds_logs/*/log/fw.logptr > AFTER

for DOMAIN in $(ls -1 $MDSDIR/customers)
do
   SIZE_BEFORE=$(cat BEFORE | grep "/$DOMAIN/" | awk '{print $5}')
   SIZE_AFTER=$(cat AFTER | grep "/$DOMAIN/" | awk '{print $5}')
   rate=`echo "scale=0 ; ($SIZE_AFTER - $SIZE_BEFORE) / ( 4 * $SLEEP_TIME )" | bc`
   let total=total+rate
   echo -e -n "${DOMAIN}:\t"
   if [ ${#DOMAIN} -le 15 ]; then echo -e -n "\t"; fi
   echo "$rate"
done

echo "----------------------------------"
echo -e "Total rate:\t\t$total"
echo

Outcomes