コード例 #1
0
ファイル: functions.inc.php プロジェクト: Natolumin/observium
/**
 * Used for replace some strings at end of run all html scripts
 *
 * @param string $buffer HTML buffer from ob_start()
 * @return string Changed buffer
 */
function html_callback($buffer)
{
    global $config;
    // Install registered CSS/JS links
    $types = array('css' => '  <link href="STRING?v=' . OBSERVIUM_VERSION . '" rel="stylesheet" type="text/css" />' . PHP_EOL, 'js' => '  <script type="text/javascript" src="STRING?v=' . OBSERVIUM_VERSION . '"></script>' . PHP_EOL, 'script' => '  <script type="text/javascript">' . PHP_EOL . '  <!-- Begin' . PHP_EOL . 'STRING' . PHP_EOL . '  // End -->' . PHP_EOL . '  </script>' . PHP_EOL);
    foreach ($types as $type => $string) {
        if (isset($GLOBALS['cache_html']['resources'][$type])) {
            $uptype = strtoupper($type);
            ${$type} = '<!-- ' . $uptype . ' BEGIN -->' . PHP_EOL;
            foreach (array_unique($GLOBALS['cache_html']['resources'][$type]) as $link) {
                ${$type} .= str_replace('STRING', $link, $string);
            }
            ${$type} .= '  <!-- ' . $uptype . ' END -->' . PHP_EOL;
            $buffer = str_replace('<!-- ##' . $uptype . '_CACHE## -->' . PHP_EOL, ${$type}, $buffer);
        }
    }
    // Replace page title as specified by the page modules
    if (!is_array($GLOBALS['cache_html']['title'])) {
        // Title not set by any page, fall back to nicecase'd page name:
        if ($GLOBALS['vars']['page']) {
            $GLOBALS['cache_html']['title'] = array(nicecase($GLOBALS['vars']['page']));
        } else {
            // HALP. Likely main page, doesn't need anything else...
            $GLOBALS['cache_html']['title'] = array();
        }
    }
    // If suffix is set, put it in the back
    if ($config['page_title_suffix']) {
        $GLOBALS['cache_html']['title'][] = $config['page_title_suffix'];
    }
    // If prefix is set, put it in front
    if ($config['page_title_prefix']) {
        array_unshift($GLOBALS['cache_html']['title'], $config['page_title_prefix']);
    }
    // Build title with separators
    $title = implode($config['page_title_separator'], $GLOBALS['cache_html']['title']);
    // Replace title placeholder by actual title
    $buffer = str_replace('##TITLE##', $title, $buffer);
    // Page panel
    $buffer = str_replace('##PAGE_PANEL##', $GLOBALS['cache_html']['page_panel'], $buffer);
    // Return modified HTML page source
    return $buffer;
}
コード例 #2
0
ファイル: generic.inc.php プロジェクト: Natolumin/observium
function generate_entity_popup_graphs($entity, $vars)
{
    global $config;
    $entity_type = $vars['entity_type'];
    if (is_array($config['entities'][$entity_type]['graph'])) {
        if (isset($config['entities'][$entity_type]['graph']['type'])) {
            $graphs[] = $config['entities'][$entity_type]['graph'];
        } else {
            $graphs = $config['entities'][$entity_type]['graph'];
        }
        foreach ($graphs as $graph_array) {
            //$graph_array = $config['entities'][$entity_type]['graph'];
            // We can draw a graph for this type/metric pair!
            foreach ($graph_array as $key => $val) {
                // Check to see if we need to do any substitution
                if (substr($val, 0, 1) == "@") {
                    $nval = substr($val, 1);
                    $graph_array[$key] = $entity[$nval];
                }
            }
            $graph_array['height'] = "100";
            $graph_array['width'] = "323";
            $content = '<div style="white-space: nowrap;">';
            $content .= "<div class=entity-title><h4>" . nicecase(str_replace("_", " ", $graph_array['type'])) . "</h4></div>";
            /*
            $content = generate_box_open(array('title' => nicecase(str_replace("_", " ", $graph_array['type'])),
                                               'body-style' => 'white-space: nowrap;'));
            */
            foreach (array('day', 'month') as $period) {
                $graph_array['from'] = $config['time'][$period];
                $content .= generate_graph_tag($graph_array);
            }
            $content .= "</div>";
            //$content .= generate_box_close();
        }
        //r($content);
        return $content;
    }
}
コード例 #3
0
ファイル: devices.inc.php プロジェクト: skive/observium
//                      'poller_perf' => 'Poll Time'
//                      );
foreach (array('graphs') as $type) {
    /// FIXME. Weird graph menu, they too long and not actual for all devices,
    /// but here also not posible use sql query from `device_graphs` because here not stored all graphs
    /*
    $query  = 'SELECT `graph` FROM `device_graphs`
               LEFT JOIN `devices` ON `devices`.`device_id` = `device_graphs`.`device_id`';
    $query .= $where . $query_permitted . ' AND `device_graphs`.`enabled` = 1 GROUP BY `graph`';
    foreach (dbFetchColumn($query) as $option)
    {
      $data = $config['graph_types']['device'][$option];
    */
    foreach ($config['graph_types']['device'] as $option => $data) {
        if (!isset($data['descr'])) {
            $data['descr'] = nicecase($option);
        }
        if ($vars['format'] == $type && $vars['graph'] == $option) {
            $navbar['options'][$type]['suboptions'][$option]['class'] = 'active';
            $navbar['options'][$type]['text'] .= " (" . $data['descr'] . ')';
        }
        $navbar['options'][$type]['suboptions'][$option]['text'] = $data['descr'];
        $navbar['options'][$type]['suboptions'][$option]['url'] = generate_url($vars, array('view' => NULL, 'format' => $type, 'graph' => $option));
    }
}
if ($vars['searchbar'] == "hide") {
    $navbar['options_right']['searchbar'] = array('text' => 'Show Search', 'url' => generate_url($vars, array('searchbar' => NULL)));
} else {
    $navbar['options_right']['searchbar'] = array('text' => 'Hide Search', 'url' => generate_url($vars, array('searchbar' => 'hide')));
}
if ($vars['bare'] == "yes") {
コード例 #4
0
 /**
  * @dataProvider providerNiceCase
  */
 public function testNiceCase($string, $result)
 {
     $this->assertSame($result, nicecase($string));
 }
コード例 #5
0
 $oid = ".1.3.6.1.2.1.99.1.1.1.4.{$index}";
 $type = $entitysensor[$entry['entPhySensorType']];
 $descr = rewrite_entity_name($entry['entPhysicalDescr']);
 if ($entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
     // Check if entPhysicalDescr equals entPhysicalName,
     // Also compare like this: 'TenGigabitEthernet2/1 Bias Current' and 'Te2/1 Bias Current'
     if (strpos($entry['entPhysicalDescr'], substr($entry['entPhysicalName'], 2)) === FALSE) {
         $descr = rewrite_entity_name($entry['entPhysicalDescr']) . ' - ' . rewrite_entity_name($entry['entPhysicalName']);
     }
 } else {
     if (!$entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
         $descr = rewrite_entity_name($entry['entPhysicalName']);
     } else {
         if (!$entry['entPhysicalDescr'] && !$entry['entPhysicalName']) {
             // This is also trick for some retard devices like NetMan Plus
             $descr = nicecase($type);
         }
     }
 }
 if ($device['os'] == 'asa' && $entry['entPhySensorScale'] == 'yocto' && $entry['entPhySensorPrecision'] == '0') {
     // Hardcoded fix for Cisco ASA 9.1.5 (can be other) bug when all scales equals yocto (OBSERVIUM-1110)
     $scale = 1;
 } else {
     if (isset($entry['entPhySensorScale'])) {
         $scale = si_to_scale($entry['entPhySensorScale'], $entry['entPhySensorPrecision']);
     } else {
         // Some devices not report scales, like NetMan Plus. But this is really HACK
         // Heh, I not know why only ups.. I'm not sure that this for all ups.. just I see this only on NetMan Plus.
         $scale = $device['os_group'] == 'ups' && $type == 'temperature' ? 0.1 : 1;
     }
 }
コード例 #6
0
          </ul>
        </li>
<?php 
$app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`");
if ($_SESSION['userlevel'] >= '5' && $app_count > "0") {
    ?>
        <li class="dropdown">
          <a href="apps/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/icons/apps.png" border="0" align="absmiddle" /> Apps<b class="caret"></b></a>
          <ul class="dropdown-menu">
<?php 
    $app_list = dbFetchRows("SELECT `app_type` FROM `applications` GROUP BY `app_type` ORDER BY `app_type`");
    foreach ($app_list as $app) {
        $image = $config['html_dir'] . "/images/icons/" . $row['app_type'] . ".png";
        $icon = file_exists($image) ? $row['app_type'] : "apps";
        echo '
            <li><a href="apps/app=' . $app['app_type'] . '/"><img src="images/icons/' . $icon . '.png" border="0" align="absmiddle" /> ' . nicecase($app['app_type']) . ' </a></li>';
    }
    ?>
          </ul>
        </li>    
<?php 
}
$routing_count['bgp'] = dbFetchCell("SELECT COUNT(bgpPeer_id) from `bgpPeers` LEFT JOIN devices AS D ON bgpPeers.device_id=D.device_id WHERE D.device_id IS NOT NULL");
$routing_count['ospf'] = dbFetchCell("SELECT COUNT(ospf_instance_id) FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'");
$routing_count['cef'] = dbFetchCell("SELECT COUNT(cef_switching_id) from `cef_switching`");
$routing_count['vrf'] = dbFetchCell("SELECT COUNT(vrf_id) from `vrfs`");
if ($_SESSION['userlevel'] >= '5' && $routing_count['bgp'] + $routing_count['ospf'] + $routing_count['cef'] + $routing_count['vrf'] > "0") {
    ?>
        <li class="dropdown">
          <a href="routing/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/arrow_branch.png" border="0" align="absmiddle" /> Routing<b class="caret"></b></a>
          <ul class="dropdown-menu">
コード例 #7
0
ファイル: graphs.inc.php プロジェクト: skive/observium
    <tr>
      <th>Name</th>
      <th>Description</th>
      <th>Section</th>
      <th style="width: 80;">Status</th>
      <th style="width: 80;"></th>
    </tr>
  </thead>
  <tbody>

<?php 
foreach ($graphs_sections as $section => $entry) {
    foreach ($entry as $graph => $enabled) {
        echo '<tr><td><strong>' . $graph . '</strong></td><td>';
        echo $config['graph_types']['device'][$graph]['descr'] . '</td><td>';
        echo nicecase($section) . '</td><td>';
        if (!$enabled) {
            $attrib_status = '<span class="text-danger">disabled</span>';
            $toggle = 'Enable';
            $btn_class = 'btn-success';
        } else {
            $attrib_status = '<span class="text-success">enabled</span>';
            $toggle = "Disable";
            $btn_class = "btn-danger";
        }
        echo $attrib_status . '</td><td>';
        if (!in_array($section, array('poller', 'system'))) {
            echo '<form id="toggle_graph" name="toggle_graph" style="margin: 0px;" method="post" action="">
      <input type="hidden" name="toggle_graph" value="' . $graph . '">
      <button type="submit" class="btn btn-mini ' . $btn_class . '" name="Submit">' . $toggle . '</button></form>';
        } else {
コード例 #8
0
ファイル: apps.inc.php プロジェクト: REAP720801/librenms
$graphs['bind'] = array('queries');
$graphs['tinydns'] = array('queries', 'errors', 'dnssec', 'other');
print_optionbar_start();
echo "<span style='font-weight: bold;'>Apps</span> &#187; ";
unset($sep);
$link_array = array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'apps');
foreach ($app_list as $app) {
    echo $sep;
    #  if (!$vars['app']) { $vars['app'] = $app['app_type']; }
    if ($vars['app'] == $app['app_type']) {
        echo "<span class='pagemenu-selected'>";
        #echo('<img src="images/icons/'.$app['app_type'].'.png" class="optionicon" />');
    } else {
        #echo('<img src="images/icons/greyscale/'.$app['app_type'].'.png" class="optionicon" />');
    }
    echo generate_link(nicecase($app['app_type']), array('page' => 'apps', 'app' => $app['app_type']));
    if ($vars['app'] == $app['app_type']) {
        echo "</span>";
    }
    $sep = " | ";
}
print_optionbar_end();
if ($vars['app']) {
    if (is_file("pages/apps/" . mres($vars['app']) . ".inc.php")) {
        include "pages/apps/" . mres($vars['app']) . ".inc.php";
    } else {
        include "pages/apps/default.inc.php";
    }
} else {
    include "pages/apps/overview.inc.php";
}
コード例 #9
0
ファイル: mysql.inc.php プロジェクト: REAP720801/librenms
<?php

global $config;
print_optionbar_start();
echo "<span style='font-weight: bold;'>" . nicecase($app['app_type']) . "</span> &#187; ";
$app_sections = array('system' => "System", 'queries' => "Queries", 'innodb' => "InnoDB");
unset($sep);
foreach ($app_sections as $app_section => $app_section_text) {
    echo $sep;
    if (!$vars['app_section']) {
        $vars['app_section'] = $app_section;
    }
    if ($vars['app_section'] == $app_section) {
        echo "<span class='pagemenu-selected'>";
    }
    echo generate_link($app_section_text, $vars, array('app_section' => $app_section));
    if ($vars['app_section'] == $app_section) {
        echo "</span>";
    }
    $sep = " | ";
}
print_optionbar_end();
$graphs['system'] = array('mysql_connections' => 'Connections', 'mysql_files_tables' => 'Files and Tables', 'mysql_myisam_indexes' => 'MyISAM Indexes', 'mysql_network_traffic' => 'Network Traffic', 'mysql_table_locks' => 'Table Locks', 'mysql_temporary_objects' => 'Temporary Objects');
$graphs['queries'] = array('mysql_command_counters' => 'Command Counters', 'mysql_query_cache' => 'Query Cache', 'mysql_query_cache_memory' => 'Query Cache Memory', 'mysql_select_types' => 'Select Types', 'mysql_slow_queries' => 'Slow Queries', 'mysql_sorts' => 'Sorts');
$graphs['innodb'] = array('mysql_innodb_buffer_pool' => 'InnoDB Buffer Pool', 'mysql_innodb_buffer_pool_activity' => 'InnoDB Buffer Pool Activity', 'mysql_innodb_insert_buffer' => 'InnoDB Insert Buffer', 'mysql_innodb_io' => 'InnoDB IO', 'mysql_innodb_io_pending' => 'InnoDB IO Pending', 'mysql_innodb_log' => 'InnoDB Log', 'mysql_innodb_row_operations' => 'InnoDB Row Operations', 'mysql_innodb_semaphores' => 'InnoDB semaphores', 'mysql_innodb_transactions' => 'InnoDB Transactions');
foreach ($graphs[$vars['app_section']] as $key => $text) {
    $graph_type = $key;
    $graph_array['height'] = "100";
    $graph_array['width'] = "215";
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $app['app_id'];
コード例 #10
0
ファイル: netstats.inc.php プロジェクト: Natolumin/observium
    } else {
        $data = snmpwalk_cache_oid($device, $type, array(), $netstats['mib']);
        if (!count($data)) {
            continue;
        }
        $data_array = $data[0];
    }
    $rrd_file = 'netstats-' . $type . '.rrd';
    $rrd_create = '';
    $rrd_update = 'N';
    foreach ($oids as $oid) {
        $oid_ds = truncate($oid, 19, '');
        if ($oid == 'tcpCurrEstab') {
            $rrd_create .= ' DS:' . $oid_ds . ':GAUGE:600:U:4294967295';
            // Gauge32 max value 2^32 = 4294967295
        } else {
            $rrd_create .= ' DS:' . $oid_ds . ':COUNTER:600:U:4294967295';
            // Counter32 max value 2^32 = 4294967295
        }
        $value = is_numeric($data_array[$oid]) ? $data_array[$oid] : 'U';
        $rrd_update .= ':' . $value;
    }
    rrdtool_create($device, $rrd_file, $rrd_create);
    rrdtool_update($device, $rrd_file, $rrd_update);
    foreach ($netstats['graphs'] as $graph) {
        $graphs[$graph] = TRUE;
    }
    print_cli_data(nicecase($type) . " Graphs", implode(" ", $netstats['graphs']), 2);
}
unset($netstats_poll, $netstats, $type, $oids, $oid, $oid_ds, $oids_string, $data, $data_array, $rrd_create, $rrd_file, $rrd_update, $value, $mibs_blacklist);
// EOF
コード例 #11
0
ファイル: logs.inc.php プロジェクト: RomanBogachev/observium
<?php

if (!isset($vars['section'])) {
    $vars['section'] = 'eventlog';
}
$sections = array('eventlog', 'syslog');
$navbar['brand'] = "Logging";
$navbar['class'] = "navbar-narrow";
foreach ($sections as $section) {
    $type = strtolower($section);
    if (!isset($vars['section'])) {
        $vars['section'] = $section;
    }
    if ($vars['section'] == $section) {
        $navbar['options'][$section]['class'] = "active";
    }
    $navbar['options'][$section]['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'logs', 'section' => $section));
    $navbar['options'][$section]['text'] = nicecase($section);
}
print_navbar($navbar);
switch ($vars['section']) {
    case 'syslog':
    case 'eventlog':
        include 'pages/device/logs/' . $vars['section'] . '.inc.php';
        break;
    default:
        echo '<h2>Error. No section ' . $vars['section'] . '.<br /> Please report this to observium developers.</h2>';
        break;
}
コード例 #12
0
/**
 * Display syslog messages.
 *
 * Display pages with device syslog messages.
 * Examples:
 * print_syslogs() - display last 10 syslog messages from all devices
 * print_syslogs(array('pagesize' => 99)) - display last 99 syslog messages from all device
 * print_syslogs(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 syslog messages from page 3 with pagination header
 * print_syslogs(array('pagesize' => 10, 'device' = 4)) - display last 10 syslog messages for device_id 4
 * print_syslogs(array('short' => TRUE)) - show small block with last syslog messages
 *
 * @param array $vars
 * @return none
 *
 */
function print_syslogs($vars)
{
    // Short events? (no pagination, small out)
    $short = isset($vars['short']) && $vars['short'];
    // With pagination? (display page numbers in header)
    $pagination = isset($vars['pagination']) && $vars['pagination'];
    $pageno = isset($vars['pageno']) && !empty($vars['pageno']) ? $vars['pageno'] : 1;
    $pagesize = isset($vars['pagesize']) && !empty($vars['pagesize']) ? $vars['pagesize'] : 10;
    $start = $pagesize * $pageno - $pagesize;
    $priorities = $GLOBALS['config']['syslog']['priorities'];
    $param = array();
    $where = ' WHERE 1 ';
    foreach ($vars as $var => $value) {
        if ($value != '') {
            $cond = array();
            switch ($var) {
                case 'device':
                case 'device_id':
                    $where .= ' AND `device_id` = ?';
                    $param[] = $value;
                    break;
                case 'priority':
                    if (!is_array($value)) {
                        $value = array($value);
                    }
                    foreach ($value as $k => $v) {
                        // Rewrite priority strings to numbers
                        $value[$k] = priority_string_to_numeric($v);
                    }
                    // Do not break here, it's true!
                // Do not break here, it's true!
                case 'program':
                    if (!is_array($value)) {
                        $value = array($value);
                    }
                    foreach ($value as $v) {
                        $cond[] = '?';
                        $param[] = $v === '[[EMPTY]]' ? '' : $v;
                    }
                    $where .= " AND `{$var}` IN (";
                    $where .= implode(', ', $cond);
                    $where .= ')';
                    break;
                case 'message':
                    foreach (explode(',', $value) as $val) {
                        $param[] = '%' . $val . '%';
                        $cond[] = '`msg` LIKE ?';
                    }
                    $where .= 'AND (';
                    $where .= implode(' OR ', $cond);
                    $where .= ')';
                    break;
                case 'timestamp_from':
                    $where .= ' AND `timestamp` > ?';
                    $param[] = $value;
                    break;
                case 'timestamp_to':
                    $where .= ' AND `timestamp` < ?';
                    $param[] = $value;
                    break;
            }
        }
    }
    // Show events only for permitted devices
    $query_permitted = generate_query_permitted();
    $query = 'FROM `syslog` ';
    $query .= $where . $query_permitted;
    $query_count = 'SELECT COUNT(`seq`) ' . $query;
    $query = 'SELECT * ' . $query;
    $query .= ' ORDER BY `seq` DESC ';
    $query .= "LIMIT {$start},{$pagesize}";
    // Query syslog messages
    $entries = dbFetchRows($query, $param);
    // Query syslog count
    if ($pagination && !$short) {
        $count = dbFetchCell($query_count, $param);
    } else {
        $count = count($entries);
    }
    if (!$count) {
        // There have been no entries returned. Print the warning.
        print_warning('<h4>No syslog entries found!</h4>
Check that the syslog daemon and Observium configuration options are set correctly, that your devices are configured to send syslog to Observium and that there are no firewalls blocking the messages.

See <a href="http://www.observium.org/wiki/Category:Documentation" target="_blank">documentation</a> and <a href="http://www.observium.org/wiki/Configuration_Options#Syslog_Settings" target="_blank">configuration options</a> for more information.');
    } else {
        // Entries have been returned. Print the table.
        $list = array('device' => FALSE, 'priority' => TRUE);
        // For now (temporarily) priority always displayed
        if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'syslog') {
            $list['device'] = TRUE;
        }
        if ($short || !isset($vars['priority']) || empty($vars['priority'])) {
            $list['priority'] = TRUE;
        }
        $string = '<table class="table table-bordered table-striped table-hover table-condensed-more">' . PHP_EOL;
        if (!$short) {
            $string .= '  <thead>' . PHP_EOL;
            $string .= '    <tr>' . PHP_EOL;
            $string .= '      <th>Date</th>' . PHP_EOL;
            if ($list['device']) {
                $string .= '      <th>Device</th>' . PHP_EOL;
            }
            if ($list['priority']) {
                $string .= '      <th>Priority</th>' . PHP_EOL;
            }
            $string .= '      <th>Message</th>' . PHP_EOL;
            $string .= '    </tr>' . PHP_EOL;
            $string .= '  </thead>' . PHP_EOL;
        }
        $string .= '  <tbody>' . PHP_EOL;
        foreach ($entries as $entry) {
            $string .= '  <tr>';
            if ($short) {
                $string .= '    <td class="syslog" style="white-space: nowrap">';
                $timediff = $GLOBALS['config']['time']['now'] - strtotime($entry['timestamp']);
                $string .= overlib_link('', formatUptime($timediff, "short-3"), format_timestamp($entry['timestamp']), NULL) . '</td>' . PHP_EOL;
            } else {
                $string .= '    <td width="160">';
                $string .= format_timestamp($entry['timestamp']) . '</td>' . PHP_EOL;
            }
            if ($list['device']) {
                $dev = device_by_id_cache($entry['device_id']);
                $device_vars = array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'logs', 'section' => 'syslog');
                $string .= '    <td class="entity">' . generate_device_link($dev, short_hostname($dev['hostname']), $device_vars) . '</td>' . PHP_EOL;
            }
            if ($list['priority']) {
                if (!$short) {
                    $string .= '    <td style="color: ' . $priorities[$entry['priority']]['color'] . '; white-space: nowrap;">' . nicecase($priorities[$entry['priority']]['name']) . ' (' . $entry['priority'] . ')</td>' . PHP_EOL;
                }
            }
            $entry['program'] = empty($entry['program']) ? '[[EMPTY]]' : $entry['program'];
            if ($short) {
                $string .= '    <td class="syslog">';
                $string .= '<strong style="color: ' . $priorities[$entry['priority']]['color'] . ';">' . $entry['program'] . '</strong> : ';
            } else {
                $string .= '    <td>';
                $string .= '<strong>' . $entry['program'] . '</strong> : ';
            }
            $string .= htmlspecialchars($entry['msg']) . '</td>' . PHP_EOL;
            $string .= '  </tr>' . PHP_EOL;
        }
        $string .= '  </tbody>' . PHP_EOL;
        $string .= '</table>' . PHP_EOL;
        // Print pagination header
        if ($pagination && !$short) {
            $string = pagination($vars, $count) . $string . pagination($vars, $count);
        }
        // Print syslog
        echo $string;
    }
}
コード例 #13
0
ファイル: icon.inc.php プロジェクト: samyscoub/librenms
<table cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <form id="edit" name="edit" method="post" action="">
        <input type="hidden" name="editing" value="yes">
        <table border="0">
<?php 
$numicons = 1;
echo "          <tr>\n";
// Default icon
$icon = $config['os'][$device['os']]['icon'];
echo '            <td width="64" align="center"><img src="images/os/' . $icon . '.png"><br /><i>' . nicecase($icon) . '</i><p />';
echo '<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == '' || $device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n";
for ($i = 0; $i < count($config['os'][$device['os']]['icons']); $i++) {
    $icon = $config['os'][$device['os']]['icons'][$i];
    echo '            <td width="64" align="center"><img src="images/os/' . $icon . '.png"><br /><i>' . nicecase($icon) . '</i><p />';
    echo '<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n";
}
if ($numicons % 10 == 0) {
    echo "          </tr>\n";
    echo "          <tr>\n";
}
?>
          </tr>
          <tr>
            <td colspan="10">
              <br />
              <input type="submit" name="Submit" value="Save" />
            </td>
          </tr>
        </table>
コード例 #14
0
ファイル: graphs.inc.php プロジェクト: Natolumin/observium
} else {
    $title .= " :: " . nicecase($subtype);
}
// Generate navbar with subtypes
$graph_array = $vars;
$graph_array['height'] = "60";
$graph_array['width'] = $thumb_width;
$graph_array['legend'] = "no";
$graph_array['to'] = $config['time']['now'];
$navbar = array('brand' => "Graph", 'class' => "navbar-narrow");
switch ($type) {
    case 'device':
    case 'sensor':
    case 'cefswitching':
    case 'munin':
        $navbar['options']['graph'] = array('text' => nicecase($type) . ' (' . $subtype . ')', 'url' => generate_url($vars, array('type' => $type . "_" . $subtype, 'page' => "graphs")));
        break;
    default:
        # Load our list of available graphtypes for this object
        /// FIXME not all of these are going to be valid
        /// This is terrible. --mike
        /// The future solution is to keep a 'registry' of which graphtypes apply to which entities and devices.
        /// I'm not quite sure if this is going to be too slow. --adama 2013-11-11
        if ($handle = opendir($config['html_dir'] . "/includes/graphs/" . $type . "/")) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != ".." && $file != "auth.inc.php" && $file != "graph.inc.php" && strstr($file, ".inc.php")) {
                    $types[] = str_replace(".inc.php", "", $file);
                }
            }
            closedir($handle);
        }
コード例 #15
0
//Printer-MIB::prtMarkerSpotColorants.1.1 = INTEGER: 0
//Printer-MIB::prtMarkerAddressabilityUnit.1.1 = INTEGER: tenThousandthsOfInches(3)
//Printer-MIB::prtMarkerAddressabilityFeedDir.1.1 = INTEGER: 600
//Printer-MIB::prtMarkerAddressabilityXFeedDir.1.1 = INTEGER: 600
//Printer-MIB::prtMarkerNorthMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerSouthMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerWestMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerEastMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerStatus.1.1 = INTEGER: 2
$oids = snmpwalk_cache_multi_oid($device, "prtMarkerEntry", array(), $mib);
$prt_supplies = snmpwalk_cache_oid($device, 'prtMarkerSuppliesDescription', array(), $mib);
//print_vars($oids);
$count = count($oids);
foreach ($oids as $index => $entry) {
    $printer_supply = dbFetchRow("SELECT * FROM `printersupplies` WHERE `device_id` = ? AND `supply_mib` = ? AND `supply_index` = ?", array($device['device_id'], 'jetdirect', $index));
    $marker_descr = "Printed " . nicecase($entry['prtMarkerCounterUnit']);
    list($hrDeviceIndex, $prtMarkerIndex) = explode('.', $index);
    $options = array('measured_class' => 'printersupply', 'measured_entity' => $printer_supply['supply_id'], 'sensor_unit' => $entry['prtMarkerCounterUnit']);
    // Lifetime counter (should be always single)
    $descr = "Total {$marker_descr}";
    $oid_name = 'prtMarkerLifeCount';
    $oid = '.1.3.6.1.2.1.43.10.2.1.4.' . $index;
    $value = $entry[$oid_name];
    if (isset($entry[$oid_name])) {
        // CLEANME. Compatibility, remove in r8500, but not before CE 0.16.8
        // Rename olf rrd filename and old ds name
        $new_rrd = 'sensor-counter-Printer-MIB-prtMarkerLifeCount-' . $index;
        $renamed = rename_rrd($device, 'pagecount', $new_rrd);
        if ($renamed) {
            rrdtool_rename_ds($device, $new_rrd, 'pagecount', 'sensor');
        }
コード例 #16
0
    var_dump($GLOBALS['cache']['discovery-protocols']);
}
$table_rows = array();
$neighbours_db = dbFetchRows('SELECT * FROM `neighbours` LEFT JOIN `ports` USING(`port_id`) WHERE `device_id` = ?', array($device['device_id']));
foreach ($neighbours_db as $neighbour) {
    $local_port_id = $neighbour['port_id'];
    $remote_hostname = $neighbour['remote_hostname'];
    $remote_port = $neighbour['remote_port'];
    print_debug("{$local_port_id} -> {$remote_hostname} -> {$remote_port}");
    if (!$valid['neighbours'][$local_port_id][$remote_hostname][$remote_port]) {
        dbDelete('neighbours', '`neighbour_id` = ?', array($neighbour['neighbour_id']));
        $GLOBALS['module_stats'][$module]['deleted']++;
    } else {
        $port = get_port_by_id_cache($local_port_id);
        if (is_numeric($neighbour['remote_port_id'])) {
            $remote_port_array = get_port_by_id_cache($neighbour['remote_port_id']);
            $remote_port = $remote_port_array['port_label'];
        }
        $table_rows[] = array(nicecase($neighbour['protocol']), $port['port_label'], $remote_hostname, $remote_port, truncate($neighbour['remote_platform'], 20), truncate($neighbour['remote_version'], 40));
    }
}
echo PHP_EOL;
$table_headers = array('%WProtocol%n', '%WifName%n', '%WRemote: hostname%n', '%Wport%n', '%Wplatform%n', '%Wversion%n');
print_cli_table($table_rows, $table_headers);
$GLOBALS['module_stats'][$module]['status'] = count($valid[$module]);
if (OBS_DEBUG && $GLOBALS['module_stats'][$module]['status']) {
    print_vars($valid[$module]);
}
unset($valid['neighbours']);
echo PHP_EOL;
// EOF
コード例 #17
0
ファイル: settings.inc.php プロジェクト: Natolumin/observium
     }
 }
 // Split enum|foo|bar into enum  foo|bar
 list($vartype, $varparams) = explode('|', $config_variable[$sqlname]['type'], 2);
 $params = array();
 // If a callback function is defined, use this to fill params.
 if ($config_variable[$sqlname]['params_call'] && function_exists($config_variable[$sqlname]['params_call'])) {
     $params = call_user_func($config_variable[$sqlname]['params_call']);
     // Else if the params are defined directly, use these.
 } else {
     if (is_array($config_variable[$sqlname]['params'])) {
         $params = $config_variable[$sqlname]['params'];
     } else {
         if (!empty($varparams)) {
             foreach (explode('|', $varparams) as $param) {
                 $params[$param] = array('name' => nicecase($param));
             }
         }
     }
 }
 switch ($vartype) {
     case 'int':
     case 'integer':
     case 'float':
         if (is_numeric($content)) {
             $ok = TRUE;
         } else {
             $errors[] = $config_variable[$sqlname]['name'] . " ({$confname}) should be of <strong>numeric</strong> type. Setting '" . escape_html($content) . "' ignored.";
         }
         break;
     case 'bool':
コード例 #18
0
ファイル: os.inc.php プロジェクト: Natolumin/observium
print_cli_data("Asset", $asset_tag ?: "%b<empty>%n");
echo PHP_EOL;
foreach ($os_additional_info as $header => $entries) {
    print_cli_heading($header, 3);
    foreach ($entries as $field => $entry) {
        print_cli_data($field, $entry, 3);
    }
    echo PHP_EOL;
}
// Fields notified in event log
$update_fields = array('version', 'features', 'hardware', 'serial', 'kernel', 'distro', 'distro_ver', 'arch', 'asset_tag');
// Log changed variables
foreach ($update_fields as $field) {
    if (isset(${$field})) {
        ${$field} = snmp_fix_string(${$field});
    }
    // Fix unprintable chars
    if ((isset(${$field}) || strlen($device[$field])) && ${$field} != $device[$field]) {
        $update_array[$field] = ${$field};
        log_event(nicecase($field) . " -> " . $update_array[$field], $device, 'device', $device['device_id']);
    }
}
// Here additional fields, change only if not set already
foreach (array('type', 'icon') as $field) {
    if (isset(${$field}) && ($device[$field] == "unknown" || $device[$field] == '' || !isset($device[$field]) || !strlen($device[$field]))) {
        $update_array[$field] = ${$field};
        log_event(nicecase($field) . " -> " . $update_array[$field], $device, 'device', $device['device_id']);
    }
}
unset($entPhysical, $oids, $hw, $os_additional_info);
// EOF
コード例 #19
0
 * Copyright (C) 2006-2014, Adam Armstrong - http://www.observium.org
 *
 * @package    observium
 * @subpackage webui
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
echo generate_link($descr, $link_array, array('view' => 'macaccounting'));
$graphs = array('bits' => 'Bits', 'pkts' => '数据包');
$navbar = array();
$navbar['class'] = "navbar-narrow";
$navbar['brand'] = 'Mac核算';
$subviews = array('details', 'graphs', 'minigraphs', 'top10');
foreach ($subviews as $type) {
    $navbar['options'][$type]['text'] = nicecase($type);
    $navbar['options'][$type]['url'] = generate_url($vars, array('subview' => $type));
    if ($vars['subview'] == $type) {
        $navbar['options'][$type]['class'] = "active";
    }
}
foreach ($graphs as $type => $text) {
    $navbar['options_right'][$type]['text'] = $text;
    $navbar['options_right'][$type]['url'] = generate_url($link_array, array('view' => 'macaccounting', 'subview' => 'graphs', 'graph' => $type));
    if ($vars['graph'] == $type) {
        $navbar['options_right'][$type]['class'] = "active";
    }
}
print_navbar($navbar);
// FIXME - REWRITE!
$hostname = $device['hostname'];
コード例 #20
0
ファイル: percent.inc.php プロジェクト: Natolumin/observium
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage graphs
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$scale_min = "0";
$scale_max = "100";
include_once $config['html_dir'] . "/includes/graphs/common.inc.php";
$rrd_options .= " COMMENT:'                          Min     Last   Max\\n'";
$rrd_options .= " DEF:sensor={$rrd_filename}:sensor:AVERAGE";
$rrd_options .= " DEF:sensor_max={$rrd_filename}:sensor:MAX";
$rrd_options .= " DEF:sensor_min={$rrd_filename}:sensor:MIN";
$rrd_options .= " CDEF:sensor_diff=sensor_max,sensor_min,-";
$rrd_options .= " AREA:sensor_min";
$rrd_options .= " AREA:sensor_diff#c5c5c5::STACK";
$rrd_options .= " LINE1.5:sensor#cc0000:'" . rrdtool_escape($sensor['sensor_descr'], 20) . "'";
$rrd_options .= " GPRINT:sensor_min:MIN:%4.1lf%%";
$rrd_options .= " GPRINT:sensor:LAST:%4.1lf%%";
$rrd_options .= " GPRINT:sensor_max:MAX:%4.1lf%%\\l";
if (is_numeric($sensor['sensor_limit'])) {
    $rrd_options .= " HRULE:" . $sensor['sensor_limit'] . "#999999::dashes";
}
if (is_numeric($sensor['sensor_limit_low'])) {
    $rrd_options .= " HRULE:" . $sensor['sensor_limit_low'] . "#999999::dashes";
}
$graph_return['descr'] = nicecase($sensor['sensor_class']) . ' sensor measured in percent.';
// EOF
コード例 #21
0
    <div class="well info_box">
      <div class="title"><i class="oicon-bell"></i> 分组详情</div>
      <div class="content">
  <fieldset>
  <div class="control-group">
    <label class="control-label" for="entity_type">实体类型</label>
    <div class="controls">
      <select name="entity_type" class="selectpicker" data-show-icon="true">
        <?php 
foreach ($config['entities'] as $entity_type => $entity_type_array) {
    echo '<option value="' . $entity_type . '" ';
    if (!isset($entity_type_array['icon'])) {
        $entity_type_array['icon'] = $config['entity_default']['icon'];
    }
    echo $vars['entity_type'] == $entity_type || $vars['entity_type'] == '' ? 'selected' : '';
    echo ' data-icon="' . $entity_type_array['icon'] . '"> ' . nicecase($entity_type) . '</option>';
}
?>
      </select>
    </div>
        </div>

  <div class="control-group">
    <label class="control-label" for="group_name">分组名称</label>
    <div class="controls">
      <input type=text name="group_name" size="32" placeholder="组名称"/>
    </div>
  </div>
        <div class="control-group">
    <label class="control-label" for="group_descr">概述</label>
    <div class="controls">
コード例 #22
0
$navbar['options']['graphs'] = array('text' => '流量图');
foreach ($navbar['options'] as $option => $array) {
    if (!isset($vars['format'])) {
        $vars['format'] = 'basic';
    }
    if ($vars['format'] == $option) {
        $navbar['options'][$option]['class'] .= " active";
    }
    $navbar['options'][$option]['url'] = generate_url($vars, array('format' => $option));
}
$menu_options = array('bits' => 'Bits', 'processor' => 'CPU', 'mempool' => 'Memory', 'uptime' => 'Uptime', 'storage' => 'Storage', 'diskio' => 'Disk I/O', 'poller_perf' => 'Poll Time');
// Print options related to graphs.
foreach (array('graphs') as $type) {
    foreach ($config['graph_types']['device'] as $option => $data) {
        if (!isset($data['name'])) {
            $data['name'] = nicecase($option);
        }
        if ($vars['format'] == $type && $vars['graph'] == $option) {
            $navbar['options'][$type]['suboptions'][$option]['class'] = 'active';
            $navbar['options'][$type]['text'] .= " (" . $data['name'] . ')';
        }
        $navbar['options'][$type]['suboptions'][$option]['text'] = $data['name'];
        $navbar['options'][$type]['suboptions'][$option]['url'] = generate_url($vars, array('view' => NULL, 'format' => $type, 'graph' => $option));
    }
}
if ($vars['searchbar'] == "hide") {
    $navbar['options_right']['searchbar'] = array('text' => '显示搜索', 'url' => generate_url($vars, array('searchbar' => NULL)));
} else {
    $navbar['options_right']['searchbar'] = array('text' => '隐藏搜索', 'url' => generate_url($vars, array('searchbar' => 'hide')));
}
if ($vars['bare'] == "yes") {
コード例 #23
0
    $sql .= " LEFT JOIN  `sensors-state` ON  `sensors`.sensor_id =  `sensors-state`.sensor_id";
    $sql .= " WHERE `sensor_class` = ? AND `device_id` = ? ORDER BY `sensor_type`, `sensor_descr`";
    $sensors = dbFetchRows($sql, array($sensor_type, $device['device_id']));
    if (count($sensors)) {
        ?>

<div class="well info_box">
    <div class="title"><a href="<?php 
        echo generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'health', 'metric' => $sensor_type));
        ?>
">
      <i class="<?php 
        echo $config['sensor_types'][$sensor_type]['icon'];
        ?>
"></i> <?php 
        echo nicecase($sensor_type);
        ?>
</a></div>
    <div class="content">

<?php 
        echo '<table class="table table-condensed-more table-striped table-bordered">';
        foreach ($sensors as $sensor) {
            humanize_sensor($sensor);
            // FIXME - make this "four graphs in popup" a function/include and "small graph" a function.
            // FIXME - So now we need to clean this up and move it into a function. Isn't it just "print-graphrow"?
            // FIXME - DUPLICATED IN health/sensors
            $graph_colour = str_replace("#", "", $row_colour);
            $graph_array = array();
            $graph_array['to'] = $config['time']['now'];
            $graph_array['id'] = $sensor['sensor_id'];
コード例 #24
0
function generate_printersupplies_row($supply, $vars)
{
    $graph_type = "printersupply_usage";
    $table_cols = 5;
    $total = $supply['supply_capacity'];
    $perc = $supply['supply_value'];
    $graph_array['type'] = $graph_type;
    $graph_array['id'] = $supply['supply_id'];
    $graph_array['from'] = $GLOBALS['config']['time']['day'];
    $graph_array['to'] = $GLOBALS['config']['time']['now'];
    $graph_array['height'] = "20";
    $graph_array['width'] = "80";
    if ($supply['supply_colour'] != '') {
        $background = toner_to_colour($supply['supply_colour'], $perc);
    } else {
        $background = toner_to_colour($supply['supply_descr'], $perc);
    }
    /// FIXME - popup for printersupply entity.
    $output .= '<tr class="' . $supply['html_row_class'] . '">';
    $output .= '<td class="state-marker"></td>';
    if ($vars['popup'] == TRUE) {
        $output .= '<td style="width: 40px; text-align: center;"><i class="' . $GLOBALS['config']['entities']['printersupply']['icon'] . '"></i></td>';
    } else {
        $output .= '<td style="width: 1px;"></td>';
    }
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $output .= '<td class="entity">' . generate_device_link($supply) . '</td>';
        $table_cols++;
    }
    $output .= '<td class="entity">' . generate_entity_link('printersupply', $supply) . '</td>';
    if (!isset($vars['supply'])) {
        $output .= '<td>' . nicecase($supply['supply_type']) . '</td>';
    }
    $output .= '<td style="width: 70px;">' . generate_graph_popup($graph_array) . '</td>';
    $output .= '<td style="width: 200px;"><a href="' . $link . '">' . print_percentage_bar(400, 20, $perc, $perc . '%', 'ffffff', $background['right'], NULL, "ffffff", $background['left']) . '</a></td>';
    $output .= '<td style="width: 50px; text-align: right;"><span class="label">' . $perc . '%</span></td>';
    $output .= '</tr>';
    if ($vars['view'] == "graphs") {
        $output .= '<tr class="' . $supply['html_row_class'] . '">';
        $output .= '<td class="state-marker"></td>';
        $output .= '<td colspan=' . $table_cols . '>';
        unset($graph_array['height'], $graph_array['width'], $graph_array['legend']);
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $supply['supply_id'];
        $graph_array['type'] = $graph_type;
        $output .= generate_graph_row($graph_array, TRUE);
        $output .= "</td></tr>";
    }
    # endif graphs
    return $output;
}
コード例 #25
0
ファイル: proxmox.inc.php プロジェクト: samyscoub/librenms
<?php

require_once 'includes/application/proxmox.inc.php';
$graphs['proxmox'] = array('netif');
$pmxcl = dbFetchRows("SELECT DISTINCT(`app_instance`) FROM `applications` WHERE `app_type` = ?", array('proxmox'));
print_optionbar_start();
echo "<span style='font-weight: bold;'>Proxmox Clusters</span> &#187; ";
unset($sep);
foreach ($pmxcl as $pmxc) {
    if (isset($sep)) {
        echo $sep;
    }
    if (var_eq('instance', $pmxc['app_instance']) || !isset($vars['instance']) && !isset($sep)) {
        echo "<span class='pagemenu-selected'>";
    }
    echo generate_link(nicecase($pmxc['app_instance']), array('page' => 'apps', 'app' => 'proxmox', 'instance' => $pmxc['app_instance']));
    if (var_eq('instance', $pmxc['app_instance'])) {
        echo '</span>';
    }
    $sep = ' | ';
}
print_optionbar_end();
$pagetitle[] = 'Proxmox';
$pagetitle[] = $instance;
if (!isset($vars['instance'])) {
    $instance = $pmxcl[0]['app_instance'];
} else {
    $instance = var_get('instance');
}
if (isset($vars['vmid'])) {
    include "pages/apps/proxmox/vm.inc.php";
コード例 #26
0
   $graph_array['legend'] = "no";
   $graph_array['to'] = $config['time']['now'];
   print_optionbar_start();
   echo $title;
   echo '<div class="pull-right">';
   ?>
 <form action="" style="margin-top: -5px;">
 <select name='type' id='type' onchange="window.open(this.options[this.selectedIndex].value,'_top')" >
 <?php 
   sort($types);
   foreach ($types as $avail_type) {
       echo "<option value='" . generate_url($vars, array('type' => $type . "_" . $avail_type, 'page' => "graphs")) . "'";
       if ($avail_type == $subtype) {
           echo " selected";
       }
       echo ">" . nicecase($avail_type) . "</option>";
   }
   ?>
   </select>
 </form>
 <?php 
   echo '</div>';
   print_optionbar_end();
   // Start form for the custom range.
   print_optionbar_start();
   $thumb_array = array('sixhour' => '6 Hours', 'day' => '24 Hours', 'twoday' => '48 Hours', 'week' => 'One Week', 'month' => 'One Month', 'year' => 'One Year', 'twoyear' => 'Two Years');
   echo '<table width=100% style="background: transparent;"><tr>';
   foreach ($thumb_array as $period => $text) {
       $graph_array['from'] = $config['time'][$period];
       $link_array = $vars;
       $link_array['from'] = $graph_array['from'];
コード例 #27
0
ファイル: apps.inc.php プロジェクト: Natolumin/observium
}
print_navbar($navbar);
unset($navbar, $name, $url, $device_app_types);
$where_array = array($device['device_id'], $vars['app']);
if ($vars['instance']) {
    $where = " AND `app_id` = ?";
    $where_array[] = $vars['instance'];
}
$app = dbFetchRow("SELECT * FROM `applications` WHERE `device_id` = ? AND `app_type` = ?" . $where, $where_array);
$app_filename = $config['html_dir'] . '/pages/device/apps/' . $vars['app'] . '.inc.php';
if (is_file($app_filename)) {
    // Include app code to output data
    include $app_filename;
    // If an $app_sections array has been returned, build a menu
    if (isset($app_sections) && is_array($app_sections)) {
        $navbar['brand'] = nicecase($vars['app']);
        $navbar['class'] = "navbar-narrow";
        foreach ($app_sections as $app_section => $text) {
            // Set the chosen app to be this one if it's not already set.
            if (!$vars['app_section']) {
                $vars['app_section'] = $app_section;
            }
            if ($vars['app_section'] == $app_section) {
                $navbar['options'][$app_section]['class'] = "active";
            }
            $navbar['options'][$app_section]['url'] = generate_url($vars, array('app_section' => $app_section));
            $navbar['options'][$app_section]['text'] = $text;
        }
        print_navbar($navbar);
        unset($navbar);
    } else {
コード例 #28
0
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage graphs
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$rrd_filename = get_rrd_path($device, 'netapp_stats.rrd');
$rrd_exists = is_file($rrd_filename);
$count = 0;
foreach (array('iscsi', 'nfs', 'cifs', 'http', 'fcp') as $stat) {
    if (!$rrd_exists) {
        continue;
    }
    $rrd_list[$count]['filename'] = $rrd_filename;
    $rrd_list[$count]['descr'] = nicecase($stat);
    $rrd_list[$count]['ds'] = $stat . '_ops';
    $count++;
}
$unit_text = 'Operations/s';
$colours = 'mixed';
$units = '';
$total_units = '';
$scale_min = '0';
$scale_max = '100';
$divider = $count;
$text_orig = 1;
$nototal = 1;
include 'includes/graphs/generic_multi_simplex_separated.inc.php';
// EOF
コード例 #29
0
 echo '
 <td style="width: 1px; background-color: #194b7f; margin: 0px; padding: 0px"></td>
 <td style="width: 1px;"></td>';
 // Print the conditions applied by this alert
 echo '<td><strong>';
 echo $group['group_id'];
 echo '</strong></td>';
 echo '<td><strong>';
 echo '<a href="', generate_url(array('page' => 'group', 'group_id' => $group['group_id'])), '">' . $group['group_name'] . '</a></strong><br />';
 echo '<i>', $group['group_descr'], '</i>';
 echo '</td>';
 // Print the count of entities this alert applies to and a popup containing a list and Print breakdown of entities by status.
 // We assume each row here is going to be two lines, so we just <br /> them.
 echo '<td>';
 echo '<i>' . $group['member_count'] . '</i><br />';
 echo '<i class="' . $entity_type['icon'], '"></i> ', nicecase($group['entity_type']);
 echo '</td>';
 echo '<td>';
 echo '<table class="table table-condensed-more table-bordered table-striped table-rounded" style="margin-bottom: 0px;">';
 // Loop the associations which link this alert to this device
 foreach ($group_assoc[$group['group_id']] as $assoc_id => $assoc) {
     echo '<tr>';
     echo '<td style="width: 50%;">';
     if (is_array($assoc['device_attribs'])) {
         $text_block = array();
         foreach ($assoc['device_attribs'] as $attribute) {
             $text_block[] = '' . $attribute['attrib'] . ' ' . $attribute['condition'] . ' ' . $attribute['value'] . '';
         }
         echo '<code>' . implode($text_block, '<br />') . '</code>';
     } else {
         echo '<code>*</code>';
コード例 #30
0
ファイル: iftype.inc.php プロジェクト: skive/observium
    $bg = "#ffffff";
}
if (!is_array($vars['type'])) {
    $vars['type'] = array($vars['type']);
}
$where = 'WHERE 1';
$where .= generate_query_values($vars['type'], 'port_descr_type', 'LIKE');
$where .= generate_query_permitted(array('port'));
$ports = dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D {$where} AND I.`device_id` = D.`device_id` ORDER BY I.`ifAlias`");
$if_list = array();
foreach ($ports as $port) {
    $if_list[] = $port['port_id'];
}
$if_list = implode(',', $if_list);
for ($i = 0; $i < count($vars['type']); $i++) {
    $vars['type'][$i] = nicecase($vars['type'][$i]);
}
$types = implode(' + ', $vars['type']);
echo '<h4>Total Graph for ports of type : ' . $types . '</h4>';
if ($if_list) {
    $graph_type = "multiport_bits_separate";
    $port['port_id'] = $if_list;
    include "includes/print-interface-graphs.inc.php";
    ?>

<table class="table table-hover table-striped-two table-bordered table-condensed table-rounded" style="margin-top: 10px;">
  <thead>
      <tr>
        <th style="width: 250px;"><span style="font-weight: bold;" class="interface">Description</span></th>
        <th style="width: 150px;">Device</th>
        <th style="width: 100px;">Interface</th>