Re: [Nagios-devel] [PATCH] add hostname to html title

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] [PATCH] add hostname to html title

Post by Guest »

This is a multi-part message in MIME format.
--------------060207040803070901070504
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 10/07/2010 03:13 AM, Craig Leres wrote:
> Attached is a short patch that uses javascript to add the current
> hostname to the page title in the html generated by index.php. For
> example, this changes the title from "Nagios" to "Nagios: ee.lbl.gov"
> and makes it easier to open the "right" browser window when running
> nagios on multiple servers.

FWIW: This gave me the idea to reflect not the Nagios host (which I can
recognize by color coding the favicon.ico), but the host/service/group
shown into the , so as to better recognize the Firefox tabs I
opened to diagnose problem X (as opposed to those opened for the
simultaneous problems Y, Z, and WotNot ;-). Unfortunately, it's a patch
on top of an already-patched 3.2.1, so take the diffs with a grain of
salt ...

(Also, making the read just "Service Desc", "[Hostname]",
"(Servicegroup)", and "{Hostgroup}", respectively, is aimed at keeping
ever-narrowing *tabs* legible. If you're using *windows* instead, expand
the text at your leisure.)

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

--------------060207040803070901070504
Content-Type: text/plain;
name="nagios-3.2.1-HostSrvGrp-Titles-patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="nagios-3.2.1-HostSrvGrp-Titles-patch.txt"

--- status.c.orig 2010-08-20 18:06:46.000000000 +0200
+++ status.c 2010-10-08 14:21:00.000000000 +0200
@@ -533,7 +533,13 @@
printf("\n");
printf("\n",url_images_path);
printf("\n");
- printf("Current Network Status\n");
+ if ((display_type==DISPLAY_HOSTS)&&(!show_all_hosts)&&host_name&&(*host_name!='\0'))
+ printf ("[%s]\n",html_encode(host_name,FALSE));
+ else if ((display_type==DISPLAY_HOSTGROUPS)&&(!show_all_hostgroups)&&hostgroup_name
+ &&(*hostgroup_name!='\0')) printf ("{%s}\n",html_encode(hostgroup_name,FALSE));
+ else if ((display_type==DISPLAY_SERVICEGROUPS)&&(!show_all_servicegroups)&&servicegroup_name
+ &&(*servicegroup_name!='\0')) printf ("(%s)\n",html_encode(servicegroup_name,FALSE));
+ else printf("Current Network Status\n");
printf("\n");

if(use_stylesheet==TRUE){
--- extinfo.c.orig 2010-08-03 14:44:33.000000000 +0200
+++ extinfo.c 2010-10-08 14:14:28.000000000 +0200
@@ -611,7 +611,17 @@
printf("\n");
printf("\n",url_images_path);
printf("\n");
- printf("Extended Information\n");
+ if ((display_type==DISPLAY_HOST_INFO)&&host_name&&(*host_name!='\0'))
+ printf ("[%s]\n",html_encode(host_name,FALSE));
+ else if ((display_type==DISPLAY_SERVICE_INFO)&&service_desc&&(*service_desc!='\0')) {
+ printf ("%s\n",service_desc);
+ if (host_name&&(*host_name!='\0')) printf ("@ %s\n",html_encode(host_name,FALSE));
+ }
+ else if ((display_type==DISPLAY_HOSTGROUP_INFO)&&hostgroup_name&&(*hostgroup_name!='\0'))
+ printf ("{%s}\n",html_encode(hostgroup_name,FALSE));
+ else if ((display_type==DISPLAY_SERVICEGROUP_INFO)&&servicegroup_name
+ &&(*servicegroup_name!='\0')) printf ("(%s)\n",html_encode(servicegroup_name,FALSE));
+ else printf("Extended Information\n");
printf("\n");

if(use_stylesheet==TRUE){

--------------060207040803070901070504--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked