#!/bin/bash
#
# Test ob die config von einem netscreen cluster "in sync" ist.
#
FW=$1
NLOGIN=/usr/lib/rancid/bin/nlogin
FWCONF=/usr/lib/nagios/plugins/check_fw_conf.pw

$NLOGIN -f $FWCONF -c "undebug all; clear db; exec nsrp sync global-config check" $FW >/var/log/nagios/check_fw_conf.log

sleep 1

OUT=`$NLOGIN -f $FWCONF -c "get db str" $FW | grep -c "configuration in sync"`

if [ $OUT = 1 ]
then
    echo "Alles ok: configuration in sync"
    exit 0
else
    echo "Fehler - config nicht in sync"
    exit 2
fi
