Пример #1
0
 public function index()
 {
     $start = $this->input->get('start');
     $end = $this->input->get('end');
     $source = $this->input->get('source');
     $view = "";
     if (isset($_GET['view']) && $_GET['view'] != "") {
         $view = pnp::clean($_GET['view']);
     } else {
         $view = $this->config->conf['overview-range'];
     }
     if (isset($this->config->conf['popup-width']) && $this->config->conf['popup-width'] != "") {
         $this->imgwidth = $this->config->conf['popup-width'];
     } else {
         $this->imgwidth = FALSE;
     }
     $this->data->getTimeRange($start, $end, $view);
     if (isset($this->host) && isset($this->service)) {
         $this->data->buildDataStruct($this->host, $this->service, $view);
         $this->template->host = $this->host;
         $this->template->srv = $this->service;
         $this->template->view = $view;
         $this->template->source = $source;
         $this->template->end = $end;
         $this->template->start = $start;
         $this->template->imgwidth = $this->imgwidth;
     } else {
         url::redirect("/graph");
     }
 }
Пример #2
0
 public function index()
 {
     if (!$this->isAuthorizedFor('pages')) {
         throw new Kohana_Exception('error.auth-pages');
     }
     $this->page = pnp::clean($this->input->get('page'));
     if ($this->page == "") {
         $this->page = $this->data->getFirstPage();
     }
     if ($this->page == "") {
         throw new Kohana_Exception('error.page-config-dir', $this->config->conf['page_dir']);
     }
     if ($this->view == "") {
         $this->view = $this->config->conf['overview-range'];
     }
     $this->data->buildPageStruct($this->page, $this->view);
     $this->template->page->header->title = Kohana::lang('common.page', $this->data->PAGE_DEF['page_name']);
     $this->url = "?page&page={$this->page}";
     // Timerange Box Vars
     $this->template->page->timerange_box = $this->add_view('timerange_box');
     $this->template->page->timerange_box->timeranges = $this->data->TIMERANGE;
     // Pages Box
     $this->pages = $this->data->getPages();
     $this->template->page->pages_box = $this->add_view('pages_box');
     $this->template->page->pages_box->pages = $this->pages;
     // Basket Box
     $this->template->page->basket_box = $this->add_view('basket_box');
     // Icon Box
     $this->template->page->icon_box = $this->add_view('icon_box');
     $this->template->page->icon_box->position = "page";
 }
Пример #3
0
 public function __construct()
 {
     parent::__construct();
     $this->data = new Data_Model();
     $this->config = new Config_Model();
     $this->rrdtool = new Rrdtool_Model();
     $this->config->read_config();
     Kohana::config_set('locale.language', $this->config->conf['lang']);
     Kohana::config_set('core.site_domain', $this->config->conf['base_url']);
     // Check for mod_rewrite
     $this->check_mod_rewrite();
     $this->start = $this->input->get('start', FALSE);
     $this->end = $this->input->get('end', FALSE);
     $this->theme = $this->input->get('theme', FALSE);
     $this->view = "";
     $this->controller = Router::$controller;
     if (isset($_GET['view']) && $_GET['view'] != "") {
         $this->view = pnp::clean($_GET['view']);
     }
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     if (Router::$controller != "image" && Router::$controller != "image_special") {
         $this->session = Session::instance();
         if ($this->theme) {
             $this->session->set('theme', $this->theme);
         }
         # New session
         if ($this->session->get("theme", "new") == "new") {
             $this->theme = $this->config->conf['ui-theme'];
             $this->session->set("theme", $this->theme);
         } else {
             $this->theme = $this->session->get('theme');
         }
         if ($this->start && $this->end) {
             if ($this->session->get('timerange-reset', 0) == 0) {
                 $this->session->set("start", $this->start);
                 $this->session->set("end", $this->end);
             } else {
                 $this->session->set('timerange-reset', 0);
             }
         }
         if ($this->start && !$this->end) {
             if ($this->session->get('timerange-reset', 0) == 0) {
                 $this->session->set("start", $this->start);
                 $this->session->set("end", "");
             } else {
                 $this->session->set('timerange-reset', 0);
             }
         }
         if ($this->end && !$this->start) {
             if ($this->session->get('timerange-reset', 0) == 0) {
                 $this->session->set("end", $this->end);
                 $this->session->set("start", "");
             } else {
                 $this->session->set('timerange-reset', 0);
             }
         }
     }
     $this->template = $this->add_view('template');
 }
Пример #4
0
 public function index()
 {
     // Disable auto-rendering
     $this->auto_render = FALSE;
     if ($this->view == "") {
         $this->view = $this->config->conf['overview-range'];
     }
     // Service Details
     if ($this->host != "" && $this->service != "") {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
         $services = $this->data->getServices($this->host);
         $this->data->buildDataStruct($this->host, $this->service, $this->view);
         $i = 0;
         $json = array();
         foreach ($this->data->STRUCT as $struct) {
             $json[$i]['image_url'] = "host=" . $struct['MACRO']['HOSTNAME'] . "&srv=" . $struct['MACRO']['SERVICEDESC'] . "&source=" . $struct['SOURCE'] . "&view=" . $struct['VIEW'];
             $json[$i]['ds_name'] = $struct['ds_name'];
             $json[$i]['start'] = $struct['TIMERANGE']['start'];
             $json[$i]['end'] = $struct['TIMERANGE']['end'];
             $json[$i]['title'] = $struct['TIMERANGE']['title'];
             $i++;
         }
         print json_encode($json);
         // Host Overview
     } elseif ($this->host != "") {
         $this->host = pnp::clean($this->host);
         $services = $this->data->getServices($this->host);
         foreach ($services as $service) {
             if ($service['state'] == 'active') {
                 $this->data->buildDataStruct($this->host, $service['name'], $this->view);
             }
         }
         $i = 0;
         $json = array();
         foreach ($this->data->STRUCT as $struct) {
             $json[$i]['image_url'] = "host=" . $struct['MACRO']['HOSTNAME'] . "&srv=" . $struct['MACRO']['SERVICEDESC'] . "&source=" . $struct['SOURCE'] . "&view=" . $struct['VIEW'];
             $json[$i]['servicedesc'] = $struct['MACRO']['SERVICEDESC'];
             $json[$i]['ds_name'] = $struct['ds_name'];
             $json[$i]['start'] = $struct['TIMERANGE']['start'];
             $json[$i]['end'] = $struct['TIMERANGE']['end'];
             $json[$i]['title'] = $struct['TIMERANGE']['title'];
             $i++;
         }
         print json_encode($json);
     } else {
         $this->hosts = $this->data->getHosts();
         $i = 0;
         $json = array();
         foreach ($this->hosts as $host) {
             if ($host['state'] == "active") {
                 $json[$i]['hostname'] = $host['name'];
                 $i++;
             }
         }
         print json_encode($json);
     }
 }
Пример #5
0
 public function index()
 {
     $this->source = $this->input->get('source');
     $this->view = "";
     if (isset($_GET['view']) && $_GET['view'] != "") {
         $this->view = pnp::clean($_GET['view']);
     } else {
         $this->view = $this->config->conf['overview-range'];
     }
     #
     #  Limit startto 2000/01/01
     #
     $start_limit = strtotime("2000/01/01");
     $this->start = abs((int) $this->start);
     if ($this->start < $start_limit) {
         $this->start = $start_limit;
     }
     #
     # Limit end to now + one hour
     #
     $end_limit = time() + 3600;
     $this->end = abs((int) $this->end);
     if ($this->end > $end_limit) {
         $this->end = $end_limit;
     }
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     if (isset($this->tpl) && $this->tpl != 'undefined') {
         if ($this->start && $this->end) {
             $this->session->set("start", $this->start);
             $this->session->set("end", $this->end);
         }
         $this->template->tpl = $this->tpl;
         $this->template->view = $this->view;
         $this->template->source = $this->source;
         $this->template->end = $this->end;
         $this->template->start = $this->start;
         $this->url = "?tpl=" . $this->tpl;
         $this->template->graph_height = $this->graph_height;
         $this->template->graph_width = $this->graph_width;
     } elseif (isset($this->host) && isset($this->service)) {
         if ($this->start && $this->end) {
             $this->session->set("start", $this->start);
             $this->session->set("end", $this->end);
         }
         $this->template->host = $this->host;
         $this->template->srv = $this->service;
         $this->template->view = $this->view;
         $this->template->source = $this->source;
         $this->template->end = $this->end;
         $this->template->start = $this->start;
         $this->url = "?host=" . $this->host . "&srv=" . $this->service;
         $this->template->graph_height = $this->graph_height;
         $this->template->graph_width = $this->graph_width;
     } else {
         url::redirect("/graph");
     }
 }
Пример #6
0
 public function basket($action = FALSE)
 {
     // Disable auto-rendering
     $this->auto_render = FALSE;
     $host = false;
     $service = false;
     $basket = array();
     if ($action == "list") {
         $basket = $this->session->get("basket");
         if (is_array($basket) && sizeof($basket) > 0) {
             foreach ($basket as $item) {
                 echo "<span id=\"basket_action_remove\"><a title=\"Remove " . $item . "\" id=\"" . $item . "\"><img width=12px height=12px src=\"" . url::base() . "media/images/remove.png\"></a>" . pnp::shorten($item) . "</span><br>\n";
             }
         }
     } elseif ($action == "add") {
         $item = $_POST['item'];
         $basket = $this->session->get("basket");
         if (!is_array($basket)) {
             $basket[] = "{$item}";
         } else {
             if (!in_array($item, $basket)) {
                 $basket[] = $item;
             }
         }
         $this->session->set("basket", $basket);
         foreach ($basket as $item) {
             echo "<span id=\"basket_action_remove\"><a title=\"Remove " . $item . "\" id=\"" . $item . "\"><img width=12px height=12px src=\"" . url::base() . "media/images/remove.png\"></a>" . pnp::shorten($item) . "</span><br>\n";
         }
     } elseif ($action == "remove") {
         $basket = $this->session->get("basket");
         $item_to_remove = $_POST['item'];
         $new_basket = array();
         foreach ($basket as $item) {
             if ($item == $item_to_remove) {
                 continue;
             }
             $new_basket[] = $item;
         }
         $basket = $new_basket;
         $this->session->set("basket", $basket);
         foreach ($basket as $item) {
             echo "<span id=\"basket_action_remove\"><a title=\"Remove " . $item . "\" id=\"" . $item . "\"><img width=12px height=12px src=\"" . url::base() . "media/images/remove.png\"></a>" . pnp::shorten($item) . "</span><br>\n";
         }
     } elseif ($action == "remove-all") {
         $this->session->delete("basket");
     } else {
         echo "Action {$action} not known";
     }
     $basket = $this->session->get("basket");
     if (is_array($basket) && sizeof($basket) == 0) {
         echo "basket is empty";
     } else {
         echo "<a class=\"multi0\" href=\"" . url::base(TRUE) . "page/basket\">show basket</a>";
     }
 }
Пример #7
0
 public function index()
 {
     $this->view = "";
     if (isset($_GET['view']) && $_GET['view'] != "") {
         $this->view = pnp::clean($_GET['view']);
     }
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     if (isset($this->host) && isset($this->service)) {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
         $this->url = "?host=" . $this->host . "&srv=" . $this->service;
         if ($this->start) {
             $this->url .= "&start=" . $this->start;
             $this->session->set("start", $this->start);
         }
         if ($this->end) {
             $this->url .= "&end=" . $this->end;
             $this->session->set("end", $this->end);
         }
         $services = $this->data->getServices($this->host);
         $this->data->buildDataStruct($this->host, $this->service, $this->view);
         $this->is_authorized = $this->auth->is_authorized($this->data->MACRO['AUTH_HOSTNAME'], $this->data->MACRO['AUTH_SERVICEDESC']);
         $this->title = "Service Details " . $this->host . " -> " . $this->data->MACRO['DISP_SERVICEDESC'];
     } elseif (isset($this->host)) {
         $this->host = pnp::clean($this->host);
         $this->is_authorized = $this->auth->is_authorized($this->host);
         if ($this->view == "") {
             $this->view = $this->config->conf['overview-range'];
         }
         if ($this->start) {
             $this->url .= "&start=" . $this->start;
             $this->session->set("start", $this->start);
         }
         if ($this->end) {
             $this->url .= "&end=" . $this->end;
             $this->session->set("end", $this->end);
         }
         $this->title = "Start {$this->host}";
         $services = $this->data->getServices($this->host);
         $this->title = "Service Overview for {$this->host}";
         foreach ($services as $service) {
             if ($service['state'] == 'active') {
                 $this->data->buildDataStruct($this->host, $service['name'], $this->view);
             }
         }
     } else {
         if (isset($this->host)) {
             url::redirect("/graph");
         } else {
             throw new Kohana_Exception('error.get-first-host');
         }
     }
 }
Пример #8
0
 public function index()
 {
     // Disable auto-rendering
     $this->auto_render = FALSE;
     $this->tpl = $this->input->get('tpl');
     $this->start = $this->input->get('start');
     $this->end = $this->input->get('end');
     $this->view = $this->config->conf['overview-range'];
     //default value
     $this->source = NULL;
     if ($this->input->get('view') != "") {
         $this->view = $this->input->get('view');
     }
     if ($this->input->get('source')) {
         $this->source = intval($this->input->get('source'));
     }
     if ($this->input->get('w') != "") {
         $this->rrdtool->config->conf['graph_width'] = intval($this->input->get('w'));
     }
     if ($this->input->get('graph_width') != "") {
         $this->rrdtool->config->conf['graph_width'] = intval($this->input->get('graph_width'));
     }
     if ($this->input->get('h') != "") {
         $this->rrdtool->config->conf['graph_height'] = intval($this->input->get('h'));
     }
     if ($this->input->get('graph_height') != "") {
         $this->rrdtool->config->conf['graph_height'] = intval($this->input->get('graph_height'));
     }
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     if (isset($this->tpl)) {
         $this->tpl = pnp::clean($this->tpl);
         $this->data->buildDataStruct('__special', $this->tpl, $this->view, $this->source);
         #print Kohana::debug($this->data->STRUCT);
         $image = $this->rrdtool->doImage($this->data->STRUCT[0]['RRD_CALL']);
         $this->rrdtool->streamImage($image);
     } elseif (isset($this->host) && isset($this->service)) {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
         $this->data->buildDataStruct($this->host, $this->service, $this->view, $this->source);
         if ($this->auth->is_authorized($this->data->MACRO['AUTH_HOSTNAME'], $this->data->MACRO['AUTH_SERVICEDESC']) === FALSE) {
             $this->rrdtool->streamImage("ERROR: NOT_AUTHORIZED");
         }
         #print Kohana::debug($this->data->STRUCT);
         if (sizeof($this->data->STRUCT) > 0) {
             $image = $this->rrdtool->doImage($this->data->STRUCT[0]['RRD_CALL']);
         } else {
             $image = FALSE;
         }
         $this->rrdtool->streamImage($image);
     } else {
         url::redirect("start", 302);
     }
 }
Пример #9
0
 public function csv()
 {
     if (isset($this->host) && isset($this->service)) {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
         $this->data->buildXport($this->host, $this->service);
         $data = $this->rrdtool->doXport($this->data->XPORT);
         $csv = $this->data->xml2csv($data);
         header("Content-Type: text/plain; charset=UTF-8");
         print $csv;
     } else {
         throw new Kohana_Exception('error.xport-host-service');
     }
 }
Пример #10
0
 public function search()
 {
     $this->template->query = $this->add_view('mobile_search');
     $query = pnp::clean($this->input->post('term'));
     $result = array();
     if (strlen($query) >= 1) {
         $hosts = $this->data->getHosts();
         foreach ($hosts as $host) {
             if (preg_match("/{$query}/i", $host['name'])) {
                 array_push($result, $host['name']);
             }
         }
     }
     $this->result = $result;
 }
Пример #11
0
 public function csv()
 {
     if (isset($this->host) && isset($this->service)) {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
         $this->data->buildXport($this->host, $this->service);
         if ($this->auth->is_authorized($this->data->MACRO['AUTH_HOSTNAME'], $this->data->MACRO['AUTH_SERVICEDESC']) === FALSE) {
             header("Content-Type: text/plain; charset=UTF-8");
             print "not authorized";
             exit;
         }
         $data = $this->rrdtool->doXport($this->data->XPORT);
         $csv = $this->data->xml2csv($data);
         header("Content-Type: text/plain; charset=UTF-8");
         print $csv;
     } else {
         throw new Kohana_Exception('error.xport-host-service');
     }
 }
Пример #12
0
 public function index()
 {
     if ($this->view == "") {
         $this->view = $this->config->conf['overview-range'];
     }
     $this->imgwidth = pnp::clean($this->input->get('width', $this->config->conf['popup-width']));
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     if (isset($this->host) && isset($this->service)) {
         $this->data->buildDataStruct($this->host, $this->service, $this->view, $this->source);
         $this->template->host = $this->host;
         $this->template->srv = $this->service;
         $this->template->view = $this->view;
         $this->template->source = $this->source;
         $this->template->end = $this->end;
         $this->template->start = $this->start;
         $this->template->imgwidth = $this->imgwidth;
     } else {
         url::redirect("/graph");
     }
 }
Пример #13
0
 public function index()
 {
     $this->start = $this->input->get('start');
     $this->end = $this->input->get('end');
     $this->source = $this->input->get('source');
     $this->view = "";
     if (isset($_GET['view']) && $_GET['view'] != "") {
         $this->view = pnp::clean($_GET['view']);
     } else {
         $this->view = $this->config->conf['overview-range'];
     }
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     if (isset($this->tpl) && $this->tpl != 'undefined') {
         if ($this->start && $this->end) {
             $this->session->set("start", $this->start);
             $this->session->set("end", $this->end);
         }
         $this->template->tpl = $this->tpl;
         $this->template->view = $this->view;
         $this->template->source = $this->source;
         $this->template->end = $this->end;
         $this->template->start = $this->start;
         $this->template->graph_height = $this->config->conf['graph_height'];
         $this->template->graph_width = $this->config->conf['graph_width'];
     } elseif (isset($this->host) && isset($this->service)) {
         if ($this->start && $this->end) {
             $this->session->set("start", $this->start);
             $this->session->set("end", $this->end);
         }
         $this->template->host = $this->host;
         $this->template->srv = $this->service;
         $this->template->view = $this->view;
         $this->template->source = $this->source;
         $this->template->end = $this->end;
         $this->template->start = $this->start;
         $this->template->graph_height = $this->config->conf['graph_height'];
         $this->template->graph_width = $this->config->conf['graph_width'];
     } else {
         url::redirect("/graph");
     }
 }
