#!/bin/bash prom_file=/srv/docker/container/telegraf/monitoring-results/backups.prom ISSUE=`/home/ddp/bin/backup-success` RES=$? echo "# HELP node_backups status of last backup" > $prom_file echo "# TYPE node_backups gauge" >> $prom_file if [ $RES != 0 ]; then echo "node_backups{what=\"state\",issue=\"$ISSUE\"} $RES" >> $prom_file curl 'http://mara.ddp.net:3001/api/push/hoJD234qsx?status=down&msg=OK' else # need a space here to make the metric still have an issue field & so grafanas regex matches it echo "node_backups{what=\"state\",issue=\" \"} $RES" >> $prom_file curl 'http://mara.ddp.net:3001/api/push/hoJD234qsx?status=up&msg=OK' fi