Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 94d3255

Browse files
authored
docs: Update Readme files and Helm values (#57)
docs: Update Readme files and Helm values Signed-off-by: hayk96 <[email protected]>
1 parent 6d3e3ad commit 94d3255

File tree

4 files changed

+41
-9
lines changed

4 files changed

+41
-9
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ optional arguments:
143143
144144
required parameters:
145145
--rule.path RULE.PATH
146-
path to Prometheus rules directory
146+
Prometheus rules directory path
147+
--config.file CONFIG.FILE
148+
Prometheus configuration file path
147149
--prom.addr PROM.ADDR
148150
URL of Prometheus server, e.g. http://localhost:9090
149151
```

docs/examples/kubernetes/helm/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ To deploy `prometheus-api` in Kubernetes, it is easy to use the provided [values
44
deploy the [prometheus-community/prometheus](https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus)
55
chart including the `prometheus-api` application as a sidecar container inside the Prometheus pod.
66

7+
**IMPORTANT:** When using the provided values.yaml, all Prometheus configurations specified in the prometheus.yml file can not be managed through Helm values. Instead, the configurations need to be managed via
8+
the [/configs API](https://hayk96.github.io/prometheus-api/#tag/configs) or the web UI of the **prometheus-api** app.
9+
710
### Get repository info
811
```shell
912
$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
@@ -28,10 +31,10 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
2831
prometheus-server ClusterIP 10.100.237.217 <none> 80/TCP 1m
2932

3033
$ kubectl logs -f -l app.kubernetes.io/component=server -c prometheus-api
31-
{"timestamp": "22 Jul 2023 13:13:52", "level": "INFO", "message": "The connection to the Prometheus server has been established successfully!"}
32-
{"timestamp": "22 Jul 2023 13:13:53", "level": "INFO", "message": "Server listening on 0.0.0.0:9090"}
33-
{"timestamp": "22 Jul 2023 13:13:53", "level": "INFO", "message": "-", "status": 200, "method": "POST", "path": "/-/reload"}
34-
{"timestamp": "22 Jul 2023 13:14:09", "level": "INFO", "message": "-", "status": 200, "method": "GET", "path": "/metrics"}
34+
{"timestamp": "07 Dec 2024 10:23:14", "level": "INFO", "message": "Starting web management UI"}
35+
{"timestamp": "07 Dec 2024 10:23:15", "level": "INFO", "message": "The connection to the Prometheus server has been established successfully!"}
36+
{"timestamp": "07 Dec 2024 10:23:15", "level": "INFO", "message": "Successfully started metrics endpoint at /api-metrics path"}
37+
{"timestamp": "07 Dec 2024 10:23:15", "level": "INFO", "message": "Server listening on 0.0.0.0:9090"}
3538
```
3639
Once the apps are ready to handle requests, you can start creating your first Prometheus rules via API.
3740
> **Important:** As you can see, the type of service is `ClusterIP`, which means it's only accessible from within the
@@ -81,9 +84,9 @@ HTTP/1.1 201 Created
8184
content-length: 99
8285
content-type: application/json
8386
84-
{"status":"success","message":"The rule was created successfully","file":"scviiavxvnqdpjl.yml"}
87+
{"status":"success","message":"The rule was created successfully","file":"453ee16d-6310-42e0-8d57-2857e27d250f.yml"}
8588
```
86-
Where the `scviiavxvnqdpjl.yml` is the randomly generated filename created by the **prometheus-api** server.
89+
Where the `453ee16d-6310-42e0-8d57-2857e27d250f.yml` is the randomly generated filename created by the **prometheus-api** server.
8790

8891
### Deleting alerting rule file via API
8992
> DELETE /api/v1/rules/{file}
@@ -92,7 +95,7 @@ _Note that the filename in your example is different from the example below._
9295

9396
**Request**
9497
```shell
95-
curl -i -XDELETE 'http://localhost:9090/api/v1/rules/scviiavxvnqdpjl.yml'
98+
curl -i -XDELETE 'http://localhost:9090/api/v1/rules/453ee16d-6310-42e0-8d57-2857e27d250f.yml'
9699
```
97100
**Response**
98101
```

docs/examples/kubernetes/helm/values.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,37 @@
11
server:
2+
extraInitContainers:
3+
- name: config-setup
4+
image: busybox
5+
command: ["sh", "-c"]
6+
args:
7+
- >
8+
! test -f /config/prometheus.yml &&
9+
cp /etc/config/prometheus.yml /config
10+
|| true
11+
volumeMounts:
12+
- name: config-volume
13+
mountPath: /etc/config
14+
- name: storage-volume
15+
mountPath: /config
16+
subPath: config
217
sidecarContainers:
318
prometheus-api:
419
image: hayk96/prometheus-api:latest
520
imagePullPolicy: IfNotPresent
621
args:
722
- --prom.addr=http://localhost:9091
823
- --web.listen-address=0.0.0.0:9090
24+
- --config.file=/config/prometheus.yml
925
- --rule.path=/rules
1026
- --web.enable-ui=true
1127
ports:
1228
- name: http
1329
containerPort: 9090
1430
volumeMounts:
31+
- name: storage-volume
32+
mountPath: /config
33+
subPath: config
34+
readOnly: false
1535
- name: storage-volume
1636
mountPath: /rules
1737
subPath: rules
@@ -40,12 +60,19 @@ server:
4060
- web.enable-lifecycle
4161
- web.enable-admin-api
4262
- web.listen-address=:9091
63+
configPath: /config/prometheus.yml
4364
extraVolumeMounts:
65+
- name: storage-volume
66+
mountPath: /config
67+
subPath: config
4468
- name: storage-volume
4569
mountPath: /rules
4670
subPath: rules
4771
serverFiles:
4872
prometheus.yml:
4973
rule_files:
5074
- /rules/*.yml
51-
- /rules/*.yaml
75+
- /rules/*.yaml
76+
configmapReload:
77+
prometheus:
78+
enabled: false

docs/images/ui.png

43.5 KB
Loading

0 commit comments

Comments
 (0)