Ejemplo n.º 1
0
     }
 }
 unset($service);
 // fetch sla
 $slaData = API::Service()->getSla(array('intervals' => array(array('from' => $period_start, 'to' => $period_end))));
 // expand problem trigger descriptions
 foreach ($slaData as &$serviceSla) {
     foreach ($serviceSla['problems'] as &$problemTrigger) {
         $problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description'];
     }
     unset($problemTrigger);
 }
 unset($serviceSla);
 $treeData = array();
 createServiceMonitoringTree($services, $slaData, $period, $treeData);
 $tree = new CServiceTree('service_status_tree', $treeData, array('caption' => _('Service'), 'status' => _('Status'), 'reason' => _('Reason'), 'sla' => _('Problem time'), 'sla2' => nbsp(_('SLA') . ' / ' . _('Acceptable SLA'))));
 if ($tree) {
     // creates form for choosing a preset interval
     $r_form = new CForm();
     $r_form->setAttribute('class', 'nowrap');
     $r_form->setMethod('get');
     $r_form->setAttribute('name', 'period_choice');
     $r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
     $period_combo = new CComboBox('period', $period, 'javascript: submit();');
     foreach ($periods as $key => $val) {
         $period_combo->addItem($key, $val);
     }
     $r_form->addItem(array(_('Period') . SPACE, $period_combo));
     $srv_wdgt = new CWidget('hat_services', 'service-list service-mon');
     $srv_wdgt->addPageHeader(_('IT SERVICES'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
     $srv_wdgt->addHeader(_('IT services'), $r_form);
Ejemplo n.º 2
0
        }
    }
    unset($service);
    // fetch sla
    $slaData = API::Service()->getSla(['intervals' => [['from' => $period_start, 'to' => $period_end]]]);
    // expand problem trigger descriptions
    foreach ($slaData as &$serviceSla) {
        foreach ($serviceSla['problems'] as &$problemTrigger) {
            $problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description'];
        }
        unset($problemTrigger);
    }
    unset($serviceSla);
    $treeData = [];
    createServiceMonitoringTree($services, $slaData, $period, $treeData);
    $tree = new CServiceTree('service_status_tree', $treeData, ['caption' => _('Service'), 'status' => _('Status'), 'reason' => _('Reason'), 'sla' => (new CColHeader(_('Problem time')))->setColSpan(2), 'sla2' => null, 'sla3' => nbsp(_('SLA') . ' / ' . _('Acceptable SLA'))]);
    if ($tree) {
        // creates form for choosing a preset interval
        $r_form = (new CForm('get'))->setAttribute('name', 'period_choice')->addVar('fullscreen', $_REQUEST['fullscreen']);
        $period_combo = new CComboBox('period', $period, 'javascript: submit();');
        foreach ($periods as $key => $val) {
            $period_combo->addItem($key, $val);
        }
        // controls
        $r_form->addItem((new CList())->addItem([_('Period'), SPACE, $period_combo])->addItem(get_icon('fullscreen', ['fullscreen' => $_REQUEST['fullscreen']])));
        $srv_wdgt = (new CWidget())->setTitle(_('IT services'))->setControls($r_form)->addItem(BR())->addItem($tree->getHTML())->show();
    } else {
        error(_('Cannot format Tree. Check logic structure in service links.'));
    }
}
require_once dirname(__FILE__) . '/include/page_footer.php';