Пример #14
0
 public function index()
 {
     // Disable auto-rendering
     $this->auto_render = FALSE;
     $tpl = $this->input->get('tpl');
     $host = $this->input->get('host');
     $service = $this->input->get('srv');
     $start = $this->input->get('start');
     $end = $this->input->get('end');
     $view = $this->config->conf['overview-range'];
     //default value
     $source = "";
     if ($this->input->get('view') != "") {
         $view = $this->input->get('view');
     }
     if ($this->input->get('source')) {
         $source = $this->input->get('source');
     }
     $this->data->getTimeRange($start, $end, $view);
     if (isset($tpl)) {
         $tpl = pnp::clean($tpl);
         $this->data->buildDataStruct('__special', $tpl, $view, $source);
         #print Kohana::debug($this->data->STRUCT);
         $image = $this->rrdtool->doImage($this->data->STRUCT[0]['RRD_CALL']);
         $this->rrdtool->streamImage($image);
     } elseif (isset($host) && isset($service)) {
         $service = pnp::clean($service);
         $host = pnp::clean($host);
         $this->data->buildDataStruct($host, $service, $view, $source);
         #print Kohana::debug($this->data->STRUCT);
         if (sizeof($this->data->STRUCT) > 0) {
             $image = $this->rrdtool->doImage($this->data->STRUCT[0]['RRD_CALL']);
         } else {
             $image = FALSE;
         }
         $this->rrdtool->streamImage($image);
     } else {
         print "ERROR";
     }
 }
Пример #15
0
 public function index()
 {
     $this->auto_render = FALSE;
     if (isset($this->host) && isset($this->service)) {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
     } elseif (isset($this->host)) {
         $this->host = pnp::clean($this->host);
         $this->service = "_HOST_";
     } else {
         throw new Kohana_User_Exception('No Options', "RTFM my Friend, RTFM!");
     }
     $xmlfile = $this->config->conf['rrdbase'] . $this->host . "/" . $this->service . ".xml";
     if (is_readable($xmlfile)) {
         $fh = fopen($xmlfile, 'r');
         header('Content-Type: application/xml');
         fpassthru($fh);
         fclose($fh);
         exit;
     }
     throw new Kohana_User_Exception('File Not found', "File {$xmlfile} not found");
 }
Пример #16
0
 public function index()
 {
     $this->auto_render = FALSE;
     if (isset($this->host) && isset($this->service)) {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
     } elseif (isset($this->host)) {
         $this->host = pnp::clean($this->host);
         $this->service = "_HOST_";
     } else {
         throw new Kohana_User_Exception('No Options', "RTFM my Friend, RTFM!");
     }
     $this->data->readXML($this->host, $this->service);
     if ($this->auth->is_authorized($this->data->MACRO['AUTH_HOSTNAME'], $this->data->MACRO['AUTH_SERVICEDESC']) === FALSE) {
         header('Content-Type: application/xml');
         print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
         print "<NAGIOS>\n";
         print "<ERROR>not authorized</ERROR>\n";
         print "</NAGIOS>\n";
         exit;
     } else {
         $xmlfile = $this->config->conf['rrdbase'] . $this->host . "/" . $this->service . ".xml";
         if (is_readable($xmlfile)) {
             $fh = fopen($xmlfile, 'r');
             header('Content-Type: application/xml');
             fpassthru($fh);
             fclose($fh);
             exit;
         } else {
             header('Content-Type: application/xml');
             print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
             print "<NAGIOS>\n";
             print "<ERROR>file not found</ERROR>\n";
             print "</NAGIOS>\n";
         }
     }
 }
Пример #17
0
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
 
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//$fp = fopen('/tmp/test', 'a');
//ob_start();
//print_r($this->DS);
$fmt = '%4.2lf';
$unit = 'B';
// Array remap
foreach ($this->DS as $key => $value) {
    $ds[$value['NAME']] = $value;
}
$max = pnp::adjust_unit($ds['real_used']['MAX'], 1024, $fmt);
$upper = "-u {$max['1']}";
$unit_scale = $max[2];
$divis = $max[3];
$opt[1] = "--vertical-label {$unit_scale} -l 0 {$upper} --title \"RAM usage for {$hostname}\" ";
$def[1] = rrd::def("var1", $ds['real_used']['RRDFILE'], $ds['real_used']['DS']);
$def[1] .= rrd::def("var2", $ds['total']['RRDFILE'], $ds['total']['DS']);
$def[1] .= rrd::def("var3", $ds['shared']['RRDFILE'], $ds['shared']['DS']);
$def[1] .= rrd::def("var4", $ds['buffered']['RRDFILE'], $ds['buffered']['DS']);
$def[1] .= rrd::def("var5", $ds['cached']['RRDFILE'], $ds['cached']['DS']);
$def[1] .= rrd::def("var6", $ds['free']['RRDFILE'], $ds['free']['DS']);
$def[1] .= rrd::def("var7", $ds['swap_total']['RRDFILE'], $ds['swap_total']['DS']);
$def[1] .= rrd::def("var8", $ds['swap_free']['RRDFILE'], $ds['swap_free']['DS']);
$def[1] .= rrd::cdef("v_real_used", "var1,{$divis},/");
$def[1] .= rrd::cdef("v_total", "var2,{$divis},/");
$def[1] .= rrd::cdef("v_shared", "var3,{$divis},/");
Пример #18
0
        echo "</div><br>\n";
    }
    echo "<div class=\"ui-widget-header ui-corner-top\">";
    echo "<table border=0 width=100%><tr>\n";
    echo "<td width=100% align=left>";
    echo Kohana::lang('common.datasource', $value['ds_name']) . "</td>\n";
    echo "<td align=right>";
    echo nagios::SummaryLink($value['MACRO']['DISP_HOSTNAME'], $value['TIMERANGE']['start'], $value['TIMERANGE']['end']) . "</td>\n";
    echo "<td align=right>";
    echo nagios::AvailLink($value['MACRO']['DISP_HOSTNAME'], $value['MACRO']['DISP_SERVICEDESC'], $value['TIMERANGE']['start'], $value['TIMERANGE']['end']) . "</td>\n";
    echo "<td align=right>";
    echo pnp::add_to_basket_icon($value['MACRO']['HOSTNAME'], $value['MACRO']['SERVICEDESC'], $value['SOURCE']);
    echo "</td>\n";
    echo "<td align=right>";
    echo pnp::zoom_icon($value['MACRO']['HOSTNAME'], $value['MACRO']['SERVICEDESC'], $value['TIMERANGE']['start'], $value['TIMERANGE']['end'], $value['SOURCE'], $value['VIEW'], $value['GRAPH_WIDTH'], $value['GRAPH_HEIGHT']) . "</td>\n";
    echo "</tr></table>\n";
    echo "</div>\n";
    echo "<div class=\"p4 gh ui-widget-content ui-corner-bottom\">\n";
    echo "<div style=\"position:relative;\">\n";
    $path = pnp::addToUri(array('host' => $value['MACRO']['HOSTNAME'], 'srv' => $value['MACRO']['SERVICEDESC']), FALSE);
    echo "<a href=\"" . url::base(TRUE) . "graph" . $path . "\" title=\"" . Kohana::lang('common.host', $value['MACRO']['DISP_HOSTNAME']) . " " . Kohana::lang('common.service', $value['MACRO']['DISP_SERVICEDESC']) . " " . Kohana::lang('common.datasource', $value['ds_name']) . " " . "\">\n";
    echo "<div start=" . $value['TIMERANGE']['start'] . " end=" . $value['TIMERANGE']['end'] . " style=\"width:" . $value['GRAPH_WIDTH'] . "px; height:" . $value['GRAPH_HEIGHT'] . "px; position:absolute; top:33px\" class=\"graph\" id=\"" . $this->url . "\" ></div>";
    $path = pnp::addToUri(array('host' => $value['MACRO']['HOSTNAME'], 'srv' => $value['MACRO']['SERVICEDESC'], 'view' => $value['VIEW'], 'source' => $value['SOURCE'], 'start' => $value['TIMERANGE']['start'], 'end' => $value['TIMERANGE']['end']), FALSE);
    echo "<img class=\"graph\" src=\"" . url::base(TRUE) . "image" . $path . "\"></a>\n";
    echo "</div>\n";
    echo "</div><p>\n";
}
echo "</div>\n";
?>
<!-- Graph Content End-->
Пример #19
0
<?php

if (!empty($this->templates) && $this->isAuthorizedFor('service_links')) {
    ?>
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php 
    echo Kohana::lang('common.special-templates-box-header');
    ?>
 
</div>
<div class="p4 ui-widget-content ui-corner-bottom">
<?php 
    foreach ($this->templates as $template) {
        $path = pnp::addToUri(array('tpl' => $template));
        echo "<a href=\"" . $path . "\" class=\"multi0\">" . pnp::shorten($template) . "</a><br>\n";
    }
    ?>
</div>
</div>
<p>
<?php 
}
Пример #20
0
    <?php 
if (!empty($icon_box)) {
    echo $icon_box;
}
?>

    <?php 
if (!empty($status_box)) {
    echo $status_box;
}
?>
    <?php 
if (!empty($service_box)) {
    echo $service_box;
}
?>
    </div>
    </td></tr></table>
    <div class="left w99 cb ui-corner-all">
    <?php 
if (!empty($footer)) {
    echo $footer . pnp::print_version();
}
?>
    <?php 
echo pnp::print_version();
?>
    </div>

Пример #21
0
}
if ($this->data->MACRO['COMMENT']) {
    echo $this->data->MACRO['COMMENT'] . "<p>\n";
}
foreach ($this->data->STRUCT as $key => $value) {
    if ($value['LEVEL'] == 0) {
        echo "<strong>" . $value['TIMERANGE']['title'] . "</strong> " . $value['TIMERANGE']['f_start'] . " - " . $value['TIMERANGE']['f_end'] . "\n";
        $count = 0;
    }
    echo "<div class=\"ui-widget-header ui-corner-top\">";
    echo "<table border=0 width=100%><tr>\n";
    echo "<td width=100% align=left>";
    echo Kohana::lang('common.datasource', $value['ds_name']) . "</td>\n";
    echo "<td align=right>";
    echo pnp::zoom_icon_special($this->tpl, $value['TIMERANGE']['start'], $value['TIMERANGE']['end'], $value['SOURCE'], $value['VIEW'], $value['GRAPH_WIDTH'], $value['GRAPH_HEIGHT']) . "</td>\n";
    echo "</tr></table>\n";
    echo "</div>\n";
    echo "<div class=\"p4 gh ui-widget-content ui-corner-bottom\">\n";
    echo "<div style=\"position:relative;\">\n";
    $path = pnp::addToUri(array('tpl' => $this->tpl, 'view' => NULL));
    echo "<a href=\"" . $path . "\">\n";
    echo "<div start=" . $value['TIMERANGE']['start'] . " end=" . $value['TIMERANGE']['end'] . " style=\"width:" . $value['GRAPH_WIDTH'] . "px; height:" . $value['GRAPH_HEIGHT'] . "px; position:absolute; top:33px;\" class=\"graph\" id=\"" . $this->url . "\"></div>\n";
    $path = pnp::addToUri(array('tpl' => $this->tpl, 'view' => $value['VIEW'], 'source' => $value['SOURCE'], 'start' => $value['TIMERANGE']['start'], 'end' => $value['TIMERANGE']['end']), FALSE);
    echo "<img class=\"graph\" src=\"" . url::base(TRUE) . "image" . $path . "\">\n";
    echo "</div>\n";
    echo "</a></div><p>\n";
}
echo "</div>\n";
?>
<!-- Graph Content End-->
Пример #22
0
<div class="ui-widget">
 <div class="p2 ui-widget-header ui-corner-top">
<?php 
echo Kohana::lang('common.status-box-header');
?>
 </div>
 <div class="p4 ui-widget-content ui-corner-bottom">
<?php 
if (isset($host)) {
    echo "<strong>Host:&nbsp;</strong>" . html::anchor('graph' . "?host=" . $lhost, html::specialchars(pnp::shorten($host)) . "<br>");
}
if (isset($service)) {
    echo "<strong>Service:&nbsp;</strong>" . html::anchor('graph' . "?host=" . $lhost . "&srv=" . $lservice, html::specialchars(pnp::shorten($service)) . "<br>");
}
if (isset($timet)) {
    echo "<strong>Last Check:&nbsp;</strong>{$timet}<br>";
}
?>
 </div>
</div>
<p>

Пример #23
0
        $divis = $max[3];
        $return = '';
    }
    $ds_name[$KEY] = str_replace("_", "/", $VAL['NAME']);
    # set graph labels
    $opt[$KEY] = "--vertical-label {$label} -l 0 {$upper} --title \"Filesystem {$ds_name[$KEY]}\" ";
    # Graph Definitions
    $def[$KEY] = rrd::def("var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
    # "normalize" graph values
    $def[$KEY] .= rrd::cdef("v_n", "var1,{$divis},/");
    $def[$KEY] .= rrd::area("v_n", "#c6c6c6", $ds_name[$KEY]);
    $def[$KEY] .= rrd::line1("v_n", "#003300");
    # show values in legend
    $def[$KEY] .= rrd::gprint("v_n", "LAST", "{$fmt} {$label}{$pct} {$maximum} ");
    $def[$KEY] .= rrd::gprint("v_n", "AVERAGE", "{$fmt} {$label}{$pct} avg used {$return}");
    # create max line and legend
    if ($VAL['MAX'] != "") {
        $def[$KEY] .= rrd::gprint("v_n", "MAX", "{$fmt} {$label}{$pct} max used \\n");
        $def[$KEY] .= rrd::hrule($max[1], "#003300", "Size of FS  {$max['0']} \\n");
    }
    # create warning line and legend
    if ($VAL['WARN'] != "") {
        $warn = pnp::adjust_unit($VAL['WARN'] . $unit, 1024, $fmt);
        $def[$KEY] .= rrd::hrule($warn[1], "#ffff00", "Warning  on {$warn['0']} \\n");
    }
    # create critical line and legend
    if ($VAL['CRIT'] != "") {
        $crit = pnp::adjust_unit($VAL['CRIT'] . $unit, 1024, $fmt);
        $def[$KEY] .= rrd::hrule($crit[1], "#ff0000", "Critical on {$crit['0']}\\n");
    }
}
Пример #24
0
 </h3>
<div style="position:relative;">
<?php 
echo "<div start={$start} end={$end} style=\"width:" . $graph_width . "px; height:" . $graph_height . "px; position:absolute; top:33px\" class=\"graph\" id=\"" . $this->url . "\" ></div>";
if (!empty($tpl)) {
    echo "<img class=\"graph\" src=\"image?source={$source}" . "&tpl={$tpl}" . "&view={$view}" . "&start={$start}" . "&end={$end}" . "&graph_height={$graph_height}" . "&graph_width={$graph_width}\">";
} else {
    echo "<img src=\"image?source={$source}" . "&host={$host}" . "&srv={$srv}" . "&view={$view}" . "&start={$start}" . "&end={$end}" . "&graph_height={$graph_height}" . "&graph_width={$graph_width}\">";
}
$start_down = $this->data->TIMERANGE['start'] - intval(($this->data->TIMERANGE['end'] - $this->data->TIMERANGE['start']) / 2);
$path = pnp::addToUri(array('start' => $start_down));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; left:%dpx; bottom:-28px\"></a>\n", $path, "Move Start to " . date($this->config->conf['date_fmt'], $start_down), url::base() . "media/images/go-left.png", 10);
$start_up = $this->data->TIMERANGE['start'] + intval(($this->data->TIMERANGE['end'] - $this->data->TIMERANGE['start']) / 2);
$path = pnp::addToUri(array('start' => $start_up));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; left:%dpx; bottom:-28px\"></a>\n", $path, "Move Start to " . date($this->config->conf['date_fmt'], $start_up), url::base() . "media/images/go-right.png", 60);
$path = pnp::addToUri(array('end' => time()));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; right:%dpx; bottom:-28px\"></a>\n", $path, "Move End to " . date($this->config->conf['date_fmt'], time()), url::base() . "media/images/go-now.png", 10);
$end_up = $this->data->TIMERANGE['end'] + intval(($this->data->TIMERANGE['end'] - $this->data->TIMERANGE['start']) / 2);
$path = pnp::addToUri(array('end' => $end_up));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; right:%dpx; bottom:-28px\"></a>\n", $path, "Move End to " . date($this->config->conf['date_fmt'], $end_up), url::base() . "media/images/go-right.png", 60);
$end_down = $this->data->TIMERANGE['end'] - intval(($this->data->TIMERANGE['end'] - $this->data->TIMERANGE['start']) / 2);
$path = pnp::addToUri(array('end' => $end_down));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; right:%dpx; bottom:-28px\"></a>\n", $path, "Move End to " . date($this->config->conf['date_fmt'], $end_down), url::base() . "media/images/go-left.png", 110);
?>
</div>
</div>
</div>
</body>
</html>

