In my current project, this particlar filesystem /tmp is dynamic. So whenever it is exec/no-exec , the check turns into WARNING state.
Apart from disabling the check, can you advise what can be done to handle this dynamic behaviour ? Shall we make the mount options permanent and make a default threshold for the options ?
Unfortunatley the mounts check currently has no proper possibility to configure what you ask for. Most of the behaviour is hardcoded. Contrary to what the manpage says, not only the option commit= is ignored but also the options localalloc=, subvol=, and subvolid=.
The only thing you can configure is a list of expected options, for example relatime or noexec, in which case the check goes WARN if any of these options does not exist. But you cannot tell the check which options to ignore.
I would suggest to either disable the check for /tmp entirely or to copy the check plugin from ~/share/check_mk/checks/mounts to ~/local/share/check_mk/checks/mounts and enhance the (hardcoded) list of options to ignore in that local copy. The check contains a helper function that reads
# Ignore options that are allowed to change
def should_ignore_option(option):
for ignored_option in ["commit=", "localalloc=", "subvol=", "subvolid="]:
if option.startswith(ignored_option):
return True
return False
As a first approach you could add noexec to the list, i.e.
for ignored_option in ["commit=", "localalloc=", "subvol=", "subvolid=", "noexec"]:
...
Note that this will ignore the option for all filesystems. Restricting this to just /tmp would be a bit more complicated and has the downside that then not only the list but also the filesystem would be hardcoded in the check.
To be honest, I’d either enhance the WATO plugin and enable the check to also have the list of ignored options configurable or wait until someone else finds the time to do this.
The new rule is compatible with existing rules but it may get a bit bumpy if you again remove the MKP file. In that case you probably have to delete all rules regarding mount-options for which you also configured an ignore list.
This is because the old parameterset is just a list (of expected options) while the new parameterset is a dictionary with two lists (the expected options and those to ignore). The modified WATO plugin can read both (so existing rules will be considered) but once you save a rule with the new WATO plugin installed, these rules are converted to and written in the dictionary format.
If you later decide to remove the Extension package the original plugin will complain about the unexpected format of the parameterset.