Example #1
0
<?php

$rrd_filename = rrd_name($device['hostname'], 'cipsec_flow');
$ds_in = 'InPkts';
$ds_out = 'OutPkts';
$colour_area_in = 'AA66AA';
$colour_line_in = '330033';
$colour_area_out = 'FFDD88';
$colour_line_out = 'FF6600';
$colour_area_in_max = 'CC88CC';
$colour_area_out_max = 'FFEFAA';
$graph_max = 1;
$unit_text = 'Pkts   ';
require 'includes/graphs/generic_duplex.inc.php';
Example #2
0
<?php

if ($_GET['id'] && is_numeric($_GET['id'])) {
    $atm_vp_id = $_GET['id'];
}
$vp = dbFetchRow('SELECT * FROM `juniAtmVp` as J, `ports` AS I, `devices` AS D WHERE J.juniAtmVp_id = ? AND I.port_id = J.port_id AND I.device_id = D.device_id', array($atm_vp_id));
if ($auth || port_permitted($vp['port_id'])) {
    $port = $vp;
    $device = device_by_id_cache($port['device_id']);
    $title = generate_device_link($device);
    $title .= ' :: Port  ' . generate_port_link($port);
    $title .= ' :: VP ' . $vp['vp_id'];
    $auth = true;
    $rrd_filename = rrd_name($vp['hostname'], array('vp', $vp['ifIndex'], $vp['vp_id']));
}
Example #3
0
<?php

$scale_min = '0';
$rrd_filename = rrd_name($device['hostname'], array('bgp', $data['bgpPeerIdentifier']));
$ds_in = 'bgpPeerInUpdates';
$ds_out = 'bgpPeerOutUpdates';
$colour_area_in = 'AA66AA';
$colour_line_in = '330033';
$colour_area_out = 'FF6600';
$colour_line_out = 'FFDD88';
$colour_area_in_max = 'FFEE99';
$colour_area_out_max = 'FF7711';
$graph_max = 1;
$unit_text = 'Updates';
require 'includes/graphs/generic_duplex.inc.php';
Example #4
0
function rrd_create_update($device, $name, $def, $val, $step = 300)
{
    global $config;
    $rrd = rrd_name($device['hostname'], $name);
    if (!is_file($rrd) && $def != null) {
        // add the --step and the rra definitions to the array
        $newdef = "--step {$step} " . implode(' ', $def) . $config['rrd_rra'];
        rrdtool_create($rrd, $newdef);
    }
    rrdtool_update($rrd, $val);
}
<?php

