Query to calculate percent

Hello all,

I have limited promql and trying to work out how to calculate percentage.

My kubernetes cluster has a service that imports a large amount of files on certain days.

The following query returns all imported files for the service:

sum(increase(imported_files_Active_Count_total{app=“import-files-qa”, kubernetes_pod_name=~“import-files-qa-([0-9a-zA-Z].)", pod=~"import-files-qa-([0-9a-zA-Z].)”}[4h]))

How do I create an alert or a rule in grafana/promql for when the number of files drops below 80% ?

Thank you

1 Like