Monit - Test with type Network Ping not allowed for this service type

Started by TarteTatin, June 15, 2025, 03:55:14 PM

Previous topic - Next topic
Hello,

I can't make something work and I don't know what is my error.

My provider changes sometimes my WAN IP address, and when it happens, my Internet connection stop working, and I have to manually reload the WAN interface in "Interfaces: Overview" to make it work again.
So it's a problem when I am not at home.

I want to automatically reload this interface when Internet is not available anymore.

I tried to use "Monit", but my configuration is not accepted.

Services: Monit: Settings: Service Tests Settings
Name: ping_failed_cloudflare
Condition: failed ping4 address 1.1.1.1 count 5 with timeout 5 seconds
Action: Alert

Services: Monit: Settings: Service Settings
Enable service checks: checked
Name: reload_wan
Type: Custom
Path: /usr/local/sbin/ifctl
Start:
Stop: /usr/local/sbin/ifctl -r opt2
Tests: ping_failed_cloudflare
Depends:
Description: Reload WAN interface if ping to Cloudflare DNS fail.

I can't save my "Service Settings - reload_wan" configuration, and here is the error message:
QuoteTest ping_failed_cloudflare with type Network Ping not allowed for this service type
How to make it work?

Thanks for your help!

I tried different things and it does not work, even with "Type: Remote Host". I think I will try my chance with cron instead of Monit.