add grafana stuff
This commit is contained in:
parent
7896091428
commit
a1c4c7cf07
4 changed files with 124 additions and 0 deletions
58
clients/quadraticserver/stats/grafana.nix
Normal file
58
clients/quadraticserver/stats/grafana.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
services =
|
||||
let
|
||||
domain = "status.federated.nexus";
|
||||
in
|
||||
{
|
||||
grafana = {
|
||||
enable = true;
|
||||
declarativePlugins = [ ];
|
||||
settings = {
|
||||
analytics.feedback_links_enabled = false;
|
||||
server = {
|
||||
inherit domain;
|
||||
protocol = "socket";
|
||||
|
||||
enable_gzip = true;
|
||||
};
|
||||
|
||||
security = {
|
||||
cookie_secure = true;
|
||||
secret_key = "$__file{${config.age.secrets."grafanaSecret.age".path}}";
|
||||
|
||||
admin_user = "quadradical";
|
||||
admin_password = "$__file{${config.age.secrets."grafanaPassword.age".path}}";
|
||||
};
|
||||
};
|
||||
|
||||
provision = {
|
||||
enable = true;
|
||||
datasources.settings.datasources = [
|
||||
{
|
||||
name = "Prometheus";
|
||||
type = "prometheus";
|
||||
url = with config.services.prometheus; "http://${listenAddress}:${toString port}";
|
||||
jsonData = {
|
||||
timeInterval = config.services.prometheus.globalConfig.scrape_interval;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
dashboards.settings.providers = [
|
||||
{
|
||||
name = "Node exporter";
|
||||
options.path = pkgs.fetchurl {
|
||||
name = "dashboard-node-exporter-full.json";
|
||||
url = "https://grafana.com/api/dashboards/1860/revisions/42/download";
|
||||
hash = "";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
caddy.virtualHosts."${domain}".extraConfig =
|
||||
"reverse_proxy unix/${config.services.grafana.settings.server.socket}";
|
||||
};
|
||||
users.users.grafana = "caddy";
|
||||
}
|
||||
48
clients/quadraticserver/stats/prometheus.nix
Normal file
48
clients/quadraticserver/stats/prometheus.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
listenAddress = "127.0.0.7";
|
||||
|
||||
globalConfig.scrape_interval = "10s";
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "node";
|
||||
static_configs = [
|
||||
{
|
||||
targets = with config.services.prometheus.exporters.node; [
|
||||
"${toStringlistenAddress}:${toString port}"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
exporters.node = {
|
||||
enable = true;
|
||||
listenAddress = "127.0.0.3";
|
||||
enabledCollectors = [
|
||||
"systemd"
|
||||
"processes"
|
||||
];
|
||||
# disabledCollectors = [
|
||||
# "arp"
|
||||
# "bcache"
|
||||
# "bonding"
|
||||
# "btrfs"
|
||||
# "conntrack"
|
||||
# "dmi"
|
||||
# "edac"
|
||||
# "entropy"
|
||||
# "exec"
|
||||
# "fibrechannel"
|
||||
# "filefd"
|
||||
# "hwmon"
|
||||
# "infiniband"
|
||||
# "ipvs"
|
||||
# "mdadm"
|
||||
# "netclass"
|
||||
# ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue