Files
systemd/units/systemd-imds-metrics@.service.in
T
Lennart Poettering 55db8dc12b imds: expose instance metadata as an io.systemd.Metrics provider
When systemd-imds is invoked as a Varlink service (via the new
systemd-imds-metrics.socket), it now acts as an io.systemd.Metrics
provider for systemd-report. It connects to systemd-imdsd over the
existing io.systemd.InstanceMetadata interface to acquire the real
data and re-exposes the detected cloud vendor plus the well-known
hostname, region, zone and public IPv4/IPv6 fields as metrics in the
io.systemd.InstanceMetadata.* namespace.

The metrics logic lives entirely on the client side
(imds-tool-metrics.c); systemd-imdsd is unchanged. Each metric is
acquired on demand with a blocking call to the daemon, benefiting from
its local cache. Fields that are unset or unsupported by the vendor are
simply omitted.

The metrics socket is statically enabled into sockets.target.wants/.
2026-06-22 22:03:12 +02:00

26 lines
895 B
Plaintext

# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Cloud Instance Metadata Metrics
Documentation=man:systemd-imds(1)
DefaultDependencies=no
Conflicts=shutdown.target initrd-switch-root.target
Before=shutdown.target initrd-switch-root.target
After=systemd-imdsd.socket
[Service]
# Runs systemd-imds as an io.systemd.Metrics provider. It connects to
# systemd-imdsd to acquire the actual data. Runs as root so the daemon's Polkit
# check on io.systemd.InstanceMetadata.Get() passes.
ExecStart={{LIBEXECDIR}}/systemd-imds
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes