Here is yet another useful nagios pluging that check to see if a target is alive, by sending a continuous ping.
when the target is down the script send the magic packet frame to turn on the machine.
You can download it here
For installing the pluging follow the same step in openvpn nagios pluging article.
At last define the wol service like this
$ sudo cat >> /etc/nagios3/conf.d/services_nagios2.cfg
define service {
hostgroup_name wol
service_description Wake on LAN
check_command check_wol!host!broadcast!mac address!mode
use generic-service
notification_interval 0
}
replace “host” by the ip address or the hostname of your target, “broadcast” by the broadcast ip address, “mac address” by the mac address of your target and mode by “LAN” if your host reside in the local area and by “WAN” if it is in the other side of internet.
Example:
define service {
hostgroup_name wol
service_description Wake on LAN
check_command check_wol!192.168.0.1!192.168.0.255!00:19:db:d5:0d:2d!LAN
use generic-service
notification_interval 0
}