I have many metrics,but only a part of them should be added a labelhow can I do that?
--thanks
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5e5119ed-74d2-4f59-a9b0-0ca010cd2d17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- source_labels: [__name__]
regex: .*custom.*
replacement: 'cs'
target_label: rwlabelOn 6 June 2017 at 13:31, Qiheng Li <emp...@gmail.com> wrote:I have many metrics,but only a part of them should be added a labelhow can I do that?
thanks
--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5e5119ed-74d2-4f59-a9b0-0ca010cd2d17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I used following to add a label to a metric whose name contains string 'custom':- source_labels: [__name__] regex: .*custom.* replacement: 'cs' target_label: rwlabel
the label named rwlabel and the value of the label is always cs
but it can't work,what's wrong with me?thanks在 2017年6月6日星期二 UTC+8下午8:40:34,Brian Brazil写道:On 6 June 2017 at 13:31, Qiheng Li <emp...@gmail.com> wrote:I have many metrics,but only a part of them should be added a labelhow can I do that?--thanks
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5e5119ed-74d2-4f59-a9b0-0ca010cd2d17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Brian Brazil
--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5430a048-1769-432c-bcfc-535a9a1181e2%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5430a048-1769-432c-bcfc-535a9a1181e2%40googlegroups.com.
I queried a metric whose name contains string 'custom' ,but couldn't find any labels named rwlabelThe version of my prometheus server is 1.6.1
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/83ef7d57-6a99-4070-ba7b-2b8a068e739a%40googlegroups.com.
global:
evaluation_interval: 1m
external_labels: {monitor: P1}
scrape_interval: 60s
scrape_timeout: 10s
rule_files: [alert_rules/*.rules]
remote_write:
#- url: 'http://10.41.31.58:9990/PromReceiver'
#- url: 'http://10.60.77.80:50020'
scrape_configs:
- job_name: P1
metric_relabel_configs:
- action: drop
regex: go_.*
source_labels: [__name__]
scrape_interval: 60s
scrape_timeout: 9s
static_configs:
- targets: ['10.60.77.168:8999']
# - targets: ['10.41.31.58:9118']
# - targets: ['10.41.31.58:9116']
- consul_sd_configs:
- {datacenter: zkzone-001, server: '10.60.77.168:8500', services: ['P1_6000_3000_MySQLOS','P1_6000_3000_MySQL']}
job_name: overwritten-from-consul
metric_relabel_configs:
- source_labels: [__name__]
regex: 'mysql_up'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_global_status_uptime'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_global_status_threads_connected'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_global_status_threads_running'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_slave_status_slave_io_running'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_slave_status_slave_sql_running'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_slave_status_seconds_behind_master'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_slave_status_last_errno'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_global_variables_read_only'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'mysql_global_variables_gtid_mode'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'node_filesystem_size'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: 'node_filesystem_avail'
replacement: 'tokafka'
target_label: remoteWrite
- source_labels: [__name__]
regex: .*custom.*
replacement: 'tokafka'
target_label: remoteWrite
- action: drop
regex: go_.*
source_labels: [__name__]
relabel_configs:
- action: replace
regex: (.*);(.*)
replacement: ${1}:${2}
separator: ;
source_labels: [__meta_consul_service_address, __meta_consul_service_port]
target_label: __address__
- action: keep
regex: ^P1_.*
source_labels: [__meta_consul_service_id]
- action: replace
regex: (?i).*,hostname=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: hostname
- action: replace
regex: (?i).*,ipAddress=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: ipAddress
- action: replace
regex: (?i).*,userId=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: userId
- action: replace
regex: (?i).*,dbName=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: dbName
- action: replace
regex: (?i).*,instanceName=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: instanceName
- action: replace
regex: (?i).*,monType=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: monType
- action: replace
regex: (?i).*,promName=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: promName
- action: replace
regex: (?i).*,tenantName=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: tenantName
- action: replace
regex: (?i).*,eMail=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: eMail
- action: replace
regex: (?i).*,instanceId=([^,]+),.*
replacement: ${1}
source_labels: [__meta_consul_tags]
target_label: instanceId
scrape_interval: 60s
scrape_timeout: 10sTo view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/83ef7d57-6a99-4070-ba7b-2b8a068e739a%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/31bc66e0-75a8-4849-a763-9368a69ee48a%40googlegroups.com.
remote_write: - url: 'http://10.41.31.58:9990/PromReceiver' scrape_configs: - job_name: 'federate' scrape_interval: 60s honor_labels: true #metrics_path: '/federate' params: 'match[]': - '{remoteWrite="tokafka"}' - '{__name__=~".*custom.*"}' static_configs: - targets: - '10.60.77.168:8999' metric_relabel_configs: - action: drop regex: go_.* source_labels: [__name__] - action: drop regex: prometheus_.* source_labels: [__name__] - action: drop regex: http_.* source_labels: [__name__] - action: drop regex: process_.* source_labels: [__name__]
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/31bc66e0-75a8-4849-a763-9368a69ee48a%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/31bc66e0-75a8-4849-a763-9368a69ee48a%40googlegroups.com.
it seems for the metrics generated by rules can't be relabeled.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5e762a09-1da7-48d7-a38a-043f7bf4f71a%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5e762a09-1da7-48d7-a38a-043f7bf4f71a%40googlegroups.com.