time()) { $update_state['alert_status'] = '3'; }
} else {
$update_state['ignore_until'] = array('NULL');
}
if (is_array($update_state))
{
$up_s = dbUpdate($update_state, 'alert_table', '`alert_table_id` = ?', array($vars['alert_entry']));
}
// Refresh array because we've changed the database.
$entry = get_alert_entry_by_id($vars['alert_entry']);
}
// End actions
humanize_alert_entry($entry);
$alert_rules = cache_alert_rules();
$alert = $alert_rules[$entry['alert_test_id']];
$state = safe_json_decode($entry['state']);
$conditions = safe_json_decode($alert['conditions']);
$entity = get_entity_by_id_cache($entry['entity_type'], $entry['entity_id']);
// r($entry);
// r($alert);
?>
Type | ' . nicecase($entry['entity_type']); ?> |
Entity | |
Checker | |
Fail Msg | |
Status | |
Last Changed | |
';
$alert['state_popup'] .= 'Metric | Cond | Value | Measured | ';
foreach($state['failed'] as $test)
{
$alert['state_popup'] .= ' |
'.$test['metric'].' | '.$test['condition'].' | '.format_value($test['value']).' | '.format_value($state['metrics'][$test['metric']]).' |
';
}
$alert['state_popup'] .= '
';
} elseif (safe_count($state['metrics'])) {
$alert['state_popup'] .= '
';
$alert['state_popup'] .= 'Metric | Value |
';
foreach($state['metrics'] as $metric => $value)
{
$alert['state_popup'] .= ''.$metric.' | '.format_value($value).' |
';
}
$alert['state_popup'] .= '
';
}
echo $alert['state_popup'];
?>
'horizontal',
'id' => 'update_alert_entry',
'title' => 'Alert Settings',
//'icon' => 'oicon-gear',
'fieldset' => array('edit' => ''),
);
$form['row'][0]['editing'] = array(
'type' => 'hidden',
'value' => 'yes');
$form['row'][1]['ignore_until'] = array(
'type' => 'datetime',
//'fieldset' => 'edit',
'name' => 'Ignore Until',
'placeholder' => '',
//'width' => '250px',
'readonly' => $readonly,
'disabled' => empty($entry['ignore_until']),
'min' => 'current',
'value' => ($entry['ignore_until'] ? $entry['ignore_until'] : ''));
$form['row'][1]['ignore_until_enable'] = array(
'type' => 'toggle',
'view' => 'toggle',
'size' => 'big',
'palette' => 'blue',
'readonly' => $readonly,
'onchange' => "toggleAttrib('disabled', 'ignore_until')",
'value' => !empty($entry['ignore_until']));
$form['row'][2]['ignore_until_ok'] = array(
'type' => 'toggle',
'name' => 'Ignore Until OK',
//'fieldset' => 'edit',
'view' => 'toggle',
'size' => 'big',
'palette' => 'blue',
'readonly' => $readonly,
'value' => $entry['ignore_until_ok']);
if (!$readonly) // Hide button for readonly
{
$form['row'][7]['submit'] = array(
'type' => 'submit',
'name' => 'Save Changes',
'icon' => 'icon-ok icon-white',
'div_style' => 'padding-top: 10px; padding-bottom: 10px;',
'right' => TRUE,
'class' => 'btn-primary',
'readonly' => $readonly,
'value' => 'update-alert-entry');
}
print_form($form);
unset($form);
?>
'Historical Availability')); ?>
"); // end row
}
$vars['entity_type'] = $entry['entity_type'];
$vars['entity_id'] = $entry['entity_id'];
print_alert_log($vars);
} else {
print_error("Unfortunately, this alert entry id does not seem to exist in the database!");
}
// EOF