-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(besu): enable prometheus for besu node metrics
prometheus server deployments for individual organizations fixes hyperledger#2290 Signed-off-by: saikumarbommakanti <sai.kumar.bommakanti@accenture.com>
- Loading branch information
1 parent
cc52101
commit 19125c3
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
platforms/hyperledger-besu/configuration/roles/create/prometheus/tasks/main.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
############################################################################################## | ||
# Copyright Accenture. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
############################################################################################## | ||
|
||
# Fetching the prometheus URLs | ||
- name: Fetching the prometheus URLs | ||
include_tasks: nested_loop.yaml | ||
vars: | ||
service: "{{ org.services.peers is defined | ternary(org.services.peers, org.services.validators) }}" | ||
members: "{{service}}" | ||
|
||
#Adding the prometheus chart repo | ||
- name: Add stable chart repo | ||
kubernetes.core.helm_repository: | ||
name: stable | ||
repo_url: "https://prometheus-community.github.io/helm-charts" | ||
|
||
# Install prometheus via helmchart | ||
- name: Deploy latest version of Prometheus chart | ||
kubernetes.core.helm: | ||
kubeconfig: "{{ kubeconfig_path }}" | ||
name: "{{ name }}-prom" | ||
chart_ref: stable/prometheus | ||
release_namespace: "{{ component_ns }}" | ||
create_namespace: true | ||
values_files: | ||
- "{{ playbook_dir }}/../../../platforms/hyperledger-besu/configuration/build/{{name}}-prometheus.yaml" |
20 changes: 20 additions & 0 deletions
20
platforms/hyperledger-besu/configuration/roles/create/prometheus/tasks/nested_loop.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
- name: extracting data | ||
set_fact: | ||
targets: [] | ||
|
||
#Extracting the prometheus targets | ||
- name: extracting the prometheus targets | ||
vars: | ||
prom_url: "{{node.name}}.{{component_name}}:{{node.metrics.port}}" | ||
set_fact: | ||
targets: "{{ targets + [prom_url] }}" | ||
loop: "{{ members }}" | ||
loop_control: | ||
loop_var: node | ||
when: node.metrics.enabled == true | ||
|
||
#Updating the helm values | ||
- name: Updating helm values config | ||
template: | ||
src={{ playbook_dir }}/../../../platforms/hyperledger-besu/configuration/roles/create/prometheus/templates/prometheus_release.j2 | ||
dest={{ playbook_dir }}/../../../platforms/hyperledger-besu/configuration/build/{{name}}-prometheus.yaml |
28 changes: 28 additions & 0 deletions
28
...ms/hyperledger-besu/configuration/roles/create/prometheus/templates/prometheus_release.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
extraScrapeConfigs: | | ||
- job_name: besu | ||
scrape_interval: 15s | ||
scrape_timeout: 10s | ||
metrics_path: /metrics | ||
scheme: http | ||
static_configs: | ||
- targets: {{targets}} | ||
alertmanager: | ||
enabled: false | ||
kube-state-metrics: | ||
enabled: false | ||
prometheus-node-exporter: | ||
enabled: false | ||
prometheus-pushgateway: | ||
enabled: false | ||
server: | ||
service: | ||
annotations: | ||
{% if prometheus_enabled == 'true' %} | ||
getambassador.io/config: | | ||
--- | ||
apiVersion: ambassador/v2 | ||
kind: TCPMapping | ||
port: {{prometheus_port}} | ||
name: {{component_name}} | ||
service: {{name}}-prom-prometheus-server.{{component_ns}}:80 | ||
{% endif %} |