The manual example on network is:
check network eth0 with interface eth0 start program = '/sbin/ipup eth0' stop program = '/sbin/ipdown eth0' if failed link then restart
as soon as I add a "* program" entry monit does not startup with
$ ./monit -c monitrc [...]/monitrc:10: syntax error '='
monitrc is as simple as
set daemon 60 set log syslog set httpd port 2812 and use address localhost allow localhost allow admin:monit check network net-test with interface eth0 start program = '/usr/bin/touch /tmp/start-eth0' stop program = '/usr/bin/touch /tmp/stop-eth0'
I tested it with the latest git (pasted outputs are from this version @ 5.25.3, cloned 2018-09-09 15:00), on arch-linux (community package @ 5.25.2-1), and the current debian/testing version (default repo @ 5.25.2)
After some more testing I found out the following:
Omitting the spaces or the keyword "program =" makes monit to start up with errors:
check network net-test with interface eth0 start program='/usr/bin/touch /tmp/start-eth0' stop '/usr/bin/touch /tmp/stop-eth0'
$ ./monit -c monitrc /home/boppy/Code/monit-src/monit-dev/monitrc:10: Program does not exist: 'program=' /home/boppy/Code/monit-src/monit-dev/monitrc:11: Program does not exist: ''/usr/bin/touch /tmp/stop-eth0'' Starting Monit 5.25.3 daemon with http interface at [localhost]:2812
Web Frontend states:
Then I shortened my program call to a script without a space in its name (it's still just a
touch on a tmp-file):
check network net-test with interface eth0 start /home/boppy/Code/monit-src/test.sh
This will "do the trick" and will also work from the web frontend button! But the syntax might need some improvements... ;)
PS: git version is 5.25.3, but this version is not (yet) present in the Version dropdown.