/*
 * LibreNMS
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
require 'includes/graphs/common.inc.php';
$rrdfilename = rrd_name($device['hostname'], 'cambium-epmp-gpsSync');
if (file_exists($rrdfilename)) {
    $rrd_options .= " COMMENT:'1 - GPS Sync Up       2 - GPS Sync Down      3 - CMM Sync     \\n'";
    $rrd_options .= ' DEF:gpsSync=' . $rrdfilename . ':gpsSync:AVERAGE ';
    $rrd_options .= " -l 1 ";
    $rrd_options .= " -u 3 ";
    $rrd_options .= " LINE2:gpsSync#666699:'GPS Sync Status  ' ";
    $rrd_options .= ' GPRINT:gpsSync:LAST:%0.2lf%s ';
}
<?php

require 'includes/graphs/common.inc.php';
$mysql_rrd = rrd_name($device['hostname'], array('app', 'mysql', $app['app_id']));
if (rrdtool_check_rrd_exists($mysql_rrd)) {
    $rrd_filename = $mysql_rrd;
}
$multiplier = 8;
$ds_in = 'BRd';
$ds_out = 'BSt';
require 'includes/graphs/generic_data.inc.php';
Example #7
0
<?php

$i = 0;
foreach ($procs as $proc) {
    $rrd_filename = rrd_name($device['hostname'], array('processor', $proc['processor_type'], $proc['processor_index']));
    if (rrdtool_check_rrd_exists($rrd_filename)) {
        $descr = short_hrDeviceDescr($proc['processor_descr']);
        $rrd_list[$i]['filename'] = $rrd_filename;
        $rrd_list[$i]['descr'] = $descr;
        $rrd_list[$i]['ds'] = 'usage';
        $i++;
    }
}
$unit_text = 'Load %';
$units = '%';
$total_units = '%';
$colours = 'oranges';
$scale_min = '0';
$scale_max = '100';
$divider = $i;
$text_orig = 1;
$nototal = 1;
require 'includes/graphs/generic_multi_simplex_seperated.inc.php';
Example #8
0
<?php

require 'includes/graphs/common.inc.php';
$rrdfilename = rrd_name($device['hostname'], 'saf-modem-radio');
if (rrdtool_check_rrd_exists($rrdfilename)) {
    $rrd_options .= ' COMMENT:"  Now         Min          Max\\r" ';
    $rrd_options .= ' DEF:radioRxLevel=' . $rrdfilename . ':radioRxLevel:AVERAGE ';
    $rrd_options .= ' LINE1:radioRxLevel#CC0000:"RX Level\\l" ';
    $rrd_options .= ' COMMENT:\\u ';
    $rrd_options .= ' GPRINT:radioRxLevel:LAST:"%3.2lf dBm" ';
    $rrd_options .= ' GPRINT:radioRxLevel:MIN:"%3.2lf dBm" ';
    $rrd_options .= ' GPRINT:radioRxLevel:MAX:"%3.2lf dBm\\r" ';
}
Example #9
0
<?php

$rrd_filename = rrd_name($device['hostname'], array('arubaap', $ap['name'] . $ap['radio_number']));
$rrd_list[0]['filename'] = $rrd_filename;
$rrd_list[0]['descr'] = 'radioutil';
$rrd_list[0]['ds'] = 'radioutil';
$unit_text = 'Percent';
$units = '';
$total_units = '';
$colours = 'mixed';
$scale_min = '0';
$nototal = 1;
if ($rrd_list) {
    include 'includes/graphs/generic_multi_line.inc.php';
}
Example #10
0
<?php

require 'includes/graphs/common.inc.php';
$pallette = array(1 => 'FF0000', 2 => '0000FF', 3 => '00FF00', 4 => 'FF00FF', 5 => '000000', 6 => 'FFFF00', 7 => 'C0C0C0', 8 => '800000', 9 => '808000', 10 => '008000', 11 => '00FFFF', 12 => '008080', 13 => '000080', 14 => '800080', 15 => 'FF69B4', 16 => '006400');
$rrd_options .= ' -l 0 -E ';
$rrd_options .= " COMMENT:'Average Data Rate       Cur    Min    Max\\n'";
$radioId = 1;
foreach (glob(rrd_name($device['hostname'], 'xirrus_stats-', '*.rrd')) as $rrd) {
    // get radio name
    preg_match("/xirrus_stats-iap([0-9]{1,2}).rrd/", $rrd, $out);
    list(, $radioId) = $out;
    // build graph
    $color = $pallette[$radioId];
    $descr = "iap{$radioId}             ";
    $rrd_options .= " DEF:rate{$radioId}={$rrd}:dataRate:AVERAGE";
    $rrd_options .= " LINE2:rate{$radioId}#" . $color . ":'" . $descr . "'";
    $rrd_options .= " GPRINT:rate{$radioId}:LAST:'%5.0lf'";
    $rrd_options .= " GPRINT:rate{$radioId}:MIN:'%5.0lf'";
    $rrd_options .= " GPRINT:rate{$radioId}:MAX:'%5.0lf'\\l";
    $radioId++;
}
//end foreach
Example #11
0
<?php

require 'includes/graphs/common.inc.php';
$scale_min = 0;
$ds = 'frequency';
$colour_area = 'F6F6F6';
$colour_line = 'B3D0DB';
$colour_area_max = 'FFEE99';
$graph_max = 100;
$unit_text = 'Frequency';
$ntpclient_rrd = rrd_name($device['hostname'], array('app', 'ntpclient', $app['app_id']));
if (rrdtool_check_rrd_exists($ntpclient_rrd)) {
    $rrd_filename = $ntpclient_rrd;
}
require 'includes/graphs/generic_simplex.inc.php';
Example #12
0
<?php

/*
 * LibreNMS
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
require 'includes/graphs/common.inc.php';
$rrdfilename = rrd_name($device['hostname'], 'canopy-generic-rssi');
if (file_exists($rrdfilename)) {
    $rrd_options .= " COMMENT:'dBm                Now       Ave      Max     \\n'";
    $rrd_options .= ' DEF:rssi=' . $rrdfilename . ':rssi:AVERAGE ';
    $rrd_options .= " AREA:rssi#FF0000:'RSSI       ' ";
    $rrd_options .= ' GPRINT:rssi:LAST:%0.2lf%s ';
    $rrd_options .= ' GPRINT:rssi:MIN:%0.2lf%s ';
    $rrd_options .= ' GPRINT:rssi:MAX:%0.2lf%s\\\\l ';
}
Example #13
0
<?php

$nototal = 1;
$ds_in = 'msg_recv';
$ds_out = 'msg_sent';
$graph_titel .= '::messages';
$unit_text = 'Messages/sec';
$colour_line_in = '008800FF';
$colour_line_out = '000088FF';
$colour_area_in = 'CEFFCE66';
$colour_area_out = 'CECEFF66';
$colour_area_in_max = 'CC88CC';
$colour_area_out_max = 'FFEFAA';
$mailscanner_rrd = rrd_name($device['hostname'], array('app', 'mailscannerV2', $app['app_id']));
if (rrdtool_check_rrd_exists($mailscanner_rrd)) {
    $rrd_filename = $mailscanner_rrd;
}
require 'includes/graphs/generic_duplex.inc.php';
Example #14
0
    } elseif ($iter == '2') {
        $colour = '008C00';
    } elseif ($iter == '3') {
        $colour = '4096EE';
    } elseif ($iter == '4') {
        $colour = '73880A';
    } elseif ($iter == '5') {
        $colour = 'D01F3C';
    } elseif ($iter == '6') {
        $colour = '36393D';
    } elseif ($iter == '7') {
        $colour = 'FF0084';
        unset($iter);
    }
    $descr = rrdtool_escape(short_hrDeviceDescr($mempool['mempool_descr']), 22);
    $rrd_filename = rrd_name($device['hostname'], array('mempool', $mempool['mempool_type'], $mempool['mempool_index']));
    if (rrdtool_check_rrd_exists($rrd_filename)) {
        $rrd_options .= " DEF:mempoolfree{$i}={$rrd_filename}:free:AVERAGE ";
        $rrd_options .= " DEF:mempoolused{$i}={$rrd_filename}:used:AVERAGE ";
        $rrd_options .= " CDEF:mempooltotal{$i}=mempoolused{$i},mempoolused{$i},mempoolfree{$i},+,/,100,* ";
        $rrd_options .= " AREA:mempooltotal{$i}#" . $colour . '10';
        $rrd_optionsb .= " LINE1:mempooltotal{$i}#" . $colour . ":'" . $descr . "' ";
        $rrd_optionsb .= " GPRINT:mempooltotal{$i}:MIN:%3.0lf%%";
        $rrd_optionsb .= " GPRINT:mempooltotal{$i}:LAST:%3.0lf%%";
        $rrd_optionsb .= " GPRINT:mempooltotal{$i}:MAX:%3.0lf%%\\l ";
        $iter++;
        $i++;
    }
}
//end foreach
$rrd_options .= $rrd_optionsb;
Example #15
0
/**
 * Constructs the path to an RRD for the Ceph application
 * @param string $gtype The type of rrd we're looking for
 * @return string
**/
function ceph_rrd($gtype)
{
    global $device;
    global $vars;
    if ($gtype == "osd") {
        $var = $vars['osd'];
    } else {
        $var = $vars['pool'];
    }
    return rrd_name($device['hostname'], array('app', 'ceph', $vars['id'], $gtype, $var));
}
<?php

