Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Sostat cleanup output: Suricata output when no packet drops received and sostat-interface formatting #7

Merged
merged 2 commits into from
Jul 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions bin/sostat
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,15 @@ if [ -d /nsm/sensor_data ]; then
if [ "$ENGINE" = "suricata" ]; then
for i in /nsm/sensor_data/*/stats.log; do
echo "$i"
tail -n 50 "$i" | grep -e "Date: " -e "drop"
echo
if [ $( tail -n 50 $i | grep -c drop $i) -ne 0 ]; then
echo
tail -n 50 "$i" | grep -e "Date: " -e "drop"
echo
else
echo
echo "No packet drops reported."
echo
fi
done
else
for i in /nsm/sensor_data/*/snort-*.stats; do
Expand All @@ -125,7 +132,6 @@ if [ -d /nsm/sensor_data ]; then
fi
done
fi
echo
echo "-------------------------------------------------------------------------"
echo
TMP=`mktemp`
Expand Down
9 changes: 7 additions & 2 deletions bin/sostat-interface-delta
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
grep -v "^#" /etc/nsm/sensortab |awk '{print $4}' |while read SENSOR; do
FILE="/var/log/nsm/$SENSOR-packets.log"
if [ -f $FILE ]; then
echo -n "$SENSOR: "
echo
echo -n "$SENSOR: "
RX1=`head -1 $FILE`
RX2=`tail -1 $FILE`
expr $RX2 - $RX1
else
echo "Stats not yet available."
echo
echo
echo "Stats not yet available for $SENSOR."
echo
echo "Please wait until the current monitoring interval has completed."
echo
echo
fi
done