Help with influxdb service.....
See original GitHub issueI’ve been contributing to yet another service…somethign that takes all my docker containers and pushes them out via mqtt…specifically it has the memory used and cpu of each container. (https://github.com/psyciknz/docker2mqtt)
Now I’d like to get than in influx, and though about using the mqttwarn influxdb service.
Here’s the example of a bunch of topics that I generate:
sensors/d2m/Melkor/logspout/name logspout
sensors/d2m/Melkor/logspout/image micahhausler/logspout:gelf
sensors/d2m/Melkor/logspout/status running
sensors/d2m/Melkor/logspout/state on
sensors/d2m/Melkor/logspout/memoryused 6.738
sensors/d2m/Melkor/logspout/memorylimit 10.0
sensors/d2m/Melkor/logspout/netinput 0.93359375
sensors/d2m/Melkor/logspout/netoutput 223.0
sensors/d2m/Melkor/logspout/blockinput 18.4
sensors/d2m/Melkor/logspout/blockoutput 0.0
sensors/d2m/Melkor/logspout/memory 6.738MiB / 10MiB
sensors/d2m/Melkor/logspout/cpu 0.84%
sensors/d2m/Melkor/logspout/netio 956kB / 223MB
Of note is that Melkor is a server…this will change depending on the docker host. logspout is the container. This is an example of a container on each hose.
Ideally I’d want the memory used and cpu to go into an influx db with the server,container the measurement and the value.
I can’t quite rememember what I should have for fields and tags for this. Field is the cpu, and the tags are the server and container?
Anyway, not specifically an mqttwatrn issue, but might be a fun exercise…if I have to I’ll write to influx directly from the new service.
I’ve got the following for the config:
; -----------------------------------------
; Docker2mqtt
; -----------------------------------------
; Docker 2 mqtt
[docker 2 mqtt]
;sensors/d2m/Melkor/d2mqtt/cpu 2.15%
topic = sensors/d2m/Melkor/#
targets = log:info, influxdb:docker2mqtt
format = server=Melkor,container= value=
Where I’m specifically setting the server, but if I could pull from sensors/d2m/#
it would be better.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
I believe there are examples in our documentation.
Glad you got it all going with @jacques42’s help. I’ll now close.
I don’t really see why the topic matches from your
mqttwarn.ini
config, so I am a bit puzzled. I think what it should look like see below (but please adjust to exactly match, in case needed).I also notice you want to take on key / values from the payload, so we need to slightly change the approach to use the
alldata
function, please notice this change:and the alldata function - you need to change the mqttwarn logging settings to DEBUG in the ini file, in order to see output from that in the logs:
Note that I adjusted the config right here in Github and did not try this out so apologize if there is syntax errors or anything.