id = $system->getRequest('id', 0); $this->agent = agents_get_agents(array( 'disabled' => 0, 'id_agente' => $this->id), array('*')); if (!empty($this->agent)) { $this->agent = $this->agent[0]; if ($system->checkACL('AR', $this->agent['id_grupo'])) { $this->correct_acl = true; } else { $this->correct_acl = false; } } else { $this->agent = null; $this->correct_acl = true; } } public function show() { if (!$this->correct_acl) { $this->show_fail_acl(); } else { $this->show_agent(); } } private function show_fail_acl() { $error['type'] = 'onStart'; $error['title_text'] = __('You don\'t have access to this page'); $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); if (class_exists("HomeEnterprise")) $home = new HomeEnterprise(); else $home = new Home(); $home->show($error); } public function ajax($parameter2 = false) { $system = System::getInstance(); if (!$this->correct_acl) { return; } else { switch ($parameter2) { case 'render_events_bar': $agent_id = $system->getRequest('agent_id', '0'); $width = $system->getRequest('width', '400'); graph_graphic_agentevents( $this->id, $width, 30, SECONDS_1DAY, ui_get_full_url(false)); exit; } } } private function show_agent() { $ui = Ui::getInstance(); $system = System::getInstance(); $ui->createPage(); if ($this->id != 0) { $agent_name = (string) agents_get_name ($this->id); $ui->createDefaultHeader( sprintf('%s', $agent_name), $ui->createHeaderButton( array('icon' => 'back', 'pos' => 'left', 'text' => __('Back'), 'href' => 'index.php?page=agents'))); } else { $ui->createDefaultHeader(__("PandoraFMS: Agents")); } $ui->showFooter(false); $ui->beginContent(); if (empty($this->agent)) { $ui->contentAddHtml('' . __('No agent found') . ''); } else { $ui->contentBeginGrid(); if ($this->agent['disabled']) { $agent_name = "" . $agent_name . "" . ui_print_help_tip(__('Disabled'), true); } else if ($this->agent['quiet']) { $agent_name = "" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . ""; } else { $agent_name = $agent_name; } $addresses = agents_get_addresses($this->id); $address = agents_get_address($this->id); foreach ($addresses as $k => $add) { if ($add == $address) { unset($addresses[$k]); } } $ip = html_print_image('images/world.png', true, array('title' => __('IP address'))) . '  '; $ip .= empty($address) ? '' . __('N/A') . '' : $address; if (!empty($addresses)) { $ip .= ui_print_help_tip(__('Other IP addresses').':
'.implode('
',$addresses), true); } $ip .= '
'; $last_contact = '' . __('Last contact') . ': ' .ui_print_timestamp ($this->agent["ultimo_contacto"], true) . '
'; $description = '' . __('Description') . ':
'; if (empty($agent["comentarios"])) { $description .= '' . __('N/A') . ''; } else { $description .= ui_bbcode_to_html($this->agent["comentarios"]); } $html = '
'; $html .= ui_print_group_icon ($this->agent["id_grupo"], true, "groups_small", "", false) . '  '; $html .= '' . $agent_name . '
'; $html .= $ip; $html .= $last_contact; $html .= $description; $html .= '
'; $ui->contentGridAddCell($html, 'agent_details'); ob_start(); $html = '
'; $html .= "" . __('Modules by status') . "
"; $html .= graph_agent_status ($this->id, 160, 160, true); $graph_js = ob_get_clean(); $html = $graph_js . $html; unset($this->agent['fired_count']); if ($this->agent['total_count'] > 0) { $html .= '' . reporting_tiny_stats($this->agent, true) . '
'; } $html .= "" . __('Events (24h)') . "

"; $html .= '
'; $html .= '
'; $html .= '
'; $ui->contentGridAddCell($html, 'agent_graphs'); $ui->contentEndGrid(); $modules = new Modules(); $filters = array('id_agent' => $this->id, 'all_modules' => true, 'status' => -1); $modules->setFilters($filters); $modules->disabledColumns(array('agent')); $ui->contentBeginCollapsible(__('Modules')); $ui->contentCollapsibleAddItem($modules->listModulesHtml(0, true)); $ui->contentEndCollapsible(); $alerts = new Alerts(); $filters = array('id_agent' => $this->id, 'all_alerts' => true); $alerts->setFilters($filters); $alerts->disabledColumns(array('agent')); $ui->contentBeginCollapsible(__('Alerts')); $ui->contentCollapsibleAddItem($alerts->listAlertsHtml(true)); $ui->contentEndCollapsible(); $events = new Events(); $events->addJavascriptDialog(); $options = $events->get_event_dialog_options(); $ui->addDialog($options); $options = $events->get_event_dialog_error_options($options); $ui->addDialog($options); $ui->contentAddHtml(""); $ui->contentAddHtml(""); $ui->contentBeginCollapsible(sprintf(__('Last %s Events'), $system->getPageSize())); $tabledata = $events->listEventsHtml(0, true, 'last_agent_events'); $ui->contentCollapsibleAddItem($tabledata['table']); $ui->contentCollapsibleAddItem($events->putEventsTableJS($this->id)); $ui->contentEndCollapsible(); } $ui->contentAddLinkListener('last_agent_events'); $ui->contentAddLinkListener('list_events'); $ui->contentAddLinkListener('list_agent_Modules'); $ui->contentAddHtml(""); $ui->endContent(); $ui->showPage(); } }