k8s-at-home / charts

⚠️ Deprecated : Helm charts for applications you run at home
https://docs.k8s-at-home.com
Apache License 2.0
1.45k stars 621 forks source link

[mqtt-exporter] Issues with metrics/serviceMonitor #1736

Open reefland opened 2 years ago

reefland commented 2 years ago

Details

Helm chart name and version:

Issue when working with mqtt-exporter.

What steps did you take and what happened:

Possible missing section? mqtt-exporter section below indicates to check @default -- See values.yaml

metrics:
  # -- Enable and configure a Prometheus serviceMonitor for the chart under this key.
  # @default -- See values.yaml
  enabled: false
  serviceMonitor:
    # -- Interval at which Prometheus should scrape metrics
    interval: 30s
    # -- Timeout after which the scrape is ended
    scrapeTimeout: 10s
    # -- Additional labels for the Kubernetes `ServiceMonitor` object
    labels: {}

When I review the common/values.yaml there is nothing about metrics or serviceMonitor in it, seems like there should be.

What did you expect to happen:

Expected to see metrics section within the common values.yaml

Anything else you would like to add:

The mqtt-exporter chart, creates a service for no clear reason I could see, I assume that is for the serviceMonitor. This seems incorrect. a PodMonitor should be used for applications that do not require a service. It's not clear if a PodMonitor is supported since the metrics section is missing.

When I curl against the serviceMonitor, I get data back but there is really nothing about MQTT included:

$ k get svc -n mosquitto
NAME                               TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)          AGE
mosquitto-mqtt                     LoadBalancer   10.43.57.103   192.168.10.222   1883:31162/TCP   7h14m
mosquitto-exporter-mqtt-exporter   ClusterIP      10.43.23.150   <none>           9000/TCP         84m

$ curl -s http://10.43.23.150:9000/metrics
# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 95.0
python_gc_objects_collected_total{generation="1"} 296.0
python_gc_objects_collected_total{generation="2"} 0.0
# HELP python_gc_objects_uncollectable_total Uncollectable object found during GC
# TYPE python_gc_objects_uncollectable_total counter
python_gc_objects_uncollectable_total{generation="0"} 0.0
python_gc_objects_uncollectable_total{generation="1"} 0.0
python_gc_objects_uncollectable_total{generation="2"} 0.0
# HELP python_gc_collections_total Number of times this generation was collected
# TYPE python_gc_collections_total counter
python_gc_collections_total{generation="0"} 43.0
python_gc_collections_total{generation="1"} 3.0
python_gc_collections_total{generation="2"} 0.0
# HELP python_info Python platform information
# TYPE python_info gauge
python_info{implementation="CPython",major="3",minor="10",patchlevel="5",version="3.10.5"} 1.0
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 2.471936e+07
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.6093184e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.66009557928e+09
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 1.39
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 7.0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP mqtt_message_total Counter of received messages
# TYPE mqtt_message_total counter

There is nothing about the broker, clients connected, etc. which I assume there should be?

The exporter is connected and subscribed to the broker:

$ k logs mosquitto-exporter-mqtt-exporter-6dd9f8c77d-hg5n4 -n mosquitto
INFO:mqtt-exporter:subscribing to "#"
bjw-s commented 2 years ago

Thanks for taking the time to write up this issue. Exposing metrics / serviceMonitor is not a feature of the common library though, so this repo is not the correct place for it. I've moved it over to the charts repo, where it might be better suited.