Skip to content

The metrics endpoint #82

@khaaliid

Description

@khaaliid

Hello, I would like to thank you for the great effort you are doing for that project.

I used this project in my setup and I was able to connect to the MQTT successfully, also I can see the metrics printed out in the logs when I enabled the debug level logging. But when I tried to access the /metrics endpoint what I get are some internal metrics ( i.e. go_gc_duration_seconds{quantile="0"} 4.5e-05 ) .. the only part I found which can be relevant to the MQTT is below 3 lines and the number at the end of the third line (13) increased whenever new metric added to the Topic. Is that expected or I have missed something in my configuration?

# HELP received_messages received messages per topic and status
# TYPE received_messages counter
received_messages{status="success",topic="mydev/3/test_metrics"} 13

Below is the config file used:

mqtt:
 server: tcp://10.51.209.100:1883
 client_id: testmqqt
 topic_path: mydev/3/test_metrics
 device_id_regex: "mydev/?(?P<deviceid>.*)/.*"
 qos: 0
cache:
 timeout: 24h
json_parsing:
 separator: .
metrics:
 - prom_name: cpu_load
   mqtt_name: cpu_load
   help: test CPU load
   type: gauge
 - prom_name: memory_usage
   mqtt_name: memory_usage
   help: test memory usage
   type: gauge

And below is the mqtt2prometheus logs :

2022-03-11T15:16:30Z info mqttclient/mqttClient.go:21 Will subscribe to topic {"topic": "mydev/3/test_metrics"}
2022-03-11T15:16:31Z debug metrics/ingest.go:42 Got message {"topic": "mydev/3/test_metrics", "payload": "{"cpu_load":95.80 ,"memory_usage":123456789678.60 }\u0000"}

Thanks ..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions