This commit is contained in:
vvitkov 2018-10-31 17:11:51 +02:00
parent d038a86783
commit e37060b702
1 changed files with 15 additions and 15 deletions

View File

@ -47,28 +47,26 @@ if [ -e $MK_CONFDIR/check_rtmp.cfg ] ; then
fi
# Proces de parametres
while getopts ":u:t:h" Option
do
case $Option in
u ) URLS=$OPTARG;;
t ) TIMEOUT=$OPTARG;;
h ) print_help;;
* ) echo "unimplemented option";;
esac
while getopts ":u:t:h" Option ; do
case $Option in
u ) URLS=$OPTARG;;
t ) TIMEOUT=$OPTARG;;
h ) print_help;;
* ) echo "unimplemented option";;
esac
done
if [ ! $URLS ] ; then
if [ -z "${URLS}" ] ; then
echo "Stream_UNKNOWN ${STATE_UNKNOWN} No URL's defined"
fi
for _uri in ${URLS} ; do
# Construir noms de fitxers temporals
NAME=`echo $URL | sed -e s/[^A-Za-z0-9.]/_/g`
NAME=`echo $_uri | sed -e s/[^A-Za-z0-9.]/_/g`
ERR=/tmp/check_rtmp_err_$NAME.tmp
# Testejant
( $RTMPDUMP -m 4 --live -r $URL --stop $TIMEOUT > /dev/null 2> $ERR ) & sleep 5; kill $! 2> /dev/null
( $RTMPDUMP -m 4 --live -r $_uri --stop $TIMEOUT > /dev/null 2> $ERR ) & sleep 3; kill $! 2> /dev/null
_data=$?
# Retorn de resultats
@ -77,15 +75,17 @@ for _uri in ${URLS} ; do
if [ -z "$CONNECTA" ]
then
echo "echo Stream_${_uri} ${STATE_CRITICAL} Cannot Connect"
continue
else
ERROR=`grep "INFO: Metadata:" $ERR`
if [ ! -z "$ERROR" ]
then
echo "Stream_${_uri} ${STATE_OK} Stream is normal"
fi
echo "Stream_${_uri} ${STATE_CRITICAL} Stream is not broadcasting"
continue
fi
echo "Stream_${_uri} ${STATE_CRITICAL} Stream is not broadcasting"
continue
fi
echo "Stream_${_uri} ${STATE_UNKNOWN} Unknown output from stream check. Manual check is advised"
exit $STATE_UNKNOWN
done