Reflect status in browser title bar
Posted: Fri Apr 18, 2014 9:25 pm
Hi all,
I'm new here so I hope this is the place to show how we modified Nagios to reflect the current status in the title bar, so for tabbed browsers you can simply glance and the tab is see if everything is OK.
Edit cgi/status.c to add "nowrap" to host column (line 1671). /* because I don't like it when hostnames wrap */
Before the main() code add a global variable:
Add the following code before the return() statement in show_host_status_totals() and show_service_status_totals():
And finally add the following code before the return() statement in main():
Edit cgi/tac.c and add the following code return before the return statement in main():
Hope this helps others.
Thanks,
Bob.
I'm new here so I hope this is the place to show how we modified Nagios to reflect the current status in the title bar, so for tabbed browsers you can simply glance and the tab is see if everything is OK.
Edit cgi/status.c to add "nowrap" to host column (line 1671). /* because I don't like it when hostnames wrap */
Before the main() code add a global variable:
Code: Select all
int title_problems = 0;Code: Select all
title_problems += total_problems;Code: Select all
if(title_problems == 0)
printf("<script> top.document.title='OK - Freedom Communications Nagios';</script>\n");
else
printf("<script> top.document.title='PROBLEMS - Freedom Communications Nagios';</script>\n");
Code: Select all
if((total_hosts == hosts_up) && (total_services == services_ok))
printf("<script> top.document.title='OK - Freedom Communications Nagios';</script>\n");
else
printf("<script> top.document.title='PROBLEMS - Freedom Communications Nagios';</script>\n");
Thanks,
Bob.