From 32cbe079c60031f67ee91e2f74f39244a027eba6 Mon Sep 17 00:00:00 2001 From: Shinya Hayashi Date: Mon, 5 Feb 2024 04:16:26 +0000 Subject: [PATCH] systemd: add systemd unit file for ceph-exporter Signed-off-by: Shinya Hayashi --- ceph.spec.in | 1 + debian/ceph-exporter.install | 1 + systemd/CMakeLists.txt | 1 + systemd/ceph-exporter.service.in | 29 +++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 systemd/ceph-exporter.service.in diff --git a/ceph.spec.in b/ceph.spec.in index 58ccf067997..ff2bb741c6d 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -2052,6 +2052,7 @@ fi %files -n ceph-exporter %{_bindir}/ceph-exporter +%{_unitdir}/ceph-exporter.service %files -n rbd-fuse %{_bindir}/rbd-fuse diff --git a/debian/ceph-exporter.install b/debian/ceph-exporter.install index 618cf9eadcc..1ac0edcd2a1 100644 --- a/debian/ceph-exporter.install +++ b/debian/ceph-exporter.install @@ -1 +1,2 @@ +lib/systemd/system/ceph-exporter* usr/bin/ceph-exporter diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt index ad75ce61cd8..366bab4195d 100644 --- a/systemd/CMakeLists.txt +++ b/systemd/CMakeLists.txt @@ -14,6 +14,7 @@ set(CEPH_SYSTEMD_ENV_DIR "/etc/sysconfig" set(SYSTEMD_ENV_FILE "${CEPH_SYSTEMD_ENV_DIR}/ceph") foreach(service ceph-crash + ceph-exporter ceph-fuse@ ceph-mds@ ceph-mgr@ diff --git a/systemd/ceph-exporter.service.in b/systemd/ceph-exporter.service.in new file mode 100644 index 00000000000..f4f6d05c4b4 --- /dev/null +++ b/systemd/ceph-exporter.service.in @@ -0,0 +1,29 @@ +[Unit] +Description=Ceph cluster exporter daemon +PartOf=ceph.target +After=network-online.target local-fs.target +Before=ceph.target +Wants=network-online.target local-fs.target ceph.target ceph-mon.target + +[Service] +ExecReload=/bin/kill -HUP $MAINPID +ExecStart=/usr/bin/ceph-exporter -f --id %i --setuser ceph --setgroup ceph +LockPersonality=true +NoNewPrivileges=true +PrivateDevices=yes +PrivateTmp=true +ProtectControlGroups=true +ProtectHome=true +ProtectHostname=true +ProtectKernelLogs=true +ProtectKernelModules=true +ProtectKernelTunables=true +ProtectSystem=full +Restart=on-failure +RestartSec=10 +RestrictSUIDSGID=true +StartLimitBurst=3 +StartLimitInterval=30min + +[Install] +WantedBy=multi-user.target ceph.target