mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
This was easy because only README.md and doc/01-About.md were redacted manually, everything else via: git ls-files -z |xargs -0 perl -pi -e 's/Icinga GmbH \| GPLv2/Icinga GmbH | GPLv2+/' This is legal because we have only merged PRs with label:cla/signed or made by Icinga staff: https://github.com/Icinga/icingadb-web/pulls?page=1&q=is%3Apr+is%3Aclosed+-label%3Acla%2Fsigned+-author%3Anilmerg This has no risk for us in people distributing their own version under GPLv3 only. After all, we won't take their patches anyway, unless they sign our CLA. This is the cleanest solution for having e.g. these in one address space: * Icinga Web, GPLv2+ * K8s Web, AGPLv3 * Thirdparty, some LGPLv3 and Apache-2.0 Apropos, K8s Web is even v3-licensed on purpose, to have a stronger protection against cloud ops.
90 lines
3.6 KiB
PHP
90 lines
3.6 KiB
PHP
<?php
|
|
|
|
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2+ */
|
|
|
|
namespace Icinga\Module\Icingadb\Model;
|
|
|
|
use Icinga\Module\Icingadb\Common\Backend;
|
|
use Icinga\Module\Icingadb\Common\ServiceStates;
|
|
use ipl\Orm\Relations;
|
|
|
|
/**
|
|
* Service state model.
|
|
*
|
|
* @property string $service_id
|
|
*/
|
|
class ServiceState extends State
|
|
{
|
|
public function getTableName()
|
|
{
|
|
return 'service_state';
|
|
}
|
|
|
|
public function getKeyName()
|
|
{
|
|
return 'service_id';
|
|
}
|
|
|
|
public function getColumnDefinitions()
|
|
{
|
|
$columns = [
|
|
'environment_id' => t('Environment Id'),
|
|
'state_type' => t('Service State Type'),
|
|
'soft_state' => t('Service Soft State'),
|
|
'hard_state' => t('Service Hard State'),
|
|
'previous_soft_state' => t('Service Previous Soft State'),
|
|
'previous_hard_state' => t('Service Previous Hard State'),
|
|
'check_attempt' => t('Service Check Attempt No.'),
|
|
'severity' => t('Service State Severity'),
|
|
'output' => t('Service Output'),
|
|
'long_output' => t('Service Long Output'),
|
|
'performance_data' => t('Service Performance Data'),
|
|
'normalized_performance_data' => t('Service Normalized Performance Data'),
|
|
'check_commandline' => t('Service Check Commandline'),
|
|
'is_problem' => t('Service Has Problem'),
|
|
'is_handled' => t('Service Is Handled'),
|
|
'is_reachable' => t('Service Is Reachable'),
|
|
'is_flapping' => t('Service Is Flapping'),
|
|
'is_overdue' => t('Service Check Is Overdue'),
|
|
'is_acknowledged' => t('Service Is Acknowledged'),
|
|
'acknowledgement_comment_id' => t('Acknowledgement Comment Id'),
|
|
'in_downtime' => t('Service In Downtime'),
|
|
'execution_time' => t('Service Check Execution Time'),
|
|
'latency' => t('Service Check Latency'),
|
|
'check_timeout' => t('Service Check Timeout'),
|
|
'check_source' => t('Service Check Source'),
|
|
'scheduling_source' => t('Service Scheduling Source'),
|
|
'last_update' => t('Service Last Update'),
|
|
'last_state_change' => t('Service Last State Change'),
|
|
'next_check' => t('Service Next Check'),
|
|
'next_update' => t('Service Next Update')
|
|
];
|
|
|
|
if (Backend::supportsDependencies()) {
|
|
$columns['affects_children'] = t('Service Affects Children');
|
|
$columns['is_sticky_acknowledgement'] = t('Acknowledgement Is Sticky');
|
|
}
|
|
|
|
return $columns;
|
|
}
|
|
|
|
public function createRelations(Relations $relations)
|
|
{
|
|
$relations->belongsTo('environment', Environment::class);
|
|
$relations->belongsTo('service', Service::class);
|
|
$relations->hasOne('last_comment', LastServiceComment::class)
|
|
->setCandidateKey('last_comment_id')
|
|
->setForeignKey('id')
|
|
->setJoinType('LEFT');
|
|
}
|
|
|
|
public function getStateText(): string
|
|
{
|
|
return ServiceStates::text($this->soft_state);
|
|
}
|
|
|
|
public function getStateTextTranslated(): string
|
|
{
|
|
return ServiceStates::text($this->soft_state);
|
|
}
|
|
}
|