monitoring: initial config for victoriametrics
This commit is contained in:
parent
455259f5a2
commit
3b0174fb1a
1 changed files with 25 additions and 4 deletions
|
@ -1,4 +1,14 @@
|
|||
{ config, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
configure_prom = builtins.toFile "prometheus.yml" ''
|
||||
scrape_configs:
|
||||
- job_name: 'bebop'
|
||||
stream_parse: true
|
||||
static_configs:
|
||||
- targets:
|
||||
- 127.0.0.1:9100
|
||||
'';
|
||||
in
|
||||
{
|
||||
# Open grafana port, but only for local network
|
||||
networking.firewall.extraCommands = ''
|
||||
|
@ -10,10 +20,13 @@
|
|||
'';
|
||||
|
||||
services = {
|
||||
victoriametrics = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Collect data with conveniently declared 'scrapers'
|
||||
prometheus = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
port = 9001;
|
||||
|
||||
# Enable prometheus to collect data from systemd
|
||||
|
@ -99,12 +112,12 @@
|
|||
};
|
||||
|
||||
influxdb = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
# dataDir = "~/.config/influxdb";
|
||||
};
|
||||
|
||||
telegraf = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
extraConfig = {
|
||||
inputs = {
|
||||
# zfs = { poolMetrics = true; };
|
||||
|
@ -174,4 +187,12 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.export-to-prometheus = {
|
||||
path = with pkgs; [ victoriametrics ];
|
||||
enable = true;
|
||||
after = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = "vmagent -promscrape.config=${configure_prom} -remoteWrite.url=http://127.0.0.1:8428/api/v1/write";
|
||||
};
|
||||
}
|
||||
|
|
Reference in a new issue