Warning
This program is no longer maintained. See instead macos-ups-mqtt-connector & mqtt2influxdb.
Ship basic UPS stats from macOS to InfluxDB.
The following fields are written to an InfluxDB measurement on a periodic basis:
ac_attached
battery_charge_percent
The following syntax will run macos-ups-influx-connector
, and the program will keep running until it's killed.
macos-ups-influx-connector \
-influx-bucket "dzhome/autogen" \
-influx-server http://192.168.1.4:8086 \
-ups-nametag "work_desk" \
[OPTIONS ...]
-heartbeat-url string
: URL to GET every 60s, URL to GET every 60s, if and only if the program has successfully sent NUT statistics to Influx in the past 120s.
-influx-bucket string
: InfluxDB bucket. Supply a string in the formdatabase/retention-policy
. For the default retention policy, pass just a database name (without the slash character). Required.-influx-password string
: InfluxDB password.-influx-server string
: InfluxDB server, including protocol and port, e.g.http://192.168.1.4:8086
. Required.-influx-timeout int
: Timeout for writing to InfluxDB, in seconds. (default3
)-influx-username string
: InfluxDB username.-measurement-name string
: InfluxDB measurement name. (defaultups_stats
)-poll-interval int
: Polling interval, in seconds. (default30
)-ups-nametag string
: Value for theups_name
tag in InfluxDB. Required.-help
: Print help and exit.-version
: Print version and exit.
brew install cdzombak/oss/macos-ups-influx-connector
Pre-built binaries for Linux and macOS on various architectures are downloadable from each GitHub Release. Debian packages for each release are available as well.
git clone https://github.com/cdzombak/macos-ups-influx-connector.git
cd macos-ups-influx-connector
make build
cp out/macos-ups-influx-connector $INSTALL_DIR
After installing the binary via Homebrew, you can run it as a launchd service.
Install the launchd plist com.dzombak.macos-ups-influx-connector.plist
and customize that file as required (e.g. with the correct CLI options for your deployment):
mkdir -p "$HOME"/Library/LaunchAgents
curl -sSL https://raw.githubusercontent.com/cdzombak/macos-ups-influx-connector/main/com.dzombak.macos-ups-influx-connector.plist > "$HOME"/Library/LaunchAgents/com.dzombak.macos-ups-influx-connector.plist
nano "$HOME"/Library/LaunchAgents/com.dzombak.macos-ups-influx-connector.plist
MIT; see LICENSE
in this repository.
Chris Dzombak (GitHub @cdzombak).