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/.
23 lines
639 B
SYSTEMD
23 lines
639 B
SYSTEMD
# 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
|
|
Before=sockets.target
|
|
|
|
[Socket]
|
|
ListenStream=/run/systemd/report/io.systemd.InstanceMetadata
|
|
FileDescriptorName=varlink
|
|
SocketMode=0666
|
|
Accept=yes
|
|
MaxConnectionsPerSource=16
|
|
RemoveOnStop=yes
|