some addition to nagios I'm working on

william(at)elan.net william at elan.net
Thu Jun 29 01:18:28 CEST 2006


On Mon, 26 Jun 2006, Andreas Ericsson wrote:

> william(at)elan.net wrote:
>> [I sent earlier version of this to wrong list by accident last week, sorry]
>>
>> I'm working on some additions to nagios code as part of my current project.
>> If you'd like to see any/all of this submitted as patches for inclusion
>> in your main code, let me know:
>>
>
> While this is a very good effort, the web-interface will be rewritten in
>  Nagios 3, so your work would be better directed getting started on
> that instead.

I'm aware of that. However I really can not wait until 3.0 is stable
(client who I'm doing this for would not accept anything but close to 
production beta code anyway), but I'd be willing to help port those
changes into your new CGI base (either perl or php is fine by me).
And what I found during coding is that even though the changes are 
primarily visible in CGIs, the underlying code to support it is needed
to exist in other parts of the code (in fact patched code to other
files are larger then patched code in cgi), though I do think in the 
future the code to support *ext should be separated in such way that
those files are only read by CGIs.

In any case I'm done coding and have patch available; as I did not
see direct requests, I've not removed my #ifdefs (I find it easier
to have ifdef for all custom code I write when that code is not
part of the main program code tree). The patch can be found at
  http://www.elan.net/~william/nagios/nagios231-support_groupextinfo.patch

You'll find that all code that I introduced or changed is marked with
#ifdef SUPPORT_GROUPEXTINFO so you need to make sure that is defined
in config.h if somebody wants to use the patch.

The features implemented include:
  1. Support for hostgroupextinfo and servicegroupextinfo objects
    (this is by far largest part of the code, very repetitive - I really
    wish the original code was C++ and I'd only have to extend it).
    An example of config is:
      define hostgroupextinfo{
           hostgroup_name          firewalls
      ...
  2. New config directives for all *extinfo objects:
       action_icon - url, if configured used in place of default action icon
       action_icon_alt - custom text for those who do not see icon
       action_icon_textinfo - text used even if icon is displayed
                              (maybe I'll later add it as menu text)
       notes_icon - url, if configured used in place of default notes icon
       notes_icon_alt
       notes_icon_textinfo
       target_frame - used for both notes and action URLs to direct in
         which frame to show output in (use "_self" for same window)

     An example of config is:
      define hostextinfo{
         host_name               nagios
         action_url              /nagios/cgi-bin/ngrapher/graphs.cgi?action=HGRAPH&host=nagios
         action_icon             ngrapher/graph.png
         action_icon_alt         View Graphs For Host nagios
         action_textinfo         View Graphs For Host nagios
         target_frame            _self
      }

  3. Support for having multiple *extinfo objects for same host or service.
     Then multiple icons would be displayed one after another on CGIs.
     To enable this new global configuration directive has to be set:
       allow_duplicate_extinfo=1
     (btw - this feature took surprisingly little extra coding, just
      few changes from "if" to "for" loops in status.c; larger change
      though extinfo where code displaying icons I did rewrite).

P.S. This is only 2nd time (in 15 years I've been sometimes extending
somebody else's C code) that I see coding style with scope closing }
in the same tabulated space as scope code itself; I obviously tried to
keep my code to the same convention, but emacs really had an issue as
it was trying to be "helpful" in proper placing of '}' but was assuming
more conventional C style...

-- 
William Leibzon
Elan Networks
william at elan.net

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Developers mailing list