zwave-prometheus-exporter
v0.0.10
Published
![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)
Downloads
10
Maintainers
Readme
⚡ zwave-prometheus-exporter
Listens to Z-Wave nodes and exports Prometheus metrics.
⚡ Installation
Using Docker
docker run \
-p 9850:9850 \
-v $(pwd)/metrics.json:/home/app/metrics.json \
-v $(pwd)/keys.json:/home/app/keys.json \
--device=/dev/ttyUSB0:/dev/ttyUSB0 \
--name zwave-prometheus-exporter \
--rm \
ilshidur/zwave-prometheus-exporter
As a global npm module
Node.js required.
npm i -g zwave-prometheus-exporter
zwave-prometheus-exporter
By cloning the git project
Node.js required.
git clone https://github.com/Ilshidur/zwave-prometheus-exporter.git
npm ci
node cli.js
⚡ Usage
Usage: zwave-prometheus-exporter [options]
Options:
-V, --version output the version number
-k, --keys <keys path> the keys file path (default: "keys.json")
-m, --metrics <metrics path> the metrics file path (default: "metrics.json")
-i, --input <input path> the serial port file path (default: "/dev/ttyUSB0")
-p --port <port> the port where the prometheus metrics will be exposed (default: 9850)
-h, --help display help for command
⚡ Configuration files
The CLI needs 2 files to run : metrics.json
and keys.json
. If no path is provided, the CLI will try to load zwave-prometheus-exporter/metrics.json
and zwave-prometheus-exporter/keys.json
.
Those 2 files are required for the CLI to run.
metrics.json
This file contains the Z-Wave values to monitor and export as Prometheus metrics.
Each field being :
name
: the name with which this Z-Wave value will be exposed as a Prometheus metric.commandClass
: the Command Class of the value to export.property
: the Command Class property of the value to export.propertyKey
: the Command Class property key of the value to export.
[
{
"name": "power_consumption_watts",
"commandClass": "0x32",
"property": "value",
"propertyKey": 66049
},
{
"name": "power_consumption_volts",
"commandClass": "0x32",
"property": "value",
"propertyKey": 66561
},
{
"name": "power_consumption_amperes",
"commandClass": "0x32",
"property": "value",
"propertyKey": 66817
}
]
keys.json
This file contains the Z-Wave keys used to communicate securely with the Z-Wave nodes. Each key is a 32 hex caracters length with different content. Sharing keys between multiple security classes is a security risk!
You can find more details on the Z-Wave JS docs.
{
"s2": {
"accessControl": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"authenticated": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"unauthenticated": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"s0": {
"legacy": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
⚡ TODO
- Process to securely add a node into the Z-Wave network.