Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Add environment Info to return. #2

Open
Rucknar opened this issue May 11, 2016 · 7 comments
Open

Add environment Info to return. #2

Rucknar opened this issue May 11, 2016 · 7 comments
Assignees

Comments

@Rucknar
Copy link
Contributor

Rucknar commented May 11, 2016

For running multiple ones of these, we need to either:

  • Prefix environment (compute cluster) name to the stack/service/hostname output
  • Add a new field with the environment listed

As highlighted in infinityworks/prom-conf#2

@Rucknar
Copy link
Contributor Author

Rucknar commented May 11, 2016

@JamesBarwell You think this might be an easy one we can knock off?

@JamesBarwell
Copy link
Contributor

Should be easy if we can get the environment name passed into the node process somehow. Could it be made available as an environment variable by adjusting the docker-compose file?

I'm thinking that exposing it as a label would be better than trying to insert it into the variable name. I'd prefer to keep the metric names static, which as far as I'm aware is how every other exporter does it.

@Rucknar
Copy link
Contributor Author

Rucknar commented May 16, 2016

Indeed, labels are probably the best bet here. We can populate with the details within the API, it should be listed on each object as a parent.

@jmatsushita
Copy link

jmatsushita commented Sep 22, 2016

FYI I'd would like this feature too. In the meantime I worked around it with relabeling:

- job_name: 'rancher-api'
  static_configs:
    - targets:
      - 'prometheus-rancher-exporter:9010' 
      - 'prometheus-rancher-exporter.prometheus-agents.dev.another.org:9010'
      - 'prometheus-rancher-exporter.prometheus-agents.staging.another.org:9010'
      - 'prometheus-rancher-exporter.prometheus-agents.prod.example.org:9010'
  metric_relabel_configs:                                                        
  - source_labels: ['instance']                                                           
    target_label:  'rancher_environment'                                                          
    regex: '(.*)prometheus-agents\.(.*?)\.(example|another)(.*)'              
    replacement:  $2    

In case it helps someone else !

@joshbenner
Copy link
Contributor

I've been experimenting with monitoring multiple environment with a single instance of this service, and having env field out of the box would be great (as would stack and service fields everywhere they're relevant!).

For now I'm doing something similar to @jmatsushita by setting labels via my custom discovery mechanism.

@Rucknar Rucknar changed the title Feature Request - Add environment Info to return. Add environment Info to return. Jan 6, 2017
@Rucknar Rucknar self-assigned this Jan 6, 2017
@Rucknar
Copy link
Contributor Author

Rucknar commented Jan 9, 2017

Hi All,

Looking at scoping this one out, i'm after some clarity however on peoples requirements:

@joshbenner @jmatsushita - To confirm, is it the rancher 'environment' that you wish to be populated for each of the metrics? I can't get at the Rancher server details, but it seems i can list the projects. The downside would be, if you wish to monitor projects outside your environment, you would need to supply API credentials with the appropriate privileged against those 'environments'. The smart labels wouldn't then be applicable.

For those using this as part of the community catalog template, this would only handle the prometheus integration with the API. To discover hosts and containers in other environments, you would have to do some manual configuration, can't see a way around this.

@yongzhang
Copy link

yongzhang commented Dec 15, 2017

+1

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

No branches or pull requests

5 participants