michael orlitzky

nagios-mode

Get It

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

About

Nagios-mode is an Emacs mode for editing Nagios configuration files. Nagios is monitoring software that is configured via plain-text (*.cfg) files. Those configuration files have a C-like syntax, and a bunch of special keywords. Witin Emacs, nagios-mode will apply syntax highlighting to them, possibly alerting you to the fact that you have done something wrong, and making your buffers look pretty in any case.

Installation

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

(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,

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

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

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

which works great so long as you don't edit any other *.cfg files that have a different syntax.

How it works

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 cut and pasted in to nagios-mode.el.

The directives are a bit tricker. They too are parsed from the Nagios source (xdata/xodtemplate.c), but not all of the names map nicely to internal C variables, so there's no explicit list of them. Instead we try to piece together the valid names based on what Nagios's config parser is looking for. It's possible that some have been overlooked.

The helper scripts for this can be found in the utils directory.

Bugs

Please send all bug reports, feature requests, and unprompted criticism to michael@orlitzky.com.