With Drupal 8 in RC, any plans for a port of Nagios monitoring to Drupal 8?

Comments

Ben Coleman created an issue. See original summary.

jackalope’s picture

Chiming in with interest about a Drupal 8 version of the Nagios module. Any plans?

c-logemann’s picture

I also have an interest in a Drupal 8 version and offer my help with this.

erikwegner’s picture

This repository contains a working draft of the port: https://github.com/ErikWegner/drupal_nagios/tree/Drupal8Port

Right now, a settings and an empty status page have been ported. The real checking functions are in the queue for the next commit.

erikwegner’s picture

The checking functions have been ported now. Please test and report feedback.

greg.harvey’s picture

Thank you so much, Erik. I'll add your Github repo as a remote to my D.o repo and see if I can merge in your work to 8.x-1.x.

greg.harvey’s picture

Status: Active » Needs work

Hmm, there's a lot of change and a lot of regression here. You've basically ditched drush and NRPE support, so I can't merge this in right now. It feels like it needs breaking down, for example there's a fair bit of change to the check_drupal script which don't seem relevant to Drupal 8 and which should be reviewed in isolation. I fear if I use this "as is" then it will become hard to track the regressions it introduces, and we certainly can't use it as we're entirely NRPE reliant - we need the drush commands.

That said, those who need basic D8 functionality could probably use this version anyway and pull it from Github. :-)

erikwegner’s picture

Assigned: Unassigned » erikwegner

Well, I just found the reason: the d.o repository's master branch is not the 7.x branch. So I used an old version (i.e. the master branch). Let me do it again on the 7.x branch. :-)

erikwegner’s picture

The dev branch on GitHub is now pretty much usable, i.e. can be tested on other machines.

There is currently one thing left: in 7.x a module can be ignored for updates on the modules list. Therefore a hook_theme and theme_nagios_modules_fieldset have been implemented.

Wouldn't it be more suitable to have that choice within the nagios configuration? I suggest to drop altering the system modules list. Instead, let's have a field group or a local task to select modules. What do you think?

ben coleman’s picture

I'll agree with dropping altering the system modules list. The current implementation for 7.x disappears when the popular Module Filter module is installed. Move the implementation of module ignoring internal keeps it from being necessary to coordinate with Module Filter-type modules to keep it working.

erikwegner’s picture

Commit pushed to GitHub. Please review.

erikwegner’s picture

Status: Needs work » Needs review
ben coleman’s picture

I've installed from Erik's github 8.x-dev code, and as far as the General Settings tab and Nagios being able to pull from the /nagios path, it seems to work OK, but on clicking on the "Ignored Modules" tab, I get an error 500, with this in my Apache error log:

[Wed Dec 30 04:58:22.729964 2015] [:error] [pid 22176] [client 2001:4978:312:1:a046:beac:2bed:477b:63524] Recoverable fatal error: Argument 1 passed to Drupal\\nagios\\Form\\IgnoredModulesForm::__construct() must be an instance of Drupal\\nagios\\Form\\ModuleHandlerInterface, instance of Drupal\\Core\\Extension\\ModuleHandler given, called in /home/drupal8/public_html/modules/custom/nagios/src/Form/IgnoredModulesForm.php on line 40 and defined in /home/drupal8/public_html/modules/custom/nagios/src/Form/IgnoredModulesForm.php on line 30, referer:http://drupal8.benshome.net/admin/config/system/nagios
erikwegner’s picture

Status: Needs review » Active
erikwegner’s picture

Assigned: erikwegner » Unassigned
Status: Active » Needs review

Interesting, I cannot reproduce the problem. Which PHP-Version do you use?

But here is a new commit that addresses the issue. Does it help?

ben coleman’s picture

Status: Needs review » Active

php --version returns:

PHP 5.6.11-1ubuntu3.1 (cli)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

I pulled down the new commit, and it seems to be returning a slightly different error:

[Tue Jan 05 17:25:00.260623 2016] [:error] [pid 3195] [client 76.17.108.117:3181] Recoverable fatal error: Argument 2 passed to Drupal\\nagios\\Form\\IgnoredModulesForm::buildRow() must be an instance of Drupal\\nagios\\Form\\Extension, instance of Drupal\\Core\\Extension\\Extension given, called in /home/drupal8/public_html/modules/custom/nagios/src/Form/IgnoredModulesForm.php on line 142 and defined in /home/drupal8/public_html/modules/custom/nagios/src/Form/IgnoredModulesForm.php on line 178, referer: http://drupal8.benshome.net/admin/config/system/nagios
erikwegner’s picture

Status: Active » Needs review

Another reference added. Please try again.

ben coleman’s picture

Status: Needs review » Reviewed & tested by the community

That seems to do it. That gets rid of the fatal error, and also a bunch of php messages in the drupal log for each cron run.

c-logemann’s picture

Status: Reviewed & tested by the community » Needs work

Thanks @ErikWegner for your work on this.

I testd the actual code and it looks fine especially the status page I need mostly with cron check. And here I found a bug:
The nagios status page reports "CRON:OK" when "Last run" is more than the cron threshold setting.

c-logemann’s picture

Assigned: Unassigned » c-logemann

I already found the problem in the code. I already fixed it and will create a pull request on github soon.

c-logemann’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Assigned: c-logemann » Unassigned
Status: Needs work » Needs review

There is only a small error in getting the cron duration setting so always default value "60" was used even when I was testing with "5 minutes" for example.
I created a PR on Github for this: https://github.com/ErikWegner/drupal_nagios/pull/1

When this change is committed we can move back to RTBC in my opinion.

erikwegner’s picture

C_Logemann's fix has been merged.

c-logemann’s picture

Status: Needs review » Reviewed & tested by the community

@ErikWegner Thanx for merging.

c-logemann’s picture

Title: Drupal 8 port? » Nagios - Drupal 8 port?

Just renaming this issue. Because I want to create an issue on Drupal 8 Contrib Porting Tracker

Also it's better for my dashboard where so many "Drupal 8 port" Issues are listed.

c-logemann’s picture

Now we have an official link on the project page to the D8 Post issue I have created:
#2647984: [nagios] Nagios monitoring

c-logemann’s picture

Just found a second bug of getting settings: The function nagios_nagios() is returning every test even if they are disabled.
It's just a minor change and I have already fixed this. Here is my PR on github: https://github.com/ErikWegner/drupal_nagios/pull/2

erikwegner’s picture

Thank you for your report and the fix. It has been included.

greg.harvey’s picture

Hi all,

I was out all last week so haven't really been tracking this, but Erik nudged me by email and I'll try to find the time this week to pull in his port so it's on the D8 branch of the Drupal repo. Unfortunately I can't add him as a maintainer, I do not have the necessary privileges.

Thanks,

Greg

greg.harvey’s picture

Oh, and FWIW:

Wouldn't it be more suitable to have that choice within the nagios configuration? I suggest to drop altering the system modules list. Instead, let's have a field group or a local task to select modules. What do you think?

I don't think we care, as long as it works! :-)

Using the modules page was just for UX, but at the end of the day it's not something "normal" site editors will ever care about. I'd be happy if it's just a YAML file. In fact, I'd *prefer* that, then you could keep your excluded modules list in Git. :-)

greg.harvey’s picture

I also got rid of the 'master' branch in Git, as per https://www.drupal.org/empty-git-master - to avoid any future confusion. :-)

  • greg.harvey committed 8607fe3 on 8.x-1.x
    Issue #2598364 by ErikWegner: Initial Drupal 8 of Nagios module.
    
greg.harvey’s picture

Status: Reviewed & tested by the community » Fixed

Wow, the packager's much faster than it used to be! All done, Erik's D8 port is available on the project page for download and testing. :-)

greg.harvey’s picture

Erik, all, I'm really sorry that wasn't properly attributed to Erik - you can see from the commit history I usually *always* credit commits: https://www.drupal.org/node/368588/commits

I used the Git command at the bottom of this thread without looking at it properly, assuming it would automatically add Erik as author, but didn't realise the radio button was not set to him (only the checkbox) - massive UX fail (and me fail!) ... thanks to C_Logemann for pointing it out.

I'm going to contact the infrastructure team and see if there's any way to rectify this, *especially* now attributions affect rankings in various places and stuff like that.

Sorry sorry sorry! :(

greg.harvey’s picture

OK, I've *sort of* fixed this. I've also opened an issue with the webmasters to tidy up my original commit:
https://www.drupal.org/node/2653524

Hopefully this is fully resolvable. :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.