Trying to monitor the size of a FOLDER in Linux

Hi everyone
I am using checkmk “Free” edition.

What I want to do is monitor the size of a directory say /mnt/local/test
If that directory is over a certain size, to alert me.

I have been reading this Monitoring files
However I am stuck, and new to this, so I don’t know what to do.
Note that I believe I need to use the NON mk_filestats plugin, because I want the information for a whole folder, not specific files.

Here’s what I have done so far:

Setup → Services → Service monitoring rules → Size, age and count of file groups
Created a rule in here, gave it description
Set “Maximal size” to Warning at or above 25GiB, Critical at or above 50GiB.
I set explicit hosts to the host in question and the “file group name” to /mnt/local/test

Next I went to
Setup → Agents → Windows, Linux, Solaris, AIX → Agent Rules → Count, size and age of files
Here I configured the field “Count, size and age of files” to “/mnt/local/test”
I set an explicit host to the host in question and saved it.

Then, I went to the agents again and hit “bake agents” it gave me a new agent which I downloaded the .deb file and installed on the host.

Nothing has happened. I have scanned for new services, restarted the agent but I cannot figure out how this works from here. I lack the knowledge to get further. Help!!!

P.S, I understand as this is already a host with an agent I should have been able to install the new agent automatically? Is that right, how would I do that??

Thanks!!

This agent plugin only scans files, not directories. You need to configure it with /mnt/local/test/*.

And you need an additional rule to group the files into a group. That is the ruleset “File Grouping Patterns”.

1 Like

This can be achieved with the agent updater, also available in the CFE: Automatic agent updates - Distribute agents and plug-ins automatically

1 Like

Thanks for the information
I have managed to get agent auto deployment working so that’s great.
Here’s what I have done for the monitoring of my directory size I want to achieve, I feel this is overly complicated for such a simple task, but it’s probably just that I don’t understand the system.

Setup → Services → Service Monitoring Rules → Size, Age and count of file groups → edit rule
I added a condition for “Local group name” and called it localmedia

Setup → Services → Service Monitoring Rules → Group Patterns
Created a new pattern
Configured “File Grouping Patterns”
Set its name to “localmedia” including the pattern of my directory I want to monitor as /mnt/local/test/*
Here I also set explicit host option for my host I want to monitor the directory on.

Yet, still nothing is showing up anywhere.
What am I missing, where do I need to go so that the size of the directory is monitored?
Thanks!

I should also add I went into the agent configuration and specified the rule and pushed it out with the bakery, but it hasn’t made a difference.

Hi,
for Linux you can use the DirSize-Plugin, you can find here:

Karl

This looks much easier. Thanks.

I have configured the check for a directory but it constantly returns as 0b.
I am not sure how to debug.
I chmod 777 -R but no luck.

Can anyone help? :slight_smile:

I also posted an issue on their GitHub page to see if anyone can help.

Turns out I’m a stupid head.
The directory is naturally 0b as it’s an upload queue dir and the uploads are already deleted.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.