Monitoring Custom Directories in Linux

Hi there,
I was wondering how can I monitor the size of a custom list of directories in Linux. I moved recently to the raw versions, and importing external libraries is not an option here. Unless there is a manual steps to import external plugins from extchange.checkmk.com

Is there a way to do it using the linux agent only?

As always, thank you guys for the continuous help.
Regards,

The easiest way is a small script (local check) on the monitored host.
But there are also packages available like this one. There you get a plugin for your agent and a configurable check on your monitoring machine.
The how-to for the mkp files you can find here.

3 Likes

Hello,

What blocks you from using fileinfo?
You could use globbing patterns to cover several directories.

You could use /dir/**/**/* in the fileinfo.cfg to cover following structure:

[root@deaugwuxl0666 dir]# tree
.
β”œβ”€β”€ dira
β”‚   β”œβ”€β”€ dir1
β”‚   β”‚   β”œβ”€β”€ file1
β”‚   β”‚   β”œβ”€β”€ file2
β”‚   β”‚   └── file3
β”‚   β”œβ”€β”€ dir2
β”‚   β”‚   β”œβ”€β”€ file1
β”‚   β”‚   β”œβ”€β”€ file2
β”‚   β”‚   └── file3
β”‚   └── dir3
β”‚       β”œβ”€β”€ file1
β”‚       β”œβ”€β”€ file2
β”‚       └── file3
β”œβ”€β”€ dirb
β”‚   β”œβ”€β”€ dir1
β”‚   β”‚   β”œβ”€β”€ file1
β”‚   β”‚   β”œβ”€β”€ file2
β”‚   β”‚   └── file3
β”‚   β”œβ”€β”€ dir2
β”‚   β”‚   β”œβ”€β”€ file1
β”‚   β”‚   β”œβ”€β”€ file2
β”‚   β”‚   └── file3
β”‚   └── dir3
β”‚       β”œβ”€β”€ file1
β”‚       β”œβ”€β”€ file2
β”‚       └── file3
└── dirc
    β”œβ”€β”€ dir1
    β”‚   β”œβ”€β”€ file1
    β”‚   β”œβ”€β”€ file2
    β”‚   └── file3
    β”œβ”€β”€ dir2
    β”‚   β”œβ”€β”€ file1
    β”‚   β”œβ”€β”€ file2
    β”‚   └── file3
    └── dir3
        β”œβ”€β”€ file1
        β”œβ”€β”€ file2
        └── file3

Creates Agent Output:

<<<fileinfo:sep(124)>>>
1625748948
[[[header]]]
name|status|size|time
[[[content]]]
/dir/dira/dir1/file1|ok|0|1625747272
/dir/dira/dir1/file2|ok|0|1625747272
/dir/dira/dir1/file3|ok|0|1625747272
/dir/dira/dir2/file1|ok|0|1625747272
/dir/dira/dir2/file2|ok|0|1625747272
/dir/dira/dir2/file3|ok|0|1625747272
/dir/dira/dir3/file1|ok|0|1625747272
/dir/dira/dir3/file2|ok|0|1625747272
/dir/dira/dir3/file3|ok|0|1625747272
/dir/dirb/dir1/file1|ok|0|1625747272
/dir/dirb/dir1/file2|ok|0|1625747272
/dir/dirb/dir1/file3|ok|0|1625747272
/dir/dirb/dir2/file1|ok|0|1625747272
/dir/dirb/dir2/file2|ok|0|1625747272
/dir/dirb/dir2/file3|ok|0|1625747272
/dir/dirb/dir3/file1|ok|0|1625747272
/dir/dirb/dir3/file2|ok|0|1625747272
/dir/dirb/dir3/file3|ok|0|1625747272
/dir/dirc/dir1/file1|ok|0|1625747272
/dir/dirc/dir1/file2|ok|0|1625747272
/dir/dirc/dir1/file3|ok|0|1625747272
/dir/dirc/dir2/file1|ok|0|1625747272
/dir/dirc/dir2/file2|ok|0|1625747272
/dir/dirc/dir2/file3|ok|0|1625747272
/dir/dirc/dir3/file1|ok|0|1625747272
/dir/dirc/dir3/file2|ok|0|1625747272
/dir/dirc/dir3/file3|ok|0|1625747272

With the rule β€œfile grouping patterns” you could group that together and with the rule " Size, age and count of file groups" you can set the thresholds.

I hope that helps

Thank you Mike. I was not aware of this one. I will try it out.

Thank you Andreas as usual. For being supportive. I will give this a try. I have a different question: Regarding the piggyback data in the server. How long does it take for CheckMk to remove the outdate entries from the server from this folder /omd/sites/ro/tmp/checkmk/piggyback/. Is it something that we can configure to run faster?

Thank you in advance

Hallo,
new question new thread to get the attention of all other users.
Ralf

1 Like

Makes perfect sense.
Thanks

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.