remove topic prefix
This commit is contained in:
parent
35371304d0
commit
44671ac3cd
@ -37,9 +37,6 @@ var (
|
||||
// ClientID is how the name of the client
|
||||
ClientID string
|
||||
|
||||
// TopicPrefix is just that, a prefix for the presented data keys
|
||||
TopicPrefix string
|
||||
|
||||
// Interval is the poll interval in seconds
|
||||
Interval int
|
||||
)
|
||||
|
@ -6,11 +6,19 @@
|
||||
"oidTopics": [
|
||||
{
|
||||
"oid": ".1.3.6.1.2.1.31.1.1.1.6.4",
|
||||
"topic": "router/bytesIn"
|
||||
"topic": "network/router/interfaces/wan/bytesIn"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.2.1.31.1.1.1.10.4",
|
||||
"topic": "router/bytesOut"
|
||||
"topic": "network/router/interfaces/wan/bytesOut"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.2.1.31.1.1.1.6.2",
|
||||
"topic": "network/router/interfaces/lan/bytesIn"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.2.1.31.1.1.1.10.2",
|
||||
"topic": "network/router/interfaces/lan/bytesOut"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -20,11 +28,11 @@
|
||||
"oidTopics": [
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1",
|
||||
"topic": "rackPDU/totalLoad"
|
||||
"topic": "power/rackPDU/outputCurrentX10"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.12.1.16.0",
|
||||
"topic": "rackPDU/watts"
|
||||
"topic": "power/rackPDU/watts"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -34,23 +42,23 @@
|
||||
"oidTopics": [
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.3.2.1.0",
|
||||
"topic": "rackUPS/lineVoltage"
|
||||
"topic": "power/rackUPS/lineVoltage"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.4.2.4.0",
|
||||
"topic": "rackUPS/outputCurrent"
|
||||
"topic": "power/rackUPS/outputCurrent"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.2.2.1.0",
|
||||
"topic": "rackUPS/batteryCapacity"
|
||||
"topic": "power/rackUPS/batteryCapacity"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.2.2.3.0",
|
||||
"topic": "rackUPS/batteryRuntime"
|
||||
"topic": "power/rackUPS/batteryRuntime"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.2.2.2.0",
|
||||
"topic": "rackUPS/batteryTemperature"
|
||||
"topic": "power/rackUPS/batteryTemperature"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -60,23 +68,23 @@
|
||||
"oidTopics": [
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.3.2.1.0",
|
||||
"topic": "printerUPS/lineVoltage"
|
||||
"topic": "power/printerUPS/lineVoltage"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.4.2.4.0",
|
||||
"topic": "printerUPS/outputCurrent"
|
||||
"topic": "power/printerUPS/outputCurrent"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.2.2.1.0",
|
||||
"topic": "printerUPS/batteryCapacity"
|
||||
"topic": "power/printerUPS/batteryCapacity"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.2.2.3.0",
|
||||
"topic": "printerUPS/batteryRuntime"
|
||||
"topic": "power/printerUPS/batteryRuntime"
|
||||
},
|
||||
{
|
||||
"oid": ".1.3.6.1.4.1.318.1.1.1.2.2.2.0",
|
||||
"topic": "printerUPS/batteryTemperature"
|
||||
"topic": "power/printerUPS/batteryTemperature"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ 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.
|
||||
@ -42,11 +41,10 @@ Options:
|
||||
|
||||
config.Server, _ = args.String("--server")
|
||||
config.Port, _ = args.Int("--port")
|
||||
config.TopicPrefix, _ = args.String("--topic")
|
||||
config.ClientID, _ = args.String("--clientid")
|
||||
config.Interval, _ = args.Int("--interval")
|
||||
|
||||
log.Printf("server: %s, port: %d, topic prefix: %s, client identifier: %s, poll interval: %d", config.Server, config.Port, config.TopicPrefix, config.ClientID, config.Interval)
|
||||
log.Printf("server: %s, port: %d, client identifier: %s, poll interval: %d", config.Server, config.Port, config.ClientID, config.Interval)
|
||||
}
|
||||
|
||||
// sigChannelListen basic handlers for inbound signals
|
||||
|
@ -73,7 +73,7 @@ func Init() {
|
||||
}
|
||||
|
||||
log.Printf("%s = %s", oidTopic.Topic, convertedValue)
|
||||
token := client.Publish(config.TopicPrefix+"/"+oidTopic.Topic, 0, false, convertedValue)
|
||||
token := client.Publish(oidTopic.Topic, 0, false, convertedValue)
|
||||
|
||||
token.Wait()
|
||||
if token.Error() != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user