icecast2influx/icecast2influx.sh
2020-04-10 21:15:58 +02:00

11 lines
469 B
Bash
Executable file

#!/bin/bash
sta=$(curl "http://stream.radiospore.oziosi.org:8000/status-json.xsl" | jq -r '.icestats.source[]')
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')
curl -XPOST 'http://localhost:8086/write?db=icestat' --data-binary "listeners,listenurl=$listenurl,title=$title value=$listeners"
done