Sorting of the Status's

Andreas Ericsson ae at op5.se
Tue Feb 14 14:26:01 CET 2006


Joseph Hardeman wrote:
> Greetings,
> 
> I see that there are 8 different ways to sort the status page.  I want to be
> able to sort by Aliases.
> 
> I have added a 9th way, SORT_ALIAS to the include/cgiutils.h and recompiled
> the cgis.


Exactly how did you do to add this to include/cgiutils.h without 
modifying the sorting algorithm in status.c as well?

Do like this:

Download the nagios-2.0.tar.gz file to $HOME/patch
Run the following commands

$ cd $HOME/patch
$ tar xvzf nagios-2.0.tar.gz
$ mv nagios-2.0 nagios-2.0.patched
$ tar xvzf nagios-2.0.tar.gz
$ cd nagios-2.0.patched

Make your modifications to whatever files you did, and then do this:

$ cd $HOME/patch
$ diff -urN nagios-2.0 nagios-2.0.patched > nagios-sort-alias.diff

Send nagios-sort-alias.diff to this list and I'll have a look at it for you.


>  I then modified the status.c to display the following lines:
> 
> LINE 1554
>  printf("<TD align=left valign=center CLASS='status%s'><A
> HREF='%s?type=%d&host=%s'>%s</A></TD>\n",host_status_bg_class,EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(temp_status->host_name),temp_host->alias);
> 
> 
> LINE 1999
> printf("<TD align=left valign=center CLASS='status%s'><A
> HREF='%s?type=%d&host=%s'>%s</A> </TD>\n",status_class,EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(temp_status->host_name),temp_host->alias);
> 
> (((Changed from temp_status->host_name to temp_host->alias)))
> 
> This displays the Alias but it is still being sorted by host_name.  When I
> checked all SORT_HOSTNAME to SORT_ALIAS I do not get an error, but it is
> still only sorting by hostname.  What am I missing to get it to sort by host
> name.


Judging from your description; something fairly elementary. How much 
C-code have you written earlier?

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642




More information about the Developers mailing list