Monitor systemd service from dockerized Metricbeat

I wonder if there's a way to stream the metrics (such as cpu, mem usage, diskio etc.) of systemd services to Elasticsearch through Metricbeat.

To monitor the services running on the host, we could use the system module.

In order to monitor the systemd services, we would need to enable the system service metricset. However, the service metricset will not return the metrics, instead, it will only show the state.
Here is an example

"system": {
      "service": {
        "state": "active",
        "sub_state": "running",
        "unit_file": {
          "state": "enabled",
          "vendor_preset": "enabled"
        },
        "resources": {
          "tasks": {
            "count": 104
          }
        },
        "state_since": "2023-01-30T00:00:00.476Z",
        "name": "a-random-service.service",
        "load_state": "loaded"
      }
    }

How could I configure metricbeat to monitor the metrics of the systemd services as well?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.