[Nagios-devel] Config from PostgreSQL

Stephen Gran steve at lobefin.net
Tue Dec 7 20:14:19 UTC 2010

On Mon, Dec 06, 2010 at 10:41:39PM +0000, Phil Sturgeon said:
> I've been charged with a mission a little outside of my usual
> skillset, and that is to get Nagios 3.2.3 running from config based
> on a PostgreSQL table instead of the normal cnf_dir setting. I can
> work out the actual code for this but im struggling to find /where/
> it should go.
> I have only found one instance of cnf_dir in the source and that is here:
>             else if(strstr(input,"cfg_file=")==input ||
> strstr(input,"cfg_dir=")==input)
>             continue;
> in config.c line 1328. I have no problems hacking the core, but
> where do I start?

I'd strongly suggest that you write code in some high level language to
pull it from the database and write config files for nagios.  I've used
this approach in the past with a fair amount of success.  It has the
benefit of being much simpler, both to maintain and to upgrade.

If you absolutely must pull it live from the database, you'll want to
look at some of the existing broker modules for how to hook into the
core and all that sort of thing, but I really don't envy you the task -
you'll need to learn the psql API, the nagios event broker API, write
all sorts of fairly hairy code to cast one set to another set, and
finally get working callbacks to get nagios to reload for every update
to the database.

Good luck,
|  Stephen Gran                  | purpitation, n.:  To take something off |
|  steve at lobefin.net             | the grocery shelf, decide you  don't    |
|  http://www.lobefin.net/~steve | want it, and then put it in another     |
|                                | section.   -- "Sniglets", Rich Hall &   |
|                                | Friends                                 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.nagios.com/pipermail/nagios-devel/attachments/20101207/657d30c5/attachment.sig>

More information about the Nagios-devel mailing list