Steve Kemp's Blog Writings relating to Debian & Free Software

Everybody rolls with their fingers crossed

Tue, 19 Sep 2006 12:32:38 GMT

I’ve been using monit on my Debian servers for a long time now.

For those that don’t know monit is a simple monitoring service which allows you to check that processes are running, automatically restarting them on failure, etc.

When I first started using monit I manually added all the checks to /etc/monit/monitrc – but that soon became unwieldy, even with only three machines to maintain.

Adding new software meant I had to keep updating the file, and because each server ran different services things couldn’t be shared. Not good.

After I while I figured I’d create /etc/monit/includes and just drop files into there – that way I could include them:

# /etc/monit/monitrc

include /etc/monit/include/*.monit

Now to monitor a service I’d just create the appropriate file with a .monit suffix. All was good.

Until I needed to start monitoring different services on different systems where adding and removing the files got to be painful. Surely there must be a better way I wondered to myself?

Now there is.

I’ve come up with a nice approach (perhaps the obvious one to everybody else?):

I now have two directories:

  • /etc/monit/include.d
  • /etc/monit/master.d

The master.d can have all your *.monit files dropped into it, regardless of whether they apply to the given host or not.

To actually monitor a service you’d symlink master.d/foo.monit to include.d/foo.monit – In much the same way as you use symlinks to handle Apache sites and modules in Apache2.x

Now the really clever bit is that you write a (perl) script to automatically parse each .monit file and only link in the ones which apply to this host.

That means you can use cfengine to copy everything into the master.d/ file – and not care if some tests only apply to other hots. (e.g. You can crteate apache2.monit – and that will be symlinked in if apache2 is installed on the current host, but ignored otherwise.)

For the moment my parsing and detection code is very simple, but it is working.

In the future I guess I could create foo.monit and foo.package – then only link in the file foo.monit if the Debian package contained in foo.package was installed.

The script is in my cvs repository along with a collection of test files.

I will attempt to catch up on mail tomorrow…



Comments On This Entry

[gravitar] sno

Submitted at 11:23:42 on 24 October 2013

wow time flies! good luck with the bedroom re-org

[gravitar] Charles Darke

Submitted at 21:04:52 on 24 October 2013

Good luck! And I hope your plan works out for you! :)

[gravitar] Nux

Submitted at 15:39:11 on 26 October 2013

Wow, quite dramatic changes in your life.

I wish you good luck! :-)

What do you plan for your open source projects? Will you still "attend" to them?

[gravitar] Steve

Submitted at 16:05:46 on 26 October 2013

I can't imagine giving such things up, no. Even if I were besieged upon all sides by wailing bairns!

[gravitar] Nux

Submitted at 00:05:51 on 27 October 2013

Hehe, good good!

[gravitar] John

Submitted at 16:54:11 on 30 October 2013

There is a lot of good things to say about Bytemark, But on every one of the 5 days since you posted you have left, my clients who use the BigV cloud service had outages. An odd coincidence.

[gravitar] Steve Kemp

Submitted at 13:35:08 on 31 October 2013

Sadly that is just an unfortunate coincidence.

[gravitar] Pete Foster

Submitted at 18:52:35 on 29 March 2014

I realised the exact same as you about DNS.

I have 4 VMs (I think a couple may actually be containers) from 4 separate providers in 4 separate locations. They cost peanuts. The only time I have had problems where DNS stopped working altogether is when it was a PEBKAC problem.

[gravitar] Steve Kemp

Submitted at 19:27:41 on 29 March 2014

I realize I'm simplifying a little, as you have to cope with glue records, and some TLDs have weird requirements.

(I think it is .it who require your nameservers respond on TCP, rather than UDP.)

The biggest potential issue is that changing the IPs of nameservers is an annoyance, so you want long-term-static IPs, and ideally you want IPv6 too.

Still of all the "Run XXX as a service" DNS has to be the simplest...

[gravitar] Paul Tansom

Submitted at 15:21:27 on 31 March 2014

I know what you mean about paying for DNS. Many domain registration agents offer the service for free (although some are pretty poor), and there are some very good free services around - I'm currently migrating, likely temporarily, to Hurricane Electric which have a nice setup and will even show you the zone file which is great for migrating to your own setup at some point.

I'd almost forgotten Dyn were still going. They bought up the service I was using a while back and, iirc, forced everyone across to a paid service. They also kicked me off the free dynamic DNS service I was using for my dad's connection because I hadn't logged into the web site - clearly a policy for jettisoning anyone not paying. The main pain there is that most consumer ADSL routers can be configured for Dyn, but aren't flexible enough to use other services.

On a more positive note, for a hosted service for only a few domains Hurricane Electric have a nice setup with good IPv6 support, proper SPF records and reverse DNS - setting up a reverse IPv6 zone was what prompted the move so I could get Google to accept mail from me over IPv6.


Comments are closed on posts which are more than ten days old.

Spiral Logo


Recent Posts

Recent Tags


RSS Feed

  • Subscribe to feed