Skip to content

Instantly share code, notes, and snippets.

@rolandvarga
Last active March 31, 2020 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolandvarga/624a8258d50109d14ed319e950092e0d to your computer and use it in GitHub Desktop.
Save rolandvarga/624a8258d50109d14ed319e950092e0d to your computer and use it in GitHub Desktop.
groups:
- name: SLA Recording Rules
rules:
- record: with_silence:virtual_machine_up:bool
expr: sum(avg_over_time(with_silence:virtual_machine_up:bool{tag_monitoring="enabled"}[30d])) / count(avg_over_time(with_silence:virtual_machine_up:bool{tag_monitoring="enabled"}[30d]))
- record: with_silence:virtual_machine_up:bool
expr: >
((
sum by(resource_group, resource_name)
(virtual_machine_up)
+
sum by(resource_group, resource_name)
(alertmanager_silence_info)
OR
sum by(resource_group, resource_name)
(virtual_machine_up)
) >= bool 1) * on (resource_group, resource_name) group_left(resource_type, tag_client_name, tag_monitoring)
mock_tag_info{resource_type="Microsoft.Compute/virtualMachines", exported_instance="prometheus-mock-exporter"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment