Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hilli/apcupsd_json_status
Takes apcupsd state and output JSON for monitoring systems
https://github.com/hilli/apcupsd_json_status
Last synced: 5 days ago
JSON representation
Takes apcupsd state and output JSON for monitoring systems
- Host: GitHub
- URL: https://github.com/hilli/apcupsd_json_status
- Owner: hilli
- License: mit
- Created: 2019-11-29T14:23:48.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-03T08:24:38.000Z (about 5 years ago)
- Last Synced: 2023-03-10T20:47:12.169Z (almost 2 years ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![](https://github.com/hilli/apcupsd_json_status/workflows/Build/badge.svg)](https://github.com/hilli/apcupsd_json_status/actions)
# apcupsd_json_status
The program is intended to talk to a `apcupsd` daemon, listing on it's NIS interface.
It will output the found parameters in a single line of JSON, suitable for many modern monitoring tools. My own usecase is for [Humio](https://www.humio.com). If you are using Prometheus, check out [Matt Layher](https://github.com/mdlayher)s [apcupsd_exporter](https://github.com/mdlayher/apcupsd_exporter) (He also created the library this project is using to collect the data from the apcupsd, so thanks Matt).## Examples:
### Get a single status from the UPS
```
# ./apcupsd_json_status
{"timestamp":"2019-12-02T08:36:49.063416+01:00","USBName":"UPS1","UPSMode":"Stand Alone","UPSModel":"Smart-UPS 3000 RM","LoadPercent":33.1,"BatteryChargePercent":100,"LineVolts":231.8,"NominalInputVoltage":0,"BatteryVoltage":54,"NominalBatteryVoltage":48,"BatteryNumberTransfersTotal":0,"BatteryTimeLeftSeconds":1440,"BatteryTimeOnSeconds":0,"LastTransferOnBattery":"0001-01-01T00:00:00Z","LastTransferOffBattery":"0001-01-01T00:00:00Z","LastSelftest":"0001-01-01T00:00:00Z","NominalPowerWatts":0}
```### Run as a daemon
```
# ./apcupsd_json_status -d
{"timestamp":"2019-12-02T08:36:49.063416+01:00","USBName":"UPS1","UPSMode":"Stand Alone","UPSModel":"Smart-UPS 3000 RM","LoadPercent":33.1,"BatteryChargePercent":100,"LineVolts":231.8,"NominalInputVoltage":0,"BatteryVoltage":54,"NominalBatteryVoltage":48,"BatteryNumberTransfersTotal":0,"BatteryTimeLeftSeconds":1440,"BatteryTimeOnSeconds":0,"LastTransferOnBattery":"0001-01-01T00:00:00Z","LastTransferOffBattery":"0001-01-01T00:00:00Z","LastSelftest":"0001-01-01T00:00:00Z","NominalPowerWatts":0}
{"timestamp":"2019-12-02T08:37:09.184618+01:00","USBName":"UPS1","UPSMode":"Stand Alone","UPSModel":"Smart-UPS 3000 RM","LoadPercent":33.8,"BatteryChargePercent":100,"LineVolts":231.8,"NominalInputVoltage":0,"BatteryVoltage":51.6,"NominalBatteryVoltage":48,"BatteryNumberTransfersTotal":0,"BatteryTimeLeftSeconds":1500,"BatteryTimeOnSeconds":0,"LastTransferOnBattery":"0001-01-01T00:00:00Z","LastTransferOffBattery":"0001-01-01T00:00:00Z","LastSelftest":"0001-01-01T00:00:00Z","NominalPowerWatts":0}
etc...
```### Specific connection to the apcupsd
```
# ./apcupsd_json_status -d -c ups-host:3351
```Default it will try to connect to localhost:3351.