UPC
Use upsc to get value from a UPC and show the value in a Grafana dashboard
upcs.sh
#!/bin/sh
charge=$(upsc eaton@127.0.0.1 2>/dev/null| grep 'battery.charge:' | cut -d ' ' -f 2)
load=$(upsc eaton@127.0.0.1 2>/dev/null| grep 'ups.load:' | cut -d ' ' -f2)
power=$(upsc eaton@127.0.0.1 2>/dev/null| grep 'ups.power:' | cut -d ' ' -f2)
frequency=$(upsc eaton@127.0.0.1 2>/dev/null| grep 'output.frequency:' | cut -d ' ' -f2)
voltage=$(upsc eaton@127.0.0.1 2>/dev/null| grep 'output.voltage:' | cut -d ' ' -f2)
input_frequency=$(upsc eaton@127.0.0.1 2>/dev/null| grep 'input.frequency:' | cut -d ' ' -f2)
input_voltage=$(upsc eaton@127.0.0.1 2>/dev/null| grep 'input.voltage:' | cut -d ' ' -f2)
realpower=$(upsc eaton@127.0.0.1 2>/dev/null| grep 'ups.realpower:' | cut -d ' ' -f2)
echo "ups,ups_name=eaton,host=127.0.0.1 charge=$charge,load=$load,power=$power,frequency=$frequency,voltage=$voltage,realpower=$realpower,input_frequency=$input_frequency,input_voltage=$input_voltage"
telegraf
[[inputs.exec]]
interval = "60s"
commands = [
"/opt/ups.sh"
]
data_format = "influx"
Data source config
Collector config:
Upload an updated version of an exported dashboard.json file from Grafana
Revision | Description | Created | |
---|---|---|---|
Download |