I had the problem that on sites with a low cron frequency(once a day) nagios would often report a warning about the 'module and theme update status'.
Instead of increasing the cron interval I thought it might be more useful to trigger a drupal_cron_run(); just before the nagios check does it's job.
In theory this might remove the need for a cron daemon all together...
I currently hacked it into nagios_status_page(), and seems to work.
If others agree that this is useful I would be willing to prepare a patch which also makes this configurable.
Any feedback welcome....
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | nagios-531890-D6.patch | 1.47 KB | helmo |
| #1 | drupal_nagios_cron_run_before.patch | 1.07 KB | helmo |
Comments
Comment #1
helmo commentedAlthough I did not receive any comments jet, I decided to take a few minutes to prepare a patch.
Comment #2
kbahey commentedI don't think this is feasible.
Cron normally runs every hour or so.
The reason is that nagios checks for a Drupal site happen every few minutes. If we force a cron run that frequently it can cause undue load on a site (e.g. cache clearing, search indexing, session cleaning, dblog cleaning, and the like).
Comment #3
helmo commentedI agree that it depends on the setup weather this makes sense, but thats also why I included the checkbox on the settings page.
In my setup I had both nagios and cron running once a day. A different nagios check runs every few minutes to check the webserver as a whole, therefore running drupal nagios on every installation every few minutes would be a substantial load for me.
We could include an additional integer setting to avoid running cron if it already ran in the last x minutes.
Comment #4
kbahey commentedThis is not how I designed the module. You are trying to use it in a way it was not intended to.
If you run Nagios to check /nagios only once a day, then you are making it only check for updates. It will not tell you if Drupal is down for other reasons (database, ...etc.), it will not tell you what the performance is, and other modules that plug in to the Nagios module will not run correctly.
My suggestion is to create a module that detects that $_GET['q'] == 'nagios' and call drupal_run_cron() in hook_init() when that is the case. This solves your site specific problem without adding options that others don't need.
Comment #5
helmo commentedThanks for the suggestion, I implemented the separate module.
I've attached the code here for future reference and just in case someone else finds it useful.