--------------000001010907020001080302
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Quick patch just 'cause I felt like it ...
Introducing a new status.cgi sort mode (sortoption=3D16384) where hosts
are sorted by state, but with the order being based on "urgency"
(down>unreachable>pending>ok) instead of the historically assigned (?)
state IDs (unreachable>down>up>pending).
Note 1: Patch does not include any hyperlink pointing to the new mode.
(I'll put one straight into the static menu HTML for ourselves.)
Note 2: I'm working on top of an already-patched 3.2.3, so the line
numbers in status.c and cgiutils.h are likely off WRT official release.
Kind regards,
J. Bern
--=20
Jochen Bern, Systemingenieur --- LINworks GmbH
Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt
PGP (1024D/4096g) FP =3D D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C2=
7
Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202
Unternehmenssitz Weiterstadt, Gesch=E4ftsf=FChrer Metin Dogan, Oliver Mic=
hel
--------------000001010907020001080302
Content-Type: text/plain;
name="nagios-3.2.3-HostUrgency-patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="nagios-3.2.3-HostUrgency-patch.txt"
--- 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)status) status))
+ return TRUE;
+ else
+ return FALSE;
+ }
else if(s_option==SORT_HOSTNAME){
if(strcasecmp(new_hststatus->host_name,temp_hststatus->host_name)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;
--------------000001010907020001080302--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]