/*
 * LibreNMS
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
require 'includes/graphs/common.inc.php';
$rrdfilename = rrd_name($device['hostname'], 'canopy-generic-whispGPSStats');
if (file_exists($rrdfilename)) {
    $rrd_options .= " COMMENT:'Value    1 = Synched   2 = Lost Sync    3 = Generating   \\n'";
    $rrd_options .= ' DEF:whispGPSStats=' . $rrdfilename . ':whispGPSStats:AVERAGE ';
    $rrd_options .= " -l 1 ";
    $rrd_options .= " -u 3 ";
    $rrd_options .= " LINE2:whispGPSStats#00B8E6:'GPS Status      ' ";
    $rrd_options .= ' GPRINT:whispGPSStats:LAST:%0.2lf%s\\\\l ';
}
Example #17
0
<?php

$scale_min = '0';
require 'includes/graphs/common.inc.php';
$rrd_filename = rrd_name($device['hostname'], 'uptime');
$rrd_options .= ' DEF:uptime=' . $rrd_filename . ':uptime:AVERAGE';
$rrd_options .= ' CDEF:cuptime=uptime,86400,/';
$rrd_options .= " 'COMMENT:Days      Current  Minimum  Maximum  Average\\n'";
$rrd_options .= ' AREA:cuptime#EEEEEE:Uptime';
$rrd_options .= ' LINE1.25:cuptime#36393D:';
$rrd_options .= ' GPRINT:cuptime:LAST:%6.2lf  GPRINT:cuptime:AVERAGE:%6.2lf';
$rrd_options .= " GPRINT:cuptime:MAX:%6.2lf  'GPRINT:cuptime:AVERAGE:%6.2lf\\n'";
<?php

$rrd_filename = rrd_name($device['hostname'], 'aruba-controller');
$rrd_list[0]['filename'] = $rrd_filename;
$rrd_list[0]['descr'] = 'Clients';
$rrd_list[0]['ds'] = 'NUMCLIENTS';
$unit_text = 'Clients';
$units = '';
$total_units = '';
$colours = 'mixed';
$scale_min = '0';
$nototal = 1;
if ($rrd_list) {
    include 'includes/graphs/generic_multi_line.inc.php';
}
Example #19
0
function poll_device($device, $options)
{
    global $config, $device, $polled_devices, $db_stats, $memcache;
    $attribs = get_dev_attribs($device['device_id']);
    $status = 0;
    unset($array);
    $device_start = microtime(true);
    // Start counting device poll time
    echo $device['hostname'] . ' ' . $device['device_id'] . ' ' . $device['os'] . ' ';
    $ip = dnslookup($device);
    if (!empty($ip) && $ip != inet6_ntop($device['ip'])) {
        log_event('Device IP changed to ' . $ip, $device, 'system');
        $db_ip = inet_pton($ip);
        dbUpdate(array('ip' => $db_ip), 'devices', 'device_id=?', array($device['device_id']));
    }
    if ($config['os'][$device['os']]['group']) {
        $device['os_group'] = $config['os'][$device['os']]['group'];
        echo '(' . $device['os_group'] . ')';
    }
    echo "\n";
    unset($poll_update);
    unset($poll_update_query);
    unset($poll_separator);
    $poll_update_array = array();
    $update_array = array();
    $host_rrd = $config['rrd_dir'] . '/' . $device['hostname'];
    if (!is_dir($host_rrd)) {
        mkdir($host_rrd);
        echo "Created directory : {$host_rrd}\n";
    }
    $address_family = snmpTransportToAddressFamily($device['transport']);
    $ping_response = isPingable($device['hostname'], $address_family, $attribs);
    $device_perf = $ping_response['db'];
    $device_perf['device_id'] = $device['device_id'];
    $device_perf['timestamp'] = array('NOW()');
    if (can_ping_device($attribs) === true && is_array($device_perf)) {
        dbInsert($device_perf, 'device_perf');
    }
    $device['pingable'] = $ping_response['result'];
    $ping_time = $ping_response['last_ping_timetaken'];
    $response = array();
    $status_reason = '';
    if ($device['pingable']) {
        $device['snmpable'] = isSNMPable($device);
        if ($device['snmpable']) {
            $status = '1';
            $response['status_reason'] = '';
        } else {
            echo 'SNMP Unreachable';
            $status = '0';
            $response['status_reason'] = 'snmp';
        }
    } else {
        echo 'Unpingable';
        $status = '0';
        $response['status_reason'] = 'icmp';
    }
    if ($device['status'] != $status) {
        $poll_update .= $poll_separator . "`status` = '{$status}'";
        $poll_separator = ', ';
        dbUpdate(array('status' => $status, 'status_reason' => $response['status_reason']), 'devices', 'device_id=?', array($device['device_id']));
        log_event('Device status changed to ' . ($status == '1' ? 'Up' : 'Down'), $device, $status == '1' ? 'up' : 'down');
    }
    if ($status == '1') {
        $graphs = array();
        $oldgraphs = array();
        // we always want the core module to be included
        include 'includes/polling/core.inc.php';
        if ($options['m']) {
            foreach (explode(',', $options['m']) as $module) {
                if (is_file('includes/polling/' . $module . '.inc.php')) {
                    include 'includes/polling/' . $module . '.inc.php';
                }
            }
        } else {
            foreach ($config['poller_modules'] as $module => $module_status) {
                if ($attribs['poll_' . $module] || $module_status && !isset($attribs['poll_' . $module])) {
                    $module_start = microtime(true);
                    include 'includes/polling/' . $module . '.inc.php';
                    $module_time = microtime(true) - $module_start;
                    echo "Runtime for polling module '{$module}': {$module_time}\n";
                    // save per-module poller stats
                    $tags = array('module' => $module, 'rrd_def' => 'DS:poller:GAUGE:600:0:U', 'rrd_name' => array('poller-perf', $module));
                    $fields = array('poller' => $module_time);
                    data_update($device, 'poller-perf', $tags, $fields);
                    // remove old rrd
                    $oldrrd = rrd_name($device['hostname'], array('poller', $module, 'perf'));
                    if (is_file($oldrrd)) {
                        unlink($oldrrd);
                    }
                } else {
                    if (isset($attribs['poll_' . $module]) && $attribs['poll_' . $module] == '0') {
                        echo "Module [ {$module} ] disabled on host.\n";
                    } else {
                        echo "Module [ {$module} ] disabled globally.\n";
                    }
                }
            }
        }
        //end if
        if (!$options['m']) {
            // FIXME EVENTLOGGING -- MAKE IT SO WE DO THIS PER-MODULE?
            // This code cycles through the graphs already known in the database and the ones we've defined as being polled here
            // If there any don't match, they're added/deleted from the database.
            // Ideally we should hold graphs for xx days/weeks/polls so that we don't needlessly hide information.
            foreach (dbFetch('SELECT `graph` FROM `device_graphs` WHERE `device_id` = ?', array($device['device_id'])) as $graph) {
                if (isset($graphs[$graph['graph']])) {
                    $oldgraphs[$graph['graph']] = true;
                } else {
                    dbDelete('device_graphs', '`device_id` = ? AND `graph` = ?', array($device['device_id'], $graph['graph']));
                }
            }
            foreach ($graphs as $graph => $value) {
                if (!isset($oldgraphs[$graph])) {
                    echo '+';
                    dbInsert(array('device_id' => $device['device_id'], 'graph' => $graph), 'device_graphs');
                }
                echo $graph . ' ';
            }
        }
        //end if
        $device_end = microtime(true);
        $device_run = $device_end - $device_start;
        $device_time = substr($device_run, 0, 5);
        // Poller performance
        if (!empty($device_time)) {
            $tags = array('rrd_def' => 'DS:poller:GAUGE:600:0:U', 'module' => 'ALL');
            $fields = array('poller' => $device_time);
            data_update($device, 'poller-perf', $tags, $fields);
        }
        // Ping response
        if (can_ping_device($attribs) === true && !empty($ping_time)) {
            $tags = array('rrd_def' => 'DS:ping:GAUGE:600:0:65535');
            $fields = array('ping' => $ping_time);
            $update_array['last_ping'] = array('NOW()');
            $update_array['last_ping_timetaken'] = $ping_time;
            data_update($device, 'ping-perf', $tags, $fields);
        }
        $update_array['last_polled'] = array('NOW()');
        $update_array['last_polled_timetaken'] = $device_time;
        // echo("$device_end - $device_start; $device_time $device_run");
        echo "Polled in {$device_time} seconds\n";
        d_echo('Updating ' . $device['hostname'] . "\n");
        d_echo($update_array);
        $updated = dbUpdate($update_array, 'devices', '`device_id` = ?', array($device['device_id']));
        if ($updated) {
            echo "UPDATED!\n";
        }
        unset($storage_cache);
        // Clear cache of hrStorage ** MAYBE FIXME? **
        unset($cache);
        // Clear cache (unify all things here?)
    }
    //end if
}
Example #20
0
 } elseif ($key == "ceph_osdperf") {
     foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'osd'), '-*.rrd')) as $rrd_filename) {
         $graph_array['to'] = $config['time']['now'];
         $graph_array['id'] = $app['app_id'];
         if (preg_match("/.*-osd-(.+)\\.rrd\$/", $rrd_filename, $osds)) {
             $osd = $osds[1];
             echo '<h3>' . $osd . ' Latency</h3>';
             $graph_array['type'] = 'application_ceph_osd_performance';
             $graph_array['osd'] = $osd;
             echo "<tr bgcolor='{$row_colour}'><td colspan=5>";
             include 'includes/print-graphrow.inc.php';
             echo '</td></tr>';
         }
     }
 } elseif ($key == "ceph_df") {
     foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'df'), '-*.rrd')) as $rrd_filename) {
         if (preg_match("/.*-df-(.+)\\.rrd\$/", $rrd_filename, $pools)) {
             $pool = $pools[1];
             if ($pool == "c") {
                 echo '<h3>Cluster Usage</h3>';
                 $graph_array['to'] = $config['time']['now'];
                 $graph_array['id'] = $app['app_id'];
                 $graph_array['type'] = 'application_ceph_pool_df';
                 $graph_array['pool'] = $pool;
                 echo "<tr bgcolor='{$row_colour}'><td colspan=5>";
                 include 'includes/print-graphrow.inc.php';
                 echo '</td></tr>';
             } else {
                 echo '<h3>' . $pool . ' Usage</h3>';
                 $graph_array['to'] = $config['time']['now'];
                 $graph_array['id'] = $app['app_id'];
Example #21
0
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
/*
 * TinyDNS Other Graph
 * @author Daniel Preussker <*****@*****.**>
 * @copyright 2015 f0o, LibreNMS
 * @license GPL
 * @package LibreNMS
 * @subpackage Graphs
 */
require 'includes/graphs/common.inc.php';
$i = 0;
$scale_min = 0;
$nototal = 1;
$unit_text = 'Query/sec';
$rrd_filename = rrd_name($device['hostname'], array('app', 'tinydns', $app['app_id']));
$array = array('other', 'hinfo', 'rp', 'axfr');
$colours = 'mixed';
$rrd_list = array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
    foreach ($array as $ds) {
        $rrd_list[$i]['filename'] = $rrd_filename;
        $rrd_list[$i]['descr'] = strtoupper($ds);
        $rrd_list[$i]['ds'] = $ds;
        $i++;
    }
} else {
    echo "file missing: {$file}";
}
require 'includes/graphs/generic_multi_simplex_seperated.inc.php';
<?php

/*
 * LibreNMS
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
require 'includes/graphs/common.inc.php';
$rrdfilename = rrd_name($device['hostname'], 'canopy-generic-450-slaveSSR');
if (file_exists($rrdfilename)) {
    $rrd_options .= " COMMENT:'dBm                Now       Ave      Max     \\n'";
    $rrd_options .= ' DEF:ssr=' . $rrdfilename . ':ssr:AVERAGE ';
    $rrd_options .= " LINE2:ssr#9B30FF:'Signal Strength Ratio ' ";
    $rrd_options .= ' GPRINT:ssr:LAST:%0.2lf%s ';
    $rrd_options .= ' GPRINT:ssr:MIN:%0.2lf%s ';
    $rrd_options .= ' GPRINT:ssr:MAX:%0.2lf%s\\\\l ';
}
<?php

require 'includes/graphs/common.inc.php';
$colours = 'mixed';
$nototal = $width < 224 ? 1 : 0;
$unit_text = 'Milliseconds';
$rrd_filename = rrd_name($device['hostname'], array('app', 'ntpdserver', $app['app_id']));
$array = array('offset' => array('descr' => 'Offset'), 'jitter' => array('descr' => 'Jitter'), 'noise' => array('descr' => 'Noise'), 'stability' => array('descr' => 'Stability'));
$i = 0;
if (rrdtool_check_rrd_exists($rrd_filename)) {
    foreach ($array as $ds => $vars) {
        $rrd_list[$i]['filename'] = $rrd_filename;
        $rrd_list[$i]['descr'] = $vars['descr'];
        $rrd_list[$i]['ds'] = $ds;
        $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i];
        $i++;
    }
} else {
    echo "file missing: {$file}";
}
require 'includes/graphs/generic_multi_line.inc.php';
Example #24
0
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
$component = new LibreNMS\Component();
$options['filter']['type'] = array('=', 'Cisco-OTV');
$components = $component->getComponents($device['device_id'], $options);
// We only care about our device id.
$components = $components[$device['device_id']];
include "includes/graphs/common.inc.php";
$rrd_options .= " -l 0 -E ";
$rrd_options .= " COMMENT:'VLANs               Now     Min    Max\\n'";
$rrd_additions = "";
$count = 0;
foreach ($components as $id => $array) {
    if ($array['otvtype'] == 'overlay') {
        $rrd_filename = rrd_name($device['hostname'], array('cisco', 'otv', $array['label'], 'vlan'));
        if (file_exists($rrd_filename)) {
            // Stack the area on the second and subsequent DS's
            $stack = "";
            if ($count != 0) {
                $stack = ":STACK ";
            }
            // Grab a color from the array.
            if (isset($config['graph_colours']['mixed'][$count])) {
                $color = $config['graph_colours']['mixed'][$count];
            } else {
                $color = $config['graph_colours']['oranges'][$count - 7];
            }
            $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":count:AVERAGE ";
            $rrd_additions .= " AREA:DS" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'], 0, 15), 15) . "'" . $stack;
            $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%4.0lf%s ";
Example #25
0
<?php

$rrd_filename = rrd_name($device['hostname'], 'netstats-udp');
$stats = array('udpInDatagrams', 'udpOutDatagrams', 'udpInErrors', 'udpNoPorts');
$i = 0;
foreach ($stats as $stat) {
    $i++;
    $rrd_list[$i]['filename'] = $rrd_filename;
    $rrd_list[$i]['descr'] = str_replace('udp', '', $stat);
    $rrd_list[$i]['ds'] = $stat;
    if (strpos($stat, 'Out') !== false || strpos($stat, 'Retrans') !== false || strpos($stat, 'Attempt') !== false) {
        $rrd_list[$i]['invert'] = true;
    }
}
$colours = 'mixed';
$nototal = 1;
$simple_rrd = 1;
require 'includes/graphs/generic_multi_line.inc.php';
Example #26
0
<?php

require 'includes/graphs/common.inc.php';
$rrd_options .= ' -l 0 -E ';
$radio1 = rrd_name($device['hostname'], 'wificlients-radio1');
$radio2 = rrd_name($device['hostname'], 'wificlients-radio2');
if (file_exists($radio1)) {
    $rrd_options .= " COMMENT:'                           Cur   Min  Max\\n'";
    $rrd_options .= ' DEF:wificlients1=' . $radio1 . ':wificlients:AVERAGE ';
    $rrd_options .= " LINE1:wificlients1#CC0000:'Clients on Radio1    ' ";
    $rrd_options .= ' GPRINT:wificlients1:LAST:%3.0lf ';
    $rrd_options .= ' GPRINT:wificlients1:MIN:%3.0lf ';
    $rrd_options .= ' GPRINT:wificlients1:MAX:%3.0lf\\l ';
    if (file_exists($radio2)) {
        $rrd_options .= ' DEF:wificlients2=' . $radio2 . ':wificlients:AVERAGE ';
        $rrd_options .= " LINE1:wificlients2#008C00:'Clients on Radio2    ' ";
        $rrd_options .= ' GPRINT:wificlients2:LAST:%3.0lf ';
        $rrd_options .= ' GPRINT:wificlients2:MIN:%3.0lf ';
        $rrd_options .= ' GPRINT:wificlients2:MAX:%3.0lf\\l ';
    }
}
<?php

require 'includes/graphs/common.inc.php';
$rrd_options .= ' -l 0 -E ';
$rrdfilename = rrd_name($device['hostname'], 'ubnt-airfiber-mib');
if (file_exists($rrdfilename)) {
    $rrd_options .= " COMMENT:'Metres                     Now    Min     Max\\n'";
    $rrd_options .= ' DEF:radioLinkDistM=' . $rrdfilename . ':radioLinkDistM:AVERAGE ';
    $rrd_options .= " LINE1:radioLinkDistM#CC0000:'Distance             ' ";
    $rrd_options .= ' GPRINT:radioLinkDistM:LAST:%3.2lf%s ';
    $rrd_options .= ' GPRINT:radioLinkDistM:MIN:%3.2lf%s ';
    $rrd_options .= ' GPRINT:radioLinkDistM:MAX:%3.2lf%s\\\\l ';
}
Example #28
0
<?php

$scale_min = '0';
require 'includes/graphs/common.inc.php';
$device = device_by_id_cache($id);
$rrd_filename = rrd_name($device['hostname'], 'altiga-ssl');
$rrd_options .= " DEF:TotalSessions={$rrd_filename}:TotalSessions:AVERAGE";
$rrd_options .= " DEF:ActiveSessions={$rrd_filename}:ActiveSessions:AVERAGE";
$rrd_options .= " DEF:MaxSessions={$rrd_filename}:MaxSessions:AVERAGE";
$rrd_options .= ' CDEF:a=1min,100,/';
$rrd_options .= ' CDEF:b=5min,100,/';
$rrd_options .= ' CDEF:c=15min,100,/';
$rrd_options .= ' CDEF:cdefd=a,b,c,+,+';
$rrd_options .= " COMMENT:Load\\ Average\\ \\ Current\\ \\ \\ \\ Average\\ \\ \\ \\ Maximum\\\\n";
$rrd_options .= ' AREA:a#ffeeaa:1\\ Min:';
$rrd_options .= ' LINE1:a#c5aa00:';
$rrd_options .= ' GPRINT:a:LAST:\\ \\ \\ \\ %7.2lf';
$rrd_options .= ' GPRINT:a:AVERAGE:\\ \\ %7.2lf';
$rrd_options .= " GPRINT:a:MAX:\\ \\ %7.2lf\\\\n";
$rrd_options .= ' LINE1.25:b#ea8f00:5\\ Min:';
$rrd_options .= ' GPRINT:b:LAST:\\ \\ \\ \\ %7.2lf';
$rrd_options .= ' GPRINT:b:AVERAGE:\\ \\ %7.2lf';
$rrd_options .= " GPRINT:b:MAX:\\ \\ %7.2lf\\\\n";
$rrd_options .= ' LINE1.25:c#cc0000:15\\ Min';
$rrd_options .= ' GPRINT:c:LAST:\\ \\ \\ %7.2lf';
$rrd_options .= ' GPRINT:c:AVERAGE:\\ \\ %7.2lf';
$rrd_options .= " GPRINT:c:MAX:\\ \\ %7.2lf\\\\n";
Example #29
0
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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/>.
*
* @package    LibreNMS
* @link       http://librenms.org
* @copyright  2016 crcro
* @author     Cercel Valentin <*****@*****.**>
*/
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$ds = 'load';
$colour_area = 'EEEEEE';
$colour_line = 'FF3300';
$colour_area_max = 'FFEE99';
$graph_max = 0;
$unit_text = 'Percent';
$ups_apcups = rrd_name($device['hostname'], array('app', 'ups-apcups', $app['app_id']));
if (rrdtool_check_rrd_exists($ups_apcups)) {
    $rrd_filename = $ups_apcups;
}
require 'includes/graphs/generic_simplex.inc.php';
Example #30
0
 echo 'bps(' . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ')';
 echo 'bytes(' . formatStorage($port['stats']['ifInOctets_diff']) . '/' . formatStorage($port['stats']['ifOutOctets_diff']) . ')';
 echo 'pkts(' . format_si($port['stats']['ifInUcastPkts_rate']) . 'pps/' . format_si($port['stats']['ifOutUcastPkts_rate']) . 'pps)';
 // Port utilisation % threshold alerting. // FIXME allow setting threshold per-port. probably 90% of ports we don't care about.
 if ($config['alerts']['port_util_alert'] && $port['ignore'] == '0') {
     // Check for port saturation of $config['alerts']['port_util_perc'] or higher.  Alert if we see this.
     // Check both inbound and outbound rates
     $saturation_threshold = $this_port['ifSpeed'] * ($config['alerts']['port_util_perc'] / 100);
     echo 'IN: ' . $port['stats']['ifInBits_rate'] . ' OUT: ' . $port['stats']['ifOutBits_rate'] . ' THRESH: ' . $saturation_threshold;
     if (($port['stats']['ifInBits_rate'] >= $saturation_threshold || $port['stats']['ifOutBits_rate'] >= $saturation_threshold) && $saturation_threshold > 0) {
         log_event('Port reached saturation threshold: ' . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ' - ifspeed: ' . formatRates($this_port['stats']['ifSpeed']), $device, 'interface', $port['port_id']);
     }
 }
 // Update data stores
 $rrd_name = getPortRrdName($port_id);
 $rrdfile = rrd_name($device['hostname'], $rrd_name);
 $rrd_def = array('DS:INOCTETS:DERIVE:600:0:12500000000', 'DS:OUTOCTETS:DERIVE:600:0:12500000000', 'DS:INERRORS:DERIVE:600:0:12500000000', 'DS:OUTERRORS:DERIVE:600:0:12500000000', 'DS:INUCASTPKTS:DERIVE:600:0:12500000000', 'DS:OUTUCASTPKTS:DERIVE:600:0:12500000000', 'DS:INNUCASTPKTS:DERIVE:600:0:12500000000', 'DS:OUTNUCASTPKTS:DERIVE:600:0:12500000000', 'DS:INDISCARDS:DERIVE:600:0:12500000000', 'DS:OUTDISCARDS:DERIVE:600:0:12500000000', 'DS:INUNKNOWNPROTOS:DERIVE:600:0:12500000000', 'DS:INBROADCASTPKTS:DERIVE:600:0:12500000000', 'DS:OUTBROADCASTPKTS:DERIVE:600:0:12500000000', 'DS:INMULTICASTPKTS:DERIVE:600:0:12500000000', 'DS:OUTMULTICASTPKTS:DERIVE:600:0:12500000000');
 $fields = array('INOCTETS' => $this_port['ifInOctets'], 'OUTOCTETS' => $this_port['ifOutOctets'], 'INERRORS' => $this_port['ifInErrors'], 'OUTERRORS' => $this_port['ifOutErrors'], 'INUCASTPKTS' => $this_port['ifInUcastPkts'], 'OUTUCASTPKTS' => $this_port['ifOutUcastPkts'], 'INNUCASTPKTS' => $this_port['ifInNUcastPkts'], 'OUTNUCASTPKTS' => $this_port['ifOutNUcastPkts'], 'INDISCARDS' => $this_port['ifInDiscards'], 'OUTDISCARDS' => $this_port['ifOutDiscards'], 'INUNKNOWNPROTOS' => $this_port['ifInUnknownProtos'], 'INBROADCASTPKTS' => $this_port['ifInBroadcastPkts'], 'OUTBROADCASTPKTS' => $this_port['ifOutBroadcastPkts'], 'INMULTICASTPKTS' => $this_port['ifInMulticastPkts'], 'OUTMULTICASTPKTS' => $this_port['ifOutMulticastPkts']);
 if ($tune_port === true) {
     rrdtool_tune('port', $rrdfile, $this_port['ifSpeed']);
 }
 $port_descr_type = $port['port_descr_type'];
 $ifName = $port['ifName'];
 $tags = compact('ifName', 'port_descr_type', 'rrd_name', 'rrd_def');
 rrdtool_data_update($device, 'ports', $tags, $fields);
 $fields['ifInUcastPkts_rate'] = $port['ifInUcastPkts_rate'];
 $fields['ifOutUcastPkts_rate'] = $port['ifOutUcastPkts_rate'];
 $fields['ifInErrors_rate'] = $port['ifInErrors_rate'];
 $fields['ifOutErrors_rate'] = $port['ifOutErrors_rate'];
 $fields['ifInOctets_rate'] = $port['ifInOctets_rate'];
 $fields['ifOutOctets_rate'] = $port['ifOutOctets_rate'];