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.

David Rosenstrauch wrote:
Scratching my head as to how it might be possible to accomplish a monitoring task I need to do:

We have a database table of tags. For each tag we have a process that generates a Javascript file and pushes it out to a CDN. I've successfully created a service check to monitor that the process runs successfully (by using check_mysql_query to verify that a "pushed" date gets updated on the database table). But we also need to monitor that each of the files exists - and in the correct version - over at the CDN, and here's where I'm hitting a wall.

What I'm envisioning is a way whereby I could dynamically generate a whole bunch of service checks - one for each tag in the database table. Each service check would then go and download its corresponding file from the CDN, parse it, and verify the version number. In this way, if any particular file was missing or the wrong version, we would get a Nagios alert on that tag/file.

However, I don't see any clear way to approach this with Nagios. Near as I can tell there doesn't seem to be any way to dynamically generate service checks. From my reading of the docs, every service need to be explicitly listed in the config files beforehand.

I was thinking that perhaps having a cron job that generates passive checks might be a solution here, but again it looks like I would still need to have the service checks defined beforehand in the nagios config files, and couldn't just generate them on-the-fly based on the contents of the database table.


Anyone have any ideas on how I could accomplish this file monitoring in a dynamic fashion? (Note that alerting on a file-by-file basis is needed here; it would not be sufficient to have a single service check that monitors and alerts on all of the files.)

TIA,

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@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


--
Smartmon System Monitoring <http://www.smartmon.com.au>
www.smartmon.com.au
------------------------------------------------------------------------------
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@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

Reply via email to