Skip to content

Commit 63559cd

Browse files
authored
Merge pull request #202 from Helene/basic_auth_example
Provide an example of prometheus config file with basic_auth settings
2 parents 66468f6 + b6d8deb commit 63559cd

File tree

4 files changed

+221
-1
lines changed

4 files changed

+221
-1
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ RUN chown -R $UID:$GID /opt/IBM/bridge && \
139139
# Switch user
140140
USER $GID
141141

142-
CMD ["sh", "-c", "python3 zimonGrafanaIntf.py -c 10 -s $SERVER -r $PROTOCOL -b $BASICAUTH -u $BASICAUTHUSER -a BASICAUTHPASSW -p $PORT -e $PROMETHEUS -P $SERVERPORT -t $TLSKEYPATH -l $LOGPATH -k $TLSKEYFILE -m $TLSCERTFILE -n $APIKEYNAME -v $APIKEYVALUE"]
142+
CMD ["sh", "-c", "python3 zimonGrafanaIntf.py -c 10 -s $SERVER -r $PROTOCOL -b $BASICAUTH -u $BASICAUTHUSER -a $BASICAUTHPASSW -p $PORT -e $PROMETHEUS -P $SERVERPORT -t $TLSKEYPATH -l $LOGPATH -k $TLSKEYFILE -m $TLSCERTFILE -n $APIKEYNAME -v $APIKEYVALUE"]
143143

144144
EXPOSE 4242 8443 9250
145145

