Browse Source

Merge pull request #5916 from aparcar/prom-bmx7v2

prometheus-node-exporter-lua: extend bmx7 plugin
lilik-openwrt-22.03
champtar 7 years ago
committed by GitHub
parent
commit
68a3d3d6ee
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions
  1. +1
    -1
      utils/prometheus-node-exporter-lua/Makefile
  2. +21
    -0
      utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/bmx7.lua

+ 1
- 1
utils/prometheus-node-exporter-lua/Makefile View File

@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=prometheus-node-exporter-lua PKG_NAME:=prometheus-node-exporter-lua
PKG_VERSION:=2017.12.08 PKG_VERSION:=2017.12.08
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_MAINTAINER:=Christian Simon <simon@swine.de> PKG_MAINTAINER:=Christian Simon <simon@swine.de>
PKG_LICENSE:=Apache-2.0 PKG_LICENSE:=Apache-2.0


+ 21
- 0
utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/bmx7.lua View File

@ -39,7 +39,28 @@ local function scrape()
} }
metric_bmx7_rxRate(labels, interpret_suffix(link.rxRate)) metric_bmx7_rxRate(labels, interpret_suffix(link.rxRate))
metric_bmx7_txRate(labels, interpret_suffix(link.txRate)) metric_bmx7_txRate(labels, interpret_suffix(link.txRate))
end
local metric_bmx7_tunIn = metric("bmx7_tunIn", "gauge")
local parameters = json.decode(get_contents("/var/run/bmx7/json/parameters")).OPTIONS
for _, option in pairs(parameters) do
if option.name == "tunIn" then
for _, instance in pairs(option.INSTANCES) do
for _, child_instance in pairs(instance.CHILD_INSTANCES) do
local labels = {
name = instance.value,
network = child_instance.value
}
metric_bmx7_tunIn(labels, 1)
end
end
elseif option.name == "plugin" then
local metric_bmx7_plugin = metric("bmx7_plugin", "gauge")
for _, instance in pairs(option.INSTANCES) do
metric_bmx7_plugin({ name = instance.value }, 1)
end
end end
end
end end
return { scrape = scrape } return { scrape = scrape }

Loading…
Cancel
Save