Пример #25
0
 public function index()
 {
     $this->template->graph->graph_content = $this->add_view('graph_content');
     $this->template->graph->graph_content->graph_width = $this->config->conf['graph_width'] + 85;
     $this->template->graph->graph_content->timerange_select = $this->add_view('timerange_select');
     $this->template->graph->header = $this->add_view('header');
     $this->template->graph->search_box = $this->add_view('search_box');
     $this->template->graph->service_box = $this->add_view('service_box');
     $this->template->graph->basket_box = $this->add_view('basket_box');
     $this->template->graph->widget_menu = $this->add_view('widget_menu');
     $this->template->graph->graph_content->widget_graph = $this->add_view('widget_graph');
     // Change the status box while multisite theme is in use
     if ($this->theme == "multisite") {
         $this->template->graph->status_box = $this->add_view('multisite_box');
         $this->template->graph->status_box->base_url = $this->config->conf['multisite_base_url'];
         $this->template->graph->status_box->site = $this->config->conf['multisite_site'];
     } else {
         $this->template->graph->status_box = $this->add_view('status_box');
     }
     // Service Details
     if ($this->host != "" && $this->service != "") {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
         $this->url = "?host=" . $this->host . "&srv=" . $this->service;
         $services = $this->data->getServices($this->host);
         #print Kohana::debug($services);
         $this->data->buildDataStruct($this->host, $this->service, $this->view);
         $this->is_authorized = $this->auth->is_authorized($this->data->MACRO['AUTH_HOSTNAME'], $this->data->MACRO['AUTH_SERVICEDESC']);
         $this->title = Kohana::lang('common.service-details') . " " . $this->host . " -> " . $this->data->MACRO['DISP_SERVICEDESC'];
         $this->template->graph->graph_content->graph_width = $this->data->STRUCT[0]['GRAPH_WIDTH'] + 85;
         $this->template->zoom_header->graph_width = $this->data->STRUCT[0]['GRAPH_WIDTH'] + 140;
         $this->template->zoom_header->graph_height = $this->data->STRUCT[0]['GRAPH_HEIGHT'] + 230;
         // Status Box Vars
         $this->template->graph->status_box->host = $this->data->MACRO['DISP_HOSTNAME'];
         $this->template->graph->status_box->lhost = $this->data->MACRO['HOSTNAME'];
         $this->template->graph->status_box->service = $this->data->MACRO['DISP_SERVICEDESC'];
         $this->template->graph->status_box->lservice = $this->data->MACRO['SERVICEDESC'];
         $this->template->graph->status_box->timet = date($this->config->conf['date_fmt'], intval($this->data->MACRO['TIMET']));
         // Service Box Vars
         $this->template->graph->service_box->services = $services;
         $this->template->graph->service_box->host = $this->host;
         // Timerange Box Vars
         $this->template->graph->timerange_box = $this->add_view('timerange_box');
         $this->template->graph->timerange_box->timeranges = $this->data->TIMERANGE;
         //
         // Host Overview
     } elseif ($this->host != "") {
         $this->is_authorized = $this->auth->is_authorized($this->host);
         $this->host = pnp::clean($this->host);
         if ($this->view == "") {
             $this->view = $this->config->conf['overview-range'];
         }
         $this->url = "?host=" . $this->host;
         $this->title = Kohana::lang('common.start') . " " . $this->host;
         $services = $this->data->getServices($this->host);
         // Status Box Vars
         $this->template->graph->status_box->host = $this->data->MACRO['DISP_HOSTNAME'];
         $this->template->graph->status_box->lhost = $this->data->MACRO['HOSTNAME'];
         $this->template->graph->status_box->shost = pnp::shorten($this->data->MACRO['DISP_HOSTNAME']);
         $this->template->graph->status_box->timet = date($this->config->conf['date_fmt'], intval($this->data->MACRO['TIMET']));
         // Service Box Vars
         $this->template->graph->service_box->services = $services;
         $this->template->graph->service_box->host = $this->host;
         // Timerange Box Vars
         $this->template->graph->timerange_box = $this->add_view('timerange_box');
         $this->template->graph->timerange_box->timeranges = $this->data->TIMERANGE;
         $this->template->graph->icon_box->xml_icon = FALSE;
         $this->title = Kohana::lang('common.service-overview', $this->host);
         foreach ($services as $service) {
             if ($service['state'] == 'active') {
                 $this->data->buildDataStruct($this->host, $service['name'], $this->view);
             }
         }
     } else {
         if ($this->isAuthorizedFor('host_overview')) {
             $this->host = $this->data->getFirstHost();
             if (isset($this->host)) {
                 url::redirect("graph?host=" . $this->host);
             } else {
                 throw new Kohana_Exception('error.get-first-host');
             }
         } else {
             throw new Kohana_Exception('error.not_authorized_for_host_overview');
         }
     }
     $this->template->graph->logo_box = $this->add_view('logo_box');
     $this->template->graph->header->title = $this->title;
 }
Пример #26
0
    echo Kohana::lang('common.service-box-header');
    ?>
 
 </div>

<?php 
    $filter = $this->session->get('sfilter');
    ?>

<div class="p4 ui-widget-content">
	<?php 
    echo "<input type=\"text\" name=\"service-filter\" id=\"service-filter\" value=\"" . $filter . "\" class=\"textbox\" />";
    ?>
</div>

<div class="p4 ui-widget-content ui-corner-bottom" id="services">
<?php 
    foreach ($services as $service) {
        echo "<span id=\"service-" . $service['servicedesc'] . "\">\n";
        $path = pnp::addToUri(array('host' => $host, 'srv' => $service['name']));
        echo pnp::add_to_basket_icon($host, $service['name']);
        echo "<a href=\"" . $path . "\" class=\"multi" . $service['is_multi'] . " " . $service['state'] . "\" title=\"" . $service['servicedesc'] . "\">";
        echo pnp::shorten($service['servicedesc']) . "</a><br>\n";
        echo "</span>\n";
    }
    ?>
</div>
</div>
<p>
<?php 
}
Пример #27
0
 public function getTimeRange($start = FALSE, $end = FALSE, $view = "")
 {
     if ($end != FALSE) {
         // we are in a custom timerange
         if (!is_numeric($end)) {
             $timestamp = strtotime($end);
             if (!$timestamp) {
                 throw new Kohana_User_Exception('Wrong Format', "End -> {$end}");
             } else {
                 $end = $timestamp;
             }
         }
     } else {
         $end = time();
     }
     if ($start != FALSE) {
         // we are in a custom timerange
         if (!is_numeric($start)) {
             $timestamp = strtotime($start);
             if (!$timestamp) {
                 throw new Kohana_User_Exception('Wrong Format', "Start -> {$start}");
             } else {
                 $start = $timestamp;
             }
         }
     }
     if ($start && $end) {
         $timerange['title'] = Kohana::lang('common.timerange-selector-link');
         $timerange['start'] = $start;
         $timerange['f_start'] = date($this->config->conf['date_fmt'], $start);
         $timerange['end'] = $end;
         $timerange['f_end'] = date($this->config->conf['date_fmt'], $end);
         $timerange['cmd'] = " --start {$start} --end {$end} ";
         $timerange['type'] = "start-end";
         $this->TIMERANGE = $timerange;
         return;
     }
     $view = intval(pnp::clean($view));
     if ($view >= sizeof($this->config->views)) {
         $view = 1;
     }
     if (!$end) {
         $end = time();
     } elseif (!is_numeric($end)) {
         $timestamp = strtotime($end);
         if (!$timestamp) {
             throw new Kohana_User_Exception('Wrong Format', "{$end}");
         } else {
             $end = $timestamp;
         }
     } else {
         $end = $end;
     }
     if (!$start) {
         $start = $end - $this->config->views[$view]['start'];
     } elseif (!is_numeric($start)) {
         $timestamp = strtotime($start);
         if (!$timestamp) {
             throw new Kohana_User_Exception('Wrong Format', "{$start}");
         } else {
             $start = $timestamp;
         }
     } else {
         $start = pnp::clean($start);
     }
     if ($start >= $end) {
         //Fixme i18n
         throw new Kohana_User_Exception('Wrong Timerange', "start >= end");
     }
     $timerange['title'] = $this->config->views[$view]['title'];
     $timerange['start'] = $start;
     $timerange['f_start'] = date($this->config->conf['date_fmt'], $start);
     $timerange['end'] = $end;
     $timerange['f_end'] = date($this->config->conf['date_fmt'], $end);
     $timerange['cmd'] = " --start {$start} --end {$end} ";
     $timerange['type'] = "views";
     for ($i = 0; $i < sizeof($this->config->views); $i++) {
         $timerange[$i]['title'] = $this->config->views[$i]['title'];
         $timerange[$i]['start'] = $end - $this->config->views[$i]['start'];
         $timerange[$i]['f_start'] = date($this->config->conf['date_fmt'], $end - $this->config->views[$i]['start']);
         $timerange[$i]['end'] = $end;
         $timerange[$i]['f_end'] = date($this->config->conf['date_fmt'], $end);
         $timerange[$i]['cmd'] = " --start " . ($end - $this->config->views[$i]['start']) . " --end  {$end}";
     }
     $this->TIMERANGE = $timerange;
 }
