mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
parent
bbd59d4fbc
commit
e96d0c26e3
@ -13,6 +13,16 @@ class ServicestatehistoryQuery extends IdoQuery
|
|||||||
*/
|
*/
|
||||||
protected $allowCustomVars = true;
|
protected $allowCustomVars = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected $groupBase = array('statehistory', array('sh.statehistory_id', 'so.object_id'));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected $groupOrigin = array('hostgroups', 'servicegroups');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array to map type names to type ids for query optimization
|
* Array to map type names to type ids for query optimization
|
||||||
*
|
*
|
||||||
@ -30,22 +40,6 @@ class ServicestatehistoryQuery extends IdoQuery
|
|||||||
'instances' => array(
|
'instances' => array(
|
||||||
'instance_name' => 'i.instance_name'
|
'instance_name' => 'i.instance_name'
|
||||||
),
|
),
|
||||||
'statehistory' => array(
|
|
||||||
'host' => 'so.name1 COLLATE latin1_general_ci',
|
|
||||||
'host_name' => 'so.name1',
|
|
||||||
'object_type' => '(\'service\')',
|
|
||||||
'service' => 'so.name2 COLLATE latin1_general_ci',
|
|
||||||
'service_description' => 'so.name2',
|
|
||||||
'service_host' => 'so.name1 COLLATE latin1_general_ci',
|
|
||||||
'service_host_name' => 'so.name1'
|
|
||||||
),
|
|
||||||
'history' => array(
|
|
||||||
'type' => "(CASE WHEN sh.state_type = 1 THEN 'hard_state' ELSE 'soft_state' END)",
|
|
||||||
'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)',
|
|
||||||
'object_id' => 'sh.object_id',
|
|
||||||
'state' => 'sh.state',
|
|
||||||
'output' => "('[ ' || sh.current_check_attempt || '/' || sh.max_check_attempts || ' ] ' || sh.output)",
|
|
||||||
),
|
|
||||||
'hostgroups' => array(
|
'hostgroups' => array(
|
||||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||||
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
||||||
@ -62,7 +56,21 @@ class ServicestatehistoryQuery extends IdoQuery
|
|||||||
),
|
),
|
||||||
'services' => array(
|
'services' => array(
|
||||||
'service_display_name' => 's.display_name COLLATE latin1_general_ci'
|
'service_display_name' => 's.display_name COLLATE latin1_general_ci'
|
||||||
)
|
),
|
||||||
|
'statehistory' => array(
|
||||||
|
'host' => 'so.name1 COLLATE latin1_general_ci',
|
||||||
|
'host_name' => 'so.name1',
|
||||||
|
'object_id' => 'sh.object_id',
|
||||||
|
'object_type' => '(\'service\')',
|
||||||
|
'output' => "('[ ' || sh.current_check_attempt || '/' || sh.max_check_attempts || ' ] ' || sh.output)",
|
||||||
|
'service' => 'so.name2 COLLATE latin1_general_ci',
|
||||||
|
'service_description' => 'so.name2',
|
||||||
|
'service_host' => 'so.name1 COLLATE latin1_general_ci',
|
||||||
|
'service_host_name' => 'so.name1',
|
||||||
|
'state' => 'sh.state',
|
||||||
|
'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)',
|
||||||
|
'type' => "(CASE WHEN sh.state_type = 1 THEN 'hard_state' ELSE 'soft_state' END)"
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,7 +105,6 @@ class ServicestatehistoryQuery extends IdoQuery
|
|||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
$this->joinedVirtualTables['statehistory'] = true;
|
$this->joinedVirtualTables['statehistory'] = true;
|
||||||
$this->joinedVirtualTables['history'] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -177,21 +184,4 @@ class ServicestatehistoryQuery extends IdoQuery
|
|||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getGroup()
|
|
||||||
{
|
|
||||||
$group = array();
|
|
||||||
if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('servicegroups')) {
|
|
||||||
$group = array('sh.statehistory_id', 'so.object_id');
|
|
||||||
if ($this->hasJoinedVirtualTable('services')) {
|
|
||||||
$group[] = 'h.host_id';
|
|
||||||
$group[] = 's.service_id';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $group;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user