Fix downtime query and schedule downtime
This commit is contained in:
parent
33ecaaa52b
commit
278f975c48
|
@ -66,9 +66,10 @@ class ObjectContainer extends \stdClass
|
||||||
foreach ($exploded as $elem) {
|
foreach ($exploded as $elem) {
|
||||||
if (isset($result->$elem)) {
|
if (isset($result->$elem)) {
|
||||||
$result = $result->$elem;
|
$result = $result->$elem;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,4 +93,5 @@ class RuntimeStateContainer extends \stdClass
|
||||||
|
|
||||||
return $this->$attr;
|
return $this->$attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,9 +92,9 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
->from(
|
->from(
|
||||||
'downtime',
|
'downtime',
|
||||||
array(
|
array(
|
||||||
'host_name',
|
'host',
|
||||||
'service_description',
|
'service',
|
||||||
'downtime_scheduled_start_time',
|
'downtime_start',
|
||||||
'downtime_internal_downtime_id'
|
'downtime_internal_downtime_id'
|
||||||
)
|
)
|
||||||
)->fetchAll();
|
)->fetchAll();
|
||||||
|
@ -107,7 +107,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
$label = sprintf(
|
$label = sprintf(
|
||||||
'ID %s: %s%s Starting @ %s',
|
'ID %s: %s%s Starting @ %s',
|
||||||
$downtime->downtime_internal_downtime_id,
|
$downtime->downtime_internal_downtime_id,
|
||||||
$downtime->host_name,
|
$downtime->host,
|
||||||
!empty($downtime->service_description) ? ' (' . $downtime->service_description . ')' : '',
|
!empty($downtime->service_description) ? ' (' . $downtime->service_description . ')' : '',
|
||||||
$dateFormat->formatDateTime($downtime->downtime_scheduled_start_time)
|
$dateFormat->formatDateTime($downtime->downtime_scheduled_start_time)
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,19 +23,20 @@ $commandHelper = $this->getHelper('CommandForm');
|
||||||
<td>
|
<td>
|
||||||
<?php if (isset($downtime->service)): ?>
|
<?php if (isset($downtime->service)): ?>
|
||||||
<a href="<?= $this->href('monitoring/show/service', array(
|
<a href="<?= $this->href('monitoring/show/service', array(
|
||||||
'host' => $downtime->host_name,
|
'host' => (string) $downtime->host,
|
||||||
'service' => $downtime->service_description
|
'service' => (string) $downtime->service
|
||||||
)); ?>"><?= $downtime->service ?></a>
|
)); ?>"><?= $downtime->service ?></a>
|
||||||
<small>on <?= $downtime->host ?></small>
|
<small>on <?= $downtime->host ?></small>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a href="<?= $this->href('monitoring/show/host', array(
|
<a href="<?= $this->href('monitoring/show/host', array(
|
||||||
'host' => $downtime->host_name
|
'host' => (string) $downtime->host
|
||||||
)); ?>"><?= $downtime->host ?> </a>
|
)); ?>"><?= $downtime->host ?> </a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<br />
|
<br />
|
||||||
<?= $downtime->downtime_author ?>: <?= $downtime->downtime_comment ?>
|
<?= $downtime->downtime_author ?>: <?= $downtime->downtime_comment ?>
|
||||||
<br />
|
<br />
|
||||||
<small>Entry Time: <?= $downtime->downtime_entry_time ?></small>
|
<small>Entry Time: <?= ($downtime->downtime_entry_time) ? $this->dateFormat()->formatDateTime((int) $downtime->downtime_entry_time) : ''; ?>
|
||||||
|
</small>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$data = array(
|
$data = array(
|
||||||
|
|
|
@ -38,7 +38,7 @@ class DowntimeQuery extends IdoQuery
|
||||||
'downtime' => array(
|
'downtime' => array(
|
||||||
'downtime_author' => 'sd.author_name',
|
'downtime_author' => 'sd.author_name',
|
||||||
'downtime_comment' => 'sd.comment_data',
|
'downtime_comment' => 'sd.comment_data',
|
||||||
'downtime_entry_time' => 'sd.entry_time',
|
'downtime_entry_time' => 'UNIX_TIMESTAMP(sd.entry_time)',
|
||||||
'downtime_is_fixed' => 'sd.is_fixed',
|
'downtime_is_fixed' => 'sd.is_fixed',
|
||||||
'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END',
|
'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END',
|
||||||
'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN sd.trigger_time != '0000-00-00 00:00:00' then sd.trigger_time ELSE sd.scheduled_start_time END)",
|
'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN sd.trigger_time != '0000-00-00 00:00:00' then sd.trigger_time ELSE sd.scheduled_start_time END)",
|
||||||
|
|
|
@ -44,17 +44,17 @@ class DowntimeQuery extends StatusdatQuery
|
||||||
'downtime_is_in_effect' => 'is_in_effect',
|
'downtime_is_in_effect' => 'is_in_effect',
|
||||||
'downtime_trigger_time' => 'trigger_time',
|
'downtime_trigger_time' => 'trigger_time',
|
||||||
'downtime_triggered_by_id' => 'triggered_by_id',
|
'downtime_triggered_by_id' => 'triggered_by_id',
|
||||||
'downtime_internal_downtime_id' => 'internal_downtime_id',
|
'downtime_internal_downtime_id' => 'downtime_id',
|
||||||
'host' => 'host_name',
|
'host' => 'host_name',
|
||||||
'host_name' => 'host_name',
|
'host_name' => 'host_name',
|
||||||
'service_host_name' => 'host_name',
|
'service_host_name' => 'host_name'
|
||||||
'service_description' => 'service_description',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $handlerParameters = array(
|
public static $handlerParameters = array(
|
||||||
'object_type' => 'getObjectType',
|
'object_type' => 'getObjectType',
|
||||||
'downtime_start' => 'getDowntimeStart',
|
'downtime_start' => 'getDowntimeStart',
|
||||||
'downtime_is_flexible' => 'getFlexibleFlag'
|
'downtime_is_flexible' => 'getFlexibleFlag',
|
||||||
|
'service_description' => 'getServiceDescription'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $fieldTypes = array(
|
public static $fieldTypes = array(
|
||||||
|
@ -63,6 +63,14 @@ class DowntimeQuery extends StatusdatQuery
|
||||||
'downtime_start' => self::TIMESTAMP
|
'downtime_start' => self::TIMESTAMP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public function getServiceDescription(&$obj)
|
||||||
|
{
|
||||||
|
if (isset ($obj->service_description)) {
|
||||||
|
return $obj->service_description;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getDowntimeStart(&$obj)
|
public function getDowntimeStart(&$obj)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue