Getting "disk is % full" warnings even for < 90%
When I log into foreman is see the red dot at the bell symbol. There is a notification “Proxies - 1 New Event - foreman.example.com’s disk is 12% full. Since this proxy is running Pulp, it needs disk space to publish content views. Please ensure the disk does not get full.”
I don’t really see the point of this notification when there is still plenty of disk space available.
No notification, but only when disk space is maybe 90% full.
Foreman and Proxy versions:
Foreman and Proxy plugin versions:
Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
Fixes #24093 - Notification is sent only when disk > 90%
Here’s what happens for a proxy where the disk 12% full:
When the code runs, percentage 12% is < 90%.
The notification does not exist, therefore:
percentage[0..2].to_i < 90 && notification_already_exists?(proxy)
true && false
false # so it does not skip the loop
The next line tries to update old notifications. Since
there are no notifications at this point,
update_notifications(proxy).empty? is true.
Finally it creates the notification (at this point we
have a notification for proxy ‘foreman.example.com’ full at 12%).
After that, the job is scheduled, and when it runs (12h later):
The percentage is less than 90, 12%, and the notification
already exists. At this point Foreman is happy and proceeds
to remove the notification.
percentage[0..2].to_i < 90 && notification_already_exists?(proxy) # evaluates to
true && true
For the next 12h, we don’t have the notification.
Now, 12h later… GOTO beginning of the post :wink:
Basically right before creating the notification I added a check
for > 90% full. The rest of the logic should be fine.