Xymon Mailing List Archive search

Need help with NOEXIST for a directory

list Christoph Zechner
Wed, 30 Oct 2024 11:44:17 +0100
Message-Id: <user-3d1e357a2056@xymon.invalid>

Hi,

On 30/10/2024 00:55, Grant Taylor via Xymon wrote:
On 10/29/24 6:04 PM, Tom Schmidt wrote:
Looking at the source code, the NOEXIST option is only available for file testing, not directory testing.  You could make a request to add that feature.
Thank you for clarifying and confirming what I thought might be the case.  :-)
there is a workaround (read: dirty hack) you could use:

put a DIR check in your check list, like

DIR /home/user/test-directory SIZE<4B

and a corresponding line into logfetch.cfg:

[host=CLIENTHOSTNAME]
dir://home/user/test-directory

(replacing CLIENTHOSTNAME with the correct value of course)

This checks for a directory /home/user/test-directory bigger than 4B. If it does not exist, xymon will report:

Could not determine size of directory /home/user/test-directory

If it does exist (even when empty, that's why we need to use 4B in size), xymon will report:

Could not determine size of directory /home/user/test-directory

It is not quite the same, but it could be used for this scenario. You could of course fine-tune the size values if you expect the directory to have a certain size, my test case was just an empty file.

Cheers
Christoph

The other option is to make your own simple external script that monitors for the non-existence of the directory.
I've used a dir:`COMMAND` in the client-local.cfg (from memory) file that looks for the directory and doesn't report it if it's not there and avoids failing if the directory isn't there.  I then have a DIR: ... SIZE<1 in analysis.cfg for the directory in question.