Using m4 with Nagios: Advanced Ideas

Nagios configuration has been traditionally cumbersome and extensive; there are a lot of things to configure. The addition of templating some time ago helped, but not entirely. A configuration element such as a server or a switch can take up a huge amount of configuration and be quite repetitive, too.

Using m4 can alleviate all of these problems. When combined with GNU Make and Nagios configuration directories, changing the configuration can be done quite simply and easily.

With this beginning of a Makefile in /etc/nagios, all *.cfg files will be converted to *.m4 files as they are included as
prerequisites:

M4=/usr/bin/m4
 
%.cfg : %.m4
        $(M4) -I conf.d/includes < $< > $*.cfg

With this default rule in place, and all configuration files in the conf.d directory can be converted with this
Makefile syntax:

FILES=$(wildcard conf.d/*.cfg)
 
all: $(FILES)

This uses the GNU Make wildcard function to generate a list of files easily. Other directories
can be added with new calls to the wildcard function; it is not recursive and won’t descend
into directories.

Finish off the Makefile with these:


restart: all
        service nagios3 restart
 
.PHONY: all restart

This makes it possible to put the m4 files into conf.d (with matching cfg file or it won’t activate!) and use
a library of predefined macro files included in conf.d/includes. If make is called with make restart then all
configuration files will be processed by m4 as needed and Nagios will be reloaded.

M4 should be included in the base Linux install – but often isn’t. Load it and use it today!

Why Java is the Future for OpenVMS

Support for Java in OpenVMS has increased over the years, and now Java for OpenVMS on Integrity is part of the basic system, and includes Java JDK 6.0 and JRE 6.0.

Installing the Secure Web Server (SWS) – based on Apache – you also get Tomcat and Perl for free.

As long as OpenVMS remains viable, I personally expect both Perl and Java to flourish on this platform. Especially, when not using Perl for typical administration tasks, I expect that Java will be available for more powerful duties.

I would even expect to be able to put things like Stripes, Spring, or even Scala and Lift onto OpenVMS. With the portability of Java, one could potentially just copy over class files, Java archives, or even web application archives and expect things to (mostly) work.

The support for both Perl and Java on OpenVMS makes for an exciting time – and Tomcat to boot.

Share your experiences with Java on OpenVMS…

Death via Design by Committee

I’ve always noted this in the past: those designs that are designed by a committee seem to be, more often than not, to be a conglomeration of ideas rather than something revolutionary. Smashing Magazine has an article about design by committee which seems very apt and on-target.

Examples of both design by committee and its contrast abound in the software industry, present and past. Revolutionary items written by one person include:

  • The Apple II. Designed by Steve Wozniak.
  • The Merlin Assembler. Written by Glen Bredon, and became the pre-eminent 6502 assembler.
  • BDS C. A one-man project by Leor Zolman which broke all the rules for compilers and bested them because of it.
  • Puppet. Written by Luke Kanies.
  • Linux. Written (then coordinated and directed) by one man: Linus Torvalds.
  • OpenBSD. Certainly not written by only one person – not even from the beginning – but OpenBSD has always been one man’s dream (and direction): Theo deRaadt.

Likewise, ideas that were designed by committe abound also. I love the quote from Michael Arrington of TechCrunch, from an article he wrote:

And when too many people have product input, you’ve got lots of features but no soul.

Consider these products by committee:

  • COBOL.
  • PL/I.
  • Ada.
  • CORBA.

Rod Johnson, the founder of the Spring Framework for Java, refered to this as the Complexity Industry. He spoke about the development of Java at QCon in December of 2009. Note that the Spring Framework is known for its simplicity.

If you are a Java developer, listen to Rod’s talk in its entirety; it’s wonderful. The talk about design by committee starts at about 27:00.

True revolution is done through the individual, not the committee.

For a more light-hearted look at design by committee, see this video about designing a stop sign…

A Single Character Causes Downtime for… WordPress.com!

Last Thursday, an error in the wordpress.com software caused some user settings to be overwritten, which resulted in loss of settings for some customers. The site was taken down for checks, and an hour later, 99% of users were back online.

The cause of the error? A coding error of a single character. Certainly checks and balances are needed, but according to Matt Mullenweg, founder of WordPress.com, they are already using reviews and testing.

It was less than a month ago that Toni Schneider, CEO of Automattic, wrote in glowing terms about the use of “continuous deployment” at wordpress.com. Is this event going to lead to the death of “continuous deployment” at WordPress? I suspect not.

In fact, Paul Graham described in a paper how he used Lisp for Viaweb in just this fashion. Viaweb was bought by Yahoo! and became the Yahoo Store. Viaweb would fully implement features before it had even become mainstream.

Let this WordPress.com downtime be a lesson as to what a single character can do, and also a lesson in how none of us are immune from such mistakes.

Making Scala and NetBeans work under Ubuntu Lucid Lynx

Scala is an object-oriented language designed for the Java Virtual Machine (JVM), and a very interesting language. The inventor of Groovy suggested that Groovy would never have been created if Scala was around at the time, and the inventor of Java named Scala as a language he’d use.

NetBeans is an integrated development environment (IDE) which is particularly suited for Java (and was developed in Java besides).

Getting Scala and NetBeans to work together requires some adaptation; the basic directions are at the NetBeans website. There are, however, some caveats to making this work, especially under Ubuntu.

Install NetBeans from the Ubuntu repositories; this will be version 6.8.

The version of Scala installed by default in Ubuntu (the current stable release, 2.7.7) is not suitable. The current release candidate (2.8.0-RC3) from scala-lang.org should be installed instead, and into a single directory – /usr/local/scala is a good location. When done, the directory should contain these directories:

  • bin
  • doc
  • lib
  • man
  • meta
  • misc
  • src

The directory which contains these will be SCALA_HOME. Create a file under /etc/profile.d/scala like so:

SCALA_HOME=/usr/local/scala

Then, add this to the file /etc/netbeans.conf (at the end of the netbeans_default_options):

-J-Dscala.home=/usr/local/scala -J-Xmx1024m

At this point, let’s add the modules to NetBeans to support Scala. Download the archives and unpack them.

Start NetBeans, and select the Tools menu, followed by selecting the Plugins menu item. This brings up a new window. Select the Downloaded tab. Click on the Add files button, and select all of the nbm files that you just unpacked. After they appear in the list (all checked), click on Install.

NetBeans will have to be restarted to complete the process.

To check and make sure that everything works, create a new project and check for a category folder for Scala. Also try selecting the Tools menu, and then Scala Platforms – make sure that the path is /usr/local/scala.

Have fun with NetBeans and Scala!

Programming Languages on OpenVMS

Looking at OpenVMS administration, and investigating the possible languages to use on OpenVMS, there are many options – some supported by HP and some community open source options.

One of the first options is Perl; apparently Perl was originally designed as a way to write scripts that worked under UNIX and VMS both. Bernd Ulmann wrote an article for OpenVMS Technical Journal 13 about Perl on OpenVMS and gave a presentation on it in the spring of 2009 at an HP Connect OpenVMS Meeting (English translation) in Germany.

The HP version of Perl appears to be tied to the Secure Web Server (SWS) but it can stand alone.

Another language that is growing on OpenVMS is Java. Jean-Yves Bourles and Thierry Uso wrote on Java and OpenVMS in OpenVMS Technical Journal 10. Netbeans is available from HP to facilitate Java development on OpenVMS.

With Java available, that opens up the possibility of perhaps using a language that runs on the Java JVM as well. That brings to mind JRuby, Jython, Groovy, Scala, and Clojure. Information on most of these is rather scarce unfortunately; only Scala and JRuby have ports (both by the aforementioned Thierry Uso). Personally, these two are the most interesting to me; Scala has unmatched integration with Java itself as well.

Python is also available. Python seems to be the new administration tool of choice; at least, Red Hat seems to think that way.

As part of the Secure Web Server (SWS), you also get HP’s version of PHP. However, this does not seem to be a separate product as Perl is, and there is no description of using PHP as a scripting language (which you can do by running PHP against a file from the command line).

Lua is graciously made available for OpenVMS by our friends over at Hoffman Labs. Lua is a fantastic scripting language that doesn’t get the cover that it deserves.

Lastly, Tcl/Tk is available as well.

So which do I recommend? Well, Perl, PHP, and Java are all HP supported products, so one could start there. With Java, I see Scala and JRuby being fantastic languages as well, although they are not supported by HP. Lua is also a favorite of mine; an OpenVMS version is wonderful; however, Lua is not as widely available for other platforms as is Perl and Java.

I should mention that PL/I is still active on OpenVMS; it is commercially sold and supported by Kednos. PL/I was an interesting language, but it doesn’t have modern capabilities.

At the German openvms.org site there is also a big list of OpenVMS ports (including languages).

Are you ready for programming on OpenVMS? I am!

A Lawyer Follows His Passion for LEGOs

Over at Above the Law, as well as the New York Daily News they are talking about Nathan Sawaya, who gave up a lucrative career as a New York lawyer to become a LEGO Master Model Builder.

The folks at Above the Law (and perhaps elsewhere) can’t understand the passion that would lead someone to give up a lucrative career to follow a dream. However, I’ve always felt that one should follow one’s passion – which I’ve done in my career. If you are in your chosen field just for the money, you won’t be able to do your best, and you won’t enjoy your work.

Follow your passion, wherever it goes: I’ve been fortunate to follow my passion into a lucrative field. Nathan, for his part, seems to have taken his passion to the next level and is now an independent artist.

I wish I could do more with Legos; the Mindstorms product is most fascinating – build and program your own robot!

UPDATE: Over at the always interesting hackaday.com, just a few days ago, there was an article about self-propelled Lego NXT projects; I especially liked the one inside the wheels.

Error Messages: Who Needs ‘Em?

There was a very interesting post over at Slashdot where a reader asked the gathered populace how to get users to read error messages.

The question, to some, might sound trite or like the standard complaining from technical support staff – and yet, this is a real problem and is wrestled with by technical staff and by usability engineers as well.

There were a number of interesting responses (and thoughts) to this question:

  • Force users to read it. In one case, the support staff put a code within the text of the error message, and required entry of the code to continue. Users who called saying they were stuck were told to read the error message to the support staff – at which time, the user typically said “Oh, never mind…” Alternately, another story told of a site that stopped people cold at an error message, requiring them to call technical support. If they tried to bypass the message with a reboot, the offending application would not work for 15 minutes.
  • Start using error messages appropriately. This requires more work by developers, but the idea is that users are so used to error messages that are meaningless that they ignore them entirely.
  • People will filter out things that are unexpected or don’t fit the model. This is backed up by research (apparently) of fighter pilots who, during a simulation, overwhelmingly blotted out the fact that there were huge items in their path on the runway. In another famous case, people were given something to watch (a conversation I think it was) and no one reported the huge gorilla (yes!) that wandered through the picture.
  • Pictures are more easily noted and remembered. Some suggested using pictures – one or two said they had done this with excellent results.

What do you think about error messages? How do you get users to read them?

Software Bugs: Good or Bad?

Recently, Karl Fogel wrote about bugs and “technical debt” – as a response to a mailing list thread about the future of Subversion in 2010. This resonates with me as I recently found myself struggling with bugs in Ubuntu to find that they would not be fixed (in my case, it was the lack of embedded ROM code for a USB-serial adapter – normally included with the Linux kernel).

Karl’s article was then reported on by Joe Brockmeier of OStatic.

Much of this reporting makes me think of TeX, the typesetting system created by Donald Knuth, one of computing’s “founding fathers” (so to speak… despite coming on the scene later on.). TeX has remained unchanged except for bug fixes for several decades, and shows no sign of slowing down or dying, in contrast to what the articles report.

I also think of Ubuntu distributions contrasted with the Ubuntu LTS (“Long Term Support”) distributions – which mirrors the difference between Fedora and Red Hat Enterprise Linux. It is possible to have a system without bugs – or at least, with few bugs. Fixing the bugs in a rapid and constant fashion will improve the user experience, as well as build up the “Good Will” value of your name rather than being known for bugs that aren’t fixed.

A complaint often heard from users is that the “fix” for a problem a user of a commercial product has is to “upgrade to the new version” (normally with a substantial cost). This should not be the way things are done.

Bug removal should be primary, and solid reliable program operation number one. As a user – and a enterprise user – reliability is primary. A product which proves through history that bugs are second to upgrades and new features will not last long. This is the very reason that products like Ubuntu LTS and Red Hat Enterprise Linux exist.

I agree with several premises in Joe’s article on OStatic – that bug removal should not be the only focus, or that an increase in bug reports is not all bad. More bugs means more users are using the product, and provides a way to make the software more reliable. Users would much rather apply patches and update to a more reliable version than upgrade to something entirely new and with newly introduced bugs not yet fixed.

New programming blog: Programmagic!

As a programmer, I have found that system administration benefits from a lot more programming than most people realize. Scripting languages are not limited to just the UNIX shell – nor to Perl.

There is a new blog, a sister blog to this one, entitled Programmagic! which will focus on programming. It will focus on lesser used languages like Lua, Scala, LISP, Smalltalk, and many others.

Recent posts are on Scala; there are many more to come. Why not come visit?