#!/bin/sh

SWITCHIP=`echo $2 | sed 's/.*\/\(\([0-9]*.\)*[0-9]*\)\_.*/\1/g'`

/opt/cobra/icinga/libexec/check_ping -H $SWITCHIP -w 100,100% -c 200,100% -p 5 > /dev/null

res=$?

if [ $res -gt 0 ]
then
	echo "CRITICAL: The swich is offline!" 
	exit 2
else
	/opt/cobra/icinga/libexec/check_rrdtraf.org -f $2 -w $4 -c $6 -l $8
fi
