API
-
[ Python ] Prometheus metric 값 가져오기Python/Python Programming 2023. 5. 24. 13:56
Python을이용하여 promQL 쿼리하여 값 가져오기 Sample Metric : jvm_memory_used_bytes import requests from datetime import datetime instance = '127.0.0.1:8080' job = 'spring' query = 'sum(jvm_memory_used_bytes{area="heap", instance="%s", job="%s"})' % (instance,job) def prometheus_data(instance,jop,query): response = requests.get('http://127.0.0.1:9090/api/v1/query', params={'query': query}) response = response...