--- include/statusdata.h.orig 2008-11-30 18:22:59.000000000 +0100 +++ include/statusdata.h 2011-05-04 11:00:00.000000000 +0200 @@ -166,6 +166,16 @@ #define HOST_DOWN 4 #define HOST_UNREACHABLE 8 +/* Convert the (historically ordered) host states into a notion of "urgency". + What's *your* interpretation of that? Mine is, in ascending order: + HOST_UP (business as usual) + HOST_PENDING (waiting for - supposedly first - check result) + HOST_UNREACHABLE (a problem, but likely not its cause) + HOST_DOWN (look here!!) + The exact values are irrelevant, so I try to make the conversion as + CPU-efficient as possible: */ +#define HOST_URGENCY(hs) ((hs)|(((hs)&0x5)<<1)) + /**************************** FUNCTIONS ******************************/ --- include/cgiutils.h.orig 2010-11-10 16:13:42.000000000 +0100 +++ include/cgiutils.h 2011-05-04 10:38:33.000000000 +0200 @@ -263,6 +263,7 @@ #define SORT_STATEDURATION 6 #define SORT_NEXTCHECKTIME 7 #define SORT_HOSTSTATUS 8 +#define SORT_HOSTURGENCY 16384 /****************** HOST AND SERVICE FILTER PROPERTIES *******************/ --- cgi/status.tmp 2011-04-20 22:23:11.000000000 +0200 +++ cgi/status.c 2011-05-04 11:33:27.000000000 +0200 @@ -1914,6 +1914,8 @@ printf("host name"); else if(sort_option==SORT_HOSTSTATUS) printf("host status"); + else if(sort_option==SORT_HOSTURGENCY) + printf("host urgency"); else if(sort_option==SORT_LASTCHECKTIME) printf("last check time"); else if(sort_option==SORT_CURRENTATTEMPT) @@ -4782,6 +4784,12 @@ else return FALSE; } + else if(s_option==SORT_HOSTURGENCY){ + if(HOST_URGENCY(new_hststatus->status) <= HOST_URGENCY(temp_hststatus->status)) + return TRUE; + else + return FALSE; + } else if(s_option==SORT_HOSTNAME){ if(strcasecmp(new_hststatus->host_name,temp_hststatus->host_name)<0) return TRUE; @@ -4816,6 +4824,12 @@ else return FALSE; } + else if(s_option==SORT_HOSTURGENCY){ + if(HOST_URGENCY(new_hststatus->status) > HOST_URGENCY(temp_hststatus->status)) + return TRUE; + else + return FALSE; + } else if(s_option==SORT_HOSTNAME){ if(strcasecmp(new_hststatus->host_name,temp_hststatus->host_name)>0) return TRUE;