CREATIVE CHAOS   ▋ blog

Qnap Monitoring With Check Mk

PUBLISHED ON 21/12/2017 — EDITED ON 11/12/2023 — SYSOPS

A little update on 7.1.2020

I have implemented monitoring of QNAP devices with CheckMK following this tutorial.

The problem was that if the mount point path was too long for column, df would break the line there and the hack parser mentioned in the tutorial stops working.

To solve this issue, use -P switch with df, to force POSIX compliancy and prevent breaklines. So the working command to output and semi-parse the data would be:

df -Pk | sed 1d | awk '{print $1" ext4 "$2" "$3" "$4" "$5" "$6}'

The corresponding section should look like this, comment out the old command and paste the new one:


    echo '<<<df>>>'
    # We really *need* word splitting below!
    # shellcheck disable=SC2086
    # df -PTlk ${excludefs} | sed 1d
    df -Pk | sed 1d | awk '{print $1" ext4 "$2" "$3" "$4" "$5" "$6}'

Don’t forget to edit this part every time you update the checkmk agent.