예제 #1
0
function make_status_of_zbx()
{
    global $ZBX_SERVER, $ZBX_SERVER_PORT;
    $table = new CTableInfo();
    $table->setHeader(array(_('Parameter'), _('Value'), _('Details')));
    show_messages();
    // because in function get_status(); function clear_messages() is called when fsockopen() fails.
    $status = get_status();
    $table->addRow(array(_('Zabbix server is running'), new CSpan($status['zabbix_server'], $status['zabbix_server'] == _('Yes') ? 'off' : 'on'), isset($ZBX_SERVER, $ZBX_SERVER_PORT) ? $ZBX_SERVER . ':' . $ZBX_SERVER_PORT : _('Zabbix server IP or port is not set!')));
    $title = new CSpan(_('Number of hosts (monitored/not monitored/templates)'));
    $title->setAttribute('title', 'asdad');
    $table->addRow(array(_('Number of hosts (monitored/not monitored/templates)'), $status['hosts_count'], array(new CSpan($status['hosts_count_monitored'], 'off'), ' / ', new CSpan($status['hosts_count_not_monitored'], 'on'), ' / ', new CSpan($status['hosts_count_template'], 'unknown'))));
    $title = new CSpan(_('Number of items (monitored/disabled/not supported)'));
    $title->setAttribute('title', _('Only items assigned to enabled hosts are counted'));
    $table->addRow(array($title, $status['items_count'], array(new CSpan($status['items_count_monitored'], 'off'), ' / ', new CSpan($status['items_count_disabled'], 'on'), ' / ', new CSpan($status['items_count_not_supported'], 'unknown'))));
    $title = new CSpan(_('Number of triggers (enabled/disabled) [problem/ok]'));
    $title->setAttribute('title', _('Only triggers assigned to enabled hosts and depending on enabled items are counted'));
    $table->addRow(array($title, $status['triggers_count'], array($status['triggers_count_enabled'], ' / ', $status['triggers_count_disabled'], ' [', new CSpan($status['triggers_count_on'], 'on'), ' / ', new CSpan($status['triggers_count_off'], 'off'), ']')));
    $table->addRow(array(_('Number of users (online)'), $status['users_count'], new CSpan($status['users_online'], 'green')));
    $table->addRow(array(_('Required server performance, new values per second'), $status['qps_total'], ' - '));
    // check requirements
    if (CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN) {
        $frontendSetup = new FrontendSetup();
        $reqs = $frontendSetup->checkRequirements();
        foreach ($reqs as $req) {
            if ($req['result'] != FrontendSetup::CHECK_OK) {
                $class = $req['result'] == FrontendSetup::CHECK_WARNING ? 'notice' : 'fail';
                $table->addRow(array(new CSpan($req['name'], $class), new CSpan($req['current'], $class), new CSpan($req['error'], $class)));
            }
        }
    }
    $script = new CJSScript(get_js("jQuery('#hat_stszbx_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
    return new CDiv(array($table, $script));
}
예제 #2
0
 function stage2()
 {
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $finalResult = FrontendSetup::CHECK_OK;
     $table->addRow(array(SPACE, new CCol(_('Current value'), 'header'), new CCol(_('Required'), 'header')));
     $frontendSetup = new FrontendSetup();
     $reqs = $frontendSetup->checkRequirements();
     foreach ($reqs as $req) {
         $result = null;
         // OK
         if ($req['result'] == FrontendSetup::CHECK_OK) {
             $rowClass = '';
             $result = new CSpan(_('OK'), 'ok');
         } elseif ($req['result'] == FrontendSetup::CHECK_WARNING) {
             $rowClass = 'notice';
             $result = new CSpan(_x('Warning', 'setup'), 'link_menu notice');
             $result->setHint($req['error']);
         } else {
             $rowClass = 'fail';
             $result = new CSpan(_('Fail'), 'link_menu fail');
             $result->setHint($req['error']);
         }
         $table->addRow(array(new CCol($req['name'], 'header'), $req['current'], $req['required'] ? $req['required'] : SPACE, $result), $rowClass);
         $finalResult = max($finalResult, $req['result']);
     }
     // fatal error
     if ($finalResult == FrontendSetup::CHECK_FATAL) {
         $this->DISABLE_NEXT_BUTTON = true;
         $message = array(_('Please correct all issues and press "Retry" button'), BR(), new CSubmit('retry', _('Retry')));
     } else {
         $this->DISABLE_NEXT_BUTTON = false;
         $message = array(new CSpan(_('OK'), 'ok'));
         // add a warning message
         if ($finalResult == FrontendSetup::CHECK_WARNING) {
             $message[] = BR();
             $message[] = _('(with warnings)');
         }
     }
     return array(new CDiv(array(BR(), $table, BR()), 'table_wraper'), new CDiv($message, 'info_bar'));
 }