Performance issues, how to resolve. DEVELOPERS PLEASE READ

From Wiki Centreon

Jump to: navigation, search
Hi,

we're deploying Centreon in an enterprise environment: thousands of servers, and checks.

Several bugs came up relating to the database structure of centreon.

To fix, please add the following indexes to your database:

alter table nagios_hosts add index display_name(display_name);
alter table nagios_objects add index name1(name1);
alter table nagios_services add index host_object_id(host_object_id);
alter table nagios_services add index instance_id(instance_id);
alter table nagios_services add index service_object_id(service_object_id);
alter table nagios_timedeventqueue add index instance_id(instance_id);

Also, in ./www/include/home/tacticalOverview/tacticalOverview.php
make changes on line 103 and 112. A query which in our setup takes more than a minute to run takes
less than a second then.

		if (!$is_admin)
			$rq1 = 	" SELECT ".$ndo_base_prefix."hoststatus.host_object_id, " .$ndo_base_prefix. "hoststatus.current_state ".
					" FROM ".$ndo_base_prefix."servicestatus, ".$ndo_base_prefix."hoststatus, " . $ndo_base_prefix."services, " . $ndo_base_prefix. "objects" .
					" WHERE ".$ndo_base_prefix."servicestatus.service_object_id = ".$ndo_base_prefix."services.service_object_id" . 
					" AND ".$ndo_base_prefix."services.host_object_id = " . $ndo_base_prefix . "hoststatus.host_object_id" .
					" AND ".$ndo_base_prefix."hoststatus.host_object_id = " . $ndo_base_prefix . "objects.object_id" .
					" AND ".$ndo_base_prefix."objects.is_active = 1 " .
					" AND ".$ndo_base_prefix."objects.name1 IN ($lcaSTR) ".
					" GROUP BY nagios_services.host_object_id";
		else
			$rq1 = 	" SELECT ".$ndo_base_prefix."services.host_object_id, " .$ndo_base_prefix. "hoststatus.current_state" . 
					" FROM ".$ndo_base_prefix."servicestatus, ".$ndo_base_prefix."hoststatus, " . $ndo_base_prefix."services, " . $ndo_base_prefix. "objects" .
					" WHERE ".$ndo_base_prefix."servicestatus.service_object_id = ".$ndo_base_prefix."services.service_object_id" . 
					" AND ".$ndo_base_prefix."services.host_object_id = " . $ndo_base_prefix . "hoststatus.host_object_id" .
					" AND ".$ndo_base_prefix."hoststatus.host_object_id = " . $ndo_base_prefix . "objects.object_id" .
					" AND ".$ndo_base_prefix."objects.is_active = 1 " .
					" GROUP BY nagios_services.host_object_id";

-Han (hanno <that funny 'at' sign> liem dot cn)
Personal tools