Grafana Agent to pull systemd metrics

Hi
While we are getting the metrics from grafana agent , we also have a requirement to monitor a a specific services running on a server .
How do we enable systemd metrics to be pulled by grafana agent ?

Hey Suresh! If Grafana Agent was installed using the Grafana Cloud agent script, you should be all set up to monitor systemd metrics:

If you have custom configurations that you want to use, you can create and maintain your own custom configuration file by changing the environment variable in /etc/default/grafana-agent to point to your custom configuration file instead of the default location.

For more configuration options, see agent/configuration-reference.md at main · grafana/agent · GitHub

Hi @Melody
Thanks for your response and I have missed this process exporter some how in first place :grinning:.
Now I am able to pull the process metrics too .

Thanks
K Suresh

I was config by Grafana Cloud agent script but I not found systemd colect, anyone tell me how to config to enable this config ?

Hello @dzungbk042 thank you for bringing up this thread again.

For systemd metrics we do not have an bundled integration with the agent.
You would need to run an additional tool, the systemd_exporter, and point your Grafana Agent at the exported metrics.

More info about the exporter is available here:

Below is an example config for a Grafana agent that contains a metrics config stanza to scrape the systemd metrics from the target exporter.

server:
  log_level: info

metrics:
  global:
    scrape_interval: 1m
  remote_write:
  - url: https://prometheus-prod-10-prod-us-central-0.grafana.net/api/prom/push
    basic_auth:
      username: <Your Grafana.com User ID>
      password: <Your Grafana.com API Key>
  configs:
    - name: default
      scrape_configs:
        - job_name: systemd
          static_configs:
            - targets: ['<127.0.0.1:9558 >'] # This is the target systemd_exporter host:port 

For additional reference, here are the Grafana agent metrics docs.

And the prometheus scrape configs docs.

thank for your info, I found on on setting prometheus have config “systemd_unit_include”

Glad you got it sorted @dzungbk042!

Node_exporter has a number of collectors that are disabled by default.
A flag is needed to enable this functionality.

The Grafana Agent can be configured using the node_exporter integration config similar to below.

integrations:
  node_exporter:
    enabled: true
    enable_collectors:
      - systemd
    systemd_unit_exclude: ".+\\.(automount|device|mount|scope|slice)"
    systemd_unit_include: ".+"
    systemd_enable_restarts_metrics: true
    systemd_enable_start_time_metrics: true

See the node_exporter_config docs to read about other collectors and config points.

1 Like

I miss “enable_collectors:
- systemd” on my config
Thank peterolivo