There are a couple distros out there that will break if the modules are updated by hand without updating the entire distro. During the time between a new module release (even security update) and when the Distro is able to get an update out, nagios will continue to alert.
I would like to have the ability to simply turn off checks for module updates while allowing the rest of the checks to run.
I'm adding a patch for this functionality against 7.x-1.2.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | nagios-ignore.png | 65.26 KB | galooph |
| #22 | allow_updates_for-1813340-22.patch | 10.03 KB | galooph |
| #2 | nagios_add_module_updates_d6_1813340-2.patch | 6.37 KB | aaronott |
| #1 | nagios_add_module_updates-1813340-1.patch | 6.05 KB | aaronott |
| nagios_add_module_updates.diff | 4.16 KB | aaronott |
Comments
Comment #1
aaronott commentedI updated this patch to run the system checks a bit more efficiently.
Since both the system requirements and the module_updates use the same call to hooks, if they are both checked the module_invoke_all is run twice. This patch allows the call to be made only once and values kept in a static variable so both calls will get access to the same data.
Please let me know if there is any objection to getting this into the module itself or if there are any changes that need to be made.
Comment #2
aaronott commentedAnd for d6
Comment #3
greg.harveyHere's an alternative Drupal 7 patch. We've been working on a more elegant way of achieving this, and this patch adds an 'Ignore from nagios' link to all modules on the modules page (if user has the correct permissions), so you can select the modules you do NOT want to be warned about. We've tested this and it will be committed. It achieves the same thing as these patches.
Comment #4
greg.harveyCommitted the Drupal 7 change, needs back-porting to Drupal 6.
Comment #5
greg.harveyHere's my D6 work for this evening. Almost done, ignore checkboxes appear on the modules page and settings get saved to variable as expected, same format as with the D7 version. Just the Nagios bit to do.
Comment #6
greg.harveyFinal patch attached. I've been running this on a Drupal 6 site for a few hours, I'll leave it a day or two to watch for any unwanted side-effects, but the patch attached should allow checkboxes on the system modules page, as per the Drupal 7 patch, on Drupal 6 sites so you can exclude modules from the requirements check.
Comment #7
greg.harveySorry, better testing exposed a problem with the D6 version. This patch is definitely not complete...
Comment #8
greg.harveyOops, posted twice. *facepalm*
To expand on the above, in Drupal 7 it seems calling module_invoke() against each module in turn also does the update status checks. In Drupal 6 this is not the case. In fact, I'm no longer convinced it's the case in Drupal 7 and want to test again, but certainly for the Drupal 6 version the update status check will need re-writing in the Nagios module, as the way it functions now won't permit what we're trying to achieve here.
Comment #9
aaronott commentedgreg.harvey
I'm having trouble getting the d7 patch to apply. What version did you create that from? dev?
I wanted to check to see if there is a way, in your patch, to disable checks for all modules as well as for individual modules.
Let me know how I can help.
Comment #10
aaronott commentedgreg.harvey, any update on this?
Thanks
Comment #11
aaronott commentedSorry, I just downloaded the latest code and see the 'Ignore from nagios' checkbox, so that part works.
I'm wondering, however, is this the best way to achieve this?
The original reason for this was that we have some distributions such as the openatrium distribution that doesn't always update their modules when there is a security update. For this reason, we would like to turn off checking of all modules and do it manually ourselves.
To make this happen with the current configuration, we'd have to check through the 202 modules that come in openatrium.
Thoughts?
Comment #12
greg.harveyOK, I think we're there. Sorry this took so long, it was actually really fiddly. New patch is against latest 7.x-1.x-dev, we have no plans to make a D6 version, but patches welcome.
This patch:
modules=$(drush nagios-updates) && drush up $modulesAs far as we can tell, it works fine, but more eyeballs always welcome.
Comment #13
greg.harveyRe-posting patch, not sure how I got the issue number so wrong!
Comment #14
greg.harveyAlso hiding obsolete patches.
Comment #15
galooph commentedOn my test install using the patch from #13, the available updates page showed the following:
With nagios set to ignore nothing, and with drush 7.0-dev:
Ignoring ctools from nagios, using the checkbox on /admin/modules:
Ignoring ctools and views from nagios, using the checkbox on /admin/modules:
Repeating the above with drush 6.3 and drush 5.9 gave exactly the same output in each case.
Looks good to me.
Comment #16
greg.harveyHmm, I posted but it disappeared! Was saying there's another scenario to try, which I tested but another pair of eyes wouldn't hurt - that's having a module with security updates and a module with normal updates, and make sure when you ignore the normal updates module you get ADMIN CRITICAL and when you ignore just the module with security updates you get ADMIN WARNING. Worked for me, but worth a second check!
Comment #17
galooph commentedGood thinking!
On a test install, I had two modules showing available updates:
Devel
Installed version 7.x-1.3
Recommended update to 7.x-1.5
Views
Installed version 7.x-3.6
Security update to 7.x-3.8
With no modules ignored:
With devel ignored, views not ignored:
With views ignored, devel not ignored:
Again, I got exactly the same output using drush 6.3.0 and 5.9.0.
So I still get the CRITICAL warning, even when the only non-ignored update is just a recommended update, not a security update.
Comment #18
greg.harveyHmm, curious. I *thought* this worked for me. Will have to have another look! Thanks!
Comment #19
megaphonejon commentedHi Greg - in your last post you said you were going to take another look at this code - just wondering if you had a chance to do so?
Thanks,
Jon
Comment #20
galooph commentedI've just been digging into this a bit more and the permanent CRITICAL I was getting in #17 seems to be down to the Administration menu Toolbar style module that I had enabled on my test install.
I dpm'd the $reqs array inside nagios_check_requirements() immediately before the 'Check the requirements as to the most severe status' comment and with the Administration menu Toolbar style module enabled, $reqs['update_contrib'] contained:
If I check the available updates at /admin/reports/updates, the only update available is a recommended update for Devel 7.x-1.3 to 7.x-1.5 (2014-May-01).
Ticking the Nagios ignore box for the Administration menu Toolbar style module and re-running nagios_check_requirements(), $reqs['update_contrib'] contained:
Which is what we want to see.
I could also replicate this behaviour with the views_ui module, so it seems to be a sub-module issue.
I eventually tracked it back to how we're using _update_requirement_check(). This is supposed to be passed a project array, as returned by update_calculate_project_data(), that includes a status key. For sub-modules, that status key was missing.
As the status of sub-modules can't be checked (they come under the check for their parent module), I've simply skipped them. It would be nice revisit the modules page ignore checkbox logic now though so that the ignore option is only shown for full modules, not sub-modules, although I can't see a simple way to do this.
Repeating the tests from #17, I started with the available updates page showing:
Ctools
Installed version 7.x-1.2
Security update to 7.x-1.4
Devel
Installed version 7.x-1.3
Recommended update to 7.x-1.5
Views
Installed version 7.x-3.6
Security update to 7.x-3.8
With no modules ignored:
With devel ignored, ctools and views not ignored:
With ctools and views ignored, devel not ignored:
and with ctools, devel and views all ignored:
Testing with drush 5.9.0 and 6.3.0 gave exactly the same results.
Comment #21
galooph commentedLooking at how we could handle only displaying the ignore checkbox by non-sub-modules on the module page, I came across update_get_projects().
This function returns an array of the modules that we're after. If the update_check_disabled variable is set to true, the array contains information on disabled modules too.
If we used this function, we might need to expire the update cache before calling it in order to get the latest data. I can imagine people enabling a new module, then wanting to ignore it from nagios straight away.
Comment #22
galooph commentedI've attached an updated patch that I think handles this ok.
It turns out that we don't need to worry about the update module cache, as it's always rebuilt when loading the /admin/modules page. See update_project_cache() for the actual code.
The patch modifies the form alter so that the ignore checkbox is only shown against enabled modules that aren't sub-modules. This means that it will always be consistent, regardless of how the update_check_disabled variable is set.
As an example, this is what I see now for the admin menu module:

Comment #23
jackalope commentedThanks for your work on this, galooph!
I noticed that the new ignore functionality lets one ignore module updates, but not theme updates. Am I missing an existing way to do that, or is it not yet possible to configure Nagios to ignore themes that need updates?
Comment #24
greg.harveyI can answer for galooph - our focus has been on modules, but I don't see any reason why this couldn't be extended to include themes. I will commit the work to date and create a new issue though, so we don't get held up on this...
Comment #26
greg.harveyCommitted this to 7.x-1.x, it'll be in the dev snapshot at some point today. Yay!
Comment #27
greg.harvey@jackalope: feature request logged here, if you want to follow it or submit patches. :-)
#2377241: Expand "ignore" feature to include themes
Comment #29
jackalope commentedJust catching up on this issue; thanks @greg.harvey!