Problem/Motivation

The new API states that hook_nagios() accepts an $id variable that can be used in order to check for individual functions.

However, the default implementation of the hook (nagios_nagios()) doesn't make use of this variable.

Proposed resolution

Add support for the $id variable in the nagios_nagios() function so that individual functions can be checked.

Comments

ieguskiza created an issue. See original summary.

ieguskiza’s picture

StatusFileSize
new1.63 KB

I added the first temptative patch to provide the requested functionality.

ieguskiza’s picture

Assigned: ieguskiza » Unassigned
Status: Active » Needs review
ieguskiza’s picture

StatusFileSize
new1.64 KB

I'm adding a new version that adds a default value to $id to avoid unpleasant php warnings.

ieguskiza’s picture

StatusFileSize
new1.64 KB

Reuploading with a small fix to avoid php errors if passing a module as argument but not an id

dxvargas’s picture

Status: Needs review » Reviewed & tested by the community

Tested, it works and the code is good.
Indeed, this development fulfills the API definitions. It also adds more uses to the module. Hope it can be merged soon!

gogowitsch’s picture

The patch looks good, I'll push it to the 7.x-1.x branch today.

gogowitsch’s picture

Issue summary: View changes

You can use this new feature from the HTTP status page, e.g. for the Drupal 7 defaults, the following will only run the cron check independent of the checkboxes on the settings page:
URL: https://your-drupal-7-domain/nagios-status/nagios/cron

In the URL above, the path segments are

  • the "Nagios page path" (nagios-status),
  • the module machine name implementing hook_nagios() (nagios), and
  • the check name ($id = "cron")

I will also push this feature to the Drupal 8 branch, 8.x-1.x.

  • Gogowitsch committed 536b277 on 7.x-1.x
    Issue #2854854 by ieguskiza, dxvargas, Gogowitsch: Support $id on...
gogowitsch’s picture

Status: Reviewed & tested by the community » Fixed

  • Gogowitsch committed 42b66ed on 8.x-1.x authored by ieguskiza
    Issue #2854854 by ieguskiza, Gogowitsch, dxvargas: Support $id on...

Status: Fixed » Closed (fixed)

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