add metrics
This commit is contained in:
parent
79c5c57629
commit
1612f5e511
6 changed files with 227 additions and 60 deletions
56
services/grafana.nix
Normal file
56
services/grafana.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services = {
|
||||
grafana = {
|
||||
enable = true;
|
||||
settings = {
|
||||
server.http_addr = "::1";
|
||||
database = {
|
||||
type = "postgres";
|
||||
name = "grafana";
|
||||
user = "grafana";
|
||||
host = "/run/postgresql";
|
||||
};
|
||||
security = {
|
||||
secret_key = "$__file{${config.age.secrets.grafana_secret_key.path}}";
|
||||
admin_user = "xengi";
|
||||
admin_password = "$__file{${config.age.secrets.grafana_admin_password.path}}";
|
||||
admin_email = "grafana@xengi.de";
|
||||
};
|
||||
analytics = {
|
||||
reporting_enabled = false;
|
||||
feedback_links_enabled = false;
|
||||
};
|
||||
};
|
||||
provision = {
|
||||
enable = true;
|
||||
datasources.settings.datasources = [
|
||||
{
|
||||
name = "Prometheus";
|
||||
type = "prometheus";
|
||||
url = "http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}";
|
||||
jsonData = {
|
||||
httpMethod = "GET";
|
||||
prometheusType = "Prometheus";
|
||||
cacheLevel = "High";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
postgresql = {
|
||||
ensureUsers = [
|
||||
{
|
||||
name = config.services.grafana.settings.database.user;
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
ensureDatabases = [
|
||||
config.services.grafana.settings.database.name
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue