prometheus-node-exporter-lua: update dawn exporter
authorNick Hainke <redacted>
Thu, 1 Oct 2020 20:19:07 +0000 (22:19 +0200)
committerNick Hainke vincent@systemli.org <redacted>
Wed, 7 Oct 2020 11:54:23 +0000 (13:54 +0200)
Add dawn exporter to Makefile.
Add hostname to export.

Signed-off-by: Nick Hainke <redacted>
utils/prometheus-node-exporter-lua/Makefile
utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/dawn.lua

index 434ea95b6fff4741d25d16a058908794dd2d8d4e..371d2f776b624a26ec3abc57925080ae0db5fea9 100644 (file)
@@ -4,7 +4,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=prometheus-node-exporter-lua
-PKG_VERSION:=2020.07.04
+PKG_VERSION:=2020.10.01
 PKG_RELEASE:=1
 
 PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
@@ -78,6 +78,17 @@ define Package/prometheus-node-exporter-lua-bmx7/install
        $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/bmx7.lua $(1)/usr/lib/lua/prometheus-collectors/
 endef
 
+define Package/prometheus-node-exporter-lua-dawn
+  $(call Package/prometheus-node-exporter-lua/Default)
+  TITLE+= (dawn collector)
+  DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
+endef
+
+define Package/prometheus-node-exporter-lua-dawn/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+       $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/dawn.lua $(1)/usr/lib/lua/prometheus-collectors/
+endef
+
 define Package/prometheus-node-exporter-lua-hostapd_stations
   $(call Package/prometheus-node-exporter-lua/Default)
   TITLE+= (hostapd_stations collector) - Requires a full hostapd / wpad build
@@ -180,6 +191,7 @@ endef
 $(eval $(call BuildPackage,prometheus-node-exporter-lua))
 $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx6))
 $(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx7))
+$(eval $(call BuildPackage,prometheus-node-exporter-lua-dawn))
 $(eval $(call BuildPackage,prometheus-node-exporter-lua-hostapd_stations))
 $(eval $(call BuildPackage,prometheus-node-exporter-lua-ltq-dsl))
 $(eval $(call BuildPackage,prometheus-node-exporter-lua-nat_traffic))
index 96944632fc78afb9d49fb40624ba646dfcf52c4f..8c3c4d27382c60ed87f78b147c51d346f06a3d02 100644 (file)
@@ -20,6 +20,7 @@ local function scrape()
           ssid = ssid,
           bssid = ap,
           freq = ap_table['freq'],
+          hostname = ap_table['hostname'],
           ht_support = ht_support,
           vht_support = vht_support,
           neighbor_report = ap_table['neighbor_report'],
@@ -34,14 +35,14 @@ local function scrape()
             local client_vht_support = (client_table['vht'] == true) and 1 or 0
             local client_signal = client_table['signal'] or -255
 
-            local labels = {
+            local labels_client_signal = {
               ssid = ssid,
               bssid = ap,
               mac = client,
               ht_support = client_ht_support,
               vht_support = client_vht_support,
             }
-            metric_dawn_station_signal_dbm(labels, client_signal)
+            metric_dawn_station_signal_dbm(labels_client_signal, client_signal)
           end
         end
       end
git clone https://git.99rst.org/PROJECT