|
@@ -1,11 +1,31 @@
|
|
|
#!/bin/bash
|
|
|
|
|
|
-sta=$(curl "http://stream.radiospore.oziosi.org:8000/status-json.xsl" | jq -r '.icestats.source[]')
|
|
|
+influxurl="http://localhost:8086/write?db=icestat&precision=s"
|
|
|
|
|
|
-echo $sta | jq -c '.' | while read i; do
|
|
|
- listeners=$(echo $i | jq '.listeners')
|
|
|
- listenurl=$(basename $(echo $i | jq '.listenurl'| tr -d '"'))
|
|
|
- title=$(echo $i | jq '.title' | tr -d '"' | sed 's/ /\\ /g')
|
|
|
+timenow=$(date +%s)
|
|
|
|
|
|
- curl -XPOST 'http://localhost:8086/write?db=icestat' --data-binary "listeners,listenurl=$listenurl,title=$title value=$listeners"
|
|
|
+
|
|
|
+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
|
|
|
+
|