systemnotes org Location: System Notes / download / Shell / nagios-config-build download

Help for Aspiring Sysadmins

Linux / Open Source / Howto / Tips & Tricks

Language: en

Latest News

RHCE Flash Cards Released

Website Design Updated. This is a work in progress...

RHCE Study Guide Removed due to a potential copyright issue

RHCE Study Guide Released



Do you find this site useful?


Spread Firefox Affiliate Button



nagios-config-build is a group of shell scripts that generate Nagios configuration files from a list of hostnames. It automatically resolves IP addresses from DNS, and provides a quick way to manage a large number of hosts without having to set up a complicated system.

  1. Download nagios-config-build.tgz
    1. wget
  2. Untar
    1. tar -zxvf nagios-config-build.tgz
  3. Edit .dat files (hostgroup comes from file name)
    1. cd nagios-config-build
    2. vi abc.dat (to create abc hostgroup)
  4. Run nagios-config-build
    1. ./nagios-config-build.tgz
  5. Copy output files to nagios directory

Current Version

File iconnagios-config-build.tgz (16.88 KiB) 2009-12-11 release 0.0.1-1

See the Freshmeat project page.

Install and Use Notes

Tested with Nagios v2 and v3

How to generate nagios config files from a list of hostnames. This is useful to get a simple configuration working on any number of hosts (tested up to 1000), when they all have similar attributes. To get different options for contacts, services, etc., the scripts can be copied and run in a different directory.

Input: *.dat files Output: output/hosts.cfg, and output/hostgroups.cfg

1) Place files containing hostnames, one per line with a .dat extension, in the current directory.

2) Run ./

3) Copy files from output directory to the proper location on the nagios server.

/usr/local/nagios/etc or /usr/local/nagios/etc/hosts or /usr/local/nagios/etc/objects

To Do

  1. Improve documentation.
  2. Speed up processing with a simple optimization.
  3. Some items are hard-coded.

Comments / Questions

Please feel free to use the comment option of the blog post for questions, or comments.


Initial Release

File iconnagios-config-build-0.0.1-1.tgz (15.16 KiB) 2009-12-11 release 0.0.1-1