This seems to be the same issue as http://drupal.org/node/1162586, but the code in my nagios.module is as described having been fixed in the ticket - it should return just the data, rather than themeing a page.

That is to say, the end of "nagios_status_page()" function is like this:

  $output .= implode(', ', $output_state) . ' | ' . implode(';', $output_perf) . "\n";

  // Print the output, so we test the theme
  // TODO Please change this theme call as discussed at http://drupal.org/node/224333#theme_page.
  // print theme('page', $output);
  return $output;

  // Exit early so we do not cache the data, nor do we wrap the result in a theme
  exit();

So I am not sure what's wrong - /nagios should just show the data, right? Not a full Drupal page with the site template?

Comments

matthewv789’s picture

StatusFileSize
new2.33 KB
new9.47 KB

Attaching screenshots showing Nagios themed info page (/nagios) and Nagios module info.

matthewv789’s picture

I ended up fixing this by changing line 303 in nagios.module from:

  return $output;

to:

  print $output;
matthewv789’s picture

Category: support » bug
Status: Active » Needs review

This seemed to work for me - does the change in comment #2 make sense and should it be tested as a patch?

greg.harvey’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs review » Needs work

I'd rather go a little further, run it through a theme function and provide a blank template, I think. That would allow users to theme their own /nagios page and there's a TODO for that anyway.

Thanks for raising - let's keep this alive.

greg.harvey’s picture

Actually, on reflection, I think we should choose an approach here. We already have a patch in #1162332: Customise default /nagios callback which allows you to specify your own callback function. It's waiting to be tested.

We can *either* do that *or* we can "won't fix" that patch and instead do a proper theme() implementation here. I'm erring on the side of the latter.

Thoughts?

c-logemann’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new762 bytes

I think in most cases there is a need for performance which can be improved by avoiding a theme load. First of all Drupal is doing less. But also there is less data to encode by the server if SSL is used (which is recommended). Additionally there is less data to be transferred through the network and less data to be parsed by the monitoring system. I am not sure but I think "echo" is a little bit faster than "print". So I created a patch with "echo" instead of "return".

If there is a need for templating this page there is also a need for more structures in the data as currently provided inside the "$output"-String. So in this case somebody can use the new existing possibility with calling a custom function or create a new menu path with a complete control in a custom module.

An additional thought for templating: Currently only administrators can see this page. Using a code as a custom user-agent is mot user friendly. But this is another issue I will report soon.

greg.harvey’s picture

Status: Needs review » Closed (fixed)

I'm sold on this approach. Committed!