grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.48k stars 221 forks source link

Сonfiguration prometheus.exporter.process #1935

Open orlovds opened 1 month ago

orlovds commented 1 month ago

What's wrong?

Good afternoon, please tell me how to force prometheus.exporter.process collect data about all processes on VM? An analog of the setting in process_exporter:

cat > /etc/process-exporter.yml << EOF
process_names:
 - name: "{{.Comm}}"
 cmdline:
 - '.+'
EOF

Steps to reproduce

Run alloy and request data Image

System information

ALT SP Server 11100-01

Software version

alloy, version v1.4.2

Configuration

// Process metrics prometheus.exporter.process "local" { track_children = true }

// Configure a prometheus.scrape component to collect process_exporter metrics. prometheus.scrape "process" { targets = prometheus.exporter.process.local.targets forward_to = [prometheus.remote_write.mimir.receiver] }

Logs

No response

Nachtfalkeaw commented 1 month ago
//=======================================================================================
// BEGINN: PROCESS EXPORTER
//=======================================================================================
// Scrape für Process Exporter
prometheus.scrape "process_exporter" {
  job_name = "process_exporter"    // sonst heißt der job "prometheus.scrape.process_exporter"
  scrape_interval = "15s"
  scrape_timeout = "14s"
  extra_metrics = true

  targets    = prometheus.exporter.process.all.targets
  forward_to = [prometheus.relabel.node_exporter.receiver]  //andere .alloy fiel
}

//=======================================================================================
// Systemprozesse / Process Exporter

prometheus.exporter.process "all" {
  procfs_path = "/proc"
  track_children = true
  track_threads = true
  gather_smaps = true
  recheck_on_scrape = true

  matcher {
    name = "{{.Comm}}"
    cmdline = [".+"]
  }
}

//=======================================================================================
// Setzt als "job" den Name "process_exporter" weil es oben mit "job_name" in "prometheus.scrape.process_exporter" nicht funktioniert.
// ersetzt den Wert des labels "job" mit "node_exporter"

//prometheus.relabel "process_exporter" {

  // relabel Funktion
//  rule {
//    action        = "replace"
//    replacement   = "process_exporter"
//    target_label  = "job"
//  }

  // Anschließend die Metriken an die remote_write config senden
//  forward_to = [prometheus.relabel.localhost.receiver]
//}
//=======================================================================================
// ENDE: PROCESS EXPORTER
//=======================================================================================
orlovds commented 1 month ago

@Nachtfalkeaw Friend, thank you so much!!! It's a pity that all this is not in documentation...

Nachtfalkeaw commented 1 month ago

Many of these components are based on standalone exporters and there is a chance to get some more information.

https://github.com/ncabatoff/process-exporter

orlovds commented 1 month ago

@Nachtfalkeaw Of course, but if there https://grafana.com/docs/alloy/latest/reference/components/prometheus/prometheus.exporter.process/#example was your example from this issues, it would be much clearer....

github-actions[bot] commented 5 days ago

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!