require_once dirname(__FILE__).'/include/config.inc.php';
require_once dirname(__FILE__).'/include/triggers.inc.php';
require_once dirname(__FILE__).'/include/services.inc.php';
$page['title'] = _('Services');
$page['file'] = 'srv_status.php';
$page['scripts'] = ['layout.mode.js', 'srv_status.js'];
define('ZBX_PAGE_DO_REFRESH', 1);
if (!getRequest('serviceid') || !getRequest('showgraph')) {
$page['web_layout_mode'] = CViewHelper::loadLayoutMode();
require_once dirname(__FILE__).'/include/page_header.php';
'week' => _('This week'),
'month' => _('This month'),
'year' => _('This year'),
24 => _('Last 24 hours'),
24 * 7 => _('Last 7 days'),
24 * 30 => _('Last 30 days'),
24 * DAY_IN_YEAR => _('Last 365 days')
'serviceid' => [T_ZBX_INT, O_OPT, P_SYS|P_NZERO, DB_ID, null],
'showgraph' => [T_ZBX_INT, O_OPT, P_SYS, IN('1'), 'isset({serviceid})'],
'period' => [T_ZBX_STR, O_OPT, P_SYS, IN('"'.implode('","', array_keys($periods)).'"'), null]
if (isset($_REQUEST['serviceid']) && isset($_REQUEST['showgraph'])) {
$service = API::Service()->get([
'output' => ['serviceid'],
'serviceids' => getRequest('serviceid')
$service = reset($service);