Added exporters

This commit is contained in:
Craige McWhirter 2020-05-27 21:56:19 +10:00
parent 6b8318adce
commit 8ee9ceef34
Signed by: sercanto
GPG key ID: 7DBA9F5689EFB6AA

View file

@ -11,16 +11,51 @@
services = { services = {
prometheus = { prometheus = {
enable = true; enable = true;
webExternalUrl = "https://monitoring.mcwhirter.io/prometheus/";
extraFlags = [ extraFlags = [
"--storage.tsdb.retention.time 8760h" "--storage.tsdb.retention.time 8760h"
]; ];
alertmanagers = [ { exporters = {
scheme = "http"; node = {
path_prefix = "/"; enable = true;
static_configs = [ { openFirewall = true;
targets = [ "airgead.mcwhirter.io:9093" ]; enabledCollectors = [
} ]; "systemd"
} ]; "tcpstat"
"conntrack"
"diskstats"
"entropy"
"filefd"
"filesystem"
"loadavg"
"meminfo"
"netdev"
"netstat"
"stat"
"time"
"ntp"
"timex"
"vmstat"
"logind"
"interrupts"
"ksmd"
"processes"
];
};
};
#alertmanager = {
# enable = true;
# webExternalUrl = "https://monitoring.mcwhirter.io/alertmanager/";
# configuration = [
# ];
#};
#alertmanagers = [ {
# scheme = "http";
# path_prefix = "/";
# static_configs = [ {
# targets = [ "airgead.mcwhirter.io:9093" ];
# } ];
#} ];
rules = [ (builtins.toJSON { rules = [ (builtins.toJSON {
groups = [ groups = [
{ {
@ -159,6 +194,7 @@
targets = [ targets = [
"localhost:9090" "localhost:9090"
]; ];
labels = { alias = "prometheus"; };
} }
]; ];
} }
@ -192,8 +228,8 @@
grafana = { grafana = {
enable = true; enable = true;
addr = "0.0.0.0"; addr = "0.0.0.0";
domain = "grafana.mcwhirter.io"; domain = "monitoring.mcwhirter.io";
rootUrl = "https://grafana.mcwhirter.io/"; rootUrl = "https://monitoring.mcwhirter.io/grafana";
security = { security = {
adminPasswordFile = "/run/keys/grafana-apass"; # Where to find the password adminPasswordFile = "/run/keys/grafana-apass"; # Where to find the password
}; };
@ -204,6 +240,13 @@
}; };
provision = { provision = {
enable = true; enable = true;
#dashboards = [
# {
# name = "Node System Dashboard";
# folder = "General";
# options.path = ../monitoring/NodeSystemDashboard.json;
# }
#];
datasources = [ datasources = [
{ {
type = "prometheus"; type = "prometheus";
@ -215,15 +258,25 @@
}; };
nginx = { nginx = {
enable = true; # Enable Nginx enable = true; # Enable Nginx
recommendedGzipSettings = true; recommendedGzipSettings = true;
recommendedOptimisation = true; recommendedOptimisation = true;
recommendedProxySettings = true; recommendedProxySettings = true;
recommendedTlsSettings = true; recommendedTlsSettings = true;
virtualHosts."grafana.mcwhirter.io" = { # Grafana hostname virtualHosts."monitoring.mcwhirter.io" = { # Monitoring hostname
enableACME = true; # Use ACME certs enableACME = true; # Use ACME certs
forceSSL = true; # Force SSL forceSSL = true; # Force SSL
locations."/".proxyPass = "http://localhost:3000/"; # Proxy Grafana locations = {
"/grafana/".proxyPass = "http://localhost:3000/"; # Proxy Grafana
"/prometheus/".extraConfig = ''
proxy_pass http://localhost:9090/prometheus/;
proxy_set_header Host $host;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
'';
#"/alertmanager/".proxyPass = "http://localhost:9093/"; # Proxy Alert Manager
};
}; };
}; };
@ -234,7 +287,7 @@
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;
certs = { certs = {
"grafana.mcwhirter.io".email = "craige@mcwhirter.io"; "monitoring.mcwhirter.io".email = "craige@mcwhirter.io";
}; };
}; };