examples/prometheus_config_file/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ You need to register the target in the prometheus.yml file to get the metrics fr
5151
- targets: ['<grafana_bridge_ip>:9250']
5252
```
5353

54+
5. If HTTP/S Basic Authentication is enabled, replace the sample password with one you have generated
55+
```
56+
basic_auth:
57+
username: 'scale_admin'
58+
password: 'TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg=='
59+
```
60+
5461

5562
# Start Prometheus server
5663

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
# my global config
2+
global:
3+
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
4+
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
5+
# scrape_timeout is set to the global default (10s).
6+
query_log_file: /var/log/prometheus/query.log
7+
8+
# Alertmanager configuration
9+
alerting:
10+
alertmanagers:
11+
- static_configs:
12+
- targets:
13+
# - alertmanager:9093
14+
15+
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
16+
rule_files:
17+
# - "first_rules.yml"
18+
# - "second_rules.yml"
19+
20+
# A scrape configuration containing exactly one endpoint to scrape:
21+
# Here it's Prometheus itself.
22+
scrape_configs:
23+
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
24+
- job_name: 'prometheus'
25+
26+
# metrics_path defaults to '/metrics'
27+
# scheme defaults to 'http'.
28+
29+
static_configs:
30+
- targets: ['<prometheus_server_ip>:9090']
31+
32+
- job_name: 'GPFSAFM_cluster1'
33+
scrape_interval: 300s
34+
honor_timestamps: true
35+
metrics_path: '/metrics_gpfs_afm'
36+
scheme: http
37+
basic_auth:
38+
username: 'scale_admin'
39+
password: 'TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg=='
40+
static_configs:
41+
- targets: ['<cluster1_grafana_bridge_ip>:9250']
42+
43+
- job_name: 'GPFSAFMFS_cluster1'
44+
scrape_interval: 300s
45+
honor_timestamps: true
46+
metrics_path: '/metrics_gpfs_afmfs'
47+
scheme: http
48+
basic_auth:
49+
username: 'scale_admin'
50+
password: 'TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg=='
51+
static_configs:
52+
- targets: ['<cluster1_grafana_bridge_ip>:9250']
53+
54+
- job_name: 'GPFSAFMFSET_cluster1'
55+
scrape_interval: 300s
56+
honor_timestamps: true
57+
metrics_path: '/metrics_gpfs_afmfset'
58+
scheme: http
59+
basic_auth:
60+
username: 'scale_admin'
61+
password: 'TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg=='
62+
static_configs:
63+
- targets: ['<cluster1_grafana_bridge_ip>:9250']
64+
65+
- job_name: 'GPFSFileset_cluster1'
66+
scrape_interval: 300s
67+
honor_timestamps: true
68+
metrics_path: '/metrics_gpfs_fileset'
69+
scheme: http
70+
basic_auth:
71+
username: 'scale_admin'
72+
password: 'TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg=='
73+
static_configs:
74+
- targets: ['<cluster1_grafana_bridge_ip>:9250']
75+
76+
- job_name: 'GPFSFilesystem_cluster1'
77+
scrape_interval: 300s
78+
honor_timestamps: true
79+
metrics_path: '/metrics_gpfs_filesystem'
80+
scheme: http
81+
basic_auth:
82+
username: 'scale_admin'
83+
password: 'TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg=='
84+
static_configs:
85+
- targets: ['<cluster1_grafana_bridge_ip>:9250']
86+
87+
- job_name: 'GPFSPool_cluster1'
88+
scrape_interval: 300s
89+
honor_timestamps: true
90+
metrics_path: '/metrics_gpfs_pool'
91+
scheme: http
92+
basic_auth:
93+
username: 'scale_admin'
94+
password: 'TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg=='
95+
static_configs:
96+
- targets: ['<cluster1_grafana_bridge_ip>:9250']
97+
98+
- job_name: 'GPFSDiskCap_cluster1'
99+
scrape_interval: 86400s
100+
honor_timestamps: true
101+
metrics_path: '/metrics_gpfs_diskcap'
102+
scheme: http
103+
basic_auth:
104+
username: 'scale_admin'
105+
password: 'TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg=='
106+
static_configs:
107+
- targets: ['<cluster1_grafana_bridge_ip>:9250']
108+
109+
- job_name: 'GPFSDisk_cluster2'
110+
scrape_interval: 300s
111+
honor_timestamps: true
112+
metrics_path: '/metrics_gpfs_disk'
113+
scheme: https
114+
tls_config:
115+
cert_file: /etc/prometheus/certs/cluster2/cert.pem
116+
key_file: /etc/prometheus/certs/cluster2/privkey.pem
117+
insecure_skip_verify: true
118+
basic_auth:
119+
username: 'scale_admin'
120+
password_file: /etc/prometheus/certs/cluster2/basic_auth
121+
static_configs:
122+
- targets: ['<cluster2_grafana_bridge_ip>:9250']
123+
124+
- job_name: 'GPFSFileset_cluster2'
125+
scrape_interval: 300s
126+
honor_timestamps: true
127+
metrics_path: '/metrics_gpfs_fileset'
128+
scheme: https
129+
tls_config:
130+
cert_file: /etc/prometheus/certs/cluster2/cert.pem
131+
key_file: /etc/prometheus/certs/cluster2/privkey.pem
132+
insecure_skip_verify: true
133+
basic_auth:
134+
username: 'scale_admin'
135+
password_file: /etc/prometheus/certs/cluster2/basic_auth
136+
static_configs:
137+
- targets: ['<cluster2_grafana_bridge_ip>:9250']
138+
139+
- job_name: 'GPFSFilesetQuota_cluster2'
140+
scrape_interval: 3600s
141+
honor_timestamps: true
142+
metrics_path: '/metrics_gpfs_filesetquota'
143+
scheme: https
144+
tls_config:
145+
cert_file: /etc/prometheus/certs/cluster2/cert.pem
146+
key_file: /etc/prometheus/certs/cluster2/privkey.pem
147+
insecure_skip_verify: true
148+
basic_auth:
149+
username: 'scale_admin'
150+
password_file: /etc/prometheus/certs/cluster2/basic_auth
151+
static_configs:
152+
- targets: ['<cluster2_grafana_bridge_ip>:9250']
153+
154+
155+
- job_name: 'GPFSFilesystem_cluster2'
156+
scrape_interval: 300s
157+
honor_timestamps: true
158+
metrics_path: '/metrics_gpfs_filesystem'
159+
scheme: https
160+
tls_config:
161+
cert_file: /etc/prometheus/certs/cluster2/cert.pem
162+
key_file: /etc/prometheus/certs/cluster2/privkey.pem
163+
insecure_skip_verify: true
164+
basic_auth:
165+
username: 'scale_admin'
166+
password_file: /etc/prometheus/certs/cluster2/basic_auth
167+
static_configs:
168+
- targets: ['<cluster2_grafana_bridge_ip>:9250']
169+
170+
- job_name: 'GPFSPool_cluster2'
171+
scrape_interval: 300s
172+
honor_timestamps: true
173+
metrics_path: '/metrics_gpfs_pool'
174+
scheme: https
175+
tls_config:
176+
cert_file: /etc/prometheus/certs/cluster2/cert.pem
177+
key_file: /etc/prometheus/certs/cluster2/privkey.pem
178+
insecure_skip_verify: true
179+
basic_auth:
180+
username: 'scale_admin'
181+
password_file: /etc/prometheus/certs/cluster2/basic_auth
182+
static_configs:
183+
- targets: ['<cluster2_grafana_bridge_ip>:9250']
184+
185+
- job_name: 'GPFSDiskCap_cluster2'
186+
scrape_interval: 86400s
187+
honor_timestamps: true
188+
metrics_path: '/metrics_gpfs_diskcap'
189+
scheme: https
190+
tls_config:
191+
cert_file: /etc/prometheus/certs/cluster2/cert.pem
192+
key_file: /etc/prometheus/certs/cluster2/privkey.pem
193+
insecure_skip_verify: true
194+
basic_auth:
195+
username: 'scale_admin'
196+
password_file: /etc/prometheus/certs/cluster2/basic_auth
197+
static_configs:
198+
- targets: ['<cluster2_grafana_bridge_ip>:9250']
199+
200+
- job_name: 'NFSIO_cluster2'
201+
scrape_interval: 10s
202+
honor_timestamps: true
203+
metrics_path: '/metrics_nfsio'
204+
scheme: https
205+
tls_config:
206+
cert_file: /etc/prometheus/certs/cluster2/cert.pem
207+
key_file: /etc/prometheus/certs/cluster2/privkey.pem
208+
insecure_skip_verify: true
209+
basic_auth:
210+
username: 'scale_admin'
211+
password_file: /etc/prometheus/certs/cluster2/basic_auth
212+
static_configs:
213+
- targets: ['<cluster2_grafana_bridge_ip>:9250']

0 commit comments

Comments
 (0)