michael orlitzky

nagios-mode

Get It

The latest release is nagios-mode-0.3.tar.gz. All known bugs are fixed. The development version can be found in the nagios-mode git repository.

About

The rest of this is pretty much just copy-pasted from the README, but you should be grateful, because there are starving children in Africa who use vi.

Nagios-mode is an Emacs mode for editing Nagios configuration files. You probably already know that, or you wouldn't be reading this. But maybe you just love Emacs, and you go around looking for things that end in -mode. Then you README them.

So, Nagios is monitoring software that is configured via plain-text *.cfg files. They have a C-like syntax, and a bunch of special keywords. Nagios mode will apply syntax highlighting to these configuration files, possibly alerting you to the fact that you have done something stupid. Moreover, the buffers will look prettier.

The macros and object definitions are parsed from the Nagios source code. Object definitions are found within xdata/xodtemplate.h, while the macros are cleverly hidden within include/macros.h. Once they have been parsed, they are cuth and pasteth in to nagios-mode.

The directives (or variables) are another story. There is no obvious way to parse the object variables from the source code. So, it's done the old-fashioned way: I use nagios-mode until I notice that one of my variables isn't highlighted. Then I add it. You can mail me these and I will probably add them.

Installation

Stick nagios-mode.el somewhere, and add that place to your Emacs load path. For example,

1
2
3
(setq load-path
  (append (list "~/.home/emacs/modes/nagios-mode/")
    load-path))

is how I do it. With that in your load path, you just have to add nagios-mode to your auto-load list,

1
(autoload 'nagios-mode "nagios-mode" nil t)

And tell Emacs to use it automatically when editing *.cfg files,

1
2
3
(setq auto-mode-alist
  (append (list '("\\\\.cfg\$" . nagios-mode))
    auto-mode-alist))

which is great as long as you don't have other *.cfg files with a different syntax. That case is left as an exercise for the reader.

Bugs

Email them to me at michael@orlitzky.com.