From c1925c1c715cd3f5d348528b4b3402d83beb3c4e Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 17 Jun 2025 13:11:34 +0200
Subject: [PATCH] Add node-exporter

---
 kas-pypcc-rpi.yml              |  2 +-
 recipes/node-exporter_1.9.1.bb | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 recipes/node-exporter_1.9.1.bb

diff --git a/kas-pypcc-rpi.yml b/kas-pypcc-rpi.yml
index f15ed3f..40595f3 100644
--- a/kas-pypcc-rpi.yml
+++ b/kas-pypcc-rpi.yml
@@ -86,7 +86,7 @@ local_conf_header:
     DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
     VIRTUAL-RUNTIME_init_manager = "systemd"
     VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
-    IMAGE_INSTALL:append = "ntp python3-pypcc python3-halibut-ipconfig vcgencmd dtc i2c-tools swupdate swupdate-www libgpiod libgpiod-tools libgpiod-dev kernel-module-i2c-gpio"
+    IMAGE_INSTALL:append = "node-exporter ntp python3-pypcc python3-halibut-ipconfig vcgencmd dtc i2c-tools swupdate swupdate-www libgpiod libgpiod-tools libgpiod-dev kernel-module-i2c-gpio"
     IMAGE_FSTYPES = "tar.bz2 ext4 ext4.gz wic.bz2 wic.bmap"
     SWUPDATE_IMAGES_FSTYPES[core-image-full-cmdline] = ".ubifs"
     IMAGE_BOOT_FILES:append = "halibut.dtbo;overlays/halibut.dtbo"
diff --git a/recipes/node-exporter_1.9.1.bb b/recipes/node-exporter_1.9.1.bb
new file mode 100644
index 0000000..e8fa133
--- /dev/null
+++ b/recipes/node-exporter_1.9.1.bb
@@ -0,0 +1,26 @@
+SUMMARY = "Prometheus Node Exporter - hardware and OS metrics exporter"
+HOMEPAGE = "https://github.com/prometheus/node_exporter"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${S}/${GO_INSTALL}/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
+
+SRC_URI = "git://github.com/prometheus/node_exporter.git;branch=release-1.8;protocol=https"
+SRCREV = "f1e0e8360aa60b6cb5e5cc1560bed348fc2c1895"
+PV = "1.8.2"
+
+GO_IMPORT = "github.com/prometheus/node_exporter"
+GO_INSTALL = "src/${GO_IMPORT}/"
+
+inherit go go-mod
+
+export GO111MODULE = "on"
+export GOPROXY = "https://proxy.golang.org"
+
+FILES:${PN} += "\
+    ${systemd_unitdir}/system/*.service \
+"
+
+do_install() {
+    install -Dm755 bin/linux_arm64/node_exporter ${D}${bindir}/node_exporter
+    install -Dm644 ${S}/${GO_INSTALL}/examples/systemd/node_exporter.service ${D}${systemd_unitdir}/system/node_exporter.service
+}
-- 
GitLab