Skip to content
Snippets Groups Projects
Commit 711ab588 authored by Florian Sesser's avatar Florian Sesser
Browse files

Monitoring MegaRAID: Add scraper service

parent 5a1068f4
No related branches found
No related tags found
2 merge requests!228merge develop into production,!202Monitor MegaRAID on our storage nodes
# MegaCli to Prometheus text format exporter
#
# Scope: Gets data from MegaRAID compatible storage controllers and mogrifies
# to Prometheus text format, saves to a temp file, to later be scraped
# by the node exporter.
#
# Usage: Import this to every server with a MegaRAID card that you want to
# include in the central monitoring system
#
# See https://nixos.org/manual/nixos/stable/#module-services-prometheus-exporters
{ config, lib, ourpkgs }:
let
cfg = config.services.private-storage.monitoring.megacli2prom;
in {
options.services.private-storage.monitoring.megacli2prom = {
enable = lib.mkEnableOption "MegaCli2Prom metrics gathering service";
outFile = lib.mkOption {
type = lib.types.path;
description = "Where to store the temporary file for node exporter to scrape?";
default = /run/prometheus-node-exporter/megacli.prom
};
interval = lib.mkOption {
type = lib.types.str;
description = ''
How often to do it?
See https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events
'';
default = "hourly";
};
};
config =
lib.mkIf cfg.enable {
environment.systemPackages = [ ourpkgs.megacli2prom ];
systemd.services.megacli2prom = {
enable = true;
description = "MegaCli2Prom metrics gathering service";
wantedBy = [ "multi-user.target" ];
startAt = cfg.interval;
script = "${ourpkgs.megacli2prom}/bin/megacli2prom > ${cfg.outFile}";
};
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment