fix: paste new query

This commit is contained in:
dettlaff 2024-06-16 23:06:40 +04:00
parent ebb88bf969
commit 852cc28c1a
2 changed files with 1 additions and 2 deletions

View file

@ -6,7 +6,6 @@ from selfprivacy_api.utils.prometheus import PrometheusQueries
@strawberry.type @strawberry.type
class Monitoring: class Monitoring:
@strawberry.field @strawberry.field
def disks_usage(): def disks_usage():
return PrometheusQueries.disks_usage() return PrometheusQueries.disks_usage()

View file

@ -48,7 +48,7 @@ class PrometheusQueries:
"""Get disk usage information""" """Get disk usage information"""
start = int((datetime.now() - timedelta(minutes=20)).timestamp()) start = int((datetime.now() - timedelta(minutes=20)).timestamp())
end = int(datetime.now().timestamp()) end = int(datetime.now().timestamp())
query = 'rate(node_filesystem_size_bytes{mountpoint="/"}[5m])' query = '100 - (100 * ((node_filesystem_avail_bytes{mountpoint="/",fstype!="rootfs"} ) / (node_filesystem_size_bytes{mountpoint="/",fstype!="rootfs"}) ))'
params = {"query": query, "start": start, "end": end, "step": 60} params = {"query": query, "start": start, "end": end, "step": 60}
return self._send_request(params=params) return self._send_request(params=params)