mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Introduce model StateHistory
This commit is contained in:
parent
c1ff9f3587
commit
23f2ec65ae
1 changed files with 58 additions and 0 deletions
58
library/Eagle/Model/StateHistory.php
Normal file
58
library/Eagle/Model/StateHistory.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Eagle\Model;
|
||||
|
||||
use Icinga\Module\Eagle\Model\Behavior\Timestamp;
|
||||
use ipl\Orm\Behaviors;
|
||||
use ipl\Orm\Model;
|
||||
use ipl\Orm\Relations;
|
||||
|
||||
class StateHistory extends Model
|
||||
{
|
||||
public function getTableName()
|
||||
{
|
||||
return 'state_history';
|
||||
}
|
||||
|
||||
public function getKeyName()
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'environment_id',
|
||||
'endpoint_id',
|
||||
'object_type',
|
||||
'host_id',
|
||||
'service_id',
|
||||
'event_time',
|
||||
'state_type',
|
||||
'soft_state',
|
||||
'hard_state',
|
||||
'attempt',
|
||||
'previous_soft_state',
|
||||
'previous_hard_state',
|
||||
'output',
|
||||
'long_output',
|
||||
'max_check_attempts',
|
||||
'check_source'
|
||||
];
|
||||
}
|
||||
|
||||
public function createBehaviors(Behaviors $behaviors)
|
||||
{
|
||||
$behaviors->add(new Timestamp([
|
||||
'event_time'
|
||||
]));
|
||||
}
|
||||
|
||||
public function createRelations(Relations $relations)
|
||||
{
|
||||
$relations->belongsTo('endpoint', Endpoint::class);
|
||||
$relations->belongsTo('environment', Environment::class);
|
||||
$relations->belongsTo('host', Host::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('service', Service::class)->setJoinType('LEFT');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue