openwrt-prometheus-exporter: init at 2024.06.16
This commit is contained in:
parent
2dd59bbbe1
commit
89b0722869
2 changed files with 66 additions and 0 deletions
|
@ -91,6 +91,7 @@ in {
|
|||
odhcp-script = callPackage ./odhcp-script {};
|
||||
odhcp6c = callPackage ./odhcp6c {};
|
||||
openwrt = callPackage ./openwrt {};
|
||||
openwrt-prometheus-exporter = callPackage ./openwrt-prometheus-exporter {};
|
||||
ppp = callPackage ./ppp {};
|
||||
pppoe = callPackage ./pppoe {};
|
||||
preinit = callPackage ./preinit {};
|
||||
|
|
65
pkgs/openwrt-prometheus-exporter/default.nix
Normal file
65
pkgs/openwrt-prometheus-exporter/default.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
uhttpd,
|
||||
ubus,
|
||||
lua,
|
||||
}:
|
||||
let
|
||||
pkg-path = "utils/prometheus-node-exporter-lua/files/usr";
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "openwrt-prometheus-exporter";
|
||||
version = "24.10";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "openwrt";
|
||||
repo = "packages";
|
||||
rev = "openwrt-${version}";
|
||||
hash = "sha256-O8yYVbuSY25PDY5oNTPMDDICE5RBIdvH1cavRXeQoLI=";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
uhttpd
|
||||
ubus
|
||||
lua
|
||||
];
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
patchPhase = ''
|
||||
runHook prePatch
|
||||
|
||||
substituteInPlace ${pkg-path}/bin/prometheus-node-exporter-lua \
|
||||
--replace-fail "/usr/lib/lua/prometheus-collectors/*.lua" "$out/share/lua/${lua.luaversion}/prometheus-collectors/*.lua"
|
||||
|
||||
runHook postPatch
|
||||
'';
|
||||
|
||||
enabledCollectors = [
|
||||
"hostapd_ubus_stations.lua"
|
||||
"cpu.lua"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/{bin,share/lua/${lua.luaversion}/prometheus-collectors}
|
||||
|
||||
cp ${pkg-path}/bin/prometheus-node-exporter-lua $out/bin/openwrt-prometheus-exporter
|
||||
cp ${pkg-path}/lib/lua/prometheus-collectors/{${lib.concatStringsSep "," enabledCollectors}} $out/share/lua/${lua.luaversion}/prometheus-collectors/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
||||
meta = {
|
||||
description = "Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md";
|
||||
homepage = "https://github.com/openwrt/packages";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ soyouzpanda ];
|
||||
mainProgram = "openwrt-prometheus-exporter";
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue