Advertisement
G0nz0uk

configalloy123

Mar 5th, 2025
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.51 KB | None | 0 0
  1. prometheus.exporter.windows "integrations_windows_exporter" {
  2.   enabled_collectors = ["cpu", "cs", "logical_disk", "net", "os", "service", "system", "diskdrive", "process"]
  3. }
  4. discovery.relabel "integrations_windows_exporter" {
  5.   targets = prometheus.exporter.windows.integrations_windows_exporter.targets
  6.   rule {
  7.     target_label = "job"
  8.     replacement  = "integrations/windows_exporter"
  9.   }
  10.   rule {
  11.     target_label = "instance"
  12.     replacement  = constants.hostname
  13.   }
  14. }
  15. prometheus.scrape "integrations_windows_exporter" {
  16.   targets    = discovery.relabel.integrations_windows_exporter.output
  17.   forward_to = [prometheus.relabel.integrations_windows_exporter.receiver]
  18.   job_name   = "integrations/windows_exporter"
  19. }
  20. prometheus.relabel "integrations_windows_exporter" {
  21.   forward_to = [prometheus.remote_write.local_metrics_service.receiver]
  22.   rule {
  23.     source_labels = ["volume"]
  24.     regex         = "HarddiskVolume.*"
  25.     action        = "drop"
  26.   }
  27. }
  28. prometheus.remote_write "local_metrics_service" {
  29.   endpoint {
  30.     url = "http://192.168.138.11:9090/api/v1/write"
  31.   }
  32. }
  33. loki.process "logs_integrations_windows_exporter_application" {
  34.   forward_to = [loki.write.grafana_andy_loki.receiver]
  35.   stage.json {
  36.     expressions = {
  37.       level  = "levelText",
  38.       source = "source",
  39.     }
  40.   }
  41.   stage.labels {
  42.     values = {
  43.       level  = "",
  44.       source = "",
  45.     }
  46.   }
  47. }
  48. loki.relabel "logs_integrations_windows_exporter_application" {
  49.   forward_to = [loki.process.logs_integrations_windows_exporter_application.receiver]
  50.   rule {
  51.     source_labels = ["computer"]
  52.     target_label  = "agent_hostname"
  53.   }
  54. }
  55. loki.source.windowsevent "logs_integrations_windows_exporter_application" {
  56.   locale                 = 1033
  57.   eventlog_name          = "Application"
  58.   bookmark_path          = "./bookmarks-app.xml"
  59.   poll_interval          = "0s"
  60.   use_incoming_timestamp = true
  61.   forward_to             = [loki.relabel.logs_integrations_windows_exporter_application.receiver]
  62.   labels                 = {
  63.     instance = constants.hostname,
  64.     job      = "integrations/windows_exporter",
  65.   }
  66. }
  67. loki.process "logs_integrations_windows_exporter_system" {
  68.   forward_to = [loki.write.grafana_andy_loki.receiver]
  69.   stage.json {
  70.     expressions = {
  71.       level  = "levelText",
  72.       source = "source",
  73.     }
  74.   }
  75.   stage.labels {
  76.     values = {
  77.       level  = "",
  78.       source = "",
  79.     }
  80.   }
  81. }
  82. loki.relabel "logs_integrations_windows_exporter_system" {
  83.   forward_to = [loki.process.logs_integrations_windows_exporter_system.receiver]
  84.   rule {
  85.     source_labels = ["computer"]
  86.     target_label  = "agent_hostname"
  87.   }
  88. }
  89. loki.source.windowsevent "logs_integrations_windows_exporter_system" {
  90.   locale                 = 1033
  91.   eventlog_name          = "System"
  92.   bookmark_path          = "./bookmarks-sys.xml"
  93.   poll_interval          = "0s"
  94.   use_incoming_timestamp = true
  95.   forward_to             = [loki.relabel.logs_integrations_windows_exporter_system.receiver]
  96.   labels                 = {
  97.     instance = constants.hostname,
  98.     job      = "integrations/windows_exporter",
  99.   }
  100. }
  101.  
  102.  local.file_match "local_files" {
  103.      path_targets = [{"__path__" = "C:\\temp\\aw\\*.log"}]
  104.      sync_period  = "5s"
  105.  }
  106.  
  107.   loki.source.file "log_scrape" {
  108.     targets    = local.file_match.local_files.targets
  109.     forward_to = [loki.write.grafana_andy_loki.receiver]
  110.     tail_from_end = false
  111.   }
  112.  
  113. loki.write "grafana_andy_loki" {
  114.   endpoint {
  115.     url = "http://192.168.138.11:3100/loki/api/v1/push"
  116.   }
  117. }
  118.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement