function stage5() { $dbType = $this->getConfig('DB_TYPE'); $frontendSetup = new CFrontendSetup(); $databases = $frontendSetup->getSupportedDatabases(); $table = new CTable(null, 'requirements'); $table->setAlign('center'); $table->addRow(array(new CCol(_('Database type'), 'header'), $databases[$dbType])); switch ($dbType) { case ZBX_DB_SQLITE3: $table->addRow(array(new CCol(_('Database file'), 'header'), $this->getConfig('DB_DATABASE'))); break; default: $table->addRow(array(new CCol(_('Database server'), 'header'), $this->getConfig('DB_SERVER'))); $dbPort = $this->getConfig('DB_PORT'); $table->addRow(array(new CCol(_('Database port'), 'header'), $dbPort == 0 ? _('default') : $dbPort)); $table->addRow(array(new CCol(_('Database name'), 'header'), $this->getConfig('DB_DATABASE'))); $table->addRow(array(new CCol(_('Database user'), 'header'), $this->getConfig('DB_USER'))); $table->addRow(array(new CCol(_('Database password'), 'header'), preg_replace('/./', '*', $this->getConfig('DB_PASSWORD')))); if ($dbType == ZBX_DB_DB2 || $dbType == ZBX_DB_POSTGRESQL) { $table->addRow(array(new CCol(_('Database schema'), 'header'), $this->getConfig('DB_SCHEMA'))); } break; } $table->addRow(BR()); $table->addRow(array(new CCol(_('Zabbix server'), 'header'), $this->getConfig('ZBX_SERVER'))); $table->addRow(array(new CCol(_('Zabbix server port'), 'header'), $this->getConfig('ZBX_SERVER_PORT'))); $table->addRow(array(new CCol(_('Zabbix server name'), 'header'), $this->getConfig('ZBX_SERVER_NAME'))); return array('Please check configuration parameters.', BR(), 'If all is correct, press "Next" button, or "Previous" button to change configuration parameters.', BR(), BR(), $table); }
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 (enabled/disabled/templates)')); $title->setAttribute('title', 'asdad'); $table->addRow(array(_('Number of hosts (enabled/disabled/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 (enabled/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 CFrontendSetup(); $reqs = $frontendSetup->checkRequirements(); foreach ($reqs as $req) { if ($req['result'] != CFrontendSetup::CHECK_OK) { $class = $req['result'] == CFrontendSetup::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("#' . WIDGET_ZABBIX_STATUS . '_footer").html("' . _s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)) . '");')); return new CDiv(array($table, $script)); }
function stage4() { $db_type = $this->getConfig('DB_TYPE'); $databases = CFrontendSetup::getSupportedDatabases(); $table = new CFormList(); $table->addRow((new CSpan(_('Database type')))->addClass(ZBX_STYLE_GREY), $databases[$db_type]); switch ($db_type) { case ZBX_DB_SQLITE3: $table->addRow((new CSpan(_('Database file')))->addClass(ZBX_STYLE_GREY), $this->getConfig('DB_DATABASE')); break; default: $db_port = $this->getConfig('DB_PORT') == 0 ? _('default') : $this->getConfig('DB_PORT'); $db_password = preg_replace('/./', '*', $this->getConfig('DB_PASSWORD')); $table->addRow((new CSpan(_('Database server')))->addClass(ZBX_STYLE_GREY), $this->getConfig('DB_SERVER')); $table->addRow((new CSpan(_('Database port')))->addClass(ZBX_STYLE_GREY), $db_port); $table->addRow((new CSpan(_('Database name')))->addClass(ZBX_STYLE_GREY), $this->getConfig('DB_DATABASE')); $table->addRow((new CSpan(_('Database user')))->addClass(ZBX_STYLE_GREY), $this->getConfig('DB_USER')); $table->addRow((new CSpan(_('Database password')))->addClass(ZBX_STYLE_GREY), $db_password); if ($db_type == ZBX_DB_DB2 || $db_type == ZBX_DB_POSTGRESQL) { $table->addRow((new CSpan(_('Database schema')))->addClass(ZBX_STYLE_GREY), $this->getConfig('DB_SCHEMA')); } break; } $table->addRow(null, null); $table->addRow((new CSpan(_('Zabbix server')))->addClass(ZBX_STYLE_GREY), $this->getConfig('ZBX_SERVER')); $table->addRow((new CSpan(_('Zabbix server port')))->addClass(ZBX_STYLE_GREY), $this->getConfig('ZBX_SERVER_PORT')); $table->addRow((new CSpan(_('Zabbix server name')))->addClass(ZBX_STYLE_GREY), $this->getConfig('ZBX_SERVER_NAME')); return [new CTag('h1', true, _('Pre-installation summary')), (new CDiv([new CTag('p', true, _s('Please check configuration parameters. If all is correct, press "%1$s" button, or "%2$s" button to change configuration parameters.', _('Next step'), _('Back'))), $table]))->addClass(ZBX_STYLE_SETUP_RIGHT_BODY)]; }