#!/bin/bash if [ "$1" = "autoconf" ]; then echo "yes" exit 0 fi if [ "$1" = "config" ]; then echo "graph_title Ossec agents status" echo "graph_args --base 1000 -l 0" echo "graph_vlabel Number of ossec agents" echo "graph_category security" echo "graph_scale no" echo "active.label active" echo "active.draw LINE2" echo 'active.min 0' echo "inactive.label inactive" echo "inactive.draw LINE2" echo 'inactive.min 0' exit 0 fi ### where to find the ossec tools ossecdir="/var/ossec/bin" ### count the lines from the output of the list_agents tool ACTIVE=`$ossecdir/list_agents -c | grep -wv "** No agent available" | wc -l` INACTIVE=`$ossecdir/list_agents -n | grep -wv "** No agent available" | wc -l` echo "active.value ${ACTIVE}" echo "inactive.value ${INACTIVE}" exit 0