31 lines
1.1 KiB
Bash
Executable file
31 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
influxurl="http://localhost:8086/write?db=icestat&precision=s"
|
|
|
|
timenow=$(date +%s)
|
|
|
|
|
|
icecasturl="http://stream1.esiliati.org:8000"
|
|
|
|
icecastsrv=$(echo "${icecasturl##*/}")
|
|
sta=$(curl "${icecasturl}/status-json.xsl" | jq '.icestats.source[]')
|
|
echo $sta | jq -c '.' | while read -r i; do
|
|
listeners=$(echo $i | jq -r '.listeners')
|
|
listenurl=$(basename $(echo $i | jq -r '.listenurl'))
|
|
title=$(echo $i | jq -r '.title' | sed 's/ /\\ /g' | sed 's/\"//g')
|
|
curl -XPOST $influxurl --data-binary "listeners,icecastsrv=$icecastsrv,listenurl=$listenurl,title=$title value=$listeners $timenow"
|
|
done
|
|
|
|
|
|
|
|
icecasturl="http://stream2.esiliati.org:8000"
|
|
|
|
icecastsrv=$(echo "${icecasturl##*/}")
|
|
sta=$(curl "${icecasturl}/status-json.xsl" | jq '.icestats.source[]')
|
|
echo $sta | jq -c '.' | while read -r i; do
|
|
listeners=$(echo $i | jq -r '.listeners')
|
|
listenurl=$(basename $(echo $i | jq -r '.listenurl'))
|
|
title=$(echo $i | jq -r '.title' | sed 's/ /\\ /g' | sed 's/\"//g')
|
|
curl -XPOST $influxurl --data-binary "listeners,icecastsrv=$icecastsrv,listenurl=$listenurl,title=$title value=$listeners $timenow"
|
|
done
|
|
|