Пример #28
0
<div class="ui-widget">
 <div class="p2 ui-widget-header ui-corner-top">
<?php 
echo Kohana::lang('common.multisite-box-header');
?>
 </div>
 <div class="p4 ui-widget-content ui-corner-bottom">
<?php 
if (isset($host)) {
    echo "<strong>Host: </strong><a href=" . pnp::multisite_link($base_url, $site, $host) . ">" . html::specialchars(pnp::shorten($host)) . "</a><br>\n";
}
if (isset($service) && $service != "Host Perfdata") {
    echo "<strong>Service: </strong><a href=" . pnp::multisite_link($base_url, $site, $host, $service) . ">" . html::specialchars(pnp::shorten($service)) . "</a>\n";
}
?>
 </div>
</div>
<p>

Пример #29
0
 public function basket()
 {
     $this->start = $this->input->get('start');
     $this->end = $this->input->get('end');
     $this->view = "";
     if (isset($_GET['view']) && $_GET['view'] != "") {
         $this->view = pnp::clean($_GET['view']);
     }
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     $basket = $this->session->get("basket");
     if (is_array($basket) && sizeof($basket) > 0) {
         foreach ($basket as $item) {
             # explode host::service::source
             $slices = explode("::", $item);
             if (sizeof($slices) == 2) {
                 $this->data->buildDataStruct($slices[0], $slices[1], $this->view);
             }
             if (sizeof($slices) == 3) {
                 $this->data->buildDataStruct($slices[0], $slices[1], $this->view, $slices[2]);
             }
         }
     }
     //echo Kohana::debug($this->data->STRUCT);
     /*
      * PDF Output
      */
     $pdf = new PDF();
     $pdf->AliasNbPages();
     $pdf->SetAutoPageBreak('off');
     $pdf->SetMargins(17.5, 30, 10);
     $pdf->AddPage();
     if ($this->use_bg) {
         $pdf->setSourceFile($this->config->conf['background_pdf']);
         $tplIdx = $pdf->importPage(1, '/MediaBox');
         $pdf->useTemplate($tplIdx);
     }
     $pdf->SetCreator('Created with PNP');
     $pdf->SetFont('Arial', '', 10);
     // Title
     foreach ($this->data->STRUCT as $data) {
         if ($pdf->GetY() > 200) {
             $pdf->AddPage();
             if ($this->use_bg) {
                 $pdf->useTemplate($tplIdx);
             }
         }
         if ($data['LEVEL'] == 0) {
             $pdf->SetFont('Arial', '', 12);
             $pdf->CELL(120, 10, $data['MACRO']['DISP_HOSTNAME'] . " -- " . $data['MACRO']['DISP_SERVICEDESC'], 0, 1);
             $pdf->SetFont('Arial', '', 10);
             $pdf->CELL(120, 5, $data['TIMERANGE']['title'] . " (" . $data['TIMERANGE']['f_start'] . " - " . $data['TIMERANGE']['f_end'] . ")", 0, 1);
             $pdf->SetFont('Arial', '', 8);
             $pdf->CELL(120, 5, "Datasource " . $data["ds_name"], 0, 1);
         } else {
             $pdf->SetFont('Arial', '', 8);
             $pdf->CELL(120, 5, "Datasource " . $data["ds_name"], 0, 1);
         }
         $image = $this->rrdtool->doImage($data['RRD_CALL'], $out = 'PDF');
         $img = $this->rrdtool->saveImage($image);
         $Y = $pdf->GetY();
         $cell_height = $img['height'] * 0.23;
         $cell_width = $img['width'] * 0.23;
         $pdf->Image($img['file'], 17.5, $Y, $cell_width, $cell_height, 'PNG');
         $pdf->CELL(120, $cell_height, '', 0, 1);
         unlink($img['file']);
     }
     $pdf->Output("pnp4nagios.pdf", "I");
 }
Пример #30
0
<?php

if (!empty($pages) && $this->isAuthorizedFor('pages')) {
    ?>
<div class="ui-widget">
 <div class="p2 ui-widget-header ui-corner-top">
 <?php 
    echo Kohana::lang('common.pages-box-header');
    ?>
 </div>
<div class="p4 ui-widget-content ui-corner-bottom">
<?php 
    foreach ($pages as $page) {
        $this->data->getPageDetails($page);
        echo "<a class=\"multi0\" href=\"" . url::base(TRUE) . "page?page=" . $page . "\" title=\"" . $this->data->PAGE_DEF['page_name'] . "\">" . pnp::shorten($this->data->PAGE_DEF['page_name']) . "</a><br>\n";
    }
    ?>
</div>
</div>
<p>
<?php 
}