services: Remove mqtt-graphite

This commit is contained in:
polyfloyd 2024-04-14 13:40:26 +02:00
parent 1511f6df22
commit 051eef5bbf
5 changed files with 0 additions and 69 deletions

View file

@ -1,15 +0,0 @@
# Managed by Ansible
[Unit]
Description=MQTT to Graphite bridge
After=network.target
[Service]
Type=simple
ExecStart=/bin/bash /var/lib/mqtt-graphite.sh
Restart=on-failure
RestartSec=10s
DynamicUser=true
[Install]
WantedBy=multi-user.target

View file

@ -1,20 +0,0 @@
#!/bin/bash
GRAPHITE_HOST="100.64.0.11"
GRAPHITE_PORT="2003"
set -eu
set -o pipefail
mqtt-simple -h {{ mqtt_internal_host }} -t "#" |
while read line; do
topic=$(echo "$line" | cut -d' ' -f1 | sed 's/\//./g' | tr '[:upper:]' '[:lower:]')
value=$(echo "$line" | cut -s -d' ' -f2- | sed 's/closed/0/g;s/open/1/g')
# Only relay numeric values.
if [[ $value =~ ^-?[0-9]+\.?[0-9]*$ ]]; then
echo "$topic $value $(date +%s)" | nc -q0 "$GRAPHITE_HOST" "$GRAPHITE_PORT"
echo "$topic $value $(date +%s)"
fi
done