Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,467,581
Community Members
 
Community Events
177
Community Groups

I would like to see an example of using templates in Prometheus

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}}

 

1 answer

0 votes
Samir Atlassian Team Apr 22, 2021

Hi @Gokulasuriyan R.K ,

 

It sounds like this is more of a general Prometheus question, as opposed to a question specific to Opsgenie's integration with Prometheus .

 

I think this question would be better suited in a general Prometheus forum. I found this doc on template examples in Prometheus.

 

If you have any questions specific to Opsgenie's integration with Prometheus, feel free to share and we can do our best to assist! We just don't have much expertise on using Prometheus in general.

 

Thanks,

Samir

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events