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

how do i add custom labels? #8

Closed
yosefy opened this issue Nov 29, 2016 · 4 comments
Closed

how do i add custom labels? #8

yosefy opened this issue Nov 29, 2016 · 4 comments

Comments

@yosefy
Copy link

yosefy commented Nov 29, 2016

i want to add just x="y"
no connection to grok fields
may i?

thanks

@fstab
Copy link
Owner

fstab commented Nov 30, 2016

Hi yosefy, it is currently not possible to do that in grok_exporter, but you can add labels in Prometheus using the static_config in the job configuration. For example, to add the x=y label for each metric from the grok_exporter instance on localhost:9441, put the following in prometheus.yml:

  - job_name: 'grok'
    static_configs:
      - targets: ['localhost:9144']
        labels: { 'x': 'y' }

If you want something more complex (like dynamically rewriting labels depending on their values), check out Prometheus' relabel_config: https://prometheus.io/docs/operating/configuration/#relabel_config

Hope this helps
Fabian.

@fstab
Copy link
Owner

fstab commented Jan 3, 2017

Hi, I just released v0.2.0, which uses templates for defining labels. With the new version, defining a constant label for grok_exporter should be easily possible like this:

labels:
    x: 'y'

@yosefy
Copy link
Author

yosefy commented Jan 3, 2017 via email

@fstab
Copy link
Owner

fstab commented Jan 30, 2017

Just released v0.2.1 with even better support for templates. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants