Skip to content

Commit

Permalink
Aggregated rules consumed by Castellum
Browse files Browse the repository at this point in the history
We move the queries from Castellum to here. Also monitor the snapshot
usage to avoid snapshot spill to active share.
  • Loading branch information
chuan137 committed Sep 18, 2023
1 parent 42471b0 commit 3af270d
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# vim: set ft=yaml:

groups:
- name: castellum_manila
rules:

# Case one: old provision style, where snapshot reserve is allocated AS PART OF the target share size and snapshot reserver percentage is 5.
# The logical space reporting/enforcement is always disabled for them.
# Share size = netapp_volume_total_bytes + netapp_volume_snapshot_reserved_bytes
# Share usage = netapp_volume_used_bytes
- record: netapp_volume_provision_case_one
expr: netapp_volume_percentage_snapshot_reserve{share_id!="", volume=~"share.*"} / 5 == 1

- record: manila_share_size_bytes_for_castellum
expr: netapp_volume_provision_case_one * (netapp_volume_total_bytes + netapp_volume_snapshot_reserved_bytes)

- record: manila_share_used_bytes_for_castellum
expr: netapp_volume_provision_case_one * netapp_volume_used_bytes

# We don't monitor the minimal size in particular for shares in case one, they trun to other cases once resized.
- record: manila_share_minimal_size_bytes_for_castellum
expr: netapp_volume_provision_case_one * (netapp_volume_total_bytes + netapp_volume_snapshot_reserved_bytes)

# Case two: new provision style and logical space is NOT enabled
# New provision style means snapshot reserve is allocated IN ADDTION TO share size, and sanpshot reserve percentage is 50
# To avoid snapshot spill, share's minimal size must be larger than the snapshot used size.
# Share size = netapp_volume_total_bytes
# Share usage = netapp_volume_used_bytes
# Share minimal size = max(netapp_volume_total_bytes, netapp_volume_snapshot_used_bytes)
- record: netapp_volume_provision_case_two
expr: (netapp_volume_percentage_snapshot_reserve{share_id!="", volume=~"share.*"} / 50 == 1) * (1 + netapp_volume_is_space_enforcement_logical == 1)

- record: manila_share_size_bytes_for_castellum
expr: netapp_volume_provision_case_two * netapp_volume_total_bytes

- record: manila_share_used_bytes_for_castellum
expr: netapp_volume_provision_case_two * netapp_volume_used_bytes

- record: manila_share_minimal_size_bytes_for_castellum
expr: netapp_volume_provision_case_two * on (share_id) group_left max({__name__=~"netapp_volume_total_bytes|netapp_volume_snapshot_used_bytes"}) by (share_id)

# Case three: new provision style and logical space enabled
# To avoid snapshot spill, share's minimal size must be larger than the snapshot used size.
# Share size = netapp_volume_total_bytes
# Share usage = netapp_volume_logical_used_bytes
# Share minimal size = max(netapp_volume_total_bytes, netapp_volume_snapshot_used_bytes)
- record: netapp_volume_provision_case_three
expr: (netapp_volume_percentage_snapshot_reserve{share_id!="", volume=~"share.*"} / 50 == 1) * (netapp_volume_is_space_enforcement_logical == 1)

- record: manila_share_size_bytes_for_castellum
expr: netapp_volume_provision_case_three * netapp_volume_total_bytes

- record: manila_share_used_bytes_for_castellum
expr: netapp_volume_provision_case_three * netapp_volume_logical_used_bytes

- record: manila_share_minimal_size_bytes_for_castellum
expr: netapp_volume_provision_case_three * on (share_id) group_left max({__name__=~"netapp_volume_total_bytes|netapp_volume_snapshot_used_bytes"}) by (share_id)

0 comments on commit 3af270d

Please sign in to comment.