I would like to have a syslog messages everytime the link state changes on our linux servers.

So for example, if the switch power cycles, the linux server will log eth0 link state changed to down at 5:05 pm. And when the switch is back, it would log eth0 link state changed to up at 5:06 pm.

I know how to get the link state (so far the only reliable tool I found is mii-tool). I could use a cron job that would check every minute with mii-tool, but I would rather a program (or daemon) that monitors it and then either runs a command or logs a message.

I read that ip monitor (rtmon) can do this, however I can't get that to work.

Does anyone know how I could do this?
Thanks.