NFS check on AIX 7.2

Hello,
i am using checkmk enterprise (1.6.0p11) and i want to monitor nfs mounts on AIX 7.2 using the AIX agent. As far as I can see the following section in the agent code is intended for this:

# Check for hanging NFS mounts. This needs a GNU stat installed in the PATH
if type stat >/dev/null 2>&1 ; then
echo '<<<nfsmounts>>>'
mount | grep ' nfs' | awk '{print $3;}' | \
    while read MP
do
    waitmax 5 stat -f -c '"'$MP' ok - - - -"' "$MP" || \
        echo "$MP hanging 0 0 0 0"
done

Unfortunately, the stat command does not exist on our AIX systems. Does anyone know if this can be installed? Does it currently work for anyone?

VG
Christian

The binary stat is included in a package called coreutils. Maybe that helps a bit.

1 Like

Hi @simon-mueller,
thank you for this hint.
The checkmk-Script now shows for example the following output for a nfs share:

<<<nfsmounts>>>
/mnt ok - - - -

But I do not see this nfs share during service discovery for this host.
Any ideas?

regards
Christian

Okay, I’ve already figured it out. If you run the agent script as root user, it’ll find the stat command. But if the agent script is executed remotely by checkmk over inet.d, it won’t find the command. Workaround now was to put the stat path into the .profile of the root user. But I am looking for a better way to extend the PATH variable for the agent script.

Place

export PATH=$PATH:<your-custom-path-here>

somewhere, I am not very familiar with AIX, but maybe /etc/environment will do.

Hello, Simon,
/etc/environment we had already tried. So the stat command was in the path of the root user, but only if you logged in via ssh. The checkmk-script nevertheless did not have the command in the path.
Then we just copied the stat command to /usr/bin and now everything works.
Maybe it would have worked to adjust the path variable in /etc/profile, but we didn’t try that anymore.
Thanks for your help!

Christian

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