Monitor dropbox.cache directory size

A local check to monitor the size of the automatically created Dropbox Cache directory on a linux server.

Firstly, create a new local check as below. Update the if statement to determine the acceptable size of your Dropbox cache directory on your server in KB. Due to the large amount of changes that occur on the server that I wrote this for I have set this value quite large (5GB) though you should adjust as required.

nano /usr/share/check-mk-agent/local/check-dropboxcache

#!/bin/bash

# Locate .dropbox.cache directory
dc=$(locate “dropbox.cache”)

# Calculate size in KB
size=$(du $dc | awk ‘{ print $1 }’)
hrsize=$(du -sh $dc | awk ‘{print $1}’)

if [[ $size -gt 5000000 ]]; then
s=2
st=”Dropbox Cache directory is $hrsize”
else
s=0
st=”Dropbox Cache directory is $hrsize”
fi

echo “$s Dropbox_Cache_Size count=$size;5000;10000;0; $st”

Now make the above file executable and re-inventory your server

chmod +x /usr/share/check-mk-agent/local/check-dropboxcache

Any comments or questions? Get in touch here or Email me at [email protected]