Mount options of /tmp check

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 ?

Hi Marco,

I think this article would be nice interesting for you: https://checkmk.com/cms_intro.html#magicfactor

I hope it helps
Anastasios

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.

2 Likes

Sorry this is for Filesystem. I was asking for Mount options.

Thanks for the detailed explanation Dirk. So far, I have disabled the check. I will try the options mentioned by you and will update here.

1 Like

@marco I modified the mounts plugin and submitted a pull request on github. Let’s see what they think of it.

2 Likes

Thank you Dirk. That sounds really good.

Hi @marco,

given that it is not clear if and when tribe29 will approve my pull request I published the changes on github.

You can download the MKP file from there.

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.

Just give it a try on a test site.

Cheers,
Dirk

1 Like

Thanks a lot for the MKP.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.