Xander Cage writes:
hi,
i use the storage promise to monitor disk space. now i want to make sure that some volume has always lets say 500MB free, but i could not see a practical way to do it. i read in the docs of eval that there are some math functions but i hope there issomething easier.
Hi Christian,
How would you make sure that some volume always has 500MB of free space?
Off the top of my head I can think of 2 relatively easy possibilities.
Then I start thinking about more crazy things like unionfs to merge in free space from some place afar but really getting into the rhelm of crazy here.
In either of the relatively simple ways I can think of you are obviously constrained by what was allocated to the host. Either your host is allocated a large PV of which very little is actually used or your filesystem is allocated significant space that you pre-fill with blobs that can be purged to free up space.
Does this help?
– Nick Anderson| Doer of Things | (+1) 785-550-1767 | https://northern.tech
Xander Cage writes:
Option 2 is exactly what i had in mind. As this is AIX and everything is managed through the AIX Volume Manager , so allocation contraints can be disregarded.
I looked at https://github.com/cfengine/masterfiles/blob/master/lib/storage.cf, but could not find evidence where the information/value about free space is gathered or is this done in C somewhere in the agent? I need to know this classes/vars so that i can use eval functions on it.
Are your reports promises from your policy emitted when the filesystem is too full?
reports: system_root_full:: "Report: / has to little free space."; var_full:: "Report: /var has to little free space."; usr_full:: "Report: /usr has to little free space."; opt_full:: "Report: /opt has to little free space."; tmp_full:: "Report: /tmp has to little free space.";
If they are, you should just be able to leverage them with commands promises.
commands: var_full:: "command to extend var +500M";
Storage promises don't define variables about the free space available, they simply check to see if the volume has the free space you want or not and then defines the class. So, if you really want to do math so that you extend volume by 500M-freespace you will need to get the current free space into a var so that you can do the caluclation.
Does that make sense or am I missing something obvious?