2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/ossec/ossec_active_response
dipohl ed77c82d8a Category Tree: Reduce number of categories
multiple plugins -> "mail" (qsmtpd, zimbra)
ossec -> "security" (ossec)
zeo -> appserver (zope)
2017-02-22 23:20:56 +01:00

46 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
if [ "$1" = "autoconf" ]; then
echo "yes"
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title OSSEC Active Response"
echo "graph_args --base 1000 -l 0"
echo "graph_vlabel Number of responses"
echo "graph_category security"
echo "graph_scale no"
echo "c_add_actions.label rules added"
echo "c_add_actions.draw LINE2"
echo 'c_add_actions.min 0'
echo "c_del_actions.label rules deleted"
echo "c_del_actions.draw LINE2"
echo 'c_del_actions.min 0'
exit 0
fi
### Deleting temporary log files from last run
rm -f /tmp/ossecactive.log
logdir="/var/ossec/logs"
### day of moth needs to be space padded
month="$(date "+%b")"; day="$(date "+%e")";year="$(date "+%Y")";
search1="$month $day"
### for loop for grepping the last 5 min of logs and copy it to /tmp
for (( i = 5; i >=0; i-- )) ; do
grep $(date "+%R" -d "-$i min") $logdir/active-responses.log | grep "$search1" | grep "$year" >> /tmp/ossecactive.log
done
### End for loop
### count the lines for each action in the temporary log file
NB_ADD=`cat /tmp/ossecactive.log | grep add | wc -l`
NB_DEL=`cat /tmp/ossecactive.log | grep del | wc -l`
echo "c_add_actions.value ${NB_ADD}"
echo "c_del_actions.value ${NB_DEL}"
exit 0