Dynamically generated service checks
David Rosenstrauch
darose at darose.net
Wed Jul 15 17:19:46 CEST 2009
Matthew Jurgens wrote:
> I do a similar thing where I dynamically change the service check
> definitions configured into Nagios. You've almost got to this solution
> but say "and couldn't just ". Not sure why you say that but I'll briefly
> cover what I did. You will need some programming/scripting.
>
> First up in the nagios.cfg file configure either a specific
> configuration file or directory where you will define your dynamic
> service checks
> eg cfg_dir=/etc/nagios/dynamic_services or
> cfg_file=/etc/nagios/dynamic_services.cfg
>
> Using a file/directory will be dependent on exactly how you need to
> generate your checks.
>
> Then at the point where you know what the service checks will be
> generate the appropriate nagios config file based on what is in the
> database into either your single config file or into one file each in
> the dynamic directory.
>
> You will then need to reload the nagios config and make sure it syntaxes
> ok.
>
> We do this quite sucessfully. When customers add/delete servers we just
> regenerate the config to match and reload Nagios.
Thanks much for the response Matthew. Very helpful!
I understand what you're suggesting here. Sounds like a couple of
potential issues with it though. By doing this via regenerating a
config file, this means that:
1) We would need to manually kick off a "config file regenerate" process
each time a user adds/changes a tag/file in our system. It would be
much better if there were some way to have nagios automatically pick up
the change without any manual intervention. (Though I suppose we could
work around this by using a cron job that runs periodically, checks for
updates, and then regenerates the config if needed.)
2) If I understand correctly, Nagios loads its config files at startup
time and does not re-read them after that. So if I'm regenerating a
config file, then that means I'd need to restart the Nagios service
afterwards, which is a bit of an onerous imposition. And although
again, I could in theory do this in a cron job, I'm not sure I'm
comfortable with that. There's the potential for the Nagios service to
not start up again successfully, and I don't like taking the risk that
this dynamic update procedure could potentially bring down the entire
Nagios system.
Hmmmm .... there's got to be *some* other way to accomplish this, no?
Thanks,
DR
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list