| 1 |
$Id$ |
|---|
| 2 |
|
|---|
| 3 |
This is a collection of scripts and libraries meant to make it easy/possible |
|---|
| 4 |
to generate Nagios configurations. The first and probably most important part |
|---|
| 5 |
of the collection is the set of libraries. They include a parser for existing |
|---|
| 6 |
Nagios configurations plus the ability to create and easily print fully formed |
|---|
| 7 |
objects. With these libraries, you can: |
|---|
| 8 |
1) Parse any existing configuration |
|---|
| 9 |
2) Create new configurations from scratch using other objects (e.g., SQL |
|---|
| 10 |
or LDAP) |
|---|
| 11 |
3) Write out either of the above configurations |
|---|
| 12 |
|
|---|
| 13 |
In addition to the libraries, a few utilities have been written. Currently |
|---|
| 14 |
(as of 7/26/04) these utilities are largely centered around a single purpose: |
|---|
| 15 |
Using cfengine (http://www.cfengine.org) to generate Nagios configurations for |
|---|
| 16 |
all of my clients. This collection is special, though, because it generates |
|---|
| 17 |
the configurations 1) on the client itself 2) and in two configurations -- one |
|---|
| 18 |
meant to be run against locally and one meant to be centralized and aggregated |
|---|
| 19 |
with all other clients. |
|---|
| 20 |
|
|---|
| 21 |
This results in a large star-type Nagios network. I have a Nagios process |
|---|
| 22 |
running on every host on my network, and the central Nagios server has two |
|---|
| 23 |
processes -- one running the aggregated config and one running the local |
|---|
| 24 |
config for the server. Every local nagios process uses nsca to submit passive |
|---|
| 25 |
checks, and the central server receives those, and produces warnings if the |
|---|
| 26 |
checks get stale. |
|---|
| 27 |
|
|---|
| 28 |
This system does not actually require cfengine, I just find it to be |
|---|
| 29 |
incredibly useful. The basic idea is that you run a script (currently at |
|---|
| 30 |
cfengine/modules/module:nagios), passing it 1) a list of services to monitor, |
|---|
| 31 |
and 2) a list of classes the server is a member of. The script matches those |
|---|
| 32 |
services against services defined in the 'checkcommands.cfg' file, and the |
|---|
| 33 |
classes are matched against 'hostgroups.cfg'. If any services not defined in |
|---|
| 34 |
'checkcommands.cfg' are passed, an error will result, but it is assumed that |
|---|
| 35 |
there are many classes passed from cfengine that will not be hostgroups, so it |
|---|
| 36 |
is not an error to pass unknown hostgroups. See the |
|---|
| 37 |
cfengine/inputs/nagios[12].cf files for a basic example of how this is done. |
|---|
| 38 |
|
|---|
| 39 |
I know this isn't very well documented, but it's not actually that much code. |
|---|
| 40 |
Feel free to email me at <luke at madstop.com> for more information or |
|---|
| 41 |
whatnot. |
|---|