diff --git a/kas-pypcc-rpi.yml b/kas-pypcc-rpi.yml index 40595f3cb87a2ff04c9098963ab3a24f4567d208..76a98bc756b70be3382306b19cf159ec7aefae27 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 = "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_INSTALL:append = "node-exporter chrony-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/chrony-exporter_0.12.0.bb b/recipes/chrony-exporter_0.12.0.bb new file mode 100644 index 0000000000000000000000000000000000000000..3c02577231cdee53e494c96e67c5cb18d12a7a44 --- /dev/null +++ b/recipes/chrony-exporter_0.12.0.bb @@ -0,0 +1,44 @@ +SUMMARY = "Prometheus Exporter for Chrony NTP" +HOMEPAGE = "https://github.com/SuperQ/chrony_exporter" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${S}/${GO_INSTALL}/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +FILESEXTRAPATHS:prepend := "${THISDIR}:" +SRC_URI = " \ + git://github.com/SuperQ/chrony_exporter.git;branch=main;protocol=https \ + file://files/chrony_exporter.service \ + file://files/chrony_exporter.socket \ + file://files/chrony_exporter.sysconfig \ +" +SRCREV = "f95d00763f6291742e51326402102ffd68d6d5cf" + +GO_IMPORT = "github.com/SuperQ/chrony_exporter" +GO_INSTALL = "src/${GO_IMPORT}/" + +inherit go go-mod + +export GO111MODULE = "on" +export GOPROXY = "https://proxy.golang.org" + +FILES:${PN} += "\ + ${systemd_unitdir}/system/chrony_exporter.service \ + ${systemd_unitdir}/system/chrony_exporter.socket \ + ${systemd_unitdir}/system/multi-user.target.wants/chrony_exporter.service \ + ${systemd_unitdir}/system/sockets.target.wants/chrony_exporter.socket \ + ${sysconfdir}/sysconfig/chrony_exporter \ +" + +do_install() { + install -Dm755 bin/linux_arm64/chrony_exporter ${D}${bindir}/chrony_exporter + + install -Dm644 ${WORKDIR}/files/chrony_exporter.service ${D}${systemd_unitdir}/system/chrony_exporter.service + install -d ${D}${systemd_unitdir}/system/multi-user.target.wants + ln -sf ../chrony_exporter.service ${D}${systemd_unitdir}/system/multi-user.target.wants/chrony_exporter.service + + install -Dm644 ${WORKDIR}/files/chrony_exporter.socket ${D}${systemd_unitdir}/system/chrony_exporter.socket + install -d ${D}${systemd_unitdir}/system/sockets.target.wants + ln -sf ../chrony_exporter.socket ${D}${systemd_unitdir}/system/sockets.target.wants/chrony_exporter.socket + + install -Dm644 ${WORKDIR}/files/chrony_exporter.sysconfig ${D}${sysconfdir}/sysconfig/chrony_exporter +} diff --git a/recipes/files/chrony_exporter.options b/recipes/files/chrony_exporter.options new file mode 100644 index 0000000000000000000000000000000000000000..cbf3bcdda70856bf5a0d39cd4932041d07e17b97 --- /dev/null +++ b/recipes/files/chrony_exporter.options @@ -0,0 +1 @@ +OPTIONS="--collector.sources" diff --git a/recipes/files/chrony_exporter.service b/recipes/files/chrony_exporter.service new file mode 100644 index 0000000000000000000000000000000000000000..5e9c9a64a92d37e9b32f70c51d49509161f42c99 --- /dev/null +++ b/recipes/files/chrony_exporter.service @@ -0,0 +1,11 @@ +[Unit] +Description=Chrony Exporter +Requires=chrony_exporter.socket + +[Service] +User=node_exporter +EnvironmentFile=/etc/sysconfig/chrony_exporter +ExecStart=/usr/sbin/chrony_exporter --web.systemd-socket $OPTIONS + +[Install] +WantedBy=multi-user.target diff --git a/recipes/files/chrony_exporter.socket b/recipes/files/chrony_exporter.socket new file mode 100644 index 0000000000000000000000000000000000000000..ae50e4ad3b5c8148810c0cf9878e656f705b05b2 --- /dev/null +++ b/recipes/files/chrony_exporter.socket @@ -0,0 +1,8 @@ +[Unit] +Description=Chrony Exporter + +[Socket] +ListenStream=9123 + +[Install] +WantedBy=sockets.target diff --git a/recipes/files/chrony_exporter.sysconfig b/recipes/files/chrony_exporter.sysconfig new file mode 100644 index 0000000000000000000000000000000000000000..cbf3bcdda70856bf5a0d39cd4932041d07e17b97 --- /dev/null +++ b/recipes/files/chrony_exporter.sysconfig @@ -0,0 +1 @@ +OPTIONS="--collector.sources" diff --git a/recipes/files/node_exporter.service b/recipes/files/node_exporter.service new file mode 100644 index 0000000000000000000000000000000000000000..82553e91eebc74f931d10325ed07529b684a4e97 --- /dev/null +++ b/recipes/files/node_exporter.service @@ -0,0 +1,11 @@ +[Unit] +Description=Node Exporter +Requires=node_exporter.socket + +[Service] +User=node_exporter +EnvironmentFile=/etc/sysconfig/node_exporter +ExecStart=/usr/sbin/node_exporter --web.systemd-socket $OPTIONS + +[Install] +WantedBy=multi-user.target diff --git a/recipes/files/node_exporter.socket b/recipes/files/node_exporter.socket new file mode 100644 index 0000000000000000000000000000000000000000..c3e5670bfbb5b703a42939c97dd8a186a7e4a8ff --- /dev/null +++ b/recipes/files/node_exporter.socket @@ -0,0 +1,8 @@ +[Unit] +Description=Node Exporter + +[Socket] +ListenStream=9100 + +[Install] +WantedBy=sockets.target diff --git a/recipes/files/node_exporter.sysconfig b/recipes/files/node_exporter.sysconfig new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/recipes/node-exporter_1.9.1.bb b/recipes/node-exporter_1.9.1.bb index 7d390c6d9b43f555f0e668c5d6fb8c8319265ce6..605feecf30940656aeb1b63560e2087430023e58 100644 --- a/recipes/node-exporter_1.9.1.bb +++ b/recipes/node-exporter_1.9.1.bb @@ -4,9 +4,14 @@ 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" +FILESEXTRAPATHS:prepend := "${THISDIR}:" +SRC_URI = " \ + git://github.com/prometheus/node_exporter.git;branch=release-1.8;protocol=https \ + file://files/node_exporter.service \ + file://files/node_exporter.socket \ + file://files/node_exporter.sysconfig \ +" SRCREV = "f1e0e8360aa60b6cb5e5cc1560bed348fc2c1895" -PV = "1.8.2" GO_IMPORT = "github.com/prometheus/node_exporter" GO_INSTALL = "src/${GO_IMPORT}/" @@ -17,13 +22,23 @@ export GO111MODULE = "on" export GOPROXY = "https://proxy.golang.org" FILES:${PN} += "\ - ${systemd_unitdir}/system/*.service \ + ${systemd_unitdir}/system/node_exporter.service \ + ${systemd_unitdir}/system/node_exporter.socket \ + ${systemd_unitdir}/system/multi-user.target.wants/node_exporter.service \ + ${systemd_unitdir}/system/sockets.target.wants/node_exporter.socket \ + ${sysconfdir}/sysconfig/node_exporter \ " 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 + install -Dm644 ${WORKDIR}/files/node_exporter.service ${D}${systemd_unitdir}/system/node_exporter.service install -d ${D}${systemd_unitdir}/system/multi-user.target.wants ln -sf ../node_exporter.service ${D}${systemd_unitdir}/system/multi-user.target.wants/node_exporter.service + + install -Dm644 ${WORKDIR}/files/node_exporter.socket ${D}${systemd_unitdir}/system/node_exporter.socket + install -d ${D}${systemd_unitdir}/system/sockets.target.wants + ln -sf ../node_exporter.socket ${D}${systemd_unitdir}/system/sockets.target.wants/node_exporter.socket + + install -Dm644 ${WORKDIR}/files/node_exporter.sysconfig ${D}${sysconfdir}/sysconfig/node_exporter }