Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-130271 / 24.10 / Check SnapshotCountAlert on SMB shares only #14161

Merged
merged 9 commits into from
Aug 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
address @anodos325
creatorcary committed Aug 9, 2024
commit 05157964b3d6457403594033c304c1b26fce054d
3 changes: 3 additions & 0 deletions src/middlewared/middlewared/alert/source/snapshot_count.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from middlewared.alert.base import AlertClass, AlertCategory, AlertLevel, Alert, AlertSource
from middlewared.alert.schedule import CrontabSchedule
from middlewared.utils.path import FSLocation, path_location


class SnapshotTotalCountAlertClass(AlertClass):
@@ -46,6 +47,8 @@ async def _check_smb(self, snapshot_counts: dict[str, int]) -> list[Alert]:
to_alert = list()

for share in await self.middleware.call("sharing.smb.query"):
if path_location(share["path"]) != FSLocation.LOCAL:
continue
path = share["path"].removeprefix("/mnt/")
anodos325 marked this conversation as resolved.
Show resolved Hide resolved
count = snapshot_counts.get(path, 0)
if count > max_: