Page 1 of 2

UI Change Request 2

Posted: Wed Jun 18, 2014 9:56 pm
by rajasegar
Nagios XI 2012R2.9
Offloaded DB
RHEL 6.5 x64
Manual Install

Please refer to the attached pic, the list is not sorted.
The user has to scroll up and down to find the correct host group.
19-06-2014 10-52-38 AM.png

Re: UI Change Request 2

Posted: Thu Jun 19, 2014 9:53 am
by abrist
I have opened an internal bug report. Thanks for the report!

Re: UI Change Request 2

Posted: Thu Jun 19, 2014 10:52 am
by tmcdonald
I might have a fix for this - checking with devs. Will update post when I know more.

Edit the /usr/local/nagiosxi/html/reports/execsummary.php file to change the following:

Code: Select all

	<select name="hostgroup" id="hostgroupList" style="width: 150px;">
	<option value=""><?php echo gettext("Hostgroup"); ?>:</option>
<?php
	$oxml=get_xml_hostgroup_objects();
	if($oxml){
		foreach($oxml->hostgroup as $hg){
			$name=strval($hg->hostgroup_name);
			echo "<option value='".$name."' ".is_selected($hostgroup,$name).">$name</option>\n";
			}
		}
?>
	</select>
	<select name="servicegroup" id="servicegroupList" style="width: 150px;">
	<option value=""><?php echo gettext("Servicegroup"); ?>:</option>
<?php
	$oxml=get_xml_servicegroup_objects();
	if($oxml){
		foreach($oxml->servicegroup as $sg){
			$name=strval($sg->servicegroup_name);
			echo "<option value='".$name."' ".is_selected($servicegroup,$name).">$name</option>\n";
			}
		}
?>
	</select>
to

Code: Select all

	<select name="hostgroup" id="hostgroupList" style="width: 150px;">
	<option value=""><?php echo gettext("Hostgroup"); ?>:</option>
<?php
	$hg_array = array();
	$oxml=get_xml_hostgroup_objects();
	if($oxml){
		foreach($oxml->hostgroup as $hg){
			$name=strval($hg->hostgroup_name);
			$hg_array["$name"] = "<option value='".$name."' ".is_selected($hostgroup,$name).">$name</option>\n";
		}
		sort($hg_array);
		foreach($hg_array as $name => $html) {
			echo $html;
		}
    }
?>
	</select>
	<select name="servicegroup" id="servicegroupList" style="width: 150px;">
	<option value=""><?php echo gettext("Servicegroup"); ?>:</option>
<?php
	$sg_array = array();
	$oxml=get_xml_servicegroup_objects();
	if($oxml){
		foreach($oxml->servicegroup as $sg){
			$name=strval($sg->servicegroup_name);
			$sg_array["$name"] = "<option value='".$name."' ".is_selected($servicegroup,$name).">$name</option>\n";
			}
		}
	sort($sg_array);
	foreach($sg_array as $name => $html) {
		echo $html;
	}
?>
	</select>
beginning on line 241. Note that other reports like the SLA will need to be similarly changed, but in the meantime this will work. The devs should hopefully be fixing this for all reports.

Re: UI Change Request 2

Posted: Thu Jun 19, 2014 6:44 pm
by rajasegar
tmcdonald wrote:I might have a fix for this - checking with devs. Will update post when I know more.

Edit the /usr/local/nagiosxi/html/reports/execsummary.php file to change the following:

Code: Select all

	<select name="hostgroup" id="hostgroupList" style="width: 150px;">
	<option value=""><?php echo gettext("Hostgroup"); ?>:</option>
<?php
	$oxml=get_xml_hostgroup_objects();
	if($oxml){
		foreach($oxml->hostgroup as $hg){
			$name=strval($hg->hostgroup_name);
			echo "<option value='".$name."' ".is_selected($hostgroup,$name).">$name</option>\n";
			}
		}
?>
	</select>
	<select name="servicegroup" id="servicegroupList" style="width: 150px;">
	<option value=""><?php echo gettext("Servicegroup"); ?>:</option>
<?php
	$oxml=get_xml_servicegroup_objects();
	if($oxml){
		foreach($oxml->servicegroup as $sg){
			$name=strval($sg->servicegroup_name);
			echo "<option value='".$name."' ".is_selected($servicegroup,$name).">$name</option>\n";
			}
		}
?>
	</select>
to

Code: Select all

	<select name="hostgroup" id="hostgroupList" style="width: 150px;">
	<option value=""><?php echo gettext("Hostgroup"); ?>:</option>
<?php
	$hg_array = array();
	$oxml=get_xml_hostgroup_objects();
	if($oxml){
		foreach($oxml->hostgroup as $hg){
			$name=strval($hg->hostgroup_name);
			$hg_array["$name"] = "<option value='".$name."' ".is_selected($hostgroup,$name).">$name</option>\n";
		}
		sort($hg_array);
		foreach($hg_array as $name => $html) {
			echo $html;
		}
    }
