Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can prometheus get multi values in rules file? #2496

Closed
tailnode opened this Issue Mar 14, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@tailnode
Copy link

tailnode commented Mar 14, 2017

What did you do?
for example, i use this rule

ALERT test
  IF go_memstats_alloc_bytes > 1 and go_goroutines > 2 
  ANNOTATIONS {
    currentValue = "{{ $value }}",
  }

What did you expect to see?
i want get the values of go_memstats_alloc_bytes and go_goroutines , and write them into annotations

What did you see instead? Under which circumstances?
{{ $value }} is value of go_memstats_alloc_bytes

Environment

  • System information:

    Linux 4.4.0-62-generic x86_64

  • Prometheus version:

prometheus, version 1.5.2 (branch: master, revision: bd1182d)
build user: root@a8af9200f95d
build date: 20170210-14:41:22
go version: go1.7.5

  • Prometheus configuration file:
global:
  scrape_interval:     5s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 5s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
      monitor: 'codelab-monitor'

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  - rules/*.rules
#- rules/wanglei.rules
  # - "second.rules"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ['localhost:9090']

sorry for my bad english, i am not native speaker. thanks very much.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Mar 14, 2017

This is expected behaviour, usage questions are best addressed on the mailing list: https://groups.google.com/forum/#!forum/prometheus-users

@reymont

This comment has been minimized.

Copy link

reymont commented Jun 19, 2017

@tailnode Can you share which mail can resolve this problem in the mailing list? I have the same problem.

@efficks

This comment has been minimized.

Copy link

efficks commented Mar 4, 2019

@brian-brazil
I've found this conversation on the forum (https://groups.google.com/d/topic/prometheus-users/Rah4Ck_AoDM/discussion). But it's more like a feature request and the answer is not really helpful.
Can we transform the current issue as a feature request? If not. Is it possible to explicitly explain why and what are the best alternatives? Better... maybe explain what is the best practice on the subject in the documentation? (https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/#templating)

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.