#!/bin/bash if [[ "$1" == 'debug' ]]; then set -x; _DEBUG=$1; shift; fi if [[ "$1" == 'debug2' ]]; then set -xvT; _DEBUG=$1; shift; fi if [[ "$1" == 'trace' ]]; then _TRACE=$1; shift; fi #################################################################### ############################################################ # - Watcher-Report Rev. 3 - # - Consolidated Watcher-Report - ############################################################ #--- Mandatory ---------- REALPATH=`realpath $0` WHERE=`dirname $REALPATH` ME=`basename $REALPATH` cd $WHERE . ../system.conf . ../watchermap.conf . ../common.conf . ../common.bashlib #--- Private stuff ------ #. ../api/bash/$ME.bashlib . ../conf/private/$ME.conf # No longer local functions here. Coming from API now # Configuration and private stuff outsourced whereever possible #DB_preload usage() { echo "Usage ..." echo " $ME reports the state of DROPS in the firewall if called with no parameters. If called with '-d' the counters of dropped packets in all IPSETs that have packet DROPs are dumped and the program terminates. " exit } # _____ Main _____ REPORTTYPE=stock # Set some default while getopts eh opts do case $opts in 'e') # dropped-packets REPORTTYPE=efficiency ;; '?'|'h') usage ;; esac done #if [ $OPTIND -eq 1 ]; then usage; fi . ../api/bash/$ME-$REPORTTYPE.bashlib report_$REPORTTYPE