5.02021-11-21T21:55:31ZTemplates ProdService HLSService HLS## Overview
This is beta version of HLS checker.
This template can discovery different streams (playlist in playlists file) and show next parameters:
There is presented ts file
Total lenght of ts file
Target duration of ts file
Duration of ts file
Spended time for download ts file
Average speed for download ts file
Not created: different paraneters of ts file from ffprobe. May be later.
You need install python2, m3u8 library and ffmpeg if you want:
apt install python python-m3u8 python-requests ffmpeg
1. Put script to /path\_to\_script/check\_hls
2. Give him executable flag by:
chmod ugo+x check\_hls
3. Add userparameter into zabbix agent:
echo "UserParameter=hls[*], /usr/bin/python /path\_to\_script/check\_hls \$1 \$2" > /etc/zabbix/zabbix\_agentd.d/hls.conf
4. Import template into zabbix server
5. Apply template to host
6. Add macros {$HLSURI} = "http://yourdmain.local/playlist.m3u8"
If you have additions or comments you are welcome!
## Author
Kirill Savin
Templates Prodhlsm3u8 listshls["-d",{$HLSURI}]1h5dHLS average speed $1DEPENDENThls.averagespeed[{#PROFILE}]07d30dbhlsJSONPATH$..['#DOWNLOAD-OPTS']..['#AVERAGE-SPEED']JAVASCRIPTreturn(value.slice(0,-1).slice(1))hls["-g",{#PROFILE}]HLS duration $1DEPENDENThls.duration[{#PROFILE}]07d30dFLOATshlsJSONPATH$..['#DURATION']JAVASCRIPTreturn(value.slice(0,-1).slice(1))hls["-g",{#PROFILE}]{last()}<8HLS duration is below 8 in {#PROFILE}WARNINGHLS spended time $1DEPENDENThls.spendedtime[{#PROFILE}]07d30dFLOATshlsJSONPATH$..['#DOWNLOAD-OPTS']..['#SPENDED-TIME']JAVASCRIPTreturn(value.slice(0,-1).slice(1))hls["-g",{#PROFILE}]{last()}>200HLS spended time is more 200ms in {#PROFILE}INFOHLS target duration $1DEPENDENThls.target_duration[{#PROFILE}]07d30dFLOATshlsJSONPATH$..['#TARGETDURATION']JAVASCRIPTreturn(value.slice(0,-1).slice(1))hls["-g",{#PROFILE}]HLS total legth $1DEPENDENThls.totallength[{#PROFILE}]07d30dbhlsJSONPATH$..['#DOWNLOAD-OPTS']..['#TOTAL-LENGTH']JAVASCRIPTreturn(value.slice(0,-1).slice(1))hls["-g",{#PROFILE}]{last()} < ({avg(5m)} * 0.9)HLS there's unstable bitrate in {#PROFILE}HLS ts present $1DEPENDENThls.tsuri[{#PROFILE}]07d30dhlsJSONPATH$..['#TSURI']JAVASCRIPTreturn(value.slice(0,-1).slice(1))hls["-g",{#PROFILE}]{last()}=0HLS TS isn't present in {#PROFILE}HIGHHLS playlist $2hls["-g",{#PROFILE}]2m7d0TEXThlsJSONPATH$.*{Service HLS:hls.duration[{#PROFILE}].last()} < {Service HLS:hls.target_duration[{#PROFILE}].last()} or
{Service HLS:hls.duration[{#PROFILE}].last()} > {Service HLS:hls.target_duration[{#PROFILE}].last()}HLS duration is different on target duration in {#PROFILE}DISABLED{$HLSURI}URI to m3u8