mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 12:29:19 -08:00
58 lines
1.2 KiB
Nix
58 lines
1.2 KiB
Nix
{config, ...}: {
|
|
users.users.telegraf = {
|
|
extraGroups = [
|
|
"nginx"
|
|
];
|
|
};
|
|
|
|
services.telegraf = {
|
|
enable = true;
|
|
extraConfig = {
|
|
inputs = {
|
|
nginx = {
|
|
urls = [
|
|
"http://localhost/nginx_status"
|
|
];
|
|
response_timeout = "5s";
|
|
};
|
|
tail = {
|
|
name_override = "nginxlog";
|
|
files = [
|
|
"/var/log/nginx/access.log"
|
|
];
|
|
from_beginning = true;
|
|
pipe = false;
|
|
data_format = "grok";
|
|
grok_patterns = ["%{COMBINED_LOG_FORMAT}"];
|
|
};
|
|
cpu = {
|
|
percpu = true;
|
|
};
|
|
disk = {
|
|
};
|
|
diskio = {
|
|
};
|
|
io = {
|
|
};
|
|
net = {
|
|
};
|
|
mem = {
|
|
};
|
|
system = {
|
|
};
|
|
};
|
|
outputs = {
|
|
prometheus_client = {
|
|
listen = "127.0.0.1:9125";
|
|
};
|
|
http = {
|
|
url = "http://localhost:${toString config.services.grafana.settings.server.http_port}/api/live/push/custom_stream_id";
|
|
data_format = "influx";
|
|
headers = {
|
|
Authorization = "Bearer !!TELEGRAF_API_KEY!!";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|