aboutsummaryrefslogtreecommitdiff
path: root/utils/prometheus-node-exporter-ucode/Makefile
blob: 6a626d9f47e6c7ec0658b0940f33cfe95885991f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright (C) 2013-2017 OpenWrt.org

include $(TOPDIR)/rules.mk

PKG_NAME:=prometheus-node-exporter-ucode
PKG_VERSION:=2024.02.07
PKG_RELEASE:=1

PKG_MAINTAINER:=Andre Heider <a.heider@gmail.com>
PKG_LICENSE:=Apache-2.0

include $(INCLUDE_DIR)/package.mk

Build/Compile=

define Package/$(PKG_NAME)/Default
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=Prometheus node exporter
  PKGARCH:=all
endef

define Package/$(PKG_NAME)
  $(call Package/$(PKG_NAME)/Default)
  DEPENDS:=+uhttpd +uhttpd-mod-ucode +rpcd +ucode-mod-fs +ucode-mod-ubus
endef

define Package/$(PKG_NAME)/install
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF) ./files/config $(1)/etc/config/$(PKG_NAME)
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/init $(1)/etc/init.d/$(PKG_NAME)
	$(INSTALL_DIR) $(1)/usr/share/ucode/node-exporter/lib
	$(INSTALL_DATA) ./files/metrics.uc $(1)/usr/share/ucode/node-exporter/
	$(INSTALL_DATA) ./files/base/*.uc $(1)/usr/share/ucode/node-exporter/lib/
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) ./files/run.sh $(1)/usr/bin/$(PKG_NAME)
endef

define Package/$(PKG_NAME)/conffiles
/etc/config/$(PKG_NAME)
endef

define Package/$(PKG_NAME)/description
  Provides node metrics as Prometheus scraping endpoint.

  This service is a lightweight rewrite in ucode of the offical Prometheus node_exporter.
endef

$(eval $(call BuildPackage,prometheus-node-exporter-ucode))

define Collector
  define Package/$(PKG_NAME)-$(1)
    $$(call Package/$(PKG_NAME)/Default)
    TITLE+= ($(2))
    DEPENDS:=$(PKG_NAME) $(3)
  endef

  define Package/$(PKG_NAME)-$(1)/install
	$$(INSTALL_DIR) $$(1)/usr/share/ucode/node-exporter/lib
	$$(INSTALL_DATA) ./files/extra/$(1).uc $$(1)/usr/share/ucode/node-exporter/lib/
  endef

  $$(eval $$(call BuildPackage,$(PKG_NAME)-$(1)))
endef

$(eval $(call Collector,dnsmasq,Dnsmasq collector,@dnsmasq))
$(eval $(call Collector,ltq-dsl,Lantiq/Intel/MaxLinear DSL collector,@ltq-dsl-app))
$(eval $(call Collector,netstat,netstat collector,))
$(eval $(call Collector,openwrt,OpenWrt collector,))
$(eval $(call Collector,snmp6,snmp6 collector,))
$(eval $(call Collector,uci_dhcp_host,UCI DHCP host collector,))
$(eval $(call Collector,wifi,Wi-Fi collector,+ucode-mod-nl80211))
$(eval $(call Collector,wireguard,Wireguard collector,+rpcd-mod-wireguard))