Files
bin/node-collector-myth

20 lines
775 B
Bash
Executable File

#!/bin/bash
num_tuners=`ls -dl /dev/dvb/* | wc -l`
num_upcoming_recordings=`/home/ddp/bin/myth_upcoming_recordings.pl --plain_text --hours 4 | wc -l`
num_tuners_recording=`/home/ddp/bin/myth_upcoming_recordings.pl --plain_text --hours 4 | egrep -cw '^RECORDING:'`
tmp_file=/tmp/myth.prom.$$
real_file=/srv/docker/container/node-exporter/textfile_collector/myth.prom
echo "# HELP node_myth data on myth tuners and recordings coming up and happening now" >> $tmp_file
echo "# TYPE node_myth gauge" >> $tmp_file
echo "node_myth{what=\"num_tuners\"} $num_tuners" >> $tmp_file
echo "node_myth{what=\"num_upcoming_recordings\"} $num_upcoming_recordings" >> $tmp_file
echo "node_myth{what=\"num_tuners_recording\"} $num_tuners_recording" >> $tmp_file
mv $tmp_file $real_file