Configuring FreeBSD to notify me when an interface is down

Hi!
I'm trying to configure my FreeBSD so that it notifies me when an interface goes down.
I've written this script in /etc/devd/interface.conf
Code:
notify 0 {
    match "system"        "IFNET";
    match "subsystem"     "(em0|em1)";
    match "type"          "LINK_DOWN";
    action "/usr/local/sbin/notifier.sh $subsystem"
}

Would this work? And if yes, what sort of response can I expect to see from FreeBSD when the interface goes down?

Thanks!
 
sorry , I cant help you with devd , but you can write an script and put it in cron every x seconds or minutes to check the interface
 
Not sure if subsystem is correct. But the basic idea should work.

This is what I've used for a carp(4) connection. It automagically sends a notification to Zabbix about the state of the interface (BACKUP, MASTER) if it changes. Which allows me to keep track of which node is the active one.

Code:
% cat /etc/devd/carp.conf
notify 0 {
        match "system"    "CARP";
        match "subsystem" "[0-9]+@[0-9a-z]+";
        match "type"      "(MASTER|BACKUP)";
        action "/root/bin/carpcontrol.sh $type $subsystem";
};
 
Hi!
I'm trying to configure my FreeBSD so that it notifies me when an interface goes down.
I've written this script in /etc/devd/interface.conf
Code:
notify 0 {
    match "system"        "IFNET";
    match "subsystem"     "(em0|em1)";
    match "type"          "LINK_DOWN";
    action "/usr/local/sbin/notifier.sh $subsystem"
}

Would this work? And if yes, what sort of response can I expect to see from FreeBSD when the interface goes down?

Semicolon needed after each line in notify 0 {...} including the last.

Whether and how it works will depend on your content in /usr/local/sbin/notifier.sh ?

From one I added years ago to monitor battery charge reports (ACPI CMBAT), write some stats to a log and a line to /var/log/messages:

Code:
#!/bin/sh
LOGGER="logger -t acpi_cmbat -p daemon.notice"
${LOGGER} "CMBAT notify = $1"
/root/bin/x200stat >> /root/acpi_cmbat_events.log

Or you could play a tune ...

cheers
 
Back
Top