Try https://github.com/cloudalchemy/ansible-prometheus
On Fri, Apr 2, 2021 at 11:52 AM Gokulasuriyan R.K <[email protected]> wrote: > I am looking for some help on using prometheus Templates in my prometheus > config.yml file. > > > > 1. Where and how to define templates, so that Prometheus recognizes them? > > 2. How to use templates ? Please refer to my scenario below. > > Basically I want to avoid repetitive definitions. > > > > my prometheus config.yml, right now: > ------------------------------------------------------------- > scrape_configs: > # The job name is added as a label `job=<job_name>` to any timeseries > scraped from this config. > > - job_name: 'DT11A SAMPLE' > scheme: https > basic_auth: > username: usr > password: pwd > metrics_path: "/yyy" > params: > agent: ['xxxx'] > delta: ['true'] > function: ['xxxx'] > static_configs: > - targets: ['yyyy'] > > - job_name: 'DT12A SAMPLE' > scheme: https > basic_auth: > username: usr > password: pwd > metrics_path: "/yyy" > params: > agent: ['xxx'] > delta: ['true'] > function: ['XXXX'] > static_configs: > - targets: ['yyy'] > > How I want my prometheus config.yml file to be: > > ----------------------------------------------------------------------------- > > scrape_configs: > # The job name is added as a label `job=<job_name>` to any timeseries > scraped from this config. > > > - job_name: 'DT11A SAMPLE' > {{template "myConfig"}} > > - job_name: 'DT12A SAMPLE' > {{template "myConfig"}} > > template I want to define: > ------------------------------------------ > > {{define "myConfig"}} > > scheme: https > basic_auth: > username: usr > password: pwd > metrics_path: "/yyy" > params: > agent: ['xxx'] > delta: ['true'] > function: ['XXXX'] > static_configs: > - targets: ['yyy'] > > {{end}} > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/da30ca7c-c521-4eb6-8c98-b4183f01eba0n%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/da30ca7c-c521-4eb6-8c98-b4183f01eba0n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CABbyFmoqgEWh2qqGMGyfZWvhz4DW_pjr3Uh7%3Db07MAUTa68XUg%40mail.gmail.com.

