grafana tweaks
This commit is contained in:
parent
3291b8ae04
commit
c7fe5d8d54
1 changed files with 20 additions and 23 deletions
|
|
@ -10,13 +10,9 @@ in {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "grafana.reidlab.pink";
|
default = "grafana.reidlab.pink";
|
||||||
};
|
};
|
||||||
orgId = mkOption {
|
grafanaSocket = mkOption {
|
||||||
type = types.int;
|
type = types.str;
|
||||||
default = 1;
|
default = "/run/grafana/grafana.sock";
|
||||||
};
|
|
||||||
grafanaPort = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 3000;
|
|
||||||
};
|
};
|
||||||
alloyPort = mkOption {
|
alloyPort = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
|
|
@ -43,8 +39,8 @@ in {
|
||||||
settings = {
|
settings = {
|
||||||
server = {
|
server = {
|
||||||
domain = cfg.domain;
|
domain = cfg.domain;
|
||||||
http_port = cfg.grafanaPort;
|
protocol = "socket";
|
||||||
http_addr = "127.0.0.1";
|
socket = cfg.grafanaSocket;
|
||||||
};
|
};
|
||||||
database.type = "sqlite3"; # TODO: use postgres?
|
database.type = "sqlite3"; # TODO: use postgres?
|
||||||
# use default secret key
|
# use default secret key
|
||||||
|
|
@ -53,9 +49,9 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
provision.datasources.settings = {
|
provision.datasources.settings = {
|
||||||
|
prune = true; # delete datasources if not in provision file
|
||||||
datasources = [
|
datasources = [
|
||||||
{
|
{
|
||||||
orgId = cfg.orgId;
|
|
||||||
name = "Prometheus";
|
name = "Prometheus";
|
||||||
type = "prometheus";
|
type = "prometheus";
|
||||||
url = "http://127.0.0.1:${toString cfg.prometheusPort}";
|
url = "http://127.0.0.1:${toString cfg.prometheusPort}";
|
||||||
|
|
@ -63,23 +59,12 @@ in {
|
||||||
isDefault = true;
|
isDefault = true;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
orgId = cfg.orgId;
|
|
||||||
name = "Loki";
|
name = "Loki";
|
||||||
type = "loki";
|
type = "loki";
|
||||||
url = "http://127.0.0.1:${toString cfg.lokiPort}";
|
url = "http://127.0.0.1:${toString cfg.lokiPort}";
|
||||||
uid = "loki";
|
uid = "loki";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
deleteDatasources = [
|
|
||||||
{
|
|
||||||
orgId = cfg.orgId;
|
|
||||||
name = "Prometheus";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
orgId = cfg.orgId;
|
|
||||||
name = "Loki";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -89,6 +74,7 @@ in {
|
||||||
ports = {
|
ports = {
|
||||||
node = mkPort 0;
|
node = mkPort 0;
|
||||||
nginx = mkPort 1;
|
nginx = mkPort 1;
|
||||||
|
smartctl = mkPort 2;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -105,6 +91,10 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
port = ports.nginx;
|
port = ports.nginx;
|
||||||
};
|
};
|
||||||
|
smartctl = {
|
||||||
|
enable = true;
|
||||||
|
port = ports.smartctl;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
scrapeConfigs = let
|
scrapeConfigs = let
|
||||||
|
|
@ -126,6 +116,13 @@ in {
|
||||||
labels = commonLabels;
|
labels = commonLabels;
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
job_name = "smartctl";
|
||||||
|
static_configs = [{
|
||||||
|
targets = [ "127.0.0.1:${toString ports.smartctl}" ];
|
||||||
|
labels = commonLabels;
|
||||||
|
}];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -246,7 +243,7 @@ in {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://127.0.0.1:${toString cfg.grafanaPort}";
|
proxyPass = "http://unix:${cfg.grafanaSocket}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
locations."= /robots.txt" = {
|
locations."= /robots.txt" = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue