mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
service/prometheus: enable systemd target and make datasource default
This commit is contained in:
parent
e9852f6c58
commit
ba615f1b29
1 changed files with 29 additions and 1 deletions
|
@ -45,6 +45,10 @@ in
|
||||||
port = 9100;
|
port = 9100;
|
||||||
listenAddress = "127.0.0.1";
|
listenAddress = "127.0.0.1";
|
||||||
};
|
};
|
||||||
|
systemd = {
|
||||||
|
enable = true;
|
||||||
|
listenAddress = "127.0.0.1";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
globalConfig = {
|
globalConfig = {
|
||||||
|
@ -53,9 +57,30 @@ in
|
||||||
|
|
||||||
scrapeConfigs = [
|
scrapeConfigs = [
|
||||||
{
|
{
|
||||||
job_name = config.networking.hostName;
|
job_name = "prometheus";
|
||||||
|
static_configs = [{
|
||||||
|
targets = [ "127.0.0.1:${toString cfg.port}" ];
|
||||||
|
labels = {
|
||||||
|
instance = config.networking.hostName;
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "node";
|
||||||
static_configs = [{
|
static_configs = [{
|
||||||
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
|
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
|
||||||
|
labels = {
|
||||||
|
instance = config.networking.hostName;
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "systemd";
|
||||||
|
static_configs = [{
|
||||||
|
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.systemd.port}" ];
|
||||||
|
labels = {
|
||||||
|
instance = config.networking.hostName;
|
||||||
|
};
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -66,8 +91,11 @@ in
|
||||||
{
|
{
|
||||||
name = "Prometheus";
|
name = "Prometheus";
|
||||||
type = "prometheus";
|
type = "prometheus";
|
||||||
|
isDefault = true;
|
||||||
url = "http://127.0.0.1:${toString config.services.prometheus.port}";
|
url = "http://127.0.0.1:${toString config.services.prometheus.port}";
|
||||||
jsonData = {
|
jsonData = {
|
||||||
|
prometheusType = "Prometheus";
|
||||||
|
prometheusVersion = toString pkgs.prometheus.version;
|
||||||
timeInterval = config.services.prometheus.globalConfig.scrape_interval;
|
timeInterval = config.services.prometheus.globalConfig.scrape_interval;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue