What happens if you just make it a file: entry, even though it's a directory? My guess is that EXISTS simply reports whether the [file://run/log/journal] section has any content matching the "file" name. The fact that it happens to be a directory probably doesn't matter for EXISTS.
There's a chance that the [dir:<dirname>] is significantly different in structure from [file:<filename>] to the point that Xymon gets weirded out and complains that the "file" doesn't look like a file. If that's the case, use backticks to make the dir look like a file. Something like:
file:D=/run/log/journal; [ -d $D ] && stat --printf "type:100000 (file)\nmode:%a (%A)\nlinkcount:%h\nowner:%u (%U)\ngroup:%g (%G)\nsize:%s\nclock:$(date +'%s (%F %T.%N %z)')\natime:%X (%x)\nctime:%Z (%z)\nmtime:%Y (%y)\n" /run/log/journal
If the dir exists, this gives me:
type:100000 (file) mode:2755 (drwxr-sr-x) linkcount:3 owner:0 (root) group:190 (systemd-journal) size:60 clock:1730432083 (2024-11-01 14:34:43.189892664 +1100) atime:1730392322 (2024-11-01 03:32:02.629206150 +1100) ctime:1714705493 (2024-05-03 13:04:53.832001476 +1000) mtime:1714705472 (2024-05-03 13:04:32.778000198 +1000)
so Xymon should see this as a file, and things like EXISTS should work, and show this as OK.
If the dir doesn't exist, this gives me no output, so EXISTS should flag this as an error with an appropriate message.
Ugly, but should work, if you have GNUstat and date. If you like, you could
put this (or equivalent) into a script and use file:testdir /run/log/journal.
J
On Fri, 1 Nov 2024 at 13:07, Grant Taylor via Xymon <xymon@xymon.com> wrote:
On 10/30/24 05:44, Christoph Zechner wrote:
there is a workaround (read: dirty hack) you could use:
put a DIR check in your check list
That's what I did, and said as much.
On 10/29/24 18:55, Grant Taylor via Xymon wrote:
I've used a dir:
COMMANDin 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.The
COMMANDpart of the dir:COMMANDis that the command generates a list of the directories that exist out of the possible directories.If one of the possible directories doesn't exist, then it won't be listed in
COMMANDs output and as such won't generate an error for the directory not existing.For clarity, the possible directories are:
- /run/log/journal
- /var/log/journal
I'm wanting to make sure that /run/log/journal doesn't exist as I want to use persistent journaling to /var/log/journal.
Aside: I suppose I should also make sure that /var/log/journal does exist and that it's being used; read size > 0.
COMMANDis a simple/bin/ls -d /???/log/journalcommand that will simply list one or both of the directories if they exist.P.S. I'm tired of systemd-journald consuming ~4 GB of swap for logs that are in /run (tmpfs) which is memory -> swap backed. I've got multiple systems where logs are 80% of what's in swap. IMHO those logs should live on disk; hence /var/log/journal. -- I'm wanting to have Xymon be a safety net and report when it finds systems using the wrong directory.
-- Grant. . . .
Xymon mailing list -- xymon@xymon.com To unsubscribe send an email to xymon-leave@xymon.com