{"id":13582432,"url":"https://github.com/prometheus-community/systemd_exporter","last_synced_at":"2025-05-15T00:13:38.158Z","repository":{"id":37424172,"uuid":"176556296","full_name":"prometheus-community/systemd_exporter","owner":"prometheus-community","description":"Exporter for systemd unit metrics","archived":false,"fork":false,"pushed_at":"2025-04-01T15:09:32.000Z","size":276,"stargazers_count":316,"open_issues_count":33,"forks_count":34,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-13T22:39:20.754Z","etag":null,"topics":["metrics","prometheus","prometheus-exporter","system-information","system-metrics","systemd-metrics"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prometheus-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-03-19T16:35:15.000Z","updated_at":"2025-04-10T07:36:14.000Z","dependencies_parsed_at":"2024-05-01T16:30:28.518Z","dependency_job_id":"d15fd735-9b61-4c92-aea9-ffa54b480ff4","html_url":"https://github.com/prometheus-community/systemd_exporter","commit_stats":{"total_commits":144,"total_committers":16,"mean_commits":9.0,"dds":0.6805555555555556,"last_synced_commit":"d7bc71f564d8760fbb6e25bc13c24aaaa4cb095d"},"previous_names":["povilasv/systemd_exporter"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-community%2Fsystemd_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-community%2Fsystemd_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-community%2Fsystemd_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-community%2Fsystemd_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prometheus-community","download_url":"https://codeload.github.com/prometheus-community/systemd_exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249206,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metrics","prometheus","prometheus-exporter","system-information","system-metrics","systemd-metrics"],"created_at":"2024-08-01T15:02:42.343Z","updated_at":"2025-05-15T00:13:33.093Z","avatar_url":"https://github.com/prometheus-community.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Systemd exporter\n\n[![CircleCI](https://circleci.com/gh/prometheus-community/systemd_exporter/tree/master.svg?style=shield)](circleci)\n[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus-community/systemd_exporter)](https://goreportcard.com/report/github.com/prometheus-community/systemd_exporter)\n[![Docker Pulls](https://img.shields.io/docker/pulls/prometheuscommunity/systemd-exporter.svg?maxAge=604800)](https://hub.docker.com/r/prometheuscommunity/systemd-exporter)\n[![Docker Repository on Quay](https://quay.io/repository/prometheuscommunity/systemd-exporter/status)](https://quay.io/repository/prometheuscommunity/systemd-exporter)\n\nPrometheus exporter for systemd units, written in Go.\n\n## Relation to Node and Process Exporter\n\nThe focus on each exporter is different. For example, the [node_exporter](https://github.com/prometheus/node_exporter/) has a broad node level focus, and the [process-exporter](https://github.com/ncabatoff/process-exporter)\nis focused on deep analysis of specific processes. systemd-exporter aims to fit in the middle, taking \nadvantage of systemd's builtin process and thread grouping to provide application-level metrics. \n\n| Exporter         | Metric Goals                               | Example                                            |\n| ---------------- | ------------------------------------------ | -------------------------------------------------- |\n| node-exporter    | Machine-wide monitoring and usage summary  | CPU usage of entire node (e.g. `127.0.0.1`)        |\n| systemd-exporter | Systemd unit monitoring and resource usage | The state of each service (e.g. `mongodb.service`) |\n| process-exporter | Focus is on individual processes           | CPU of specific process ID (e.g. `1127`)           |\n| cAdvisor         | Metrics per cgroup (systemd uses cgroups)  | CPU usage of each cgroup (e.g. `system.slice/mongodb.service`\n\nSystemd groups processes, threads, and other resources (PIDs, memory, etc) into logical containers \ncalled units. Systemd-exporter will read the 11 different types of systemd units (e.g. service, slice, etc)\nand give you metrics about the health and resource consumption of each unit. This allows an application\nspecific view of your system, allowing you to determine resource usage of an application such as \n`mysql.service` independently from the resources used by other processes on your system.\n\nThis clearly allows more granular monitoring than machine-level metrics. However, we do not export \nmetrics for specific processes or threads. Said another way, the granularity of systemd-exporter is \nlimited by the size of the systemd unit. If you've chosen to pack 400 threads and 20 processes inside\nthe `mysql.service`, we will only export systemd provided metrics on the service unit, not on the\nindividual tasks. For that level of detail (and numerous other \"very fine grained\") metrics, you\nshould look into process-exporter.\n\nThere is overlap between these three exporters, so make sure to read the documents if you use multiple. \n\nFor example, if you are using systemd-exporter, then you should *not* enable these flags in node-exporter \nas we already expose identical metrics by default: `--systemd.collector.enable-task-metrics --systemd.collector.enable-restarts-metrics\n --systemd.collector.enable-start-time-metrics`. process-exporter has a concept of logically grouping\nprocesses according to the process names. This is a bottom-up variant of logical process grouping, while \nsystemd's approach is top-down (e.g. groups are named and then processes are launched in them). The systemd\napproach provides much stronger guarantees that no processes/threads are \"missing\" from your group, but \nit does also require that you are using systemd as your init system whereas the bottom-up approach works\non all systems.\n\n# Systemd versions\n\nThere is varying support for different metrics based on systemd version. \nFlags that come from newer systemd versions are disabled by default to avoid breaking things for users using older systemd versions. Try enabling different flags, to see what works on your system.\n\nOptional Flags:\n\nName     | Description | \n---------|-------------|\n--systemd.collector.enable-restart-count | Enables service restart count metrics. This feature only works with systemd 235 and above.\n--systemd.collector.enable-file-descriptor-size | Enables file descriptor size metrics. Systemd Exporter needs access to /proc/X/fd files.\n--systemd.collector.enable-ip-accounting | Enables service ip accounting metrics. This feature only works with systemd 235 and above.\n\nOf note, there is no customized support for `.snapshot` (removed in systemd v228), `.busname` (only present on systems using kdbus), `generated` (created via generators), `transient` (created during systemd-run) have no special support. \n\n# Deployment\n\nTo install this exporter, either:\n\n * Clone this Git repository and run `go build`.\n * Use one of the prebuilt binaries from the [releases page](https://github.com/prometheus-community/systemd_exporter/releases/).\n * Use the [Ansible systemd_exporter role](https://prometheus-community.github.io/ansible/branch/main/systemd_exporter_role.html).\n * On NixOS, use the [services.prometheus.exporters.systemd module](https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/monitoring/prometheus/exporters.nix).\n * Take a look at `examples` for daemonset manifests for Kubernetes.\n\n# User privilleges\n\nUser needs to access systemd dbus, typically exporter needs to see node's `/proc` to work.\n\n# Metrics\n\nAll metrics have `name` label, which contains systemd unit name. For example \n`name=\"bluetooth.service\"` or `name=\"systemd-coredump.socket\"`. Metrics that \nare present for all units (e.g. those named `unit_*`) additionally have a \nlabel type e.g. (`type=\"socket\"` or `type=\"service\"`) to allow usage in \nPromQL grouping queries (e.g. `count(systemd_unit_state) by (type)`)\n\nNote that a number of unit types are filtered by default\n\n| Metric name                                  | Metric type | Status   | Cardinality                                                        |\n| -------------------------------------------- | ----------- | -------- | ------------------------------------------------------------------ |\n| systemd_exporter_build_info                  | Gauge       | UNSTABLE | 1 per systemd-exporter                                             |\n| systemd_unit_info                            | Gauge       | UNSTABLE | 1 per service + 1 per mount                                        |\n| systemd_unit_state                           | Gauge       | UNSTABLE | 5 per unit {state=\"activating/active/deactivating/failed/inactive} |\n| systemd_unit_tasks_current                   | Gauge       | UNSTABLE | 1 per service                                                      |\n| systemd_unit_tasks_max                       | Gauge       | UNSTABLE | 1 per service                                                      |\n| systemd_unit_start_time_seconds              | Gauge       | UNSTABLE | 1 per service                                                      |\n| systemd_service_restart_total                | Gauge       | UNSTABLE | 1 per service                                                      |\n| systemd_service_ip_ingress_bytes             | Counter     | UNSTABLE | 1 per service                                                      |\n| systemd_service_ip_egress_bytes              | Counter     | UNSTABLE | 1 per service                                                      |\n| systemd_service_ip_ingress_packets_total     | Counter     | UNSTABLE | 1 per service                                                      |\n| systemd_service_ip_egress_packets_total      | Counter     | UNSTABLE | 1 per service                                                      |\n| systemd_socket_accepted_connections_total    | Counter     | UNSTABLE | 1 per socket                                                       |\n| systemd_socket_current_connections           | Gauge       | UNSTABLE | 1 per socket                                                       |\n| systemd_socket_refused_connections_total     | Gauge       | UNSTABLE | 1 per socket                                                       |\n| systemd_timer_last_trigger_seconds           | Gauge       | UNSTABLE | 1 per timer                                                        |\n| systemd_watchdog_enabled                     | Gauge       | UNSTABLE | 1 (only 1 watchdog configurable)                                   |\n| systemd_watchdog_last_ping_monotonic_seconds | Gauge       | UNSTABLE | 1                                                                  |\n| systemd_watchdog_last_ping_time_seconds      | Gauge       | UNSTABLE | 1                                                                  |\n| systemd_watchdog_runtime_seconds             | Gauge       | UNSTABLE | 1                                                                  |\n\n## Configuration\n\nsystemd_exporter allows you to include/exclude some systemd units. You can use `--systemd.collector.unit-include` and `--systemd.collector.unit-exclude` to select wanted units. Both of these options are in [RE2](https://github.com/google/re2/wiki/Syntax) syntax. For example:\n\n```\nargs:\n  - --systemd.collector.unit-include=.*ceph.*\\.service|ceph.*\\.timer|kubelet.service|docker.service\n  - --systemd.collector.unit-exclude=ceph-volume.*\\.service\n```\n\n## TLS and basic authentication\n\nThe systemd Exporter supports TLS and basic authentication.\n\nTo use TLS and/or basic authentication, you need to pass a configuration file\nusing the `--web.config.file` parameter. The format of the file is described\n[in the exporter-toolkit repository](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometheus-community%2Fsystemd_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprometheus-community%2Fsystemd_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometheus-community%2Fsystemd_exporter/lists"}