Prometheus & Prometheus Jenkins plugin

3,516 views
Skip to first unread message

HK

unread,
May 11, 2017, 8:56:21 AM5/11/17
to Prometheus Users
Hello,

I installed the Prometheus plugin in Jenkins 2.x.

I would like to know to configure Prometheus (yaml file) to get metrics from Prometheus Jenkins plugin.


HK

Julius Volz

unread,
May 11, 2017, 9:19:44 AM5/11/17
to HK, Prometheus Users
In the simplest case, your prometheus.yml can look like:

---------
scrape_configs:
  - job_name: 'jenkins'
    scrape_interval: 15s
    static_configs:
      - targets: ['jenkins-host:12345']
---------

(where you'll want to change the target host / port to point to your Jenkins endpoint)

That's a static configuration of a target, but Prometheus also supports many different kinds of service discovery to dynamically discover targets.

--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/d2dc9124-dc53-4f3d-aa57-c94f4b8e25d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julius Volz

unread,
May 11, 2017, 9:21:39 AM5/11/17
to HK, Prometheus Users
If you need to change the endpoint to scrape from (/metrics by default, but could default to /prometheus in the Jenkins Prometheus plugin?), you can also set that:

---------
scrape_configs:
  - job_name: 'jenkins'
    metrics_path: '/prometheus'
    scrape_interval: 15s
    static_configs:
      - targets: ['jenkins-host:12345']
---------
Message has been deleted
Message has been deleted

khail....@gmail.com

unread,
May 11, 2017, 3:14:02 PM5/11/17
to Prometheus Users, khail....@gmail.com
It works fine with metrics_path: '/prometheus'

Thanks


patil1...@gmail.com

unread,
Jul 26, 2018, 10:05:00 AM7/26/18
to Prometheus Users
I am trying to scrape jenkins metrics. I have used it in same way mentioned above.
When I am trying to get metrices directly using jenkins url/prometheus. Its giving me the metrices list. 
But when I am configuring it n the prometheus config, I cant get any metrics in prometheus or in grafana.

Please suggest me the solution, I am trying to do this from so long.

Thanks in advance.

Simon Pasquier

unread,
Jul 26, 2018, 11:19:59 AM7/26/18
to patil1...@gmail.com, Prometheus Users
Is your Jenkins target up in the Targets page of the Prometheus UI?
You could also share your Prometheus configuration file and logs.

--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.

patil1...@gmail.com

unread,
Jul 26, 2018, 11:30:55 AM7/26/18
to Prometheus Users

No, my jenkins target showing down on targets page on prometheus UI.

This is my prometheus config configurations:


- job_name: 'jenkins'
      metrics_path: '/prometheus'
      scrape_interval: 15s
      static_configs:
      - targets:
        - "jenkins_host:port"

On Thursday, July 26, 2018 at 8:49:59 PM UTC+5:30, Simon Pasquier wrote:
Is your Jenkins target up in the Targets page of the Prometheus UI?
You could also share your Prometheus configuration file and logs.
On Thu, Jul 26, 2018 at 4:05 PM, <patil1...@gmail.com> wrote:
I am trying to scrape jenkins metrics. I have used it in same way mentioned above.
When I am trying to get metrices directly using jenkins url/prometheus. Its giving me the metrices list. 
But when I am configuring it n the prometheus config, I cant get any metrics in prometheus or in grafana.

Please suggest me the solution, I am trying to do this from so long.

Thanks in advance.

On Friday, May 12, 2017 at 12:44:02 AM UTC+5:30, khail....@gmail.com wrote:
It works fine with metrics_path: '/prometheus'

Thanks


--
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 prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.

yspand...@gmail.com

unread,
Jul 26, 2018, 12:47:55 PM7/26/18
to Prometheus Users
When i try to configure Jenkins URL in Prometheus.yml file.it doesn't show any Jenkins Metrics in Prometheus UI dropdown.my prometheus.yml look like

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

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# 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:1234']
    - targets: ['jenkins_host:4567']
      

Simon Pasquier

unread,
Jul 27, 2018, 3:52:23 AM7/27/18
to patil1...@gmail.com, Prometheus Users
On Thu, Jul 26, 2018 at 5:30 PM, <patil1...@gmail.com> wrote:

No, my jenkins target showing down on targets page on prometheus UI.

And what is the error message? It should give you a clue about the problem.
 
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/aaac029e-5bac-426c-879d-a119e369e8be%40googlegroups.com.

patil1...@gmail.com

unread,
Jul 27, 2018, 4:17:10 AM7/27/18
to Prometheus Users
Thanks Simon for replying the immediately and addressing pro-actively.

My issue has fixed. It was something network issue. I was using previously the loadbalancer url. Now I have given it to route53 url. And it worked.
I don't have to do any modifications.

Thanks.

srinik...@gmail.com

unread,
Feb 13, 2019, 9:41:04 AM2/13/19
to Prometheus Users
Hi Patil, could you tell me how you got fixed? Currently i am giving the hostname defined in the ingress of kuberntes. i am also facing the similar issue.
Reply all
Reply to author
Forward
0 new messages