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.

215 lines
8.9 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:=2020.10.29
  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/filefd.lua $(1)/usr/lib/lua/prometheus-collectors/
  33. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/loadavg.lua $(1)/usr/lib/lua/prometheus-collectors/
  34. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/meminfo.lua $(1)/usr/lib/lua/prometheus-collectors/
  35. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/netdev.lua $(1)/usr/lib/lua/prometheus-collectors/
  36. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/time.lua $(1)/usr/lib/lua/prometheus-collectors/
  37. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/uname.lua $(1)/usr/lib/lua/prometheus-collectors/
  38. endef
  39. define Package/prometheus-node-exporter-lua/conffiles
  40. /etc/config/prometheus-node-exporter-lua
  41. endef
  42. define Package/prometheus-node-exporter-lua/description
  43. Provides node metrics as Prometheus scraping endpoint.
  44. This service is a lightweight rewrite in LUA of the offical Prometheus node_exporter.
  45. endef
  46. # Additional optional exporters:
  47. define Package/prometheus-node-exporter-lua-bmx6
  48. $(call Package/prometheus-node-exporter-lua/Default)
  49. TITLE+= (bmx6 links collector)
  50. DEPENDS:=prometheus-node-exporter-lua bmx6 +lua-cjson +bmx6-json
  51. endef
  52. define Package/prometheus-node-exporter-lua-bmx6/install
  53. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  54. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/bmx6.lua $(1)/usr/lib/lua/prometheus-collectors/
  55. endef
  56. define Package/prometheus-node-exporter-lua-bmx7
  57. $(call Package/prometheus-node-exporter-lua/Default)
  58. TITLE+= (bmx7 links collector)
  59. DEPENDS:=prometheus-node-exporter-lua bmx7 +lua-cjson +bmx7-json
  60. endef
  61. define Package/prometheus-node-exporter-lua-bmx7/install
  62. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  63. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/bmx7.lua $(1)/usr/lib/lua/prometheus-collectors/
  64. endef
  65. define Package/prometheus-node-exporter-lua-dawn
  66. $(call Package/prometheus-node-exporter-lua/Default)
  67. TITLE+= (dawn collector)
  68. DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
  69. endef
  70. define Package/prometheus-node-exporter-lua-dawn/install
  71. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  72. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/dawn.lua $(1)/usr/lib/lua/prometheus-collectors/
  73. endef
  74. define Package/prometheus-node-exporter-lua-hostapd_stations
  75. $(call Package/prometheus-node-exporter-lua/Default)
  76. TITLE+= (hostapd_stations collector) - Requires a full hostapd / wpad build
  77. DEPENDS:=prometheus-node-exporter-lua +hostapd-utils +lua-bit32 +libubus-lua
  78. endef
  79. define Package/prometheus-node-exporter-lua-hostapd_stations/install
  80. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  81. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/hostapd_stations.lua $(1)/usr/lib/lua/prometheus-collectors/
  82. endef
  83. define Package/prometheus-node-exporter-lua-hostapd_ubus_stations
  84. $(call Package/prometheus-node-exporter-lua/Default)
  85. TITLE+= (hostapd_ubus_stations collector)
  86. DEPENDS:=prometheus-node-exporter-lua +luabitop +libubus-lua
  87. endef
  88. define Package/prometheus-node-exporter-lua-hostapd_ubus_stations/install
  89. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  90. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/hostapd_ubus_stations.lua $(1)/usr/lib/lua/prometheus-collectors/
  91. endef
  92. define Package/prometheus-node-exporter-lua-ltq-dsl
  93. $(call Package/prometheus-node-exporter-lua/Default)
  94. TITLE+= (lantiq dsl collector)
  95. DEPENDS:=prometheus-node-exporter-lua @(PACKAGE_ltq-adsl-app||PACKAGE_ltq-vdsl-app)
  96. endef
  97. define Package/prometheus-node-exporter-lua-ltq-dsl/install
  98. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  99. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/ltq-dsl.lua $(1)/usr/lib/lua/prometheus-collectors/
  100. endef
  101. define Package/prometheus-node-exporter-lua-nat_traffic
  102. $(call Package/prometheus-node-exporter-lua/Default)
  103. TITLE+= (nat_traffic collector)
  104. DEPENDS:=prometheus-node-exporter-lua
  105. endef
  106. define Package/prometheus-node-exporter-lua-nat_traffic/install
  107. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  108. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/nat_traffic.lua $(1)/usr/lib/lua/prometheus-collectors/
  109. endef
  110. define Package/prometheus-node-exporter-lua-netstat
  111. $(call Package/prometheus-node-exporter-lua/Default)
  112. TITLE+= (netstat collector)
  113. DEPENDS:=prometheus-node-exporter-lua
  114. endef
  115. define Package/prometheus-node-exporter-lua-netstat/install
  116. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  117. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/netstat.lua $(1)/usr/lib/lua/prometheus-collectors/
  118. endef
  119. define Package/prometheus-node-exporter-lua-openwrt
  120. $(call Package/prometheus-node-exporter-lua/Default)
  121. TITLE+= (openwrt collector)
  122. DEPENDS:=prometheus-node-exporter-lua +libubus-lua
  123. endef
  124. define Package/prometheus-node-exporter-lua-openwrt/install
  125. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  126. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/openwrt.lua $(1)/usr/lib/lua/prometheus-collectors/
  127. endef
  128. define Package/prometheus-node-exporter-lua-textfile
  129. $(call Package/prometheus-node-exporter-lua/Default)
  130. TITLE+= (textfile collector)
  131. DEPENDS:=prometheus-node-exporter-lua +luci-lib-nixio
  132. endef
  133. define Package/prometheus-node-exporter-lua-textfile/install
  134. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  135. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/textfile.lua $(1)/usr/lib/lua/prometheus-collectors/
  136. endef
  137. define Package/prometheus-node-exporter-lua-uci_dhcp_host
  138. $(call Package/prometheus-node-exporter-lua/Default)
  139. TITLE+= (uci_dhcp_host collector)
  140. DEPENDS:=prometheus-node-exporter-lua +libuci-lua
  141. endef
  142. define Package/prometheus-node-exporter-lua-uci_dhcp_host/install
  143. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  144. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/uci_dhcp_host.lua $(1)/usr/lib/lua/prometheus-collectors/
  145. endef
  146. define Package/prometheus-node-exporter-lua-wifi
  147. $(call Package/prometheus-node-exporter-lua/Default)
  148. TITLE+= (wifi collector)
  149. DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
  150. endef
  151. define Package/prometheus-node-exporter-lua-wifi/install
  152. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  153. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/wifi.lua $(1)/usr/lib/lua/prometheus-collectors/
  154. endef
  155. define Package/prometheus-node-exporter-lua-wifi_stations
  156. $(call Package/prometheus-node-exporter-lua/Default)
  157. TITLE+= (wifi_stations collector)
  158. DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
  159. endef
  160. define Package/prometheus-node-exporter-lua-wifi_stations/install
  161. $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
  162. $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/wifi_stations.lua $(1)/usr/lib/lua/prometheus-collectors/
  163. endef
  164. $(eval $(call BuildPackage,prometheus-node-exporter-lua))
  165. $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx6))
  166. $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx7))
  167. $(eval $(call BuildPackage,prometheus-node-exporter-lua-dawn))
  168. $(eval $(call BuildPackage,prometheus-node-exporter-lua-hostapd_stations))
  169. $(eval $(call BuildPackage,prometheus-node-exporter-lua-hostapd_ubus_stations))
  170. $(eval $(call BuildPackage,prometheus-node-exporter-lua-ltq-dsl))
  171. $(eval $(call BuildPackage,prometheus-node-exporter-lua-nat_traffic))
  172. $(eval $(call BuildPackage,prometheus-node-exporter-lua-netstat))
  173. $(eval $(call BuildPackage,prometheus-node-exporter-lua-openwrt))
  174. $(eval $(call BuildPackage,prometheus-node-exporter-lua-textfile))
  175. $(eval $(call BuildPackage,prometheus-node-exporter-lua-uci_dhcp_host))
  176. $(eval $(call BuildPackage,prometheus-node-exporter-lua-wifi))
  177. $(eval $(call BuildPackage,prometheus-node-exporter-lua-wifi_stations))