modified readme
This commit is contained in:
parent
5b77a6a059
commit
5db2f64a54
53
README.md
53
README.md
@ -2,37 +2,58 @@
|
|||||||
|
|
||||||
A simple go app that reads SNMP values and publishes it to the specified MQTT endpoint at the specified interval.
|
A simple go app that reads SNMP values and publishes it to the specified MQTT endpoint at the specified interval.
|
||||||
|
|
||||||
Please download the precompiled binary from the releases page: https://github.com/dchote/snmp-mqtt/releases
|
In constrast to the original version, all configuration must be provided via an environment variable containing
|
||||||
|
a JSON string.
|
||||||
|
|
||||||
|
The MQTT configuration is part of this JSON string.
|
||||||
|
|
||||||
|
The topic has been moved to the MQTT configuration and there is now only one topic for all endpoints and variables.
|
||||||
|
|
||||||
|
The published message on MQTT looks like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
Usage: snmp-mqtt [options]
|
{"device":"172.16.3.1","label":"router","variables":{"lan-in":{"label":"lan-in","variable":".1.3.6.1.2.1.31.1.1.1.6.2","value":"979673705579"},"lan-out":{"label":"lan-out","variable":".1.3.6.1.2.1.31.1.1.1.10.2","value":"1813410276168"},"wan-in":{"label":"wan-in","variable":".1.3.6.1.2.1.31.1.1.1.6.4","value":"83591215399"},"wan-out":{"label":"wan-out","variable":".1.3.6.1.2.1.31.1.1.1.10.4","value":"83741895468"}}}
|
||||||
|
|
||||||
Options:
|
|
||||||
--endpoints_map=<endpoints_map> SNMP Endpoints Map File [default: ./endpoints.json]
|
|
||||||
--server=<server> MQTT server host/IP [default: 127.0.0.1]
|
|
||||||
--port=<port> MQTT server port [default: 1883]
|
|
||||||
--topic=<topic> MQTT topic prefix [default: snmp]
|
|
||||||
--clientid=<clientid> MQTT client identifier [default: snmp]
|
|
||||||
--interval=<interval> Poll interval (seconds) [default: 5]
|
|
||||||
-h, --help Show this screen.
|
|
||||||
-v, --version Show version.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
An example endpoints.json file:
|
```
|
||||||
|
export SNMP_MQTT_CONF=$(cat config.json)
|
||||||
|
./smq
|
||||||
|
```
|
||||||
|
|
||||||
|
An example config.json file:
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
|
"mqtt": {
|
||||||
|
"broker": "mqtt://172.23.1.102:1883",
|
||||||
|
"tlsEnable": "false",
|
||||||
|
"topic": "snmp"
|
||||||
|
},
|
||||||
|
"interval": 10,
|
||||||
"snmpEndpoints": [
|
"snmpEndpoints": [
|
||||||
{
|
{
|
||||||
"endpoint": "172.18.0.1",
|
"endpoint": "172.16.3.1",
|
||||||
|
"label": "router",
|
||||||
"community": "public",
|
"community": "public",
|
||||||
"oidTopics": [
|
"oidTopics": [
|
||||||
{
|
{
|
||||||
"oid": ".1.3.6.1.2.1.31.1.1.1.6.4",
|
"oid": ".1.3.6.1.2.1.31.1.1.1.6.4",
|
||||||
"topic": "router/bytesIn"
|
"label": "wan-in",
|
||||||
|
"diff": "true"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"oid": ".1.3.6.1.2.1.31.1.1.1.10.4",
|
"oid": ".1.3.6.1.2.1.31.1.1.1.10.4",
|
||||||
"topic": "router/bytesOut"
|
"label": "wan-out",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.6.2",
|
||||||
|
"label": "lan-in",
|
||||||
|
"diff": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"oid": ".1.3.6.1.2.1.31.1.1.1.10.2",
|
||||||
|
"label": "lan-out",
|
||||||
|
"diff": "true"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user