?>
	</select>
	<select name="servicegroup" id="servicegroupList" style="width: 150px;">
	<option value=""><?php echo gettext("Servicegroup"); ?>:</option>
<?php
	$sg_array = array();
	$oxml=get_xml_servicegroup_objects();
	if($oxml){
		foreach($oxml->servicegroup as $sg){
			$name=strval($sg->servicegroup_name);
			$sg_array["$name"] = "<option value='".$name."' ".is_selected($servicegroup,$name).">$name</option>\n";
			}
		}
	sort($sg_array);
	foreach($sg_array as $name => $html) {
		echo $html;
	}
?>
	</select>
beginning on line 241. Note that other reports like the SLA will need to be similarly changed, but in the meantime this will work. The devs should hopefully be fixing this for all reports.
Mine does not look the same as yours. Please double confirm the version this is for.
See attached execsummary.php.
execsummary.zip

Re: UI Change Request 2

Posted: Fri Jun 20, 2014 9:04 am
by tmcdonald
Our two versions are different, yes. Looking at yours the changes begin on line 212 and go to line 235, and in mine there is an extra "style" parameter that should not affect anything. Other than that they are the same as far as this patch goes.

Re: UI Change Request 2

Posted: Mon Jun 23, 2014 1:19 am
by rajasegar
tmcdonald wrote:Our two versions are different, yes. Looking at yours the changes begin on line 212 and go to line 235, and in mine there is an extra "style" parameter that should not affect anything. Other than that they are the same as far as this patch goes.
I am not comfortable introducing change that is not based on the same version. There might be some other changes that possibly not considered.

Re: UI Change Request 2

Posted: Mon Jun 23, 2014 9:36 am
by tmcdonald
I just manually configured a new 2012R2.9 server and applied the patch myself - it works:
exec-alpha.png
Line 212 is the beginning of the <select> for hostgroups, and line 235 is the end of the <select> for servicegroups. All of the changes should be made in-between those lines. The only difference is that you will not have the CSS width attribute, which will not affect the functionality.

Re: UI Change Request 2

Posted: Mon Jun 23, 2014 6:17 pm
by rajasegar
tmcdonald wrote:I just manually configured a new 2012R2.9 server and applied the patch myself - it works:
exec-alpha.png
Line 212 is the beginning of the <select> for hostgroups, and line 235 is the end of the <select> for servicegroups. All of the changes should be made in-between those lines. The only difference is that you will not have the CSS width attribute, which will not affect the functionality.
Ok. Thanks for the confirmation.

Removed line 212 to 235 from original file and pasted your code.
The list is sorted now but the page does not produce any reports.

Noticed the following errors in the httpd error log. This errors are still there from the original version but it seems to be working.

Code: Select all

[Tue Jun 24 07:26:51 2014] [error] [client 10.17.44.201] PHP Notice:  Undefined variable: data in /usr/local/nagiosxi/html/reports/availability.php on line 98, referer: http://10.17.19.235/nagiosxi/reports/execsummary.php
[Tue Jun 24 07:26:51 2014] [error] [client 10.17.44.201] PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/reports/availability.php on line 98, referer: http://10.17.19.235/nagiosxi/reports/execsummary.php
[Tue Jun 24 07:26:51 2014] [error] [client 10.17.44.201] PHP Notice:  Undefined variable: xdata in /usr/local/nagiosxi/html/reports/availability.php on line 111, referer: http://10.17.19.235/nagiosxi/reports/execsummary.php
[Tue Jun 24 07:26:51 2014] [error] [client 10.17.44.201] PHP Notice:  Undefined variable: data in /usr/local/nagiosxi/html/reports/availability.php on line 98, referer: http://10.17.19.235/nagiosxi/reports/execsummary.php
[Tue Jun 24 07:26:51 2014] [error] [client 10.17.44.201] PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/reports/availability.php on line 98, referer: http://10.17.19.235/nagiosxi/reports/execsummary.php
[Tue Jun 24 07:26:51 2014] [error] [client 10.17.44.201] PHP Notice:  Undefined variable: xdata in /usr/local/nagiosxi/html/reports/availability.php on line 111, referer: http://10.17.19.235/nagiosxi/reports/execsummary.php

Re: UI Change Request 2

Posted: Tue Jun 24, 2014 9:02 am
by tmcdonald
I'm a bit confused here. Those errors are from the Availability Report but we were working on the Executive Summary. Which of these are you seeing issues with?

Re: UI Change Request 2

Posted: Tue Jun 24, 2014 6:04 pm
by rajasegar
tmcdonald wrote:I'm a bit confused here. Those errors are from the Availability Report but we were working on the Executive Summary. Which of these are you seeing issues with?
Sorry for the confusion, this was FYI on the possible issues on the other report. There was no errors in Executive Summary but nothing came out after making the changes.