Monitoring your ZFS root using monit

Started by redbull666, February 26, 2022, 09:30:52 AM

Previous topic - Next topic
January 15, 2023, 11:03:13 PM #15 Last Edit: January 15, 2023, 11:23:08 PM by dcol
I have tried commenting the entire script and it still shows 'No such file or directory'
Must be something else.

Maybe there is a problem with the NonZeroStatus test. No other enabled Monit service uses that test.

[Update] I enabled gateway status check, which uses the NonZeroStatus test and it works fine. I am at a complete loss on this one.

Not very likely if you can't even execute the script using the command line. This has nothing to do with Monit at all.

There must be some issue with my OPNsense. I can execute the test.sh just fine in the same location. I have two other custom Monit scripts and they work fine.

My assumption still is that the error is caused by either wrong (invisible) characters in the bash file or by a wrong encoding.

If you can execute other files (with the same shebang at the top) just fine there MUST be an issue with this particular file.

Sure seems that way. I just copied the script from this thread and used notepad to save it to a file. Did the same with one of my other custom Monit tests.

try to learn a bit about unixes/bsds dcol, it helps. Most of the errors you have posted are result of not being familiar with the way the OSs work.
For instance they are case sensitive. zfs-file.sh is not the same as ZFS-file.sh. The result is file/object not found.
Paths are important. If you try to find or run a file, the path has to be able to get to it. A period i.e, "." denotes the current location you are at.
The shebang in a script tells the OS which shell to use, so #! /bin/sh at the beginning is important.

Do you have nano installed on OPN? Forget the windows editors, they introduce characters mostly for line endings that are different in unix and windows, and often a source of no end of problems. In this case I doubt is the problem but a) will help in the future, b) will take care of it if is the problem.
pkg install nano is to install it.

Once installed. Remove the file and recreate it as per the first post with nano, that allows you to paste into it.
Take it from there.