-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from qclaogui:fix-mimir-resources-dashboards
Metrics: Agent add cAdvisor integration
- Loading branch information
Showing
40 changed files
with
1,720 additions
and
1,420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
...r-compose/common/config/agent-flow/modules/docker/metrics/jobs/integration_cadvisor.river
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/* | ||
Module: integration-job | ||
Description: Wrapper module to include all Docker containers metric modules | ||
*/ | ||
argument "forward_to" { | ||
comment = "Must be a list(MetricssReceiver) where collected metrics should be forwarded to" | ||
} | ||
|
||
argument "cluster" { | ||
optional = true | ||
} | ||
|
||
argument "namespace" { | ||
optional = true | ||
} | ||
|
||
argument "scrape_interval" { | ||
comment = "How often to scrape metrics from the targets (default: 60s)" | ||
optional = true | ||
} | ||
|
||
argument "scrape_timeout" { | ||
comment = "How long before a scrape times out (default: 10s)" | ||
optional = true | ||
} | ||
|
||
/******************************************** | ||
* Integrations cAdvisor | ||
********************************************/ | ||
prometheus.exporter.cadvisor "pec_cadvisor" { | ||
docker_host = "unix:///var/run/docker.sock" | ||
|
||
store_container_labels = false | ||
// store_container_labels must be set to false for this to take effect. | ||
// https://github.com/google/cadvisor/blob/master/docs/runtime_options.md#cadvisor-runtime-options | ||
allowlisted_container_labels = [ | ||
"com.docker.compose.project", | ||
"com.docker.compose.service", | ||
"metrics.agent.grafana.com/job", | ||
"prometheus.io/job", | ||
] | ||
|
||
docker_only = true | ||
enabled_metrics = ["cpu", "diskIO", "memory", "network"] | ||
} | ||
|
||
/******************************************** | ||
* Prometheus Scrape Integrations Targets | ||
********************************************/ | ||
prometheus.scrape "ps_cadvisor" { | ||
targets = concat( | ||
prometheus.exporter.cadvisor.pec_cadvisor.targets, | ||
) | ||
|
||
enable_protobuf_negotiation = true | ||
scrape_classic_histograms = true | ||
|
||
scrape_interval = coalesce(argument.scrape_interval.value, "60s") | ||
scrape_timeout = coalesce(argument.scrape_timeout.value, "10s") | ||
|
||
clustering { | ||
enabled = true | ||
} | ||
|
||
forward_to = [prometheus.relabel.pr_cadvisor.receiver] | ||
} | ||
|
||
/******************************************** | ||
* Prometheus Metric Relabelings (post-scrape) | ||
********************************************/ | ||
prometheus.relabel "pr_cadvisor" { | ||
forward_to = argument.forward_to.value | ||
|
||
// drop unused metric label | ||
rule { | ||
action = "labeldrop" | ||
regex = "id" | ||
} | ||
|
||
// set the cluster label | ||
rule { | ||
action = "replace" | ||
replacement = coalesce(argument.cluster.value, "docker-compose") | ||
target_label = "cluster" | ||
} | ||
|
||
// set the namespace label | ||
rule { | ||
action = "replace" | ||
replacement = coalesce(argument.namespace.value, "monitoring-system") | ||
target_label = "namespace" | ||
} | ||
|
||
// set a default job label to be the namespace/service_name | ||
rule { | ||
action = "replace" | ||
source_labels = [ | ||
"container_label_com_docker_compose_service", | ||
] | ||
regex = "^(?:;*)?([^;]+).*$" | ||
replacement = coalesce(argument.namespace.value, "monitoring-system") + "/$1" | ||
target_label = "job" | ||
} | ||
|
||
rule { | ||
action = "replace" | ||
source_labels = [ | ||
"container_label_com_docker_compose_service", | ||
] | ||
regex = "^(?:;*)?([^;]+).*$" | ||
replacement = "$1" | ||
target_label = "pod" | ||
} | ||
|
||
rule { | ||
action = "replace" | ||
source_labels = [ | ||
"container_label_com_docker_compose_service", | ||
] | ||
regex = "^(?:;*)?([^;]+).*$" | ||
replacement = "$1" | ||
target_label = "container" | ||
} | ||
|
||
// allow resources to declare their the job label value to use when collecting their metrics, the default value is "", | ||
rule { | ||
action = "replace" | ||
source_labels = [ | ||
"container_label_metrics_agent_grafana_com_job", | ||
"container_label_prometheus_io_job", | ||
] | ||
separator = ";" | ||
regex = "^(?:;*)?([^;]+).*$" | ||
replacement = "$1" | ||
target_label = "job" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.