forked from mirrors/nixpkgs
Merge pull request #266283 from Noodlesalat/ping-exporter-1.1.0
ping_exporter: init at 1.1.0
This commit is contained in:
commit
6be9d4fc21
|
@ -13564,6 +13564,12 @@
|
|||
githubId = 1839979;
|
||||
name = "Niklas Thörne";
|
||||
};
|
||||
nudelsalat = {
|
||||
email = "nudelsalat@clouz.de";
|
||||
name = "Fabian Dreßler";
|
||||
github = "Noodlesalat";
|
||||
githubId = 12748782;
|
||||
};
|
||||
nukaduka = {
|
||||
email = "ksgokte@gmail.com";
|
||||
github = "NukaDuka";
|
||||
|
|
|
@ -33,6 +33,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
|||
- [Anki Sync Server](https://docs.ankiweb.net/sync-server.html), the official sync server built into recent versions of Anki. Available as [services.anki-sync-server](#opt-services.anki-sync-server.enable).
|
||||
The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been marked deprecated and will be dropped after 24.05 due to lack of maintenance of the anki-sync-server softwares.
|
||||
|
||||
- [ping_exporter](https://github.com/czerwonk/ping_exporter), a Prometheus exporter for ICMP echo requests. Available as [services.prometheus.exporters.ping](#opt-services.prometheus.exporters.ping.enable).
|
||||
|
||||
- [Clevis](https://github.com/latchset/clevis), a pluggable framework for automated decryption, used to unlock encrypted devices in initrd. Available as [boot.initrd.clevis.enable](#opt-boot.initrd.clevis.enable).
|
||||
|
||||
- [TuxClocker](https://github.com/Lurkki14/tuxclocker), a hardware control and monitoring program. Available as [programs.tuxclocker](#opt-programs.tuxclocker.enable).
|
||||
|
|
|
@ -64,6 +64,7 @@ let
|
|||
"pgbouncer"
|
||||
"php-fpm"
|
||||
"pihole"
|
||||
"ping"
|
||||
"postfix"
|
||||
"postgres"
|
||||
"process"
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
{ config, lib, pkgs, options }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.ping;
|
||||
|
||||
settingsFormat = pkgs.formats.yaml {};
|
||||
configFile = settingsFormat.generate "config.yml" cfg.settings;
|
||||
in
|
||||
{
|
||||
port = 9427;
|
||||
extraOpts = {
|
||||
telemetryPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/metrics";
|
||||
description = ''
|
||||
Path under which to expose metrics.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = {};
|
||||
|
||||
description = lib.mdDoc ''
|
||||
Configuration for ping_exporter, see
|
||||
<https://github.com/czerwonk/ping_exporter>
|
||||
for supported values.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
serviceOpts = {
|
||||
serviceConfig = {
|
||||
# ping-exporter needs `CAP_NET_RAW` to run as non root https://github.com/czerwonk/ping_exporter#running-as-non-root-user
|
||||
CapabilityBoundingSet = [ "CAP_NET_RAW" ];
|
||||
AmbientCapabilities = [ "CAP_NET_RAW" ];
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-ping-exporter}/bin/ping_exporter \
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
||||
--web.telemetry-path ${cfg.telemetryPath} \
|
||||
--config.path="${configFile}" \
|
||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1053,6 +1053,50 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
ping = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
targets = [ {
|
||||
"localhost" = {
|
||||
alias = "local machine";
|
||||
env = "prod";
|
||||
type = "domain";
|
||||
};
|
||||
} {
|
||||
"127.0.0.1" = {
|
||||
alias = "local machine";
|
||||
type = "v4";
|
||||
};
|
||||
} {
|
||||
"::1" = {
|
||||
alias = "local machine";
|
||||
type = "v6";
|
||||
};
|
||||
} {
|
||||
"google.com" = {};
|
||||
} ];
|
||||
dns = {};
|
||||
ping = {
|
||||
interval = "2s";
|
||||
timeout = "3s";
|
||||
history-size = 42;
|
||||
payload-size = 56;
|
||||
};
|
||||
log = {
|
||||
level = "warn";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
exporterTest = ''
|
||||
wait_for_unit("prometheus-ping-exporter.service")
|
||||
wait_for_open_port(9427)
|
||||
succeed("curl -sSf http://localhost:9427/metrics | grep 'ping_up{.*} 1'")
|
||||
'';
|
||||
};
|
||||
|
||||
postfix = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
|
22
pkgs/servers/monitoring/prometheus/ping-exporter.nix
Normal file
22
pkgs/servers/monitoring/prometheus/ping-exporter.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ lib, buildGoModule, fetchFromGitHub }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "ping-exporter";
|
||||
version = "1.1.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "czerwonk";
|
||||
repo = "ping_exporter";
|
||||
rev = version;
|
||||
hash = "sha256-ttlsz0yS4vIfQLTKQ/aiIm/vg6bwnbUlM1aku9RMXXU=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-ZTrQNtpXTf+3oPv8zoVm6ZKWzAvRsAj96csoKJKxu3k=";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Prometheus exporter for ICMP echo requests";
|
||||
homepage = "https://github.com/czerwonk/ping_exporter";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ nudelsalat ];
|
||||
};
|
||||
}
|
|
@ -27195,6 +27195,7 @@ with pkgs;
|
|||
prometheus-pgbouncer-exporter = callPackage ../servers/monitoring/prometheus/pgbouncer-exporter.nix { };
|
||||
prometheus-php-fpm-exporter = callPackage ../servers/monitoring/prometheus/php-fpm-exporter.nix { };
|
||||
prometheus-pihole-exporter = callPackage ../servers/monitoring/prometheus/pihole-exporter.nix { };
|
||||
prometheus-ping-exporter = callPackage ../servers/monitoring/prometheus/ping-exporter.nix { };
|
||||
prometheus-postfix-exporter = callPackage ../servers/monitoring/prometheus/postfix-exporter.nix { };
|
||||
prometheus-postgres-exporter = callPackage ../servers/monitoring/prometheus/postgres-exporter.nix { };
|
||||
prometheus-process-exporter = callPackage ../servers/monitoring/prometheus/process-exporter.nix { };
|
||||
|
|
Loading…
Reference in a new issue