2018/monitoring/custom-scripts/check_mk-agent/count-streams.sh

39 lines
1015 B
Bash
Raw Permalink Normal View History

2018-10-31 16:11:19 +02:00
#!/bin/sh
#
# This check can be used to count the number of streams from nginx
STREAMERS=http://stream.openfest.org/stats
if [ -e $MK_CONFDIR/count-streams.cfg ] ; then
. $MK_CONFDIR/count-streams.cfg
fi
echo "<<<mrpe>>>"
2018-10-31 16:11:19 +02:00
if [ ! -r $MK_CONFDIR/count-streams.xsl ] ; then
_res=3
_data="UNKNOWN: Stylesheet not found"
fi
for STREAMER in ${STREAMERS} ; do
stream_count=`curl -sfq -m1 ${STREAMER} | xsltproc $MK_CONFDIR/count-streams.xsl -`
_warn=${WARNLEVEL:-3}
_crit=${CRITLEVEL:-6}
2018-10-31 16:11:19 +02:00
if [ $stream_count -ge $_crit ] ; then
_data="OK - stream count $stream_count"
_res=0
fi
if [ $stream_count -ge $_crit -a $stream_count -le $_warn ] ; then
_data="WARN - stream count $stream_count, less than expected. Min $_crit, needed $_warn"
_res=1
fi
if [ $stream_count -lt $_crit ] ; then
_data="CRITICAL - Streams lower than $_crit"
_res=2
fi
2018-10-31 16:42:57 +02:00
echo "Streamcount_${STREAMER} ${_res} ${_data}"
2018-10-31 16:11:19 +02:00
done