Skip to content

Commit

Permalink
change script
Browse files Browse the repository at this point in the history
  • Loading branch information
Negashev committed Jan 3, 2024
1 parent ea8f990 commit 5dfea09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 1 addition & 10 deletions chart/templates/generator-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,7 @@ spec:
- sh
- -c
args:
- pip
- install
- prometheus_client
- requests
- &&
- python
- /script/run.py
- &&
- sleep
- infinity
- pip install prometheus_client requests && python3 /script/run.py && sleep infinity
volumeMounts:
- name: python-uptime-script
mountPath: /script
Expand Down
10 changes: 9 additions & 1 deletion chart/templates/metrics-config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ metadata:
namespace: {{ .Release.Namespace }}
data:
run.py: |
print('hello world')
from prometheus_client.parser import text_string_to_metric_families
import requests
import time
while True:
metrics = requests.get("http://0.0.0.0:{{ .Values.tunnel.port }}/metrics").content
for family in text_string_to_metric_families(metrics):
for sample in family.samples:
print("Name: {0} Labels: {1} Value: {2}".format(*sample))
time.sleep(5)

0 comments on commit 5dfea09

Please sign in to comment.