You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

240 lines
10 KiB

prometheus-node-exporter-lua: add bmx6/7 scraper scrapes bmx6 status and connected links. example output: bmx6_status{id="qMp-LibreMesh-1706",version="BMX6-0.1-alpha",address="fd66:66:66:a:6670:2ff:fe3e:9d28"} 1 bmx6_link_rxRate{target="UPC-CN-C6-E104-Alix",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 bmx6_link_txRate{target="UPC-CN-C6-E104-Alix",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 bmx6_link_rxRate{target="UPC-CN-C6-E104-Alix-Paul",source="qMp-LibreMesh-1706",dev="wlan1-adhoc_12"} 100 bmx6_link_txRate{target="UPC-CN-C6-E104-Alix-Paul",source="qMp-LibreMesh-1706",dev="wlan1-adhoc_12"} 100 bmx6_link_rxRate{target="UPC-CN-C6-E104-Turoffner",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 97 bmx6_link_txRate{target="UPC-CN-C6-E104-Turoffner",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 node_scrape_collector_duration_seconds{collector="bmx6"} 0.0025260448455811 node_scrape_collector_success{collector="bmx6"} 1 scrapes bmx7 status and connected links. example output: bmx7_status{id="C68791D2",revision="3a52f89",name="smpl-18f4ce",address="fd70:c687:91d2:8ab3:1a88:6b14:bad0:2b18"} 1 bmx7_cpu_usage 0.7 bmx7_mem_usage 3204000 bmx7_link_rxRate{target="F48239CD",dev="wlan0-mesh_13",source="C68791D2",name="smpl-07889a"} 54000 bmx7_link_txRate{target="F48239CD",dev="wlan0-mesh_13",source="C68791D2",name="smpl-07889a"} 52729 node_scrape_collector_duration_seconds{collector="bmx7"} 0.0020999908447266 node_scrape_collector_success{collector="bmx7"} 1 prometheus-node-exporter-lua: bmx6/7 netjson format adds labels called source and target to links instead of only the target previously called "id". Retrieving all *links* from prometheus now makes it easier to create a valid netjson(.org) graph. It's not feasible to use *instance* as *source* as for instance likely the name is used for dns, instead of the ID. Using the *name* instead of *id* for netjson linking results in a bad graph when two devices have the same (default) hostname. Signed-off-by: Paul Spooren <spooren@informatik.uni-leipzig.de>
7 years ago
prometheus-node-exporter-lua: add bmx6/7 scraper scrapes bmx6 status and connected links. example output: bmx6_status{id="qMp-LibreMesh-1706",version="BMX6-0.1-alpha",address="fd66:66:66:a:6670:2ff:fe3e:9d28"} 1 bmx6_link_rxRate{target="UPC-CN-C6-E104-Alix",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 bmx6_link_txRate{target="UPC-CN-C6-E104-Alix",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 bmx6_link_rxRate{target="UPC-CN-C6-E104-Alix-Paul",source="qMp-LibreMesh-1706",dev="wlan1-adhoc_12"} 100 bmx6_link_txRate{target="UPC-CN-C6-E104-Alix-Paul",source="qMp-LibreMesh-1706",dev="wlan1-adhoc_12"} 100 bmx6_link_rxRate{target="UPC-CN-C6-E104-Turoffner",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 97 bmx6_link_txRate{target="UPC-CN-C6-E104-Turoffner",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 node_scrape_collector_duration_seconds{collector="bmx6"} 0.0025260448455811 node_scrape_collector_success{collector="bmx6"} 1 scrapes bmx7 status and connected links. example output: bmx7_status{id="C68791D2",revision="3a52f89",name="smpl-18f4ce",address="fd70:c687:91d2:8ab3:1a88:6b14:bad0:2b18"} 1 bmx7_cpu_usage 0.7 bmx7_mem_usage 3204000 bmx7_link_rxRate{target="F48239CD",dev="wlan0-mesh_13",source="C68791D2",name="smpl-07889a"} 54000 bmx7_link_txRate{target="F48239CD",dev="wlan0-mesh_13",source="C68791D2",name="smpl-07889a"} 52729 node_scrape_collector_duration_seconds{collector="bmx7"} 0.0020999908447266 node_scrape_collector_success{collector="bmx7"} 1 prometheus-node-exporter-lua: bmx6/7 netjson format adds labels called source and target to links instead of only the target previously called "id". Retrieving all *links* from prometheus now makes it easier to create a valid netjson(.org) graph. It's not feasible to use *instance* as *source* as for instance likely the name is used for dns, instead of the ID. Using the *name* instead of *id* for netjson linking results in a bad graph when two devices have the same (default) hostname. Signed-off-by: Paul Spooren <spooren@informatik.uni-leipzig.de>
7 years ago
prometheus-node-exporter-lua: add bmx6/7 scraper scrapes bmx6 status and connected links. example output: bmx6_status{id="qMp-LibreMesh-1706",version="BMX6-0.1-alpha",address="fd66:66:66:a:6670:2ff:fe3e:9d28"} 1 bmx6_link_rxRate{target="UPC-CN-C6-E104-Alix",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 bmx6_link_txRate{target="UPC-CN-C6-E104-Alix",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 bmx6_link_rxRate{target="UPC-CN-C6-E104-Alix-Paul",source="qMp-LibreMesh-1706",dev="wlan1-adhoc_12"} 100 bmx6_link_txRate{target="UPC-CN-C6-E104-Alix-Paul",source="qMp-LibreMesh-1706",dev="wlan1-adhoc_12"} 100 bmx6_link_rxRate{target="UPC-CN-C6-E104-Turoffner",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 97 bmx6_link_txRate{target="UPC-CN-C6-E104-Turoffner",source="qMp-LibreMesh-1706",dev="wlan0-mesh_12"} 100 node_scrape_collector_duration_seconds{collector="bmx6"} 0.0025260448455811 node_scrape_collector_success{collector="bmx6"} 1 scrapes bmx7 status and connected links. example output: bmx7_status{id="C68791D2",revision="3a52f89",name="smpl-18f4ce",address="fd70:c687:91d2:8ab3:1a88:6b14:bad0:2b18"} 1 bmx7_cpu_usage 0.7 bmx7_mem_usage 3204000 bmx7_link_rxRate{target="F48239CD",dev="wlan0-mesh_13",source="C68791D2",name="smpl-07889a"} 54000 bmx7_link_txRate{target="F48239CD",dev="wlan0-mesh_13",source="C68791D2",name="smpl-07889a"} 52729 node_scrape_collector_duration_seconds{collector="bmx7"} 0.0020999908447266 node_scrape_collector_success{collector="bmx7"} 1 prometheus-node-exporter-lua: bmx6/7 netjson format adds labels called source and target to links instead of only the target previously called "id". Retrieving all *links* from prometheus now makes it easier to create a valid netjson(.org) graph. It's not feasible to use *instance* as *source* as for instance likely the name is used for dns, instead of the ID. Using the *name* instead of *id* for netjson linking results in a bad graph when two devices have the same (default) hostname. Signed-off-by: Paul Spooren <spooren@informatik.uni-leipzig.de>
7 years ago
  1. #
  2. # Copyright (C) 2013-2017 OpenWrt.org
  3. #
  4. include $(TOPDIR)/rules.mk
  5. PKG_NAME:=prometheus-node-exporter-lua
  6. PKG_VERSION:=2022.04.18
  7. PKG_RELEASE:=1
  8. PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
  9. PKG_LICENSE:=Apache-2.0
  10. include $(INCLUDE_DIR)/package.mk
  11. Build/Compile=
  12. define Package/prometheus-node-exporter-lua/Default
  13. SECTION:=utils
  14. CATEGORY:=Utilities
  15. TITLE:=Prometheus node exporter
  16. PKGARCH:=all
  17. endef
  18. define Package/prometheus-node-exporter-lua
  19. $(call Package/prometheus-node-exporter-lua/Default)
  20. DEPENDS:=+luasocket +lua
  21. endef
  22. define Package/prometheus-node-exporter-lua/install
  23. $(INSTALL_DIR) $(1)/etc/config
  24. $(INSTALL_CONF) ./files/etc/config/prometheus-node-exporter-lua $(1)/etc/config/prometheus-node-exporter-lua
  25. $(INSTALL_DIR) $(1)/etc/init.d
  26. $(INSTALL_BIN) ./files/etc/init.d/prometheus-node-exporter-lua $(1)/etc/init.d/prometheus-node-exporter-lua
  27. $(INSTALL_DIR) $(1)/usr/bin
  28. $(INSTALL_BIN) ./files/usr/bin/prometheus-node-exporter-lua $(1)/usr/bin/prometheus-node-exporter-lua
  29. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  30. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/cpu.lua $(1)/usr/lib/lua/prometheus-collectors/
  31. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/conntrack.lua $(1)/usr/lib/lua/prometheus-collectors/
  32. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/entropy.lua $(1)/usr/lib/lua/prometheus-collectors/
  33. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/filefd.lua $(1)/usr/lib/lua/prometheus-collectors/
  34. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/loadavg.lua $(1)/usr/lib/lua/prometheus-collectors/
  35. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/meminfo.lua $(1)/usr/lib/lua/prometheus-collectors/
  36. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/netdev.lua $(1)/usr/lib/lua/prometheus-collectors/
  37. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/time.lua $(1)/usr/lib/lua/prometheus-collectors/
  38. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/uname.lua $(1)/usr/lib/lua/prometheus-collectors/
  39. endef
  40. define Package/prometheus-node-exporter-lua/conffiles
  41. /etc/config/prometheus-node-exporter-lua
  42. endef
  43. define Package/prometheus-node-exporter-lua/description
  44. Provides node metrics as Prometheus scraping endpoint.
  45. This service is a lightweight rewrite in LUA of the offical Prometheus node_exporter.
  46. endef
  47. # Additional optional exporters:
  48. define Package/prometheus-node-exporter-lua-bmx6
  49. $(call Package/prometheus-node-exporter-lua/Default)
  50. TITLE+= (bmx6 links collector)
  51. DEPENDS:=prometheus-node-exporter-lua bmx6 +lua-cjson +bmx6-json
  52. endef
  53. define Package/prometheus-node-exporter-lua-bmx6/install
  54. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  55. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/bmx6.lua $(1)/usr/lib/lua/prometheus-collectors/
  56. endef
  57. define Package/prometheus-node-exporter-lua-bmx7
  58. $(call Package/prometheus-node-exporter-lua/Default)
  59. TITLE+= (bmx7 links collector)
  60. DEPENDS:=prometheus-node-exporter-lua bmx7 +lua-cjson +bmx7-json
  61. endef
  62. define Package/prometheus-node-exporter-lua-bmx7/install
  63. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  64. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/bmx7.lua $(1)/usr/lib/lua/prometheus-collectors/
  65. endef
  66. define Package/prometheus-node-exporter-lua-dawn
  67. $(call Package/prometheus-node-exporter-lua/Default)
  68. TITLE+= (dawn collector)
  69. DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
  70. endef
  71. define Package/prometheus-node-exporter-lua-dawn/install
  72. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  73. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/dawn.lua $(1)/usr/lib/lua/prometheus-collectors/
  74. endef
  75. define Package/prometheus-node-exporter-lua-hostapd_stations
  76. $(call Package/prometheus-node-exporter-lua/Default)
  77. TITLE+= (hostapd_stations collector) - Requires a full hostapd / wpad build
  78. DEPENDS:=prometheus-node-exporter-lua +hostapd-utils +lua-bit32 +libubus-lua
  79. endef
  80. define Package/prometheus-node-exporter-lua-hostapd_stations/install
  81. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  82. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/hostapd_stations.lua $(1)/usr/lib/lua/prometheus-collectors/
  83. endef
  84. define Package/prometheus-node-exporter-lua-hostapd_ubus_stations
  85. $(call Package/prometheus-node-exporter-lua/Default)
  86. TITLE+= (hostapd_ubus_stations collector)
  87. DEPENDS:=prometheus-node-exporter-lua +luabitop +libubus-lua
  88. endef
  89. define Package/prometheus-node-exporter-lua-hostapd_ubus_stations/install
  90. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  91. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/hostapd_ubus_stations.lua $(1)/usr/lib/lua/prometheus-collectors/
  92. endef
  93. define Package/prometheus-node-exporter-lua-ltq-dsl
  94. $(call Package/prometheus-node-exporter-lua/Default)
  95. TITLE+= (lantiq dsl collector)
  96. DEPENDS:=prometheus-node-exporter-lua @(PACKAGE_ltq-adsl-app||PACKAGE_ltq-vdsl-app)
  97. endef
  98. define Package/prometheus-node-exporter-lua-ltq-dsl/install
  99. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  100. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/ltq-dsl.lua $(1)/usr/lib/lua/prometheus-collectors/
  101. endef
  102. define Package/prometheus-node-exporter-lua-nat_traffic
  103. $(call Package/prometheus-node-exporter-lua/Default)
  104. TITLE+= (nat_traffic collector)
  105. DEPENDS:=prometheus-node-exporter-lua
  106. endef
  107. define Package/prometheus-node-exporter-lua-nat_traffic/install
  108. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  109. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/nat_traffic.lua $(1)/usr/lib/lua/prometheus-collectors/
  110. endef
  111. define Package/prometheus-node-exporter-lua-netstat
  112. $(call Package/prometheus-node-exporter-lua/Default)
  113. TITLE+= (netstat collector)
  114. DEPENDS:=prometheus-node-exporter-lua
  115. endef
  116. define Package/prometheus-node-exporter-lua-netstat/install
  117. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  118. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/netstat.lua $(1)/usr/lib/lua/prometheus-collectors/
  119. endef
  120. define Package/prometheus-node-exporter-lua-openwrt
  121. $(call Package/prometheus-node-exporter-lua/Default)
  122. TITLE+= (openwrt collector)
  123. DEPENDS:=prometheus-node-exporter-lua +libubus-lua
  124. endef
  125. define Package/prometheus-node-exporter-lua-openwrt/install
  126. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  127. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/openwrt.lua $(1)/usr/lib/lua/prometheus-collectors/
  128. endef
  129. define Package/prometheus-node-exporter-lua-textfile
  130. $(call Package/prometheus-node-exporter-lua/Default)
  131. TITLE+= (textfile collector)
  132. DEPENDS:=prometheus-node-exporter-lua +luci-lib-nixio
  133. endef
  134. define Package/prometheus-node-exporter-lua-textfile/install
  135. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  136. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/textfile.lua $(1)/usr/lib/lua/prometheus-collectors/
  137. endef
  138. define Package/prometheus-node-exporter-lua-ubnt-manager
  139. $(call Package/prometheus-node-exporter-lua/Default)
  140. TITLE+= (ubnt-manager collector)
  141. DEPENDS:=prometheus-node-exporter-lua +ubnt-manager +lua-cjson
  142. endef
  143. define Package/prometheus-node-exporter-lua-ubnt-manager/install
  144. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  145. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/ubnt-manager.lua $(1)/usr/lib/lua/prometheus-collectors/
  146. endef
  147. define Package/prometheus-node-exporter-lua-uci_dhcp_host
  148. $(call Package/prometheus-node-exporter-lua/Default)
  149. TITLE+= (uci_dhcp_host collector)
  150. DEPENDS:=prometheus-node-exporter-lua +libuci-lua
  151. endef
  152. define Package/prometheus-node-exporter-lua-uci_dhcp_host/install
  153. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  154. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/uci_dhcp_host.lua $(1)/usr/lib/lua/prometheus-collectors/
  155. endef
  156. define Package/prometheus-node-exporter-lua-wifi
  157. $(call Package/prometheus-node-exporter-lua/Default)
  158. TITLE+= (wifi collector)
  159. DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
  160. endef
  161. define Package/prometheus-node-exporter-lua-wifi/install
  162. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  163. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/wifi.lua $(1)/usr/lib/lua/prometheus-collectors/
  164. endef
  165. define Package/prometheus-node-exporter-lua-wifi_stations
  166. $(call Package/prometheus-node-exporter-lua/Default)
  167. TITLE+= (wifi_stations collector)
  168. DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
  169. endef
  170. define Package/prometheus-node-exporter-lua-wifi_stations/install
  171. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  172. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/wifi_stations.lua $(1)/usr/lib/lua/prometheus-collectors/
  173. endef
  174. define Package/prometheus-node-exporter-lua-snmp6
  175. $(call Package/prometheus-node-exporter-lua/Default)
  176. TITLE+= (snmp6 collector)
  177. DEPENDS:=prometheus-node-exporter-lua +libubus-lua
  178. endef
  179. define Package/prometheus-node-exporter-lua-snmp6/install
  180. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  181. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/snmp6.lua $(1)/usr/lib/lua/prometheus-collectors/
  182. endef
  183. $(eval $(call BuildPackage,prometheus-node-exporter-lua))
  184. $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx6))
  185. $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx7))
  186. $(eval $(call BuildPackage,prometheus-node-exporter-lua-dawn))
  187. $(eval $(call BuildPackage,prometheus-node-exporter-lua-hostapd_stations))
  188. $(eval $(call BuildPackage,prometheus-node-exporter-lua-hostapd_ubus_stations))
  189. $(eval $(call BuildPackage,prometheus-node-exporter-lua-ltq-dsl))
  190. $(eval $(call BuildPackage,prometheus-node-exporter-lua-nat_traffic))
  191. $(eval $(call BuildPackage,prometheus-node-exporter-lua-netstat))
  192. $(eval $(call BuildPackage,prometheus-node-exporter-lua-openwrt))
  193. $(eval $(call BuildPackage,prometheus-node-exporter-lua-textfile))
  194. $(eval $(call BuildPackage,prometheus-node-exporter-lua-ubnt-manager))
  195. $(eval $(call BuildPackage,prometheus-node-exporter-lua-uci_dhcp_host))
  196. $(eval $(call BuildPackage,prometheus-node-exporter-lua-wifi))
  197. $(eval $(call BuildPackage,prometheus-node-exporter-lua-wifi_stations))
  198. $(eval $(call BuildPackage,prometheus-node-exporter-lua-snmp6))