check_mk_extensions
check_mk_extensions copied to clipboard
Check interval for dir_size
Hi, it would be great to have a check interval available to set in WATO for the dir_size check, since this can take up quite some time in many cases. Manually moving it to a subfolder (e.g. 600) will not solve the issue, since the bakery will put it in the main plugin folder eventually, messing up the monitoring for the whole host. Thanks for reading, Roland.
@gurubert Hi Robert. Kannste hier mal schauen? :-)
i rebuild the check to this, and make my own interval
#!/bin/bash
CONTENTFILE="/tmp/dir_size_checkmk.out"
TMPCONTENTFILE="/tmp/dir_size_checkmk.out.tmp"
function createoutput() {
(
if [ -e "$MK_CONFDIR/dir_size.cfg" ]; then
touch $TMPCONTENTFILE
echo '<<<dir_size>>>' >$TMPCONTENTFILE
grep -v "^#" $MK_CONFDIR/dir_size.cfg |
while read -r path; do
if [[ $path == */ ]]; then
if [ -d "$path" ]; then
find "$path" -mindepth 1 -maxdepth 1 -type d -exec nice ionice -c2 -n7 du -s {} \; >>$TMPCONTENTFILE
fi
else
if [ -d "$path" ]; then
nice ionice -c2 -n7 du -s "$path" >>$TMPCONTENTFILE
fi
fi
done
cp $TMPCONTENTFILE $CONTENTFILE
fi
) &
}
if [[ ! -f "$TMPCONTENTFILE" ]]; then
createoutput
elif [[ $(find "$CONTENTFILE" -mtime +1 -print 2>/dev/null) ]]; then
createoutput
fi
# Output
if [[ -f "$CONTENTFILE" ]]; then
CONTENT="$(cat $CONTENTFILE)"
if [[ $(echo "$CONTENT" | wc -l) -gt 0 ]]; then
cat "$CONTENTFILE"
fi
fi
in dir_size.cfg
if path ends with "/" so this will include subdirs, without only the spec path also recheck only 1 per day
but yes check Interval per service would be nice
please test dir_size-5.2.0.mkp
Hi @gurubert ,
funktioniert gut.