Using Upstart+???? to monitor interfaces

Asked by Kevin Fries on 2009-05-11

OK, one more question....

As I stated in my previous question, I am doing a testbed, minimal LFS build to test a few things out.

One thing I would love to figure out is if I can monitor interface connectivity and restart an interface, or use a failover interface from Upstart instead of having to have an external monitoring application? Or, could I let Upstart start the interfaces, and use external "emit" messages to have Upstart bring interfaces up and down? Or, is Upstart not ready for this, and I should use ifupdown?


A router with three interfaces eth0, eth1, and eth2.
eth0 => Internal Interface
eth1 => Primary Wan Interface
eth2 => Backup Wan Interface

on boot eth{0,1} is brought up, but not eth2. some type of test is being performed against eth1 on a regular basis (a ping to a public webserver every 10 seconds for example). When some type of condition indicates that the interface is down, I want eth2 to be fired up... but once eth1 starts responding again, eth2 will be brought back down.

What I am trying to simulate:

I have a remote office, that has an unreliable iDSL connection, but they need to stay online. So we have some other type of expensive (pay per use) connection like cellular or satilite. If the VPN to the corporate office goes down, using the cheaper connection, use the expensive one, but only as long as possible.

Solution 1:
eth{0,1} are started on bootup. eth2 is started on failed eth1. eth2 is stopped on successful startup of eth1. Interfaces are actually brought up and down using ifupdown.

Solution 2:
Upstart does not bring up any interface, but the normal ifupdown does that via /etc/interfaces. A monitoring app is brought up via upstart (so I can use a respawn) that issues the ifupdown commands to enforce the business rule.

Solution 3:
Upstart has no role here, or those features are not yet available

Personally, I think Solution 1 should be possible, and should create one heck of a stable system.

Any idea?

Kevin Fries
Senior Linux/R&D Engineer

Question information

English Edit question
upstart Edit question
No assignee Edit question
Last query:
Last reply:
Kevin Fries (kevin-kevinfries) said : #1

Oops, I forgot Solution 2a:
Use upstart to bring up the interfaces, then use a tool such as God, or Monit, or Mon, or <insert your favoured monitoring app here> to use "initctrl emit" commands to have the interfaces go up and down. (again, this seems like a contrived solution because why not just use ifupdown, but like I said its a learning built).

The answer is pretty much however you like ;)

I think in the long term the standard approach will be to:

 1) have Upstart use libudev to collect events about hardware

 2) also have Upstart receive more complete events from daemons like Network Manager

 3) use ifupdown or Network Manager to perform the interface up/down work

 4) receive an event from them to indicate the interface is up

Can you help with this problem?

Provide an answer of your own, or ask Kevin Fries for more information if necessary.

To post a message you must log in.