2025-02-24 15:23:20 +01:00
|
|
|
<% if @ay_manage_loki == true -%>
|
2025-02-24 13:24:45 +01:00
|
|
|
logging {
|
|
|
|
|
level = "info"
|
|
|
|
|
format = "logfmt"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loki.source.file "system_logs" {
|
|
|
|
|
targets = [
|
|
|
|
|
<% @log_targets_array.each do |target| -%>
|
|
|
|
|
{__path__ = "<%= target %>"},
|
|
|
|
|
<% end -%>
|
|
|
|
|
]
|
|
|
|
|
forward_to = [loki.write.loki.receiver]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loki.write "loki" {
|
|
|
|
|
endpoint {
|
2025-02-24 13:41:09 +01:00
|
|
|
url = "<%= @ay_loki_url %>"
|
2025-02-24 13:24:45 +01:00
|
|
|
basic_auth {
|
|
|
|
|
username = "<%= @ay_loki_username %>"
|
|
|
|
|
password = "<%= @ay_loki_userpass %>"
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-24 15:23:20 +01:00
|
|
|
}
|
|
|
|
|
<% end -%>
|
|
|
|
|
<% if @ay_manage_prom == true -%>
|
|
|
|
|
// Metrics collection
|
|
|
|
|
prometheus.exporter.unix "system_metrics" {
|
|
|
|
|
include_exporter_metrics = true
|
|
|
|
|
disable_collectors = ["mdadm"] # Optional: adjust based on your needs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prometheus.scrape "scrape_system" {
|
|
|
|
|
targets = prometheus.exporter.unix.system_metrics.targets
|
|
|
|
|
forward_to = [prometheus.remote_write.prometheus.receiver]
|
|
|
|
|
scrape_interval = "15s" # Adjust as needed
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prometheus.remote_write "prometheus" {
|
|
|
|
|
endpoint {
|
|
|
|
|
url = "<%= @ay_prom_url %>"
|
|
|
|
|
basic_auth {
|
|
|
|
|
username = "<%= @ay_loki_username %>"
|
|
|
|
|
password = "<%= @ay_loki_userpass %>"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
<% end %>
|