mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Major updates on the road to 0.7
git-svn-id: http://www.observium.org/svn/observer/trunk@492 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
77
060-to-current.sql
Normal file
77
060-to-current.sql
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
ALTER TABLE `interfaces` ADD `pagpOperationMode` VARCHAR( 32 ) NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPortState` VARCHAR( 16 ) NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerDeviceId` VARCHAR( 48 ) NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerLearnMethod` VARCHAR( 16 ) NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerIfIndex` INT NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerGroupIfIndex` INT NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerDeviceName` VARCHAR( 128 ) NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpEthcOperationMode` VARCHAR( 16 ) NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpDeviceId` VARCHAR( 48 ) NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpGroupIfIndex` INT NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `portName` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `ifName`;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifHighSpeed` INT ( 11 ) NULL DEFAULT NULL AFTER `ifSpeed`;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_input` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_input_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_input_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_input_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_output` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_output_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_output_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_output_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_input` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_input_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_input_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_input_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_output` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_output_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_output_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_output_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `poll_time` int(11) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `poll_prev` int(11) default NULL;
|
||||||
|
ALTER TABLE `mac_accounting` ADD `poll_period` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInUcastPkts` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInUcastPkts_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInUcastPkts_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInUcastPkts_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutUcastPkts` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutUcastPkts_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutUcastPkts_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutUcastPkts_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInErrors` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInErrors_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInErrors_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInErrors_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutErrors` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutErrors_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutErrors_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutErrors_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInOctets` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInOctets_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInOctets_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifInOctets_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutOctets` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutOctets_prev` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutOctets_delta` bigint(20) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifOutOctets_rate` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `poll_time` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `poll_prev` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `poll_period` int(11) default NULL;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpOperationMode` VARCHAR( 32 ) NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPortState` VARCHAR( 16 ) NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerDeviceId` VARCHAR( 48 ) NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerLearnMethod` VARCHAR( 16 ) NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerIfIndex` INT NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerGroupIfIndex` INT NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpPartnerDeviceName` VARCHAR( 128 ) NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpEthcOperationMode` VARCHAR( 16 ) NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpDeviceId` VARCHAR( 48 ) NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `pagpGroupIfIndex` INT NULL ;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifPromiscuousMode` VARCHAR( 12 ) NULL DEFAULT NULL AFTER `ifSpeed`;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifConnectorPresent` VARCHAR( 12 ) NULL DEFAULT NULL AFTER `ifSpeed`;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifName` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `ifDescr`;
|
||||||
|
ALTER TABLE `interfaces` ADD `portName` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `ifName`;
|
||||||
|
ALTER TABLE `interfaces` ADD `ifHighSpeed` INT ( 11 ) NULL DEFAULT NULL AFTER `ifSpeed`;
|
||||||
|
ALTER TABLE `interfaces` DROP `in_rate`;
|
||||||
|
ALTER TABLE `interfaces` DROP `out_rate`;
|
||||||
|
ALTER TABLE `interfaces` DROP `in_errors`;
|
||||||
|
ALTER TABLE `interfaces` DROP `out_errors`;
|
@ -1,4 +1,4 @@
|
|||||||
Release 0.6.0 ( )
|
Release 0.6.0 ( 28th August 2009 )
|
||||||
|
|
||||||
Changed IPv6 database structure and discovery *** DATABASE CHANGE ***
|
Changed IPv6 database structure and discovery *** DATABASE CHANGE ***
|
||||||
Added CollectD integration code
|
Added CollectD integration code
|
||||||
|
91
README
91
README
@ -1,71 +1,48 @@
|
|||||||
README FOR JPGRAPH 3.0.x
|
Copyright (C) 2006-2009 Adam Armstrong <adama@memetic.org>
|
||||||
========================
|
|
||||||
|
|
||||||
This package contains JpGraph, an Object Oriented PHP5 Graph Plotting library.
|
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.
|
||||||
|
|
||||||
The library is Copyright (C) 2001-2009 Aditus Consulting and
|
This program is distributed in the hope that it will be useful,
|
||||||
released under dual license QPL 1.0 for open source and educational
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
use and JpGraph Professional License for commercial use.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
Please see full license details at http://www.aditus.nu/jpgraph/
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
* --------------------------------------------------------------------
|
Please see COPYING for usage requirements and restrictions.
|
||||||
* PHP4 IS NOT SUPPORTED in the 2.x or 3.x series
|
|
||||||
* --------------------------------------------------------------------
|
|
||||||
|
|
||||||
Requirements:
|
Introduction
|
||||||
-------------
|
------------
|
||||||
Miminum:
|
|
||||||
* PHP 5.1.0 or higher
|
|
||||||
* GD 2.0.28 or higher
|
|
||||||
Note: Earlier versions might work but is unsupported.
|
|
||||||
|
|
||||||
Recommended:
|
Observer is an auto-discovering network monitoring system.
|
||||||
* PHP >= 5.2.0
|
|
||||||
* PHP Built-in GD library
|
It's designed to be an easily-navigable interface to the health of your network.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Planned Features
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* CollectD Integration * In Progress
|
||||||
|
* Full IPv6 capabilities * In Progress
|
||||||
|
* Pseudowire (MPLS/L2TP) tracking * In Progress
|
||||||
|
* MPLS IP-VPN tracking * In Progress
|
||||||
|
* 95th and metered usage tracking * In Progress
|
||||||
|
* Nagios Integration * Too scary for contempation
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
0. Make sure that the PHP version is compatible with the stated requirements
|
|
||||||
and that the PHP installation has support for the GD library.
|
|
||||||
Please run phpinfo() to check if GD library
|
|
||||||
is supported in the installation.
|
|
||||||
If the GD library doesn't seem to be installed
|
|
||||||
please consult the PHP manual under section "Image" for
|
|
||||||
instructions on where to find this library. Please refer to
|
|
||||||
the manual section "Verifying your PHP installation"
|
|
||||||
|
|
||||||
1. Unzip and copy the files to a directory of your choice where Your
|
Installation of Observer is currently not for the faint of heart! There is no automated
|
||||||
httpd sever can access them.
|
install script, so it'll probably take quite a bit of fiddling!
|
||||||
For a global site installation you should copy the files to
|
|
||||||
somewhere in the PHP search path.
|
|
||||||
|
|
||||||
2. Check that the default directory paths in jpg-config.inc
|
Please see http://www.observernms.org.
|
||||||
for cache directory and TTF directory suits your installation.
|
|
||||||
Note1: The default directories are different depending on if
|
|
||||||
the library is running on Windows or UNIX.
|
|
||||||
Note2: Apache/PHP must have write permission to your cache
|
|
||||||
directory if you enable the cache feature. By default the cache
|
|
||||||
is disabled.
|
|
||||||
|
|
||||||
3. Check that all rest of the DEFINE in jpg-config.inc
|
Please email adama@memetic.org with any feature requests, bug reports or just to tell me
|
||||||
is setup to your preference. The default should be fine
|
that you're using observer!
|
||||||
for most users.
|
|
||||||
|
|
||||||
4. Read the chapters on installation in the manual.
|
|
||||||
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
The installation includes HTML documentation and reference guide for the
|
|
||||||
library. The portal page for all the documentation is
|
|
||||||
<YOUR-INSTALLATION-DIRECTORY>/docs/index.html
|
|
||||||
|
|
||||||
|
|
||||||
Bug reports and suggestions
|
|
||||||
---------------------------
|
|
||||||
Should be reported using the the issue tracker at
|
|
||||||
|
|
||||||
http://www.aditus.nu/bugtraq
|
|
||||||
|
|
||||||
<EOF>
|
|
||||||
|
@ -12,11 +12,9 @@ $i = '0';
|
|||||||
|
|
||||||
$interface_query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id $where");
|
$interface_query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id $where");
|
||||||
while ($interface = mysql_fetch_array($interface_query)) {
|
while ($interface = mysql_fetch_array($interface_query)) {
|
||||||
$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
|
$errors = $interface['ifInErrors_delta'] + $interface['ifOutErrors_delta'];
|
||||||
$errors = interface_errors($rrdfile);
|
if($errors > '1') {
|
||||||
mysql_query("UPDATE `interfaces` SET in_errors = '" . $errors['in'] . "', out_errors = '" . $errors['out'] . "' WHERE interface_id = '" . $interface['interface_id'] . "'");
|
$errored[] = $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $interface['ifInErrors_delta'] . " - " . $interface['ifOutErrors_delta'];
|
||||||
if($errors['in'] > '100' || $errors['out'] > '100') {
|
|
||||||
$errored[] = $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $errors['in'] . " - " . $errors['out'];
|
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -25,19 +25,23 @@ while ($device = mysql_fetch_array($device_query)) {
|
|||||||
$host = $id;
|
$host = $id;
|
||||||
|
|
||||||
echo("\nDetecting CDP neighbours on $device[1]...\n");
|
echo("\nDetecting CDP neighbours on $device[1]...\n");
|
||||||
$snmp = new snmpCDP($hostname, $community);
|
# $snmp = new snmpCDP($hostname, $community);
|
||||||
$ports = $snmp->getports();
|
# $ports = $snmp->getports();
|
||||||
$cdp = $snmp->explore_cdp($ports);
|
# $cdp = $snmp->explore_cdp($ports);
|
||||||
|
|
||||||
|
# $cdp_links = "";
|
||||||
|
|
||||||
|
# foreach (array_keys($cdp) as $key) {
|
||||||
|
# $port = $ports[$key];
|
||||||
|
# $link = $cdp[$key];
|
||||||
|
# $cdp_links .= $hostname . "," . $port['desc'] . "," . $link['host'] . "," . $link['port'] . "\n";
|
||||||
|
# }
|
||||||
|
|
||||||
|
# $cdp_links = trim($cdp_links);
|
||||||
|
|
||||||
|
|
||||||
$cdp_links = "";
|
|
||||||
|
|
||||||
foreach (array_keys($cdp) as $key) {
|
|
||||||
$port = $ports[$key];
|
|
||||||
$link = $cdp[$key];
|
|
||||||
$cdp_links .= $hostname . "," . $port['desc'] . "," . $link['host'] . "," . $link['port'] . "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$cdp_links = trim($cdp_links);
|
|
||||||
|
|
||||||
foreach ( explode("\n" ,$cdp_links) as $link ) {
|
foreach ( explode("\n" ,$cdp_links) as $link ) {
|
||||||
if ($link == "") { break; }
|
if ($link == "") { break; }
|
||||||
|
117
html/graph.php
117
html/graph.php
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
if($_GET['debug']) {
|
if($_GET['debug']) {
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
ini_set('display_startup_errors', 0);
|
ini_set('display_startup_errors', 0);
|
||||||
@ -13,15 +14,9 @@ if($_GET['debug']) {
|
|||||||
include("../includes/graphing.php");
|
include("../includes/graphing.php");
|
||||||
include("includes/authenticate.inc");
|
include("includes/authenticate.inc");
|
||||||
|
|
||||||
if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }
|
# if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }
|
||||||
|
|
||||||
if($_GET['params']) {
|
if($_GET['device']) {
|
||||||
list($_GET['host'], $_GET['if'], $_GET['from'], $_GET['to'], $_GET['width'], $_GET['height'], $_GET['title'], $_GET['vertical'], $_GET['type'], $_GET['interfaces']) = explode("||", mcrypt_ecb(MCRYPT_DES, $key_value, $_GET['params'], MCRYPT_DECRYPT));
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_GET['host']) {
|
|
||||||
$device_id = $_GET['host'];
|
|
||||||
} elseif($_GET['device']) {
|
|
||||||
$device_id = $_GET['device'];
|
$device_id = $_GET['device'];
|
||||||
} elseif($_GET['if']) {
|
} elseif($_GET['if']) {
|
||||||
$device_id = getifhost($_GET['if']);
|
$device_id = getifhost($_GET['if']);
|
||||||
@ -33,22 +28,44 @@ if($_GET['debug']) {
|
|||||||
$device_id = getpeerhost($_GET['peer']);
|
$device_id = getpeerhost($_GET['peer']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_GET['legend']) { $legend = $_GET['legend']; } else { $legend = '1'; }
|
|
||||||
if($_GET['inverse']) { $inverse = $_GET['inverse']; }
|
|
||||||
if($device_id) { $hostname = gethostbyid($device_id); }
|
if($device_id) { $hostname = gethostbyid($device_id); }
|
||||||
|
|
||||||
$from = $_GET['from'];
|
$from = mres($_GET['from']);
|
||||||
$to = $_GET['to'];
|
$to = mres($_GET['to']);
|
||||||
$width = $_GET['width'];
|
$width = mres($_GET['width']);
|
||||||
$height = $_GET['height'];
|
$height = mres($_GET['height']);
|
||||||
$title = $_GET['title'];
|
$title = mres($_GET['title']);
|
||||||
$vertical = $_GET['vertical'];
|
$vertical = mres($_GET['vertical']);
|
||||||
$type = $_GET['type'];
|
$type = mres($_GET['type']);
|
||||||
|
|
||||||
$graphfile = strgen() . ".png";
|
$graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
|
||||||
|
|
||||||
$os = gethostosbyid($device_id);
|
$os = gethostosbyid($device_id);
|
||||||
|
|
||||||
|
if(is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".strtolower($os).".inc.php")) {
|
||||||
|
include($config['install_dir'] . "/html/includes/graphs/".$type."_".strtolower($os).".inc.php");
|
||||||
|
} elseif(is_file($config['install_dir'] . "/html/includes/graphs/$type.inc.php")) {
|
||||||
|
include($config['install_dir'] . "/html/includes/graphs/$type.inc.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($rrd_options) {
|
||||||
|
# echo("<pre>".$config['rrdtool'] . " graph $graphfile $rrd_options");
|
||||||
|
$thing = shell_exec($config['rrdtool'] . " graph $graphfile $rrd_options");
|
||||||
|
if(is_file($graphfile)) {
|
||||||
|
header('Content-type: image/png');
|
||||||
|
echo(`cat $graphfile`);
|
||||||
|
} else {
|
||||||
|
header('Content-type: image/png');
|
||||||
|
$string = "Graph Generation Error";
|
||||||
|
$im = imagecreate($width, $height);
|
||||||
|
$orange = imagecolorallocate($im, 255, 255, 255);
|
||||||
|
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
|
||||||
|
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
|
||||||
|
imagepng($im);
|
||||||
|
imagedestroy($im);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'cisco_entity_sensor':
|
case 'cisco_entity_sensor':
|
||||||
$graph = graph_entity_sensor ($_GET['a'], $graphfile, $from, $to, $width, $height, $title, $vertical);
|
$graph = graph_entity_sensor ($_GET['a'], $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
@ -79,7 +96,6 @@ if($_GET['debug']) {
|
|||||||
$groups = array($_GET['interfaces'], $_GET['interfaces_b'], $_GET['interfaces_c']);
|
$groups = array($_GET['interfaces'], $_GET['interfaces_b'], $_GET['interfaces_c']);
|
||||||
$graph = graph_multi_bits_trio ($groups, $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
|
$graph = graph_multi_bits_trio ($groups, $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'adsl_rate':
|
case 'adsl_rate':
|
||||||
$graph = graph_adsl_rate ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height);
|
$graph = graph_adsl_rate ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height);
|
||||||
break;
|
break;
|
||||||
@ -102,21 +118,6 @@ if($_GET['debug']) {
|
|||||||
case 'mac_acc_bits':
|
case 'mac_acc_bits':
|
||||||
$graph = graph_mac_acc ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
|
$graph = graph_mac_acc ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
break;
|
break;
|
||||||
case 'bits':
|
|
||||||
$graph = graph_bits ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
|
|
||||||
break;
|
|
||||||
case 'pkts':
|
|
||||||
$graph = pktsgraph ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
break;
|
|
||||||
case 'errors':
|
|
||||||
$graph = errorgraph ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
break;
|
|
||||||
case 'nupkts':
|
|
||||||
$graph = nucastgraph ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
break;
|
|
||||||
case 'uptime':
|
|
||||||
$graph = uptimegraph ($hostname . "/uptime.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
break;
|
|
||||||
case 'unixfs_dev':
|
case 'unixfs_dev':
|
||||||
$graph = unixfsgraph_dev ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
$graph = unixfsgraph_dev ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
break;
|
break;
|
||||||
@ -134,39 +135,6 @@ if($_GET['debug']) {
|
|||||||
case 'calls':
|
case 'calls':
|
||||||
$graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
$graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
break;
|
break;
|
||||||
case 'ip_graph':
|
|
||||||
$graph = ip_graph ($hostname . "/netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
break;
|
|
||||||
case 'icmp_graph':
|
|
||||||
$graph = icmp_graph ($hostname . "/netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
break;
|
|
||||||
case 'tcp_graph':
|
|
||||||
$graph = tcp_graph ($hostname . "/netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
break;
|
|
||||||
case 'udp_graph':
|
|
||||||
$graph = udp_graph ($hostname . "/netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
break;
|
|
||||||
case 'cpu':
|
|
||||||
if($os == "Linux" || $os == "NetBSD" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "Windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfSense" || $os == "DragonFly" || $os == "OpenBSD") {
|
|
||||||
$graph = cpugraphUnix ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
} elseif($os == "IOS" || $os == "IOS XE") {
|
|
||||||
$graph = graph_device_cpmCPU ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
} elseif($os == "CatOS") {
|
|
||||||
$graph = cpugraph ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
} elseif($os == "Windows") {
|
|
||||||
$graph = cpugraphwin ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
} elseif($os == "ProCurve") {
|
|
||||||
$graph = cpugraphHP ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
} elseif($os == "Snom") {
|
|
||||||
$graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
} elseif($os == "ScreenOS") {
|
|
||||||
$graph = graph_netscreen_cpu ($hostname . "/netscreen-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
} elseif($os == "Fortigate") {
|
|
||||||
$graph = graph_fortigate_cpu ($hostname . "/fortigate-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
} elseif($os == "JunOS") {
|
|
||||||
$graph = graph_cpu_generic_single($hostname . "/junos-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'dev_cpmCPU':
|
case 'dev_cpmCPU':
|
||||||
$graph = graph_device_cpmCPU ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
$graph = graph_device_cpmCPU ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
break;
|
break;
|
||||||
@ -250,18 +218,12 @@ if($_GET['debug']) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(is_file($config['install_dir'] . "/html/includes/graphs/$type.inc.php")) {
|
|
||||||
include($config['install_dir'] . "/html/includes/graphs/$type.inc.php");
|
|
||||||
} else {
|
|
||||||
echo("INCORRECT GRAPH TYPE");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
} // End SWITCH
|
||||||
|
|
||||||
if($graph) {
|
if($graph) {
|
||||||
header('Content-type: image/png');
|
header('Content-type: image/png');
|
||||||
echo(`cat graphs/$graphfile`);
|
echo(`cat $graphfile`);
|
||||||
} else {
|
} else {
|
||||||
header('Content-type: image/png');
|
header('Content-type: image/png');
|
||||||
$string = "Graph Generation Error";
|
$string = "Graph Generation Error";
|
||||||
@ -273,6 +235,9 @@ if($_GET['debug']) {
|
|||||||
imagedestroy($im);
|
imagedestroy($im);
|
||||||
}
|
}
|
||||||
|
|
||||||
$delete = `rm graphs/$graphfile`;
|
$delete = `rm $graphfile`;
|
||||||
|
|
||||||
|
} // End IF
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,25 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '".mres($_GET['a'])."' and D.device_id = E.device_id"));
|
||||||
|
|
||||||
|
switch ($sensor['entSensorType']) {
|
||||||
|
case 'celsius':
|
||||||
|
case 'watts':
|
||||||
|
case 'voltsDC':
|
||||||
|
case 'amperes':
|
||||||
|
$scale_min = "0";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
include("common.inc.php");
|
include("common.inc.php");
|
||||||
|
|
||||||
|
$rrd_filename = $config['rrd_dir'] . "/" . $sensor['hostname'] . "/ces-" . $sensor['entPhysicalIndex'] . ".rrd";
|
||||||
|
|
||||||
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '".mres($_GET['a'])."' and D.device_id = E.device_id"));
|
$type = str_pad($sensor['entSensorType'], 8);
|
||||||
|
$type = substr($type,0,8);
|
||||||
|
|
||||||
$rrd_filename = $config['rrd_dir'] . "/" . $sensor['hostname'] . "/ces-" . $sensor['entPhysicalIndex'] . ".rrd";
|
$rrd_options .= " DEF:avg=$rrd_filename:value:AVERAGE";
|
||||||
|
$rrd_options .= " DEF:min=$rrd_filename:value:MIN";
|
||||||
$type = str_pad($sensor['entSensorType'], 8);
|
$rrd_options .= " DEF:max=$rrd_filename:value:MAX";
|
||||||
$type = substr($type,0,8);
|
$rrd_options .= " COMMENT:' Last Min Max Ave\\n'";
|
||||||
$rrd_options .= " DEF:avg=$rrd_filename:value:AVERAGE";
|
$rrd_options .= " AREA:max#a5a5a5";
|
||||||
$rrd_options .= " DEF:min=$rrd_filename:value:MIN";
|
$rrd_options .= " AREA:min#ffffff";
|
||||||
$rrd_options .= " DEF:max=$rrd_filename:value:MAX";
|
$rrd_options .= " LINE1.25:avg#aa2200:'".$type."'";
|
||||||
$rrd_options .= " COMMENT:' Last Min Max Ave\\n'";
|
$rrd_options .= " GPRINT:avg:AVERAGE:%5.2lf%s";
|
||||||
$rrd_options .= " AREA:max#a5a5a5";
|
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
||||||
$rrd_options .= " AREA:min#ffffff";
|
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
||||||
$rrd_options .= " LINE1.25:avg#aa2200:'".$type."'";
|
$rrd_options .= " GPRINT:avg:LAST:%5.2lf%s";
|
||||||
$rrd_options .= " GPRINT:avg:AVERAGE:%5.2lf%s";
|
|
||||||
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
|
||||||
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
|
||||||
$rrd_options .= " GPRINT:avg:LAST:%5.2lf%s";
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -14,8 +14,8 @@ if($_GET['legend'] == "no") { $rrd_options = " -g"; }
|
|||||||
|
|
||||||
if(!$scale_min && !$scale_max) { $rrd_options .= " --alt-autoscale-max"; }
|
if(!$scale_min && !$scale_max) { $rrd_options .= " --alt-autoscale-max"; }
|
||||||
|
|
||||||
if($scale_min) { $rrd_options .= " -l $scale_min"; }
|
if(isset($scale_min)) { $rrd_options .= " -l $scale_min"; }
|
||||||
if($scale_max) { $rrd_options .= " -u $scale_max"; }
|
if(isset($scale_max)) { $rrd_options .= " -u $scale_max"; }
|
||||||
|
|
||||||
|
|
||||||
$rrd_options .= " -E --start ".$from." --end " . ($to - 150) . " --width ".$width." --height ".$height." ";
|
$rrd_options .= " -E --start ".$from." --end " . ($to - 150) . " --width ".$width." --height ".$height." ";
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($os == "Linux" || $os == "NetBSD" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "Windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfSense" || $os == "DragonFly" || $os == "OpenBSD") {
|
$os = strtolower($os);
|
||||||
|
|
||||||
|
if($os == "linux" || $os == "netbsd" || $os == "freebsd" || $os == "dragonfly" || $os == "openbsd" || $os == "windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfsense" || $os == "dragonfly" || $os == "openbsd") {
|
||||||
include("device_cpu_unix.inc.php");
|
include("device_cpu_unix.inc.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$os = strtolower($os);
|
||||||
|
|
||||||
|
if($os == "linux" || $os == "netbsd" || $os == "freebsd" || $os == "dragonfly" || $os == "openbsd" || $os == "windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfsense" || $os == "dragonfly" || $os == "openbsd") {
|
||||||
|
include("device_memory_unix.inc.php");
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$scale_min = "0";
|
||||||
|
|
||||||
include("common.inc.php");
|
include("common.inc.php");
|
||||||
|
|
||||||
|
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||||
|
|
||||||
|
|
||||||
$sql = mysql_query("SELECT * FROM temperature where temp_id = '$temp'");
|
$sql = mysql_query("SELECT * FROM temperature where temp_id = '$temp'");
|
||||||
$temperature = mysql_fetch_array(mysql_query("SELECT * FROM temperature where temp_id = '".mres($_GET['id'])."'"));
|
$temperature = mysql_fetch_array(mysql_query("SELECT * FROM temperature where temp_id = '".mres($_GET['id'])."'"));
|
||||||
|
|
||||||
@ -16,10 +21,13 @@ include("common.inc.php");
|
|||||||
|
|
||||||
$rrd_options .= " DEF:temp=$rrd_filename:temp:AVERAGE";
|
$rrd_options .= " DEF:temp=$rrd_filename:temp:AVERAGE";
|
||||||
$rrd_options .= " CDEF:tempwarm=temp,".$temperature[temp_limit].",GT,temp,UNKN,IF";
|
$rrd_options .= " CDEF:tempwarm=temp,".$temperature[temp_limit].",GT,temp,UNKN,IF";
|
||||||
|
$rrd_options .= " CDEF:tempcold=temp,20,LT,temp,UNKN,IF";
|
||||||
|
$rrd_options .= " AREA:temp#FFFF99";
|
||||||
|
$rrd_options .= " AREA:tempwarm#FF9999";
|
||||||
|
$rrd_options .= " AREA:tempcold#CCCCFF";
|
||||||
$rrd_options .= " LINE1.5:temp#cc0000:'" . quotemeta($temperature[temp_descr_fixed]."'");
|
$rrd_options .= " LINE1.5:temp#cc0000:'" . quotemeta($temperature[temp_descr_fixed]."'");
|
||||||
$rrd_options .= " LINE1.5:tempwarm#660000";
|
$rrd_options .= " LINE1.5:tempwarm#660000";
|
||||||
$rrd_options .= " GPRINT:temp:LAST:%3.0lfC";
|
$rrd_options .= " GPRINT:temp:LAST:%3.0lfC";
|
||||||
$rrd_options .= " GPRINT:temp:MAX:%3.0lfC\\\\l";
|
$rrd_options .= " GPRINT:temp:MAX:%3.0lfC\\\\l";
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$daily_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
$daily_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||||
$daily_traffic .= $args;
|
$daily_traffic .= $args;
|
||||||
$daily_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
$daily_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
||||||
$daily_url .= $args;
|
$daily_url .= $args;
|
||||||
|
|
||||||
$weekly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
$weekly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||||
$weekly_traffic .= $args;
|
$weekly_traffic .= $args;
|
||||||
$weekly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
$weekly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
||||||
$weekly_url .= $args;
|
$weekly_url .= $args;
|
||||||
|
|
||||||
$monthly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
$monthly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||||
$monthly_traffic .= $args;
|
$monthly_traffic .= $args;
|
||||||
$monthly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
$monthly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
||||||
$monthly_url .= $args;
|
$monthly_url .= $args;
|
||||||
|
|
||||||
$yearly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
$yearly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||||
$yearly_traffic .= $args;
|
$yearly_traffic .= $args;
|
||||||
$yearly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
$yearly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||||
$yearly_url .= $args;
|
$yearly_url .= $args;
|
||||||
|
|
||||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||||
|
@ -6,17 +6,17 @@
|
|||||||
|
|
||||||
if(!$device) { $device['device_id'] = getifhost($interface['interface_id']); }
|
if(!$device) { $device['device_id'] = getifhost($interface['interface_id']); }
|
||||||
|
|
||||||
$daily_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
$daily_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||||
$daily_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
|
$daily_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
|
||||||
|
|
||||||
$weekly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
$weekly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||||
$weekly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
|
$weekly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
|
||||||
|
|
||||||
$monthly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
$monthly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||||
$monthly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
|
$monthly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
|
||||||
|
|
||||||
$yearly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
$yearly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||||
$yearly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
|
$yearly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
|
||||||
|
|
||||||
echo("<a href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
echo("<a href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||||
<img src='$daily_traffic' border=0></a> ");
|
<img src='$daily_traffic' border=0></a> ");
|
@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#echo("<pre>");
|
||||||
|
#print_r($interface);
|
||||||
|
#echo("</pre>");
|
||||||
|
|
||||||
# This file prints a table row for each interface
|
# This file prints a table row for each interface
|
||||||
|
|
||||||
$interface['device_id'] = $device['device_id'];
|
$interface['device_id'] = $device['device_id'];
|
||||||
@ -11,8 +15,8 @@
|
|||||||
|
|
||||||
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||||
|
|
||||||
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
|
if($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
|
||||||
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
|
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>","port_errors");
|
||||||
} else { $error_img = ""; }
|
} else { $error_img = ""; }
|
||||||
|
|
||||||
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){
|
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){
|
||||||
@ -48,22 +52,24 @@
|
|||||||
echo("</td><td width=100>");
|
echo("</td><td width=100>");
|
||||||
|
|
||||||
if($port_details) {
|
if($port_details) {
|
||||||
$interface['graph_type'] = "bits";
|
$interface['graph_type'] = "port_bits";
|
||||||
echo(generateiflink($interface, "<img src='graph.php?type=bits&if=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
echo(generateiflink($interface, "<img src='graph.php?type=port_bits&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||||
$interface['graph_type'] = "pkts";
|
$interface['graph_type'] = "port_upkts";
|
||||||
echo(generateiflink($interface, "<img src='graph.php?type=pkts&if=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
echo(generateiflink($interface, "<img src='graph.php?type=port_upkts&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||||
$interface['graph_type'] = "errors";
|
$interface['graph_type'] = "port_errors";
|
||||||
echo(generateiflink($interface, "<img src='graph.php?type=errors&if=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
echo(generateiflink($interface, "<img src='graph.php?type=port_errors&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("</td><td width=120>");
|
echo("</td><td width=120>");
|
||||||
if($interface['ifOperStatus'] == "up") {
|
if($interface['ifOperStatus'] == "up") {
|
||||||
|
$interface['in_rate'] = $interface['ifInOctets_rate'] * 8;
|
||||||
|
$interface['out_rate'] = $interface['ifOutOctets_rate'] * 8;
|
||||||
$in_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
$in_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
||||||
$out_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
$out_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
|
||||||
echo("<img src='images/16/arrow_left.png' align=absmiddle> <span style='color: " . percent_colour($in_perc) . "'>" .
|
echo("<img src='images/16/arrow_left.png' align=absmiddle> <span style='color: " . percent_colour($in_perc) . "'>" .
|
||||||
formatRates($interface['in_rate']) . "</span><br />");
|
formatRates($interface['in_rate']) . "<br />".format_bi($interface['ifInUcastPkts_rate'])."pps</span><br />");
|
||||||
echo("<img align=absmiddle src='images/16/arrow_out.png'> <span style='color: " . percent_colour($out_perc) . "'>" .
|
echo("<img align=absmiddle src='images/16/arrow_out.png'> <span style='color: " . percent_colour($out_perc) . "'>" .
|
||||||
formatRates($interface['out_rate']) . "</span>");
|
formatRates($interface['out_rate']) . "<br />".format_bi($interface['ifOutUcastPkts_rate'])."pps</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("</td><td width=75>");
|
echo("</td><td width=75>");
|
||||||
@ -198,7 +204,6 @@ echo("</td>");
|
|||||||
unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
|
unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo("</td></tr>");
|
echo("</td></tr>");
|
||||||
|
|
||||||
// If we're showing graphs, generate the graph and print the img tags
|
// If we're showing graphs, generate the graph and print the img tags
|
||||||
@ -206,17 +211,17 @@ echo("</td>");
|
|||||||
|
|
||||||
$type = $graph_type;
|
$type = $graph_type;
|
||||||
|
|
||||||
$daily_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=210&height=100";
|
$daily_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=210&height=100";
|
||||||
$daily_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=500&height=150";
|
$daily_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=500&height=150";
|
||||||
|
|
||||||
$weekly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=210&height=100";
|
$weekly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=210&height=100";
|
||||||
$weekly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=500&height=150";
|
$weekly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=500&height=150";
|
||||||
|
|
||||||
$monthly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=210&height=100";
|
$monthly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=210&height=100";
|
||||||
$monthly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=500&height=150";
|
$monthly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=500&height=150";
|
||||||
|
|
||||||
$yearly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
|
$yearly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
|
||||||
$yearly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
|
$yearly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
|
||||||
|
|
||||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=7>");
|
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=7>");
|
||||||
|
|
@ -13,7 +13,7 @@ $interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS
|
|||||||
$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifOperStatus = 'down' AND I.ifAdminStatus = 'up' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0);
|
$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifOperStatus = 'down' AND I.ifAdminStatus = 'up' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0);
|
||||||
$interfaces['shutdown'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifAdminStatus = 'down' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0);
|
$interfaces['shutdown'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifAdminStatus = 'down' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0);
|
||||||
$interfaces['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '1' OR D.ignore = '1')"),0);
|
$interfaces['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '1' OR D.ignore = '1')"),0);
|
||||||
$interfaces['errored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '0' OR D.ignore = '0') AND (I.in_errors > '0' OR I.out_errors > '0')"),0);
|
$interfaces['errored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '0' OR D.ignore = '0') AND (I.ifInErrors_delta > '0' OR I.ifOutErrors_delta > '0')"),0);
|
||||||
|
|
||||||
|
|
||||||
$services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services"),0);
|
$services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services"),0);
|
||||||
|
@ -35,11 +35,20 @@
|
|||||||
list(,$circuit) = preg_split("/[\{\}]/", $interface['ifAlias']);
|
list(,$circuit) = preg_split("/[\{\}]/", $interface['ifAlias']);
|
||||||
list(,$notes) = preg_split("/[\(\)]/", $interface['ifAlias']);
|
list(,$notes) = preg_split("/[\(\)]/", $interface['ifAlias']);
|
||||||
list(,$speed) = preg_split("/[\[\]]/", $interface['ifAlias']);
|
list(,$speed) = preg_split("/[\[\]]/", $interface['ifAlias']);
|
||||||
|
$customer = trim($customer);
|
||||||
|
|
||||||
if ($customer == $prev_customer) {
|
if ($customer == $prev_customer) {
|
||||||
unset($customer);
|
unset($customer);
|
||||||
} else {
|
} else {
|
||||||
|
if(isset($prev_customer)) {
|
||||||
|
echo("<tr bgcolor='$bg_colour'><td></td><td colspan=6>
|
||||||
|
<img src='http://observer2.as8681.net/graph.php?cust=".rawurlencode($customer)."&type=customer_bits&from=1256573330&to=-300s&width=215&height=100'>
|
||||||
|
<img src='http://observer2.as8681.net/graph.php?cust=".rawurlencode($customer)."&type=customer_bits&from=1256573330&to=-300s&width=215&height=100'>
|
||||||
|
<img src='http://observer2.as8681.net/graph.php?cust=".rawurlencode($customer)."&type=customer_bits&from=1256573330&to=-300s&width=215&height=100'>
|
||||||
|
<img src='http://observer2.as8681.net/graph.php?cust=".rawurlencode($customer)."&type=customer_bits&from=1256573330&to=-300s&width=215&height=100'>
|
||||||
|
</td></tr>");
|
||||||
|
}
|
||||||
|
|
||||||
if(is_integer($customers/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
if(is_integer($customers/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||||
$customers++;
|
$customers++;
|
||||||
$prev_customer = $customer;
|
$prev_customer = $customer;
|
||||||
|
@ -15,10 +15,10 @@ while($device = mysql_fetch_array($device_query)) {
|
|||||||
switch ($device['os']) {
|
switch ($device['os']) {
|
||||||
case "JunOS":
|
case "JunOS":
|
||||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
$graph_type = "device_cpu"; include ("includes/print-device-graph.php");
|
||||||
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
||||||
echo("<div class=graphhead>Temperatures</div>");
|
echo("<div class=graphhead>Temperatures</div>");
|
||||||
$graph_type = "dev_temp"; include ("includes/print-device-graph.php");
|
$graph_type = "dev_temperatures"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,18 +73,18 @@ while($device = mysql_fetch_array($device_query)) {
|
|||||||
|
|
||||||
case "ProCurve":
|
case "ProCurve":
|
||||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
$graph_type = "device_cpu"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>Memory Usage</div>");
|
echo("<div class=graphhead>Memory Usage</div>");
|
||||||
$graph_type = "mem"; include ("includes/print-device-graph.php");
|
$graph_type = "device_memory"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>Device Uptime</div>");
|
echo("<div class=graphhead>Device Uptime</div>");
|
||||||
$graph_type = "uptime"; include ("includes/print-device-graph.php"); break;
|
$graph_type = "device_uptime"; include ("includes/print-device-graph.php"); break;
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "Windows":
|
case "Windows":
|
||||||
$graph_type = "cpu";
|
$graph_type = "device_cpu";
|
||||||
include ("includes/print-device-graph.php");
|
include ("includes/print-device-graph.php");
|
||||||
|
|
||||||
$memgraph = memgraphWin ($device[hostname] . "-mem.rrd", $device[hostname] . "-mem.png", $day, $now, 335, 100);
|
$memgraph = memgraphWin ($device[hostname] . "-mem.rrd", $device[hostname] . "-mem.png", $day, $now, 335, 100);
|
||||||
@ -106,31 +106,31 @@ while($device = mysql_fetch_array($device_query)) {
|
|||||||
case "OpenBSD":
|
case "OpenBSD":
|
||||||
case "pfSense":
|
case "pfSense":
|
||||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
$graph_type = "device_cpu"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
if($device[os] == "m0n0wall" || $device[os] == "pfSense" || $device[os] == "Voswall" || $device[monowall]) {
|
if($device[os] == "m0n0wall" || $device[os] == "pfSense" || $device[os] == "Voswall" || $device[monowall]) {
|
||||||
echo("<div class=graphhead>IP Statistics</div>");
|
echo("<div class=graphhead>IP Statistics</div>");
|
||||||
$graph_type = "ip_graph"; include ("includes/print-device-graph.php");
|
$graph_type = "device_ip"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>Device Uptime</div>");
|
echo("<div class=graphhead>Device Uptime</div>");
|
||||||
$graph_type = "uptime"; include ("includes/print-device-graph.php");
|
$graph_type = "device_uptime"; include ("includes/print-device-graph.php");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if($device['os'] != "NetBSD") {
|
if($device['os'] != "NetBSD") {
|
||||||
echo("<div class=graphhead>Memory Utilisation</div>");
|
echo("<div class=graphhead>Memory Utilisation</div>");
|
||||||
$graph_type = "mem"; include ("includes/print-device-graph.php");
|
$graph_type = "device_memory"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mysql_result(mysql_query("SELECT count(storage_id) FROM storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
|
if(mysql_result(mysql_query("SELECT count(storage_id) FROM storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
|
||||||
echo("<div class=graphhead>Storage</div>");
|
echo("<div class=graphhead>Storage</div>");
|
||||||
$graph_type = "unixfs_dev"; include ("includes/print-device-graph.php");
|
$graph_type = "device_unixfs"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
||||||
echo("<div class=graphhead>Temperatures</div>");
|
echo("<div class=graphhead>Temperatures</div>");
|
||||||
$graph_type = "dev_temp"; include ("includes/print-device-graph.php");
|
$graph_type = "device_temperatures"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,35 +138,14 @@ while($device = mysql_fetch_array($device_query)) {
|
|||||||
include("graphs/uptime.inc.php");
|
include("graphs/uptime.inc.php");
|
||||||
|
|
||||||
echo("<div class=graphhead>System Load</div>");
|
echo("<div class=graphhead>System Load</div>");
|
||||||
$graph_type = "load"; include ("includes/print-device-graph.php");
|
$graph_type = "device_load"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>Users Logged On</div>");
|
echo("<div class=graphhead>Users Logged On</div>");
|
||||||
$graph_type = "users"; include ("includes/print-device-graph.php");
|
$graph_type = "device_users"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>Running Processes</div>");
|
echo("<div class=graphhead>Running Processes</div>");
|
||||||
$graph_type = "procs"; include ("includes/print-device-graph.php");
|
$graph_type = "device_procs"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
if($device[postfix] == '1') {
|
|
||||||
echo("<div class=graphhead>Postfix Messages</div>");
|
|
||||||
$graph_type = "postfix"; include ("includes/print-device-graph.php");
|
|
||||||
echo("<br />");
|
|
||||||
echo("<div class=graphhead>Postfix Errors</div>");
|
|
||||||
$graph_type = "postfixerrors"; include ("includes/print-device-graph.php");
|
|
||||||
echo("<br />");
|
|
||||||
}
|
|
||||||
if($device[courier] == '1') {
|
|
||||||
echo("<div class=graphhead>Courier IMAP/POP3</div>");
|
|
||||||
$graph_type = "courier"; include ("includes/print-device-graph.php");
|
|
||||||
echo("<br />");
|
|
||||||
}
|
|
||||||
if($device[apache] == '1') {
|
|
||||||
echo("<div class=graphhead>Apache Hits</div>");
|
|
||||||
$graph_type = "apachehits"; include ("includes/print-device-graph.php");
|
|
||||||
echo("<br />");
|
|
||||||
echo("<div class=graphhead>Apache Traffic</div>");
|
|
||||||
$graph_type = "apachebits"; include ("includes/print-device-graph.php");
|
|
||||||
echo("<br />");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "CatOS":
|
case "CatOS":
|
||||||
@ -177,7 +156,7 @@ while($device = mysql_fetch_array($device_query)) {
|
|||||||
break;
|
break;
|
||||||
case "Snom":
|
case "Snom":
|
||||||
echo("<div class=graphhead>Calls</div>");
|
echo("<div class=graphhead>Calls</div>");
|
||||||
$graph_type = "calls"; include ("includes/print-device-graph.php");
|
$graph_type = "snom_calls"; include ("includes/print-device-graph.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($memgraph) {
|
if($memgraph) {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo("<div class=graphhead>IP Statistics</div>");
|
echo("<div class=graphhead>IP Statistics</div>");
|
||||||
$graph_type = "ip_graph"; include ("includes/print-device-graph.php");
|
$graph_type = "device_ip"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>TCP Statistics</div>");
|
echo("<div class=graphhead>TCP Statistics</div>");
|
||||||
$graph_type = "tcp_graph"; include ("includes/print-device-graph.php");
|
$graph_type = "device_tcp"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>UDP Statistics</div>");
|
echo("<div class=graphhead>UDP Statistics</div>");
|
||||||
$graph_type = "udp_graph"; include ("includes/print-device-graph.php");
|
$graph_type = "device_udp"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>ICMP Statistics</div>");
|
echo("<div class=graphhead>ICMP Statistics</div>");
|
||||||
$graph_type = "icmp_graph"; include ("includes/print-device-graph.php");
|
$graph_type = "device_icmp"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo("<div class=graphhead>CPU Usage</div>");
|
echo("<div class=graphhead>CPU Usage</div>");
|
||||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
$graph_type = "device_cpu"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>Memory Usage</div>");
|
echo("<div class=graphhead>Memory Usage</div>");
|
||||||
$graph_type = "mem"; include ("includes/print-device-graph.php");
|
$graph_type = "device_memory"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
||||||
echo("<div class=graphhead>Temperatures</div>");
|
echo("<div class=graphhead>Temperatures</div>");
|
||||||
$graph_type = "dev_temp"; include ("includes/print-device-graph.php");
|
$graph_type = "device_temperatures"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo("<div class=graphhead>Device Uptime</div>");
|
echo("<div class=graphhead>Device Uptime</div>");
|
||||||
$graph_type = "uptime"; include ("includes/print-device-graph.php");
|
$graph_type = "device_uptime"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ while($temp = mysql_fetch_array($query)) {
|
|||||||
</tr>\n");
|
</tr>\n");
|
||||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
||||||
|
|
||||||
$graph_type = "temp";
|
$graph_type = "temperature";
|
||||||
|
|
||||||
// start temperature graphs
|
// start temperature graphs
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ $interface = mysql_fetch_array($interface_query);
|
|||||||
|
|
||||||
echo("<div class=ifcell style='margin: 0px;'><table width=100% cellpadding=10 cellspacing=0>");
|
echo("<div class=ifcell style='margin: 0px;'><table width=100% cellpadding=10 cellspacing=0>");
|
||||||
|
|
||||||
include("includes/print-interface.inc");
|
include("includes/print-interface.inc.php");
|
||||||
|
|
||||||
echo("</table></div>");
|
echo("</table></div>");
|
||||||
|
|
||||||
@ -89,26 +89,30 @@ if($_GET['optb']) {
|
|||||||
include("pages/device/port/".mres($_GET['optb']).".inc.php");
|
include("pages/device/port/".mres($_GET['optb']).".inc.php");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if(file_exists($config['rrd_dir'] . "/" . $hostname . "/". $ifIndex . ".rrd")) {
|
||||||
if(file_exists("rrd/" . $hostname . "/". $ifIndex . ".rrd")) {
|
|
||||||
|
|
||||||
$iid = $id;
|
$iid = $id;
|
||||||
echo("<div class=graphhead>Interface Traffic</div>");
|
echo("<div class=graphhead>Interface Traffic</div>");
|
||||||
$graph_type = "bits";
|
$graph_type = "port_bits";
|
||||||
include("includes/print-interface-graphs.php");
|
include("includes/print-interface-graphs.inc.php");
|
||||||
|
|
||||||
echo("<div class=graphhead>Interface Packets</div>");
|
echo("<div class=graphhead>Interface Packets</div>");
|
||||||
$graph_type = "pkts";
|
$graph_type = "port_upkts";
|
||||||
include("includes/print-interface-graphs.php");
|
include("includes/print-interface-graphs.inc.php");
|
||||||
|
|
||||||
echo("<div class=graphhead>Interface Non Unicast</div>");
|
echo("<div class=graphhead>Interface Non Unicast</div>");
|
||||||
$graph_type = "nupkts";
|
$graph_type = "port_nupkts";
|
||||||
include("includes/print-interface-graphs.php");
|
include("includes/print-interface-graphs.inc.php");
|
||||||
|
|
||||||
echo("<div class=graphhead>Interface Errors</div>");
|
echo("<div class=graphhead>Interface Errors</div>");
|
||||||
$graph_type = "errors";
|
$graph_type = "port_errors";
|
||||||
include("includes/print-interface-graphs.php");
|
include("includes/print-interface-graphs.inc.php");
|
||||||
|
|
||||||
|
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/etherlike-" . $interface['ifIndex'] . ".rrd")) {
|
||||||
|
echo("<div class=graphhead>Ethernet Errors</div>");
|
||||||
|
$graph_type = "port_etherlike";
|
||||||
|
include("includes/print-interface-graphs.inc.php");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$inf = fixifName($ifname);
|
$inf = fixifName($ifname);
|
||||||
$query = mysql_query("SELECT *, (M.bps_in + M.bps_out) as bps FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id ORDER BY bps DESC");
|
|
||||||
echo("<div style='clear: both;'>");
|
echo("<div style='clear: both;'>");
|
||||||
|
|
||||||
if($_GET['optd'] == "top10") {
|
if($_GET['optd'] == "top10") {
|
||||||
@ -28,61 +28,103 @@
|
|||||||
if($_GET['optc']) {
|
if($_GET['optc']) {
|
||||||
$stat = $_GET['optc'];
|
$stat = $_GET['optc'];
|
||||||
} else { $stat = "bits"; }
|
} else { $stat = "bits"; }
|
||||||
|
if($_GET['optf']) {
|
||||||
|
$sort = $_GET['optf'];
|
||||||
|
} else { $sort = "in"; }
|
||||||
|
|
||||||
|
|
||||||
echo("<div style=' margin:0px; float: left;';>
|
echo("<div style=' margin:0px; float: left;';>
|
||||||
<div style='margin: 0px 10px 20px 0px; padding:5px; background: #e5e5e5;'>
|
<div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>
|
||||||
<span class=device-head>Day</span><br />
|
<span class=device-head>Day</span><br />
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/$stat/top10/1day/'>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id'].
|
||||||
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&stat=$stat&type=mac_acc_total&from=-1day&to=now&width=150&height=50' />
|
"/macaccounting/$stat/top10/1day/$sort/'>
|
||||||
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id'].
|
||||||
|
"&stat=$stat&type=mac_acc_total&sort=$sort&from=-1day&to=now&width=150&height=50' />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div style='margin: 0px 10px 20px 0px; padding:5px; background: #e5e5e5;'>
|
<div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>
|
||||||
|
<span class=device-head>Two Day</span><br />
|
||||||
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id'].
|
||||||
|
"/macaccounting/$stat/top10/2day/$sort/'>
|
||||||
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id'].
|
||||||
|
"&stat=$stat&type=mac_acc_total&sort=$sort&from=-2day&to=now&width=150&height=50' />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>
|
||||||
<span class=device-head>Week</span><br />
|
<span class=device-head>Week</span><br />
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/$stat/top10/1week/'>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/$stat/top10/1week/$sort/'>
|
||||||
<img valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&type=mac_acc_total&stat=$stat&from=-1week&to=now&width=150&height=50' />
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&type=mac_acc_total&sort=$sort&stat=$stat&from=-1week&to=now&width=150&height=50' />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div style='margin: 0px 10px 20px 0px; padding:5px; background: #e5e5e5;'>
|
<div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>
|
||||||
<span class=device-head>Month</span><br />
|
<span class=device-head>Month</span><br />
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/$stat/top10/1month/'>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/$stat/top10/1month/$sort/'>
|
||||||
<img valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&type=mac_acc_total&stat=$stat&from=-1month&to=now&width=150&height=50' />
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&type=mac_acc_total&sort=$sort&stat=$stat&from=-1month&to=now&width=150&height=50' />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div style='margin: 0px 10px 20px 0px; padding:5px; background: #e5e5e5;'>
|
<div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>
|
||||||
<span class=device-head>Year</span><br />
|
<span class=device-head>Year</span><br />
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/$stat/top10/1year/'>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/$stat/top10/1year/$sort/'>
|
||||||
<img valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&type=mac_acc_total&stat=$stat&from=-1year&to=now&width=150&height=50' />
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&type=mac_acc_total&sort=$sort&stat=$stat&from=-1year&to=now&width=150&height=50' />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style='float: left;'>
|
<div style='float: left;'>
|
||||||
<img src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&type=mac_acc_total&stat=$stat&from=$from&to=now&width=750&height=245' />
|
<img src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&type=mac_acc_total&sort=$sort&stat=$stat&from=$from&to=now&width=750&height=245' />
|
||||||
</div>
|
</div>
|
||||||
<div style=' margin:0px; float: left;';>
|
<div style=' margin:0px; float: left;';>
|
||||||
<div style='margin: 0px 0px 20px 10px; padding:5px; background: #e5e5e5;'>
|
<div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>
|
||||||
<span class=device-head>Traffic</span><br />
|
<span class=device-head>Traffic</span><br />
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/top10/$period/'>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/top10/$period/$sort/'>
|
||||||
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&stat=bits&type=mac_acc_total&from=$from&to=now&width=150&height=50' />
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&stat=bits&type=mac_acc_total&sort=$sort&from=$from&to=now&width=150&height=50' />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div style='margin: 0px 0px 20px 10px; padding:5px; background: #e5e5e5;'>
|
<div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>
|
||||||
<span class=device-head>Packets</span><br />
|
<span class=device-head>Packets</span><br />
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/pkts/top10/$period/'>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/pkts/top10/$period/$sort/'>
|
||||||
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&stat=pkts&type=mac_acc_total&from=$from&to=now&width=150&height=50' />
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&stat=pkts&type=mac_acc_total&sort=$sort&from=$from&to=now&width=150&height=50' />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>
|
||||||
|
<span class=device-head>Top Input</span><br />
|
||||||
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id'].
|
||||||
|
"/macaccounting/$stat/top10/$period/in/'>
|
||||||
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id'].
|
||||||
|
"&stat=$stat&type=mac_acc_total&sort=in&from=$from&to=now&width=150&height=50' />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>
|
||||||
|
<span class=device-head>Top Output</span><br />
|
||||||
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id'].
|
||||||
|
"/macaccounting/$stat/top10/$period/out/'>
|
||||||
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id'].
|
||||||
|
"&stat=$stat&type=mac_acc_total&sort=out&from=$from&to=now&width=150&height=50' />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>
|
||||||
|
<span class=device-head>Top Aggregate</span><br />
|
||||||
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id'].
|
||||||
|
"/macaccounting/$stat/top10/$period/both/'>
|
||||||
|
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id'].
|
||||||
|
"&stat=$stat&type=mac_acc_total&sort=both&from=$from&to=now&width=150&height=50' />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
");
|
");
|
||||||
unset($query);
|
unset($query);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
|
$query = mysql_query("SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M,
|
||||||
|
`interfaces` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id
|
||||||
|
AND I.device_id = D.device_id ORDER BY bps DESC");
|
||||||
|
|
||||||
while($acc = mysql_fetch_array($query)) {
|
while($acc = mysql_fetch_array($query)) {
|
||||||
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||||
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
|
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
|
||||||
$name = gethostbyaddr($addy['ipv4_address']);
|
#$name = gethostbyaddr($addy['ipv4_address']);
|
||||||
if($name == $addy['ipv4_address']) { unset ($name); }
|
#if($name == $addy['ipv4_address']) { unset ($name); }
|
||||||
if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0)) {
|
if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0)) {
|
||||||
$peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'");
|
$peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'");
|
||||||
$peer_info = mysql_fetch_array($peer_query);
|
$peer_info = mysql_fetch_array($peer_query);
|
||||||
@ -122,8 +164,8 @@
|
|||||||
<td class=list-large width=200>".mac_clean_to_readable($acc['mac'])."</td>
|
<td class=list-large width=200>".mac_clean_to_readable($acc['mac'])."</td>
|
||||||
<td class=list-large width=200>".$addy['ipv4_address']."</td>
|
<td class=list-large width=200>".$addy['ipv4_address']."</td>
|
||||||
<td class=list-large width=500>".$name."</td>
|
<td class=list-large width=500>".$name."</td>
|
||||||
<td class=list-large width=100>".formatRates($acc['bps_in'])."</td>
|
<td class=list-large width=100>".formatRates($acc['cipMacHCSwitchedBytes_input_rate'] / 8)."</td>
|
||||||
<td class=list-large width=100>".formatRates($acc['bps_out'])."</td>
|
<td class=list-large width=100>".formatRates($acc['cipMacHCSwitchedBytes_output_rate'] / 8)."</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
");
|
");
|
||||||
@ -154,4 +196,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -7,8 +7,8 @@ echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports
|
|||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/arp/'>ARP Table</a> | Graphs:
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/arp/'>ARP Table</a> | Graphs:
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/'>Bits</a>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/'>Bits</a>
|
||||||
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/thumbs/'>Mini</a>) |
|
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/thumbs/'>Mini</a>) |
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/pkts/'>Packets</a>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/upkts/'>Packets</a>
|
||||||
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/pkts/thumbs/'>Mini</a>) |
|
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/upkts/thumbs/'>Mini</a>) |
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/nupkts/'>NU Packets</a>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/nupkts/'>NU Packets</a>
|
||||||
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/nupkts/thumbs/'>Mini</a>) |
|
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/nupkts/thumbs/'>Mini</a>) |
|
||||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/errors/'>Errors</a>
|
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/errors/'>Errors</a>
|
||||||
@ -17,7 +17,7 @@ echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports
|
|||||||
print_optionbar_end();
|
print_optionbar_end();
|
||||||
|
|
||||||
if($_GET['opta'] == graphs ) {
|
if($_GET['opta'] == graphs ) {
|
||||||
if($_GET['optb']) { $graph_type = $_GET['optb']; } else { $graph_type = "bits"; }
|
if($_GET['optb']) { $graph_type = "port_" . $_GET['optb']; } else { $graph_type = "port_bits"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_GET['optc'] == thumbs) {
|
if($_GET['optc'] == thumbs) {
|
||||||
@ -51,7 +51,7 @@ if($_GET['optc'] == thumbs) {
|
|||||||
$i = "1";
|
$i = "1";
|
||||||
$interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifIndex` ASC");
|
$interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifIndex` ASC");
|
||||||
while($interface = mysql_fetch_array($interface_query)) {
|
while($interface = mysql_fetch_array($interface_query)) {
|
||||||
include("includes/print-interface.inc");
|
include("includes/print-interface.inc.php");
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
echo("</table></div>");
|
echo("</table></div>");
|
||||||
|
@ -221,11 +221,11 @@ if($_SESSION['userlevel'] >= '5')
|
|||||||
if($interfaces['wave_broadband']) {
|
if($interfaces['wave_broadband']) {
|
||||||
echo("<div style='width: 235px; float: left;'>
|
echo("<div style='width: 235px; float: left;'>
|
||||||
<a onmouseover=\"return overlib('\
|
<a onmouseover=\"return overlib('\
|
||||||
<img src=\'graph.php?type=bits&if=".$interfaces['wave_broadband']."&from=".$day."&to=".$now."&width=400&height=150&inverse=1&legend=1\'>\
|
<img src=\'graph.php?type=port_bits&port=".$interfaces['wave_broadband']."&from=".$day."&to=".$now."&width=400&height=150&inverse=1&legend=1\'>\
|
||||||
<img src=\'graph.php?type=bits&if=".$interfaces['wave_broadband']."&from=".$week."&to=".$now."&width=400&height=150&inverse=1&legend=1\'>\
|
<img src=\'graph.php?type=port_bits&port=".$interfaces['wave_broadband']."&from=".$week."&to=".$now."&width=400&height=150&inverse=1&legend=1\'>\
|
||||||
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". "
|
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". "
|
||||||
<div style='font-size: 16px; font-weight: bold; color: #555555;'>Wave Broadband</div>".
|
<div style='font-size: 16px; font-weight: bold; color: #555555;'>Wave Broadband</div>".
|
||||||
"<img src='graph.php?type=bits&if=".$interfaces['wave_broadband']."&from=".$day."&to=".$now."&width=155&height=100&inverse=1&legend=no'></a></div>");
|
"<img src='graph.php?type=port_bits&port=".$interfaces['wave_broadband']."&from=".$day."&to=".$now."&width=155&height=100&inverse=1&legend=no'></a></div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("</div>");
|
echo("</div>");
|
||||||
|
@ -25,7 +25,7 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
|||||||
echo("<tr bgcolor='$bg'><td>");
|
echo("<tr bgcolor='$bg'><td>");
|
||||||
$graph_type = "multi_bits";
|
$graph_type = "multi_bits";
|
||||||
$interface['interface_id'] = $if_list;
|
$interface['interface_id'] = $if_list;
|
||||||
include("includes/print-interface-graphs.php");
|
include("includes/print-interface-graphs.inc.php");
|
||||||
echo("</td></tr>");
|
echo("</td></tr>");
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
|||||||
if(file_exists($config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd")) {
|
if(file_exists($config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd")) {
|
||||||
|
|
||||||
$graph_type = "bits";
|
$graph_type = "bits";
|
||||||
include("includes/print-interface-graphs.php");
|
include("includes/print-interface-graphs.inc.php");
|
||||||
|
|
||||||
}
|
}
|
||||||
echo("</td></tr>");
|
echo("</td></tr>");
|
||||||
|
@ -102,7 +102,7 @@ if($_GET['type'] == "down" || $_POST['state'] == "down") {
|
|||||||
} elseif ($_GET['type'] == "admindown" || $_POST['state'] == "admindown") {
|
} elseif ($_GET['type'] == "admindown" || $_POST['state'] == "admindown") {
|
||||||
$where .= "AND I.ifAdminStatus = 'down'";
|
$where .= "AND I.ifAdminStatus = 'down'";
|
||||||
} elseif ($_GET['type'] == "errors" || $_POST['state'] == "errors") {
|
} elseif ($_GET['type'] == "errors" || $_POST['state'] == "errors") {
|
||||||
$where .= "AND ( I.`out_errors` > '0' OR I.`in_errors` > '0' )";
|
$where .= "AND ( I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0' )";
|
||||||
} elseif ($_GET['type'] == "up" || $_POST['state'] == "up") {
|
} elseif ($_GET['type'] == "up" || $_POST['state'] == "up") {
|
||||||
$where .= "AND I.ifOperStatus = 'up'";
|
$where .= "AND I.ifOperStatus = 'up'";
|
||||||
} elseif ($_GET['type'] == "l2vlan" || $_POST['state'] == "l2vlan") {
|
} elseif ($_GET['type'] == "l2vlan" || $_POST['state'] == "l2vlan") {
|
||||||
|
@ -51,7 +51,7 @@ if($_GET['opta'] == "details" ) {
|
|||||||
} else {
|
} else {
|
||||||
if(is_integer($i/2)) { $int_colour = $list_colour_b_b; } else { $int_colour = $list_colour_b_a; }
|
if(is_integer($i/2)) { $int_colour = $list_colour_b_b; } else { $int_colour = $list_colour_b_a; }
|
||||||
}
|
}
|
||||||
include("includes/print-interface.inc");
|
include("includes/print-interface.inc.php");
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$x++;
|
$x++;
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
## Common Functions
|
## Common Functions
|
||||||
|
|
||||||
|
function truncate($substring, $max = 50, $rep = '...'){
|
||||||
|
if(strlen($substring) < 1){ $string = $rep; } else { $string = $substring; }
|
||||||
|
$leave = $max - strlen ($rep);
|
||||||
|
if(strlen($string) > $max){ return substr_replace($string, $rep, $leave); } else { return $string; }
|
||||||
|
}
|
||||||
|
|
||||||
function mres($string) { // short function wrapper because the real one is stupidly long and ugly. aestetics.
|
function mres($string) { // short function wrapper because the real one is stupidly long and ugly. aestetics.
|
||||||
return mysql_real_escape_string($string);
|
return mysql_real_escape_string($string);
|
||||||
}
|
}
|
||||||
|
128
includes/functions-poller.inc.php
Normal file
128
includes/functions-poller.inc.php
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function snmp_cache_cip($oid, $device, $array, $mib = 0) {
|
||||||
|
global $config;
|
||||||
|
$cmd = $config['snmpbulkwalk'] . " -O snq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||||
|
if($mib) { $cmd .= "-m $mib "; }
|
||||||
|
$cmd .= $oid;
|
||||||
|
$data = trim(shell_exec($cmd));
|
||||||
|
$device_id = $device['device_id'];
|
||||||
|
#echo("Caching: $oid\n");
|
||||||
|
foreach(explode("\n", $data) as $entry) {
|
||||||
|
list ($this_oid, $this_value) = split(" ", $entry);
|
||||||
|
$this_oid = trim($this_oid);
|
||||||
|
$this_value = trim($this_value);
|
||||||
|
$this_oid = substr($this_oid, 30);
|
||||||
|
list($ifIndex,$dir,$a,$b,$c,$d,$e,$f) = explode(".", $this_oid);
|
||||||
|
$h_a = zeropad(dechex($a));
|
||||||
|
$h_b = zeropad(dechex($b));
|
||||||
|
$h_c = zeropad(dechex($c));
|
||||||
|
$h_d = zeropad(dechex($d));
|
||||||
|
$h_e = zeropad(dechex($e));
|
||||||
|
$h_f = zeropad(dechex($f));
|
||||||
|
$mac = "$h_a$h_b$h_c$h_d$h_e$h_f";
|
||||||
|
if($dir == "1") { $dir = "input"; } elseif($dir == "2") { $dir = "output"; }
|
||||||
|
if($mac && $dir) {
|
||||||
|
$array[$device_id][$ifIndex][$mac][$oid][$dir] = $this_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function snmp_cache_ifIndex($device) {
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
$cmd = $config['snmpbulkwalk'] . " -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||||
|
$cmd .= "-m IF-MIB ifIndex";
|
||||||
|
$data = trim(shell_exec($cmd));
|
||||||
|
$device_id = $device['device_id'];
|
||||||
|
foreach(explode("\n", $data) as $entry) {
|
||||||
|
list ($this_oid, $this_value) = split("=", $entry);
|
||||||
|
list ($this_oid, $this_index) = explode(".", $this_oid);
|
||||||
|
$this_index = trim($this_index);
|
||||||
|
$this_oid = trim($this_oid);
|
||||||
|
$this_value = trim($this_value);
|
||||||
|
if(!strstr($this_value, "No Such Instance currently exists at this OID") && $this_index) {
|
||||||
|
$array[] = $this_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
function snmp_cache_oid($oid, $device, $array, $mib = 0) {
|
||||||
|
global $config;
|
||||||
|
$cmd = $config['snmpbulkwalk'] . " -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||||
|
if($mib) { $cmd .= "-m $mib "; }
|
||||||
|
$cmd .= $oid;
|
||||||
|
$data = trim(shell_exec($cmd));
|
||||||
|
$device_id = $device['device_id'];
|
||||||
|
#echo("Caching: $oid\n");
|
||||||
|
foreach(explode("\n", $data) as $entry) {
|
||||||
|
list ($this_oid, $this_value) = split("=", $entry);
|
||||||
|
list ($this_oid, $this_index) = explode(".", $this_oid);
|
||||||
|
$this_index = trim($this_index);
|
||||||
|
$this_oid = trim($this_oid);
|
||||||
|
$this_value = trim($this_value);
|
||||||
|
if(!strstr($this_value, "No Such Instance currently exists at this OID") && $this_index) {
|
||||||
|
$array[$device_id][$this_index][$this_oid] = $this_value;
|
||||||
|
}
|
||||||
|
$array[$device_id][$oid] = '1';
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
function snmp_cache_port_oids($oids, $port, $device, $array, $mib=0) {
|
||||||
|
global $config;
|
||||||
|
foreach($oids as $oid){
|
||||||
|
$string .= " $oid.$port";
|
||||||
|
}
|
||||||
|
$cmd = $config['snmpget'] . " -O vq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||||
|
if($mib) { $cmd .= "-m $mib "; }
|
||||||
|
$cmd .= $string;
|
||||||
|
$data = trim(shell_exec($cmd));
|
||||||
|
$x=0;
|
||||||
|
$values = explode("\n", $data);
|
||||||
|
#echo("Caching: ifIndex $port\n");
|
||||||
|
foreach($oids as $oid){
|
||||||
|
if(!strstr($values[$x], "No Such Instance currently exists at this OID")) {
|
||||||
|
$array[$device[device_id]][$port][$oid] = $values[$x];
|
||||||
|
}
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
function snmp_cache_portIfIndex ($device, $array) {
|
||||||
|
global $config;
|
||||||
|
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
|
||||||
|
$output = trim(shell_exec($cmd));
|
||||||
|
#echo("Caching: portIfIndex\n");
|
||||||
|
foreach(explode("\n", $output) as $entry){
|
||||||
|
$entry = str_replace("CISCO-STACK-MIB::portIfIndex.", "", $entry);
|
||||||
|
list($slotport, $ifIndex) = explode(" ", $entry);
|
||||||
|
$array[$device_id][$ifIndex]['portIfIndex'] = $slotport;
|
||||||
|
$array[$device_id][$slotport]['ifIndex'] = $ifIndex;
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
function snmp_cache_portName ($device, $array) {
|
||||||
|
global $config;
|
||||||
|
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portName";
|
||||||
|
$output = trim(shell_exec($cmd));
|
||||||
|
#echo("Caching: portName\n");
|
||||||
|
foreach(explode("\n", $output) as $entry){
|
||||||
|
$entry = str_replace("portName.", "", $entry);
|
||||||
|
list($slotport, $portName) = explode("=", $entry);
|
||||||
|
$slotport = trim($slotport); $portName = trim($portName);
|
||||||
|
if ($array[$device_id][$slotport]['ifIndex']) {
|
||||||
|
$ifIndex = $array[$device_id][$slotport]['ifIndex'];
|
||||||
|
$array[$device_id][$slotport]['portName'] = $portName;
|
||||||
|
$array[$device_id][$ifIndex]['portName'] = $portName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -215,13 +215,6 @@ function print_message($text)
|
|||||||
echo("<table class=messagebox cellpadding=3><tr><td><img src='/images/16/tick.png' align=absmiddle> $text</td></tr></table>");
|
echo("<table class=messagebox cellpadding=3><tr><td><img src='/images/16/tick.png' align=absmiddle> $text</td></tr></table>");
|
||||||
}
|
}
|
||||||
|
|
||||||
function truncate($substring, $max = 50, $rep = '...')
|
|
||||||
{
|
|
||||||
if(strlen($substring) < 1){ $string = $rep; } else { $string = $substring; }
|
|
||||||
$leave = $max - strlen ($rep);
|
|
||||||
if(strlen($string) > $max){ return substr_replace($string, $rep, $leave); } else { return $string; }
|
|
||||||
}
|
|
||||||
|
|
||||||
function interface_rates ($rrd_file) // Returns the last in/out value in RRD
|
function interface_rates ($rrd_file) // Returns the last in/out value in RRD
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
@ -283,10 +276,10 @@ function generateiflink($interface, $text=0,$type)
|
|||||||
$interface = ifNameDescr($interface);
|
$interface = ifNameDescr($interface);
|
||||||
if(!$text) { $text = fixIfName($interface['label']); }
|
if(!$text) { $text = fixIfName($interface['label']); }
|
||||||
if($type) { $interface['graph_type'] = $type; }
|
if($type) { $interface['graph_type'] = $type; }
|
||||||
if(!$interface['graph_type']) { $interface['graph_type'] = 'bits'; }
|
if(!$interface['graph_type']) { $interface['graph_type'] = 'port_bits'; }
|
||||||
$class = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
|
$class = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
|
||||||
$graph_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=100&type=" . $interface['graph_type'];
|
$graph_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=100&type=" . $interface['graph_type'];
|
||||||
$graph_url_month = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&from=$month&to=$now&width=400&height=100&type=" . $interface['graph_type'];
|
$graph_url_month = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&from=$month&to=$now&width=400&height=100&type=" . $interface['graph_type'];
|
||||||
$device_id = getifhost($interface['interface_id']);
|
$device_id = getifhost($interface['interface_id']);
|
||||||
$link = "<a class=$class href='".$config['base_url']."/device/$device_id/interface/" . $interface['interface_id'] . "/' ";
|
$link = "<a class=$class href='".$config['base_url']."/device/$device_id/interface/" . $interface['interface_id'] . "/' ";
|
||||||
$link .= "onmouseover=\" return overlib('";
|
$link .= "onmouseover=\" return overlib('";
|
||||||
@ -305,10 +298,11 @@ function generatedevicelink($device, $text=0, $start=0, $end=0)
|
|||||||
if(!$end) { $end = $now; }
|
if(!$end) { $end = $now; }
|
||||||
$class = devclass($device);
|
$class = devclass($device);
|
||||||
if(!$text) { $text = $device['hostname']; }
|
if(!$text) { $text = $device['hostname']; }
|
||||||
$graph_url = $config['base_url'] . "/graph.php?host=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=cpu";
|
$graph_url = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=device_cpu";
|
||||||
|
$graph_url_b = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=device_memory";
|
||||||
$link = "<a class=$class href='".$config['base_url']."/device/" . $device['device_id'] . "/' ";
|
$link = "<a class=$class href='".$config['base_url']."/device/" . $device['device_id'] . "/' ";
|
||||||
$link .= "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - CPU Load</div>";
|
$link .= "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - CPU & Memory Usage</div>";
|
||||||
$link .= "<img src=\'$graph_url\'>'".$config['overlib_defaults'].", LEFT);\" onmouseout=\"return nd();\">$text</a>";
|
$link .= "<img src=\'$graph_url\'><br /><img src=\'$graph_url_b\'>'".$config['overlib_defaults'].", LEFT);\" onmouseout=\"return nd();\">$text</a>";
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ include("graphing/unix.php");
|
|||||||
|
|
||||||
function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
|
function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = " --alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height ";
|
$options = " --alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($height < "99") { $options .= " --only-graph"; }
|
if($height < "99") { $options .= " --only-graph"; }
|
||||||
@ -164,15 +163,14 @@ function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height
|
|||||||
|
|
||||||
}
|
}
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
|
||||||
# echo($config['rrdtool'] . " graph $imgfile $options");
|
# echo($config['rrdtool'] . " graph $graph $options");
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function graph_multi_bits_duo ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
|
function graph_multi_bits_duo ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height";
|
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($height < "99") { $options .= " --only-graph"; }
|
if($height < "99") { $options .= " --only-graph"; }
|
||||||
@ -282,422 +280,13 @@ function graph_multi_bits_duo ($interfaces, $graph, $from, $to, $width, $height,
|
|||||||
|
|
||||||
}
|
}
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
|
||||||
|
|
||||||
function temp_graph ($temp, $graph, $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$options = " -l 0 -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($width <= "300") {
|
|
||||||
$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal ";
|
|
||||||
}
|
|
||||||
$hostname = gethostbyid($device);
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$iter = "1";
|
|
||||||
$sql = mysql_query("SELECT * FROM temperature where temp_id = '$temp'");
|
|
||||||
$opts[] = "COMMENT: Cur Max";
|
|
||||||
$temperature = mysql_fetch_array(mysql_query("SELECT * FROM temperature where temp_id = '$temp'"));
|
|
||||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $temperature['temp_host'] . "'"),0);
|
|
||||||
|
|
||||||
$temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 28);
|
|
||||||
$temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,28);
|
|
||||||
|
|
||||||
$filename = str_replace(")", "_", str_replace("(", "_", str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr']))));
|
|
||||||
|
|
||||||
$temprrd = $config['rrd_dir'] . "/$hostname/temp-" . $filename . ".rrd";
|
|
||||||
$opts[] = "DEF:temp=$temprrd:temp:AVERAGE";
|
|
||||||
$opts[] = "CDEF:tempwarm=temp,".$temperature[temp_limit].",GT,temp,UNKN,IF";
|
|
||||||
$opts[] = "LINE1.5:temp#006600:" . quotemeta($temperature[temp_descr_fixed]);
|
|
||||||
$opts[] = "LINE1.5:tempwarm#cc0000";
|
|
||||||
$opts[] = "GPRINT:temp:LAST:%3.0lf<EFBFBD>C";
|
|
||||||
$opts[] = "GPRINT:temp:MAX:%3.0lf<EFBFBD>C\\\l";
|
|
||||||
|
|
||||||
foreach($opts as $opt) {
|
|
||||||
$opt = str_replace(" ","\ ", $opt);
|
|
||||||
$options .= " $opt";
|
|
||||||
}
|
|
||||||
# echo($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function graph_cpmCPU ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
|
||||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$hostname = gethostbyid($device);
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$iter = "1";
|
|
||||||
$sql = mysql_query("SELECT * FROM `cpmCPU` AS C, `devices` AS D where C.`cpmCPU_id` = '$id' AND C.device_id = D.device_id");
|
|
||||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n";
|
|
||||||
while($proc = mysql_fetch_array($sql)) {
|
|
||||||
if($iter=="1") {$colour="CC0000";} 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); }
|
|
||||||
$proc['descr_fixed'] = str_pad($proc['entPhysicalDescr'], 28);
|
|
||||||
$proc['descr_fixed'] = substr($proc['descr_fixed'],0,28);
|
|
||||||
$rrd = $config['rrd_dir'] . "/".$proc['hostname']."/cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd";
|
|
||||||
$options .= " DEF:proc" . $proc['cpmCPU_oid'] . "=$rrd:usage:AVERAGE ";
|
|
||||||
$options .= " LINE1:proc" . $proc['cpmCPU_oid'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
|
|
||||||
$options .= " GPRINT:proc" . $proc['cpmCPU_oid'] . ":LAST:%3.0lf";
|
|
||||||
$options .= " GPRINT:proc" . $proc['cpmCPU_oid'] . ":MAX:%3.0lf\\\l ";
|
|
||||||
$iter++;
|
|
||||||
}
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function graph_device_cpmCPU ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
|
||||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$hostname = gethostbyid($device);
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$iter = "1";
|
|
||||||
$sql = mysql_query("SELECT * FROM `cpmCPU` where `device_id` = '$device'");
|
|
||||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n";
|
|
||||||
while($proc = mysql_fetch_array($sql)) {
|
|
||||||
if($iter=="1") {$colour="CC0000";} 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); }
|
|
||||||
$proc['descr_fixed'] = str_pad($proc['entPhysicalDescr'], 28);
|
|
||||||
$proc['descr_fixed'] = substr($proc['descr_fixed'],0,28);
|
|
||||||
$rrd = $config['rrd_dir'] . "/$hostname/cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd";
|
|
||||||
$options .= " DEF:proc" . $proc['cpmCPU_oid'] . "=$rrd:usage:AVERAGE ";
|
|
||||||
$options .= " LINE1:proc" . $proc['cpmCPU_oid'] . "#" . $colour . ":'" . $proc['descr_fixed'] . "' ";
|
|
||||||
$options .= " GPRINT:proc" . $proc['cpmCPU_oid'] . ":LAST:%3.0lf";
|
|
||||||
$options .= " GPRINT:proc" . $proc['cpmCPU_oid'] . ":MAX:%3.0lf\\\l ";
|
|
||||||
$iter++;
|
|
||||||
}
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function graph_device_cempMemPool ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
|
||||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$hostname = gethostbyid($device);
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$iter = "1";
|
|
||||||
$sql = mysql_query("SELECT * FROM `cempMemPool` where `device_id` = '$device'");
|
|
||||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n";
|
|
||||||
while($mempool = mysql_fetch_array($sql)) {
|
|
||||||
$entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$device."'
|
|
||||||
AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0);
|
|
||||||
if($iter=="1") {$colour="CC0000";} 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); }
|
|
||||||
$mempool['descr_fixed'] = $entPhysicalName . " " . $mempool['cempMemPoolName'];
|
|
||||||
$mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
|
|
||||||
$mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
|
|
||||||
$mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
|
|
||||||
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 28);
|
|
||||||
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
|
|
||||||
$oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index'];
|
|
||||||
$rrd = $config['rrd_dir'] . "/$hostname/cempMemPool-$oid.rrd";
|
|
||||||
$id = $mempool['entPhysicalIndex'] . "-" . $mempool['Index'];
|
|
||||||
$options .= " DEF:mempool" . $id . "free=$rrd:free:AVERAGE ";
|
|
||||||
$options .= " DEF:mempool" . $id . "used=$rrd:used:AVERAGE ";
|
|
||||||
$options .= " CDEF:mempool" . $id . "total=mempool" . $id . "used,mempool" . $id . "used,mempool" . $id . "free,+,/,100,* ";
|
|
||||||
$options .= " LINE1:mempool" . $id . "total#" . $colour . ":'" . $mempool['descr_fixed'] . "' ";
|
|
||||||
$options .= " GPRINT:mempool" . $id . "total:LAST:%3.0lf";
|
|
||||||
$options .= " GPRINT:mempool" . $id . "total:MAX:%3.0lf\\\l ";
|
|
||||||
$iter++;
|
|
||||||
}
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function graph_cempMemPool ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
|
||||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$hostname = gethostbyid($device);
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$iter = "1";
|
|
||||||
$sql = mysql_query("SELECT * FROM `cempMemPool` AS C, `devices` AS D where C.`cempMemPool_id` = '$id' AND C.device_id = D.device_id");
|
|
||||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n";
|
|
||||||
while($mempool = mysql_fetch_array($sql)) {
|
|
||||||
$entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$mempool['device_id']."'
|
|
||||||
AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0);
|
|
||||||
if($iter=="1") {$colour="CC0000";} 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); }
|
|
||||||
$mempool['descr_fixed'] = $entPhysicalName . " " . $mempool['cempMemPoolName'];
|
|
||||||
$mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
|
|
||||||
$mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
|
|
||||||
$mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
|
|
||||||
$mempool['descr_fixed'] = str_pad($mempool['descr_fixed'], 28);
|
|
||||||
$mempool['descr_fixed'] = substr($mempool['descr_fixed'],0,28);
|
|
||||||
$oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index'];
|
|
||||||
$rrd = $config['rrd_dir'] . "/".$mempool['hostname']."/cempMemPool-$oid.rrd";
|
|
||||||
$id = $mempool['entPhysicalIndex'] . "-" . $mempool['Index'];
|
|
||||||
$options .= " DEF:mempool" . $id . "free=$rrd:free:AVERAGE ";
|
|
||||||
$options .= " DEF:mempool" . $id . "used=$rrd:used:AVERAGE ";
|
|
||||||
$options .= " CDEF:mempool" . $id . "total=mempool" . $id . "used,mempool" . $id . "used,mempool" . $id . "free,+,/,100,* ";
|
|
||||||
$options .= " LINE1:mempool" . $id . "total#" . $colour . ":'" . $mempool['descr_fixed'] . "' ";
|
|
||||||
$options .= " GPRINT:mempool" . $id . "total:LAST:%3.0lf";
|
|
||||||
$options .= " GPRINT:mempool" . $id . "total:MAX:%3.0lf\\\l ";
|
|
||||||
$iter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function temp_graph_dev ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
|
||||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$hostname = gethostbyid($device);
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$iter = "1";
|
|
||||||
$sql = mysql_query("SELECT * FROM temperature where temp_host = '$device'");
|
|
||||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n";
|
|
||||||
while($temperature = mysql_fetch_array($sql)) {
|
|
||||||
if($iter=="1") {$colour="CC0000";} 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); }
|
|
||||||
$temperature['temp_descr_fixed'] = str_pad($temperature['temp_descr'], 28);
|
|
||||||
$temperature['temp_descr_fixed'] = substr($temperature['temp_descr_fixed'],0,28);
|
|
||||||
$temprrd = addslashes("rrd/$hostname/temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd");
|
|
||||||
$temprrd = str_replace(")", "_", $temprrd);
|
|
||||||
$temprrd = str_replace("(", "_", $temprrd);
|
|
||||||
$options .= " DEF:temp" . $temperature[temp_id] . "=$temprrd:temp:AVERAGE ";
|
|
||||||
$options .= " LINE1:temp" . $temperature[temp_id] . "#" . $colour . ":'" . $temperature[temp_descr_fixed] . "' ";
|
|
||||||
$options .= " GPRINT:temp" . $temperature[temp_id] . ":LAST:%3.0lf\<EFBFBD>C ";
|
|
||||||
$options .= " GPRINT:temp" . $temperature[temp_id] . ":MAX:%3.0lf\<EFBFBD>C\\\l ";
|
|
||||||
$iter++;
|
|
||||||
}
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function graph_mac_acc ($id, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".$id."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
|
||||||
$acc = mysql_fetch_array($query);
|
|
||||||
$database = $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
|
||||||
return graph_bits ($database, $graph, $from, $to, $width, $height, $title, $vertical);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function graph_bits ($rrd, $graph, $from, $to, $width, $height, $title, $vertical, $inverse = '0', $legend = '1') {
|
|
||||||
global $config;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph"; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
global $_GET;
|
|
||||||
if($_GET['bg']) { $options .= " -c CANVAS#" . $_GET['bg'] . " "; }
|
|
||||||
if($inverse) {
|
|
||||||
$in = 'out';
|
|
||||||
$out = 'in';
|
|
||||||
} else {
|
|
||||||
$in = 'in';
|
|
||||||
$out = 'out';
|
|
||||||
}
|
|
||||||
if(strstr($database, "mac-accounting")) {
|
|
||||||
$options .= " DEF:".$out."octets=$database:OUT:AVERAGE";
|
|
||||||
$options .= " DEF:".$in."octets=$database:IN:AVERAGE";
|
|
||||||
$options .= " DEF:".$out."octets_max=$database:OUT:MAX";
|
|
||||||
$options .= " DEF:".$in."octets_max=$database:IN:MAX";
|
|
||||||
} else {
|
|
||||||
$options .= " DEF:".$out."octets=$database:OUTOCTETS:AVERAGE";
|
|
||||||
$options .= " DEF:".$in."octets=$database:INOCTETS:AVERAGE";
|
|
||||||
$options .= " DEF:".$out."octets_max=$database:OUTOCTETS:MAX";
|
|
||||||
$options .= " DEF:".$in."octets_max=$database:INOCTETS:MAX";
|
|
||||||
}
|
|
||||||
|
|
||||||
$options .= " CDEF:octets=inoctets,outoctets,+";
|
|
||||||
$options .= " CDEF:doutoctets=outoctets,-1,*";
|
|
||||||
$options .= " CDEF:inbits=inoctets,8,*";
|
|
||||||
$options .= " CDEF:inbits_max=inoctets_max,8,*";
|
|
||||||
$options .= " CDEF:outbits_max=outoctets_max,8,*";
|
|
||||||
$options .= " CDEF:doutoctets_max=outoctets_max,-1,*";
|
|
||||||
$options .= " CDEF:doutbits_max=doutoctets_max,8,*";
|
|
||||||
$options .= " CDEF:outbits=outoctets,8,*";
|
|
||||||
$options .= " CDEF:doutbits=doutoctets,8,*";
|
|
||||||
$options .= " VDEF:totin=inoctets,TOTAL";
|
|
||||||
$options .= " VDEF:totout=outoctets,TOTAL";
|
|
||||||
$options .= " VDEF:tot=octets,TOTAL";
|
|
||||||
$options .= " VDEF:95thin=inbits,95,PERCENT";
|
|
||||||
$options .= " VDEF:95thout=outbits,95,PERCENT";
|
|
||||||
$options .= " VDEF:d95thout=doutbits,5,PERCENT";
|
|
||||||
if ($legend == "no") {
|
|
||||||
$options .= " AREA:inbits#CDEB8B";
|
|
||||||
$options .= " LINE1.25:inbits#006600";
|
|
||||||
$options .= " AREA:doutbits#C3D9FF";
|
|
||||||
$options .= " LINE1.25:doutbits#000099";
|
|
||||||
$options .= " LINE1:95thin#aa0000";
|
|
||||||
$options .= " LINE1:d95thout#aa0000";
|
|
||||||
} else {
|
|
||||||
$options .= " AREA:inbits_max#aDEB7B:";
|
|
||||||
$options .= " AREA:inbits#CDEB8B:";
|
|
||||||
$options .= " COMMENT:BPS\ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Max\ \ \ 95th\ %\\\\n";
|
|
||||||
$options .= " LINE1.25:inbits#006600:In\ ";
|
|
||||||
$options .= " GPRINT:inbits:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:inbits_max:MAX:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:95thin:%6.2lf%s\\\\n";
|
|
||||||
$options .= " AREA:doutbits_max#a3b9FF:";
|
|
||||||
$options .= " AREA:doutbits#C3D9FF:";
|
|
||||||
$options .= " LINE1.25:doutbits#000099:Out";
|
|
||||||
$options .= " GPRINT:outbits:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:outbits_max:MAX:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:95thout:%6.2lf%s\\\\n";
|
|
||||||
$options .= " GPRINT:tot:Total\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:totin:\(In\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:totout:Out\ %6.2lf%s\)\\\\l";
|
|
||||||
$options .= " LINE1:95thin#aa0000";
|
|
||||||
$options .= " LINE1:d95thout#aa0000";
|
|
||||||
}
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pktsgraph ($rrd, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph"; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
global $_GET;
|
|
||||||
if($_GET['bg']) { $options .= " -c CANVAS#" . $_GET['bg'] . " "; }
|
|
||||||
$options .= " DEF:in=$database:INUCASTPKTS:AVERAGE";
|
|
||||||
$options .= " DEF:out=$database:OUTUCASTPKTS:AVERAGE";
|
|
||||||
$options .= " CDEF:dout=out,-1,*";
|
|
||||||
$options .= " AREA:in#aa66aa:";
|
|
||||||
$options .= " COMMENT:Packets\ \ \ \ Current\ \ \ \ \ Average\ \ \ \ \ \ Maximum\\\\n";
|
|
||||||
$options .= " LINE1.25:in#330033:In\ \ ";
|
|
||||||
$options .= " GPRINT:in:LAST:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:in:AVERAGE:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:in:MAX:%6.2lf%spps\\\\n";
|
|
||||||
$options .= " AREA:dout#FFDD88:";
|
|
||||||
$options .= " LINE1.25:dout#FF6600:Out\ ";
|
|
||||||
$options .= " GPRINT:out:LAST:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:out:AVERAGE:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:out:MAX:%6.2lf%spps\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function graph_mac_pkts ($id, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".$id."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
|
||||||
$acc = mysql_fetch_array($query);
|
|
||||||
$database = $config['rrd_dir'] ."/". $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['mac'] . "-pkts.rrd";
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph"; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$options .= " DEF:in=$database:IN:AVERAGE";
|
|
||||||
$options .= " DEF:out=$database:OUT:AVERAGE";
|
|
||||||
$options .= " CDEF:dout=out,-1,*";
|
|
||||||
$options .= " AREA:in#aa66aa:";
|
|
||||||
$options .= " COMMENT:Packets\ \ \ \ Current\ \ \ \ \ Average\ \ \ \ \ \ Maximum\\\\n";
|
|
||||||
$options .= " LINE1.25:in#330033:In\ \ ";
|
|
||||||
$options .= " GPRINT:in:LAST:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:in:AVERAGE:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:in:MAX:%6.2lf%spps\\\\n";
|
|
||||||
$options .= " AREA:dout#FFDD88:";
|
|
||||||
$options .= " LINE1.25:dout#FF6600:Out\ ";
|
|
||||||
$options .= " GPRINT:out:LAST:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:out:AVERAGE:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:out:MAX:%6.2lf%spps\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function errorgraph ($rrd, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph"; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
global $_GET;
|
|
||||||
if($_GET['bg']) { $options .= " -c CANVAS#" . $_GET['bg'] . " "; }
|
|
||||||
$options .= " DEF:in=$database:INERRORS:AVERAGE";
|
|
||||||
$options .= " DEF:out=$database:OUTERRORS:AVERAGE";
|
|
||||||
$options .= " CDEF:dout=out,-1,*";
|
|
||||||
$options .= " AREA:in#ff3300:";
|
|
||||||
$options .= " COMMENT:Errors\ \ \ \ Current\ \ \ \ \ Average\ \ \ \ \ \ Maximum\\\\n";
|
|
||||||
$options .= " LINE1.25:in#ff0000:In\ \ ";
|
|
||||||
$options .= " GPRINT:in:LAST:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:in:AVERAGE:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:in:MAX:%6.2lf%spps\\\\n";
|
|
||||||
$options .= " AREA:dout#FF6633:";
|
|
||||||
$options .= " LINE1.25:dout#cc3300:Out\ ";
|
|
||||||
$options .= " GPRINT:out:LAST:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:out:AVERAGE:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:out:MAX:%6.2lf%spps\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function nucastgraph ($rrd, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph"; unset ($legend); }
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
global $_GET;
|
|
||||||
if($_GET['bg']) { $options .= " -c CANVAS#" . $_GET['bg'] . " "; }
|
|
||||||
$options .= " DEF:in=$database:INNUCASTPKTS:AVERAGE";
|
|
||||||
$options .= " DEF:out=$database:OUTNUCASTPKTS:AVERAGE";
|
|
||||||
$options .= " CDEF:dout=out,-1,*";
|
|
||||||
$options .= " AREA:in#aa66aa:";
|
|
||||||
$options .= " COMMENT:Packets\ \ \ \ Current\ \ \ \ \ Average\ \ \ \ \ \ Maximum\\\\n";
|
|
||||||
$options .= " LINE1.25:in#330033:In\ \ ";
|
|
||||||
$options .= " GPRINT:in:LAST:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:in:AVERAGE:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:in:MAX:%6.2lf%spps\\\\n";
|
|
||||||
$options .= " AREA:dout#FFDD88:";
|
|
||||||
$options .= " LINE1.25:dout#FF6600:Out\ ";
|
|
||||||
$options .= " GPRINT:out:LAST:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:out:AVERAGE:%6.2lf%spps";
|
|
||||||
$options .= " GPRINT:out:MAX:%6.2lf%spps\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function graph_cbgp_prefixes ($rrd, $graph, $from, $to, $width, $height) {
|
function graph_cbgp_prefixes ($rrd, $graph, $from, $to, $width, $height) {
|
||||||
global $config;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -718,16 +307,15 @@ function graph_cbgp_prefixes ($rrd, $graph, $from, $to, $width, $height) {
|
|||||||
#$options .= " GPRINT:Advertised:LAST:%6.2lf%s";
|
#$options .= " GPRINT:Advertised:LAST:%6.2lf%s";
|
||||||
#$options .= " GPRINT:Advertised:MIN:%6.2lf%s";
|
#$options .= " GPRINT:Advertised:MIN:%6.2lf%s";
|
||||||
#$options .= " GPRINT:Advertised:MAX:%6.2lf%s\\\\l";
|
#$options .= " GPRINT:Advertised:MAX:%6.2lf%s\\\\l";
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
# echo($config['rrdtool'] . " graph $imgfile $options");
|
# echo($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function bgpupdatesgraph ($rrd, $graph , $from, $to, $width, $height) {
|
function bgpupdatesgraph ($rrd, $graph , $from, $to, $width, $height) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -745,44 +333,13 @@ function bgpupdatesgraph ($rrd, $graph , $from, $to, $width, $height) {
|
|||||||
$options .= " GPRINT:out:LAST:%6.2lf%sU/s";
|
$options .= " GPRINT:out:LAST:%6.2lf%sU/s";
|
||||||
$options .= " GPRINT:out:AVERAGE:%6.2lf%sU/s";
|
$options .= " GPRINT:out:AVERAGE:%6.2lf%sU/s";
|
||||||
$options .= " GPRINT:out:MAX:%6.2lf%sU/s\\\\n";
|
$options .= " GPRINT:out:MAX:%6.2lf%sU/s\\\\n";
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function graph_entity_sensor ($sensor, $graph , $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '$sensor' and D.device_id = E.device_id"));
|
|
||||||
$database = $config['rrd_dir'] . "/" . $sensor['hostname'] . "/ces-" . $sensor['entPhysicalIndex'] . ".rrd";
|
|
||||||
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
|
||||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$type = str_pad($sensor['entSensorType'], 8);
|
|
||||||
$type = substr($type,0,8);
|
|
||||||
$options .= " DEF:avg=$database:value:AVERAGE";
|
|
||||||
$options .= " DEF:min=$database:value:MIN";
|
|
||||||
$options .= " DEF:max=$database:value:MAX";
|
|
||||||
$options .= " COMMENT:' Last Min Max Ave\\n'";
|
|
||||||
$options .= " AREA:max#a5a5a5";
|
|
||||||
$options .= " AREA:min#ffffff";
|
|
||||||
$options .= " LINE1.25:avg#aa2200:'".$type."'";
|
|
||||||
|
|
||||||
$options .= " GPRINT:avg:AVERAGE:%5.2lf%s";
|
|
||||||
$options .= " GPRINT:max:MAX:%5.2lf%s";
|
|
||||||
$options .= " GPRINT:max:MAX:%5.2lf%s";
|
|
||||||
$options .= " GPRINT:avg:LAST:%5.2lf%s";
|
|
||||||
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
#echo($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function graph_cpu_generic_single ($rrd, $graph , $from, $to, $width, $height) {
|
function graph_cpu_generic_single ($rrd, $graph , $from, $to, $width, $height) {
|
||||||
global $config;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -791,15 +348,14 @@ function graph_cpu_generic_single ($rrd, $graph , $from, $to, $width, $height) {
|
|||||||
$options .= " AREA:cpu#ffee99: LINE1.25:cpu#aa2200:Load\ %";
|
$options .= " AREA:cpu#ffee99: LINE1.25:cpu#aa2200:Load\ %";
|
||||||
$options .= " GPRINT:cpu:LAST:%6.2lf\ GPRINT:cpu:AVERAGE:%6.2lf\ ";
|
$options .= " GPRINT:cpu:LAST:%6.2lf\ GPRINT:cpu:AVERAGE:%6.2lf\ ";
|
||||||
$options .= " GPRINT:cpu:MAX:%6.2lf\ GPRINT:cpu:AVERAGE:%6.2lf\\\\n";
|
$options .= " GPRINT:cpu:MAX:%6.2lf\ GPRINT:cpu:AVERAGE:%6.2lf\\\\n";
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function graph_adsl_rate ($rrd, $graph, $from, $to, $width, $height) {
|
function graph_adsl_rate ($rrd, $graph, $from, $to, $width, $height) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -814,14 +370,13 @@ function graph_adsl_rate ($rrd, $graph, $from, $to, $width, $height) {
|
|||||||
$options .= " LINE1.25:adslAturCurrAtt#22aa00:Down\ \ ";
|
$options .= " LINE1.25:adslAturCurrAtt#22aa00:Down\ \ ";
|
||||||
$options .= " GPRINT:dslAturCurrAtt:LAST:%5.0lfk\ GPRINT:dslAturCurrAtt:AVERAGE:%5.0lfk\ ";
|
$options .= " GPRINT:dslAturCurrAtt:LAST:%5.0lfk\ GPRINT:dslAturCurrAtt:AVERAGE:%5.0lfk\ ";
|
||||||
$options .= " GPRINT:dslAturCurrAtt:MAX:%5.0lfk\ GPRINT:dslAturCurrAtt:AVERAGE:%5.0lfk\\\\n";
|
$options .= " GPRINT:dslAturCurrAtt:MAX:%5.0lfk\ GPRINT:dslAturCurrAtt:AVERAGE:%5.0lfk\\\\n";
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function graph_adsl_snr ($rrd, $graph, $from, $to, $width, $height) {
|
function graph_adsl_snr ($rrd, $graph, $from, $to, $width, $height) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -836,14 +391,13 @@ function graph_adsl_snr ($rrd, $graph, $from, $to, $width, $height) {
|
|||||||
$options .= " LINE1.25:dslAturCurrSnr#22aa00:SNR\ Down";
|
$options .= " LINE1.25:dslAturCurrSnr#22aa00:SNR\ Down";
|
||||||
$options .= " GPRINT:dslAturCurrSnr:LAST:%3.1lfdB GPRINT:dslAturCurrSnr:AVERAGE:%3.1lfdB\ ";
|
$options .= " GPRINT:dslAturCurrSnr:LAST:%3.1lfdB GPRINT:dslAturCurrSnr:AVERAGE:%3.1lfdB\ ";
|
||||||
$options .= " GPRINT:dslAturCurrSnr:MAX:%3.1lfdB GPRINT:dslAturCurrSnr:AVERAGE:%3.1lfdB\\\\n";
|
$options .= " GPRINT:dslAturCurrSnr:MAX:%3.1lfdB GPRINT:dslAturCurrSnr:AVERAGE:%3.1lfdB\\\\n";
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function graph_adsl_atn ($rrd, $graph, $from, $to, $width, $height) {
|
function graph_adsl_atn ($rrd, $graph, $from, $to, $width, $height) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -858,14 +412,13 @@ function graph_adsl_atn ($rrd, $graph, $from, $to, $width, $height) {
|
|||||||
$options .= " LINE1.25:dslAturCurrAtn#22aa00:Atten\ Down";
|
$options .= " LINE1.25:dslAturCurrAtn#22aa00:Atten\ Down";
|
||||||
$options .= " GPRINT:dslAturCurrAtn:LAST:%3.1lfdB GPRINT:dslAturCurrAtn:AVERAGE:%3.1lfdb";
|
$options .= " GPRINT:dslAturCurrAtn:LAST:%3.1lfdB GPRINT:dslAturCurrAtn:AVERAGE:%3.1lfdb";
|
||||||
$options .= " GPRINT:dslAturCurrAtn:MAX:%3.1lfdB GPRINT:dslAturCurrAtn:AVERAGE:%3.1lfdb\\\\n";
|
$options .= " GPRINT:dslAturCurrAtn:MAX:%3.1lfdB GPRINT:dslAturCurrAtn:AVERAGE:%3.1lfdb\\\\n";
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cpugraph ($rrd, $graph , $from, $to, $width, $height) {
|
function cpugraph ($rrd, $graph , $from, $to, $width, $height) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -875,32 +428,13 @@ function cpugraph ($rrd, $graph , $from, $to, $width, $height) {
|
|||||||
$options .= " AREA:5m#ffee99: LINE1.25:5m#aa2200:Load\ %";
|
$options .= " AREA:5m#ffee99: LINE1.25:5m#aa2200:Load\ %";
|
||||||
$options .= " GPRINT:5m:LAST:%6.2lf\ GPRINT:5m:AVERAGE:%6.2lf\ ";
|
$options .= " GPRINT:5m:LAST:%6.2lf\ GPRINT:5m:AVERAGE:%6.2lf\ ";
|
||||||
$options .= " GPRINT:5m:MAX:%6.2lf\ GPRINT:5m:AVERAGE:%6.2lf\\\\n";
|
$options .= " GPRINT:5m:MAX:%6.2lf\ GPRINT:5m:AVERAGE:%6.2lf\\\\n";
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
|
||||||
|
|
||||||
function uptimegraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$options .= " DEF:uptime=$database:uptime:AVERAGE";
|
|
||||||
$options .= " CDEF:cuptime=uptime,86400,/";
|
|
||||||
$options .= " COMMENT:Days\ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
|
|
||||||
$options .= " AREA:cuptime#EEEEEE:Uptime";
|
|
||||||
$options .= " LINE1.25:cuptime#36393D:";
|
|
||||||
$options .= " GPRINT:cuptime:LAST:%6.2lf\ GPRINT:cuptime:AVERAGE:%6.2lf\ ";
|
|
||||||
$options .= " GPRINT:cuptime:MAX:%6.2lf\ GPRINT:cuptime:AVERAGE:%6.2lf\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function memgraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical) {
|
function memgraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
@ -925,190 +459,8 @@ function memgraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical
|
|||||||
$options .= " GPRINT:FREE:MAX:%6.2lf%s";
|
$options .= " GPRINT:FREE:MAX:%6.2lf%s";
|
||||||
$options .= " GPRINT:FREE:AVERAGE:%6.2lf%s\\\\l";
|
$options .= " GPRINT:FREE:AVERAGE:%6.2lf%s\\\\l";
|
||||||
$options .= " LINE1:MEMTOTAL#000000:";
|
$options .= " LINE1:MEMTOTAL#000000:";
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ip_graph ($rrd, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$options .= " DEF:ipForwDatagrams=$database:ipForwDatagrams:AVERAGE";
|
|
||||||
$options .= " DEF:ipInDelivers=$database:ipInDelivers:AVERAGE";
|
|
||||||
$options .= " DEF:ipInReceives=$database:ipInReceives:AVERAGE";
|
|
||||||
$options .= " DEF:ipOutRequests=$database:ipOutRequests:AVERAGE";
|
|
||||||
$options .= " DEF:ipInDiscards=$database:ipInDiscards:AVERAGE";
|
|
||||||
$options .= " DEF:ipOutDiscards=$database:ipOutDiscards:AVERAGE";
|
|
||||||
$options .= " DEF:ipOutNoRoutes=$database:ipInDiscards:AVERAGE";
|
|
||||||
$options .= " COMMENT:Packets/sec\ \ \ \ Current\ \ \ Average\ \ \ Maximum\\\n";
|
|
||||||
$options .= " LINE1.25:ipForwDatagrams#cc0000:ForwDgrams\ ";
|
|
||||||
$options .= " GPRINT:ipForwDatagrams:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipForwDatagrams:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipForwDatagrams:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:ipInDelivers#00cc00:InDelivers\ ";
|
|
||||||
$options .= " GPRINT:ipInDelivers:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipInDelivers:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipInDelivers:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:ipInReceives#006600:InReceives\ ";
|
|
||||||
$options .= " GPRINT:ipInReceives:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipInReceives:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipInReceives:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:ipOutRequests#0000cc:OutRequests";
|
|
||||||
$options .= " GPRINT:ipOutRequests:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipOutRequests:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipOutRequests:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:ipInDiscards#cccc00:InDiscards\ ";
|
|
||||||
$options .= " GPRINT:ipInDiscards:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipInDiscards:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipInDiscards:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:ipOutDiscards#330033:OutDiscards";
|
|
||||||
$options .= " GPRINT:ipOutDiscards:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipOutDiscards:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipOutDiscards:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:ipOutNoRoutes#660000:OutNoRoutes";
|
|
||||||
$options .= " GPRINT:ipOutNoRoutes:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipOutNoRoutes:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:ipOutNoRoutes:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function icmp_graph ($rrd, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= "DEF:icmpInMsgs=$database:icmpInMsgs:AVERAGE";
|
|
||||||
$options .= " DEF:icmpOutMsgs=$database:icmpOutMsgs:AVERAGE";
|
|
||||||
$options .= " DEF:icmpInErrors=$database:icmpInErrors:AVERAGE";
|
|
||||||
$options .= " DEF:icmpOutErrors=$database:icmpOutErrors:AVERAGE";
|
|
||||||
$options .= " DEF:icmpInEchos=$database:icmpInEchos:AVERAGE";
|
|
||||||
$options .= " DEF:icmpOutEchos=$database:icmpOutEchos:AVERAGE";
|
|
||||||
$options .= " DEF:icmpInEchoReps=$database:icmpInEchoReps:AVERAGE";
|
|
||||||
$options .= " DEF:icmpOutEchoReps=$database:icmpOutEchoReps:AVERAGE";
|
|
||||||
$options .= " COMMENT:Packets/sec\ \ \ \ Current\ \ \ \ Average\ \ \ Maximum\\\\n";
|
|
||||||
$options .= " LINE1.25:icmpInMsgs#00cc00:InMsgs ";
|
|
||||||
$options .= " GPRINT:icmpInMsgs:LAST:\ \ \ \ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpInMsgs:AVERAGE:\ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpInMsgs:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:icmpOutMsgs#006600:OutMsgs ";
|
|
||||||
$options .= " GPRINT:icmpOutMsgs:LAST:\ \ \ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpOutMsgs:AVERAGE:\ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpOutMsgs:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:icmpInErrors#cc0000:InErrors ";
|
|
||||||
$options .= " GPRINT:icmpInErrors:LAST:\ \ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpInErrors:AVERAGE:\ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpInErrors:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:icmpOutErrors#660000:OutErrors ";
|
|
||||||
$options .= " GPRINT:icmpOutErrors:LAST:\ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpOutErrors:AVERAGE:\ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpOutErrors:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:icmpInEchos#0066cc:InEchos ";
|
|
||||||
$options .= " GPRINT:icmpInEchos:LAST:\ \ \ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpInEchos:AVERAGE:\ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpInEchos:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:icmpOutEchos#003399:OutEchos ";
|
|
||||||
$options .= " GPRINT:icmpOutEchos:LAST:\ \ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpOutEchos:AVERAGE:\ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpOutEchos:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:icmpInEchoReps#cc00cc:InEchoReps ";
|
|
||||||
$options .= " GPRINT:icmpInEchoReps:LAST:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpInEchoReps:AVERAGE:\ \ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpInEchoReps:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:icmpOutEchoReps#990099:OutEchoReps";
|
|
||||||
$options .= " GPRINT:icmpOutEchoReps:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpOutEchoReps:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:icmpOutEchoReps:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function tcp_graph ($rrd, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= "DEF:icmpInMsgs=$database:icmpInMsgs:AVERAGE";
|
|
||||||
$options .= " DEF:tcpActiveOpens=$database:tcpActiveOpens:AVERAGE";
|
|
||||||
$options .= " DEF:tcpPassiveOpens=$database:tcpPassiveOpens:AVERAGE";
|
|
||||||
$options .= " DEF:tcpAttemptFails=$database:tcpAttemptFails:AVERAGE";
|
|
||||||
$options .= " DEF:tcpEstabResets=$database:tcpEstabResets:AVERAGE";
|
|
||||||
$options .= " DEF:tcpInSegs=$database:tcpInSegs:AVERAGE";
|
|
||||||
$options .= " DEF:tcpOutSegs=$database:tcpOutSegs:AVERAGE";
|
|
||||||
$options .= " DEF:tcpRetransSegs=$database:tcpRetransSegs:AVERAGE";
|
|
||||||
$options .= " COMMENT:Packets/sec\ \ \ \ Current\ \ \ \ Average\ \ \ Maximum\\\n";
|
|
||||||
$options .= " LINE1.25:tcpActiveOpens#00cc00:ActiveOpens\ ";
|
|
||||||
$options .= " GPRINT:tcpActiveOpens:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpActiveOpens:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpActiveOpens:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:tcpPassiveOpens#006600:PassiveOpens";
|
|
||||||
$options .= " GPRINT:tcpPassiveOpens:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpPassiveOpens:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpPassiveOpens:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:tcpAttemptFails#cc0000:AttemptFails";
|
|
||||||
$options .= " GPRINT:tcpAttemptFails:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpAttemptFails:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpAttemptFails:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:tcpEstabResets#660000:EstabResets\ ";
|
|
||||||
$options .= " GPRINT:tcpEstabResets:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpEstabResets:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpEstabResets:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:tcpInSegs#0066cc:InSegs\ \ \ \ \ \ ";
|
|
||||||
$options .= " GPRINT:tcpInSegs:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpInSegs:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpInSegs:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:tcpOutSegs#003399:OutSegs\ \ \ \ \ ";
|
|
||||||
$options .= " GPRINT:tcpOutSegs:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpOutSegs:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpOutSegs:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:tcpRetransSegs#cc00cc:RetransSegs\ ";
|
|
||||||
$options .= " GPRINT:tcpRetransSegs:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpRetransSegs:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:tcpRetransSegs:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function udp_graph ($rrd, $graph, $from, $to, $width, $height) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
|
||||||
$options .= $config['rrdgraph_def_text'];
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= "DEF:icmpInMsgs=$database:icmpInMsgs:AVERAGE";
|
|
||||||
$options .= " DEF:udpInDatagrams=$database:udpInDatagrams:AVERAGE";
|
|
||||||
$options .= " DEF:udpOutDatagrams=$database:udpOutDatagrams:AVERAGE";
|
|
||||||
$options .= " DEF:udpInErrors=$database:udpInErrors:AVERAGE";
|
|
||||||
$options .= " DEF:udpNoPorts=$database:udpNoPorts:AVERAGE";
|
|
||||||
$options .= " COMMENT:Packets/sec\ \ \ \ Current\ \ \ \ Average\ \ \ Maximum\\\\n";
|
|
||||||
$options .= " LINE1.25:udpInDatagrams#00cc00:InDatagrams\ ";
|
|
||||||
$options .= " GPRINT:udpInDatagrams:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:udpInDatagrams:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:udpInDatagrams:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:udpOutDatagrams#006600:OutDatagrams";
|
|
||||||
$options .= " GPRINT:udpOutDatagrams:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:udpOutDatagrams:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:udpOutDatagrams:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:udpInErrors#cc0000:InErrors\ \ \ \ ";
|
|
||||||
$options .= " GPRINT:udpInErrors:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:udpInErrors:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:udpInErrors:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$options .= " LINE1.25:udpNoPorts#660000:NoPorts\ \ \ \ \ ";
|
|
||||||
$options .= " GPRINT:udpNoPorts:LAST:%6.2lf%s";
|
|
||||||
$options .= " GPRINT:udpNoPorts:AVERAGE:\ %6.2lf%s";
|
|
||||||
$options .= " GPRINT:udpNoPorts:MAX:\ %6.2lf%s\\\\n";
|
|
||||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
@ -56,14 +56,14 @@ function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
|||||||
$options .= " GPRINT:sspam:MAX:\ %6.0lf";
|
$options .= " GPRINT:sspam:MAX:\ %6.0lf";
|
||||||
$options .= " GPRINT:rspam:AVERAGE:\ \ %5.2lf/min";
|
$options .= " GPRINT:rspam:AVERAGE:\ \ %5.2lf/min";
|
||||||
$options .= " GPRINT:rmspam:MAX:\ %5.2lf/min\\\\l";
|
$options .= " GPRINT:rmspam:MAX:\ %5.2lf/min\\\\l";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
@ -95,14 +95,14 @@ function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
|||||||
$options .= " GPRINT:srecv:MAX:\ \ %6.0lf";
|
$options .= " GPRINT:srecv:MAX:\ \ %6.0lf";
|
||||||
$options .= " GPRINT:rrecv:AVERAGE:\ \ %5.2lf/min";
|
$options .= " GPRINT:rrecv:AVERAGE:\ \ %5.2lf/min";
|
||||||
$options .= " GPRINT:rmrecv:MAX:\ %5.2lf/min\\\\l";
|
$options .= " GPRINT:rmrecv:MAX:\ %5.2lf/min\\\\l";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -161,14 +161,14 @@ function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $verti
|
|||||||
$options .= " LINE1:totalreal#050505:total";
|
$options .= " LINE1:totalreal#050505:total";
|
||||||
$options .= " GPRINT:totalreal:AVERAGE:\ \ %7.2lf%sB";
|
$options .= " GPRINT:totalreal:AVERAGE:\ \ %7.2lf%sB";
|
||||||
|
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
@ -194,15 +194,15 @@ function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vert
|
|||||||
$options .= " GPRINT:c:LAST:\ \ \ %7.2lf";
|
$options .= " GPRINT:c:LAST:\ \ \ %7.2lf";
|
||||||
$options .= " GPRINT:c:AVERAGE:\ \ %7.2lf";
|
$options .= " GPRINT:c:AVERAGE:\ \ %7.2lf";
|
||||||
$options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n";
|
$options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
@ -215,14 +215,14 @@ function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
|||||||
$options .= " GPRINT:users:AVERAGE:%6.2lf";
|
$options .= " GPRINT:users:AVERAGE:%6.2lf";
|
||||||
$options .= " GPRINT:users:MIN:%6.2lf";
|
$options .= " GPRINT:users:MIN:%6.2lf";
|
||||||
$options .= " GPRINT:users:MAX:%6.2lf\\\\n";
|
$options .= " GPRINT:users:MAX:%6.2lf\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
@ -235,17 +235,17 @@ function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
|||||||
$options .= " GPRINT:procs:AVERAGE:%6.2lf";
|
$options .= " GPRINT:procs:AVERAGE:%6.2lf";
|
||||||
$options .= " GPRINT:procs:MIN:%6.2lf";
|
$options .= " GPRINT:procs:MIN:%6.2lf";
|
||||||
$options .= " GPRINT:procs:MAX:%6.2lf\\\\n";
|
$options .= " GPRINT:procs:MAX:%6.2lf\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
@ -276,14 +276,14 @@ function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $verti
|
|||||||
$options .= " GPRINT:idle_perc:LAST:\ \ \ \ \ %5.2lf%%";
|
$options .= " GPRINT:idle_perc:LAST:\ \ \ \ \ %5.2lf%%";
|
||||||
$options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
|
$options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
|
||||||
$options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
$options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
@ -327,14 +327,14 @@ function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $v
|
|||||||
$options .= " GPRINT:vimapd_ssl_login:AVERAGE:\ %6.0lf";
|
$options .= " GPRINT:vimapd_ssl_login:AVERAGE:\ %6.0lf";
|
||||||
$options .= " GPRINT:rimapd_ssl_login:AVERAGE:%5.2lf/min";
|
$options .= " GPRINT:rimapd_ssl_login:AVERAGE:%5.2lf/min";
|
||||||
$options .= " GPRINT:rmimapd_ssl_login:MAX:%5.2lf/min\\\\l";
|
$options .= " GPRINT:rmimapd_ssl_login:MAX:%5.2lf/min\\\\l";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -345,13 +345,13 @@ function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
|||||||
$options .= " GPRINT:hits:LAST:\ %6.2lf/sec";
|
$options .= " GPRINT:hits:LAST:\ %6.2lf/sec";
|
||||||
$options .= " GPRINT:hits:AVERAGE:%6.2lf/sec";
|
$options .= " GPRINT:hits:AVERAGE:%6.2lf/sec";
|
||||||
$options .= " GPRINT:hits:MAX:%6.2lf/sec\\\\n";
|
$options .= " GPRINT:hits:MAX:%6.2lf/sec\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -377,15 +377,15 @@ function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertica
|
|||||||
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
||||||
$iter++;
|
$iter++;
|
||||||
}
|
}
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -411,14 +411,14 @@ function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title,
|
|||||||
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
||||||
$iter++;
|
$iter++;
|
||||||
}
|
}
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||||
$options .= $config['rrdgraph_def_text'];
|
$options .= $config['rrdgraph_def_text'];
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -429,6 +429,6 @@ function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
|||||||
$options .= " GPRINT:bits:LAST:\ %6.2lf/sec";
|
$options .= " GPRINT:bits:LAST:\ %6.2lf/sec";
|
||||||
$options .= " GPRINT:bits:AVERAGE:%6.2lf/sec";
|
$options .= " GPRINT:bits:AVERAGE:%6.2lf/sec";
|
||||||
$options .= " GPRINT:bits:MAX:%6.2lf/sec\\\\n";
|
$options .= " GPRINT:bits:MAX:%6.2lf/sec\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
86
includes/polling/cisco-mac-accounting.inc.php
Executable file
86
includes/polling/cisco-mac-accounting.inc.php
Executable file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$cip_oids = array('cipMacHCSwitchedBytes', 'cipMacHCSwitchedPkts');
|
||||||
|
echo("Caching OID: ");
|
||||||
|
foreach ($cip_oids as $oid) { echo("$oid "); $array = snmp_cache_cip($oid, $device, $array, "CISCO-IP-STAT-MIB"); }
|
||||||
|
echo("\n");
|
||||||
|
|
||||||
|
$polled = time();
|
||||||
|
|
||||||
|
$mac_entries = 0;
|
||||||
|
|
||||||
|
$mac_accounting_query = mysql_query("SELECT * FROM `mac_accounting` as A, `interfaces` AS I where A.interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'");
|
||||||
|
while ($acc = mysql_fetch_array($mac_accounting_query)) {
|
||||||
|
|
||||||
|
$device_id = $acc['device_id'];
|
||||||
|
$ifIndex = $acc['ifIndex'];
|
||||||
|
$mac = $acc['mac'];
|
||||||
|
if($array[$device_id][$ifIndex][$mac]) {
|
||||||
|
|
||||||
|
$polled_period = $polled - $acc['poll_time'];
|
||||||
|
|
||||||
|
$update .= "`poll_time` = '".$polled."'";
|
||||||
|
$update .= ", `poll_prev` = '".$acc['poll_time']."'";
|
||||||
|
$update .= ", `poll_period` = '".$polled_period."'";
|
||||||
|
|
||||||
|
$mac_entries++;
|
||||||
|
|
||||||
|
$b_in = $array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedBytes']['input'];
|
||||||
|
$b_out = $array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedBytes']['output'];
|
||||||
|
$p_in = $array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedPkts']['input'];
|
||||||
|
$p_out = $array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedPkts']['output'];
|
||||||
|
|
||||||
|
$this_ma = &$array[$device_id][$ifIndex][$mac];
|
||||||
|
|
||||||
|
/// Update metrics
|
||||||
|
foreach ($cip_oids as $oid) {
|
||||||
|
foreach(array('input','output') as $dir) {
|
||||||
|
$oid_dir = $oid . "_" . $dir;
|
||||||
|
$update .= ", `".$oid_dir."` = '".$this_ma[$oid][$dir]."'";
|
||||||
|
$update .= ", `".$oid_dir."_prev` = '".$acc[$oid_dir]."'";
|
||||||
|
$oid_prev = $oid_dir . "_prev";
|
||||||
|
if($this_ma[$oid][$dir]) {
|
||||||
|
$oid_diff = $this_ma[$oid][$dir] - $acc[$oid_dir];
|
||||||
|
$oid_rate = $oid_diff / $polled_period;
|
||||||
|
$update .= ", `".$oid_dir."_rate` = '".$oid_rate."'";
|
||||||
|
$update .= ", `".$oid_dir."_delta` = '".$oid_diff."'";
|
||||||
|
if($debug) {echo("\n $oid_dir ($oid_diff B) $oid_rate Bps $polled_period secs\n");}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($debug) {echo("\n" . $acc['hostname']." ".$acc['ifDescr'] . " $mac -> $b_in:$b_out:$p_in:$p_out ");}
|
||||||
|
$rrdfile = $host_rrd . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||||
|
|
||||||
|
if(!is_file($rrdfile)) {
|
||||||
|
$woo = shell_exec($config['rrdtool'] ." create $rrdfile \
|
||||||
|
DS:IN:COUNTER:600:0:12500000000 \
|
||||||
|
DS:OUT:COUNTER:600:0:12500000000 \
|
||||||
|
DS:PIN:COUNTER:600:0:12500000000 \
|
||||||
|
DS:POUT:COUNTER:600:0:12500000000 \
|
||||||
|
RRA:AVERAGE:0.5:1:600 \
|
||||||
|
RRA:AVERAGE:0.5:6:700 \
|
||||||
|
RRA:AVERAGE:0.5:24:775 \
|
||||||
|
RRA:AVERAGE:0.5:288:797 \
|
||||||
|
RRA:MAX:0.5:1:600 \
|
||||||
|
RRA:MAX:0.5:6:700 \
|
||||||
|
RRA:MAX:0.5:24:775 \
|
||||||
|
RRA:MAX:0.5:288:797");
|
||||||
|
}
|
||||||
|
$woo = "N:".($b_in+0).":".($b_out+0).":".($p_in+0).":".($p_out+0);
|
||||||
|
if($debug) {echo("\n rrdtool update $rrdfile $woo");}
|
||||||
|
$ret = rrdtool_update("$rrdfile", $woo);
|
||||||
|
|
||||||
|
if ($update) { /// Do Updates
|
||||||
|
$update_query = "UPDATE `mac_accounting` SET ".$update." WHERE `ma_id` = '" . $acc['ma_id'] . "'";
|
||||||
|
@mysql_query($update_query); $mysql++;
|
||||||
|
if($debug) {echo("\nMYSQL : [ $update_query ]");}
|
||||||
|
} /// End Updates
|
||||||
|
unset($update_query); unset($update);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($mac_entries) { echo("$mac_entries mac accounting entries updated\n"); }
|
||||||
|
|
||||||
|
?>
|
@ -3,7 +3,7 @@
|
|||||||
if($device['os'] == "CatOS" || $device['os'] == "IOS") {
|
if($device['os'] == "CatOS" || $device['os'] == "IOS") {
|
||||||
$portifIndex = array();
|
$portifIndex = array();
|
||||||
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
|
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
|
||||||
echo("$cmd");
|
#echo("$cmd");
|
||||||
$portifIndex_output = trim(shell_exec($cmd));
|
$portifIndex_output = trim(shell_exec($cmd));
|
||||||
foreach(explode("\n", $portifIndex_output) as $entry){
|
foreach(explode("\n", $portifIndex_output) as $entry){
|
||||||
$entry = str_replace("CISCO-STACK-MIB::portIfIndex.", "", $entry);
|
$entry = str_replace("CISCO-STACK-MIB::portIfIndex.", "", $entry);
|
||||||
@ -118,7 +118,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
|||||||
$update_query = "UPDATE `interfaces` SET ";
|
$update_query = "UPDATE `interfaces` SET ";
|
||||||
$update_query .= $update;
|
$update_query .= $update;
|
||||||
$update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'";
|
$update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'";
|
||||||
echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n");
|
#echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n");
|
||||||
$update_result = mysql_query($update_query);
|
$update_result = mysql_query($update_query);
|
||||||
} else {
|
} else {
|
||||||
# echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n");
|
# echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n");
|
||||||
@ -147,7 +147,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
|||||||
$ret = rrdtool_update("$rrdfile", $woo);
|
$ret = rrdtool_update("$rrdfile", $woo);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo("Interface " . $device['hostname'] . " " . $interface['ifDescr'] . " is down\n");
|
#echo("Interface " . $device['hostname'] . " " . $interface['ifDescr'] . " is down\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
167
includes/polling/ports.inc.php
Executable file
167
includes/polling/ports.inc.php
Executable file
@ -0,0 +1,167 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
unset($ports);
|
||||||
|
$ports = snmp_cache_ifIndex($device); // Cache Port List
|
||||||
|
|
||||||
|
// Build SNMP Cache Array
|
||||||
|
$data_oids = array('ifName','ifDescr','ifAlias', 'ifAdminStatus', 'ifOperStatus', 'ifMtu', 'ifSpeed', 'ifHighSpeed', 'ifType', 'ifPhysAddress',
|
||||||
|
'ifPromiscuousMode','ifConnectorPresent');
|
||||||
|
$stat_oids = array('ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts', 'ifInNUcastPkts', 'ifOutNUcastPkts',
|
||||||
|
'ifHCInMulticastPkts', 'ifHCInBroadcastPkts', 'ifHCOutMulticastPkts', 'ifHCOutBroadcastPkts',
|
||||||
|
'ifInOctets', 'ifOutOctets', 'ifHCInOctets', 'ifHCOutOctets');
|
||||||
|
|
||||||
|
$stat_oids_db = array('ifInOctets', 'ifOutOctets', 'ifInErrors', 'ifOutErrors', 'ifInUcastPkts', 'ifOutUcastPkts'); // From above for DB
|
||||||
|
|
||||||
|
$etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames',
|
||||||
|
'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions',
|
||||||
|
'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors',
|
||||||
|
'dot3StatsSymbolErrors', 'dot3StatsDuplexStatus');
|
||||||
|
|
||||||
|
$cisco_oids = array('locIfHardType', 'locIfInRunts', 'locIfInGiants', 'locIfInCRC', 'locIfInFrame', 'locIfInOverrun', 'locIfInIgnored', 'locIfInAbort',
|
||||||
|
'locIfCollisions', 'locIfInputQueueDrops', 'locIfOutputQueueDrops');
|
||||||
|
|
||||||
|
$pagp_oids = array('pagpOperationMode', 'pagpPortState', 'pagpPartnerDeviceId', 'pagpPartnerLearnMethod', 'pagpPartnerIfIndex', 'pagpPartnerGroupIfIndex',
|
||||||
|
'pagpPartnerDeviceName', 'pagpEthcOperationMode', 'pagpDeviceId', 'pagpGroupIfIndex');
|
||||||
|
|
||||||
|
$ifmib_oids = array_merge($data_oids, $stat_oids);
|
||||||
|
|
||||||
|
if(count($ifmib_oids) > (count($ports)*2.5)) { /// If there are 2.5x more interfaces than OIDs, do per-OID
|
||||||
|
$sub_start = utime();
|
||||||
|
echo("Caching Ports: ");
|
||||||
|
foreach($ports as $port) { echo("$port "); $array = snmp_cache_port_oids($ifmib_oids, $port, $device, $array, "IF-MIB"); }
|
||||||
|
$end = utime(); $run = $end - $sub_start; $proctime = substr($run, 0, 5);
|
||||||
|
#echo("\n$proctime secs\n");
|
||||||
|
} else {
|
||||||
|
$sub_start = utime();
|
||||||
|
echo("Caching Oids: ");
|
||||||
|
foreach ($ifmib_oids as $oid) { echo("$oid "); $array = snmp_cache_oid($oid, $device, $array, "IF-MIB"); }
|
||||||
|
$end = utime(); $run = $end - $sub_start; $proctime = substr($run, 0, 5);
|
||||||
|
#echo("\n$proctime secs\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#foreach ($etherlike_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "EtherLike-MIB"); }
|
||||||
|
#foreach ($cisco_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "OLD-CISCO-INTERFACES-MIB"); }
|
||||||
|
#foreach ($pagp_oids as $oid) { $array = snmp_cache_oid($oid, $device, $array, "CISCO-PAGP-MIB"); }
|
||||||
|
|
||||||
|
if($device['os'] == "IOS" || $device['os'] == "CatOS" || $device['os'] == "IOS XE") {
|
||||||
|
#$array = snmp_cache_portIfIndex ($device, $array);
|
||||||
|
#$array = snmp_cache_portName ($device, $array);
|
||||||
|
#$array = snmp_cache_oid("vmVlan", $device, $array, "CISCO-VLAN-MEMBERSHIP-MIB");
|
||||||
|
#$array = snmp_cache_oid("vlanTrunkPortEncapsulationOperType", $device, $array, "CISCO-VTP-MIB");
|
||||||
|
#$array = snmp_cache_oid("vlanTrunkPortNativeVlan", $device, $array, "CISCO-VTP-MIB");
|
||||||
|
}
|
||||||
|
|
||||||
|
$polled = time();
|
||||||
|
|
||||||
|
/// End Building SNMP Cache Array
|
||||||
|
|
||||||
|
if($debug) { print_r($array); }
|
||||||
|
|
||||||
|
/// New interface detection
|
||||||
|
///// TO DO
|
||||||
|
/// End New interface detection
|
||||||
|
|
||||||
|
/// Loop interfaces in the DB and update where necessary
|
||||||
|
$port_query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."'");
|
||||||
|
while ($port = mysql_fetch_array($port_query)) {
|
||||||
|
|
||||||
|
echo(" --> " . $port['ifDescr'] . " ");
|
||||||
|
if($array[$device[device_id]][$port[ifIndex]]) { // Check to make sure Port data is cached.
|
||||||
|
|
||||||
|
$this_port = &$array[$device[device_id]][$port[ifIndex]];
|
||||||
|
|
||||||
|
$polled_period = $polled - $port['poll_time'];
|
||||||
|
|
||||||
|
$update .= "`poll_time` = '".$polled."'";
|
||||||
|
$update .= ", `poll_prev` = '".$port['poll_time']."'";
|
||||||
|
$update .= ", `poll_period` = '".$polled_period."'";
|
||||||
|
|
||||||
|
/// Copy ifHC[In|Out]Octets values to non-HC if they exist
|
||||||
|
if(isset($this_port['ifHCInOctets']) && isset($this_port['ifHCOutOctets'])) {
|
||||||
|
echo("HC ");
|
||||||
|
$this_port['ifInOctets'] = $this_port['ifHCInOctets'];
|
||||||
|
$this_port['ifOutOctets'] = $this_port['ifHCOutOctets'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update IF-MIB data
|
||||||
|
foreach ($data_oids as $oid) {
|
||||||
|
if ( $port[$oid] != $this_port[$oid]) {
|
||||||
|
$update .= ", `$oid` = '".mysql_real_escape_string($this_port[$oid])."'";
|
||||||
|
#mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $port['device_id'] . "', '" . $port['interface_id'] . "', NOW(), '".$oid . ": ".$port[$oid]." -> " . $this_port[$oid]."')");
|
||||||
|
#eventlog($device['device_id'], 'interface', $port['interface_id'], $oid . ": ".$port[$oid]." -> " . $this_port[$oid]);
|
||||||
|
echo($oid . " ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update IF-MIB metrics
|
||||||
|
foreach ($stat_oids_db as $oid) {
|
||||||
|
$update .= ", `$oid` = '".$this_port[$oid]."'";
|
||||||
|
$update .= ", `".$oid."_prev` = '".$port[$oid]."'";
|
||||||
|
$oid_prev = $oid . "_prev";
|
||||||
|
if($port[$oid]) {
|
||||||
|
$oid_diff = $this_port[$oid] - $port[$oid];
|
||||||
|
$oid_rate = $oid_diff / $polled_period;
|
||||||
|
$update .= ", `".$oid."_rate` = '".$oid_rate."'";
|
||||||
|
$update .= ", `".$oid."_delta` = '".$oid_diff."'";
|
||||||
|
#echo("\n $oid ($oid_diff B) $oid_rate Bps $polled_period secs\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update RRDs
|
||||||
|
$rrdfile = $host_rrd . "/" . $port['ifIndex'] . ".rrd";
|
||||||
|
if(!is_file($rrdfile)) {
|
||||||
|
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
|
||||||
|
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 \
|
||||||
|
RRA:AVERAGE:0.5:1:600 \
|
||||||
|
RRA:AVERAGE:0.5:6:700 \
|
||||||
|
RRA:AVERAGE:0.5:24:775 \
|
||||||
|
RRA:AVERAGE:0.5:288:797 \
|
||||||
|
RRA:MAX:0.5:1:600 \
|
||||||
|
RRA:MAX:0.5:6:700 \
|
||||||
|
RRA:MAX:0.5:24:775 \
|
||||||
|
RRA:MAX:0.5:288:797");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($stat_oids as $oid) { /// Copy values from array to global variables and force numeric.
|
||||||
|
$$oid = $this_port[$oid];
|
||||||
|
$$oid = $$oid+0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$woo = "$polled:$ifInOctets:$ifOutOctets:$ifInErrors:$ifOutErrors:$ifInUcastPkts:$ifOutUcastPkts:$ifInNUcastPkts:$ifOutNUcastPkts";
|
||||||
|
echo("\n rrdtool update $rrdfile $woo\n");
|
||||||
|
$ret = rrdtool_update("$rrdfile", $woo);
|
||||||
|
|
||||||
|
/// End Update IF-MIB
|
||||||
|
|
||||||
|
/// Update PAgP
|
||||||
|
if($this_port['pagpOperationMode']) {
|
||||||
|
foreach ($pagp_oids as $oid) { // Loop the OIDs
|
||||||
|
if ( $this_port[$oid] != $port[$oid] ) { // If data has changed, build a query
|
||||||
|
$update .= ", `$oid` = '".mres($this_port[$oid])."'";
|
||||||
|
echo("PAgP ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End Update PAgP
|
||||||
|
|
||||||
|
if ($update) { /// Do Updates
|
||||||
|
$update_query = "UPDATE `interfaces` SET ".$update." WHERE `interface_id` = '" . $port['interface_id'] . "'";
|
||||||
|
@mysql_query($update_query); $mysql++;
|
||||||
|
if($debug) {echo("\nMYSQL : [ $update_query ]");}
|
||||||
|
} /// End Updates
|
||||||
|
|
||||||
|
unset($update_query); unset($update);
|
||||||
|
} else {
|
||||||
|
echo("Port Deleted?"); // Port missing from SNMP cache?
|
||||||
|
}
|
||||||
|
echo("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
function cpugraphHP ($rrd, $graph , $from, $to, $width, $height)
|
function cpugraphHP ($rrd, $graph , $from, $to, $width, $height)
|
||||||
{
|
{
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = "rrd/" . $rrd;
|
$database = "rrd/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
|
|
||||||
$optsa = array( "--start", $from, "--width", $width, "--height", $height, "--vertical-label", $vertical, "--alt-autoscale-max",
|
$optsa = array( "--start", $from, "--width", $width, "--height", $height, "--vertical-label", $vertical, "--alt-autoscale-max",
|
||||||
"-l 0",
|
"-l 0",
|
||||||
"-E",
|
"-E",
|
||||||
@ -23,14 +21,14 @@ function cpugraphHP ($rrd, $graph , $from, $to, $width, $height)
|
|||||||
"--font-render-mode", "normal");}
|
"--font-render-mode", "normal");}
|
||||||
$opts = array_merge($config['rrdgraph_defaults'], $$optsa, $optsb);
|
$opts = array_merge($config['rrdgraph_defaults'], $$optsa, $optsb);
|
||||||
|
|
||||||
$ret = rrd_graph("$imgfile", $opts, count($opts));
|
$ret = rrd_graph("$graph", $opts, count($opts));
|
||||||
|
|
||||||
if( !is_array($ret) ) {
|
if( !is_array($ret) ) {
|
||||||
$err = rrd_error();
|
$err = rrd_error();
|
||||||
#echo "rrd_graph() ERROR: $err\n";
|
#echo "rrd_graph() ERROR: $err\n";
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +36,7 @@ function memgraphHP ($rrd, $graph , $from, $to, $width, $height, $title, $vertic
|
|||||||
{
|
{
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = "rrd/" . $rrd;
|
$database = "rrd/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$memrrd = $database;
|
$memrrd = $database;
|
||||||
$opts = array("--start", "$from", "--alt-autoscale-max", "--width", "$width", "--height", "$height",
|
$opts = array("--start", "$from", "--alt-autoscale-max", "--width", "$width", "--height", "$height",
|
||||||
"-l", "0", "-E", "-b", "1024",
|
"-l", "0", "-E", "-b", "1024",
|
||||||
@ -55,14 +53,14 @@ function memgraphHP ($rrd, $graph , $from, $to, $width, $height, $title, $vertic
|
|||||||
|
|
||||||
$opts = array_merge($config['rrdgraph_defaults'], $$opts, $optsb);
|
$opts = array_merge($config['rrdgraph_defaults'], $$opts, $optsb);
|
||||||
|
|
||||||
$ret = rrd_graph("$imgfile", $opts, count($opts));
|
$ret = rrd_graph("$graph", $opts, count($opts));
|
||||||
|
|
||||||
if( !is_array($ret) ) {
|
if( !is_array($ret) ) {
|
||||||
$err = rrd_error();
|
$err = rrd_error();
|
||||||
#echo "rrd_graph() ERROR: $err\n";
|
#echo "rrd_graph() ERROR: $err\n";
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ $year = time() - (365 * 24 * 60 * 60);
|
|||||||
### Update Database between 0.6.0 and 0.6.1 (slight slowdown)
|
### Update Database between 0.6.0 and 0.6.1 (slight slowdown)
|
||||||
|
|
||||||
$exists = false;
|
$exists = false;
|
||||||
$columns = mysql_query("SHOW columns FROM `interfaces`");
|
$columns = @mysql_query("SHOW columns FROM `interfaces`");
|
||||||
while($c = mysql_fetch_assoc($columns)){
|
while($c = @mysql_fetch_assoc($columns)){
|
||||||
if($c['Field'] == "pagpOperationMode"){
|
if($c['Field'] == "pagpOperationMode"){
|
||||||
$db_pagp = true;
|
$db_pagp = true;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -55,14 +54,14 @@ function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
|||||||
$options .= " GPRINT:sspam:MAX:\ %6.0lf";
|
$options .= " GPRINT:sspam:MAX:\ %6.0lf";
|
||||||
$options .= " GPRINT:rspam:AVERAGE:\ \ %5.2lf/min";
|
$options .= " GPRINT:rspam:AVERAGE:\ \ %5.2lf/min";
|
||||||
$options .= " GPRINT:rmspam:MAX:\ %5.2lf/min\\\\l";
|
$options .= " GPRINT:rmspam:MAX:\ %5.2lf/min\\\\l";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -93,14 +92,14 @@ function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
|||||||
$options .= " GPRINT:srecv:MAX:\ \ %6.0lf";
|
$options .= " GPRINT:srecv:MAX:\ \ %6.0lf";
|
||||||
$options .= " GPRINT:rrecv:AVERAGE:\ \ %5.2lf/min";
|
$options .= " GPRINT:rrecv:AVERAGE:\ \ %5.2lf/min";
|
||||||
$options .= " GPRINT:rmrecv:MAX:\ %5.2lf/min\\\\l";
|
$options .= " GPRINT:rmrecv:MAX:\ %5.2lf/min\\\\l";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
$options .= " DEF:atotalswap=$database:totalswap:AVERAGE";
|
$options .= " DEF:atotalswap=$database:totalswap:AVERAGE";
|
||||||
@ -158,14 +157,14 @@ function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $verti
|
|||||||
$options .= " LINE1:totalreal#050505:total";
|
$options .= " LINE1:totalreal#050505:total";
|
||||||
$options .= " GPRINT:totalreal:AVERAGE:\ \ %7.2lf%sB";
|
$options .= " GPRINT:totalreal:AVERAGE:\ \ %7.2lf%sB";
|
||||||
|
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -190,15 +189,15 @@ function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vert
|
|||||||
$options .= " GPRINT:c:LAST:\ \ \ %7.2lf";
|
$options .= " GPRINT:c:LAST:\ \ \ %7.2lf";
|
||||||
$options .= " GPRINT:c:AVERAGE:\ \ %7.2lf";
|
$options .= " GPRINT:c:AVERAGE:\ \ %7.2lf";
|
||||||
$options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n";
|
$options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -210,14 +209,13 @@ function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
|||||||
$options .= " GPRINT:users:AVERAGE:%6.2lf";
|
$options .= " GPRINT:users:AVERAGE:%6.2lf";
|
||||||
$options .= " GPRINT:users:MIN:%6.2lf";
|
$options .= " GPRINT:users:MIN:%6.2lf";
|
||||||
$options .= " GPRINT:users:MAX:%6.2lf\\\\n";
|
$options .= " GPRINT:users:MAX:%6.2lf\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -229,17 +227,15 @@ function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $ver
|
|||||||
$options .= " GPRINT:procs:AVERAGE:%6.2lf";
|
$options .= " GPRINT:procs:AVERAGE:%6.2lf";
|
||||||
$options .= " GPRINT:procs:MIN:%6.2lf";
|
$options .= " GPRINT:procs:MIN:%6.2lf";
|
||||||
$options .= " GPRINT:procs:MAX:%6.2lf\\\\n";
|
$options .= " GPRINT:procs:MAX:%6.2lf\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -269,14 +265,13 @@ function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $verti
|
|||||||
$options .= " GPRINT:idle_perc:LAST:\ \ \ \ \ %5.2lf%%";
|
$options .= " GPRINT:idle_perc:LAST:\ \ \ \ \ %5.2lf%%";
|
||||||
$options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
|
$options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
|
||||||
$options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
$options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$period = $to - $from;
|
$period = $to - $from;
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
@ -319,14 +314,14 @@ function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $v
|
|||||||
$options .= " GPRINT:vimapd_ssl_login:AVERAGE:\ %6.0lf";
|
$options .= " GPRINT:vimapd_ssl_login:AVERAGE:\ %6.0lf";
|
||||||
$options .= " GPRINT:rimapd_ssl_login:AVERAGE:%5.2lf/min";
|
$options .= " GPRINT:rimapd_ssl_login:AVERAGE:%5.2lf/min";
|
||||||
$options .= " GPRINT:rmimapd_ssl_login:MAX:%5.2lf/min\\\\l";
|
$options .= " GPRINT:rmimapd_ssl_login:MAX:%5.2lf/min\\\\l";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
$options .= " DEF:hits=$database:hits:AVERAGE";
|
$options .= " DEF:hits=$database:hits:AVERAGE";
|
||||||
@ -336,13 +331,13 @@ function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
|||||||
$options .= " GPRINT:hits:LAST:\ %6.2lf/sec";
|
$options .= " GPRINT:hits:LAST:\ %6.2lf/sec";
|
||||||
$options .= " GPRINT:hits:AVERAGE:%6.2lf/sec";
|
$options .= " GPRINT:hits:AVERAGE:%6.2lf/sec";
|
||||||
$options .= " GPRINT:hits:MAX:%6.2lf/sec\\\\n";
|
$options .= " GPRINT:hits:MAX:%6.2lf/sec\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
$hostname = gethostbyid($device);
|
$hostname = gethostbyid($device);
|
||||||
@ -367,47 +362,14 @@ function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertica
|
|||||||
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
||||||
$iter++;
|
$iter++;
|
||||||
}
|
}
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
|
|
||||||
global $config, $installdir;
|
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
|
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
|
||||||
$hostname = gethostbyid($device);
|
|
||||||
$iter = "1";
|
|
||||||
$sql = mysql_query("SELECT * FROM storage where host_id = '$device'");
|
|
||||||
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Size\ \ \ \ \ \ Used\ \ \ \ %age\l";
|
|
||||||
while($fs = mysql_fetch_array($sql)) {
|
|
||||||
if($iter=="1") {$colour="CC0000";} 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"; $iter = "0"; }
|
|
||||||
|
|
||||||
$descr = str_pad($fs[hrStorageDescr], 14);
|
|
||||||
$descr = substr($descr,0,14);
|
|
||||||
$text = str_replace("/", "_", $fs['hrStorageDescr']);
|
|
||||||
$rrd = $config['rrd_dir'] . "/$hostname/storage-$text.rrd";
|
|
||||||
$options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
|
|
||||||
$options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
|
|
||||||
$options .= " DEF:$fs[storage_id]p=$rrd:perc:AVERAGE";
|
|
||||||
$options .= " LINE1.25:$fs[storage_id]p#" . $colour . ":'$descr'";
|
|
||||||
$options .= " GPRINT:$fs[storage_id]s:LAST:%6.2lf%SB";
|
|
||||||
$options .= " GPRINT:$fs[storage_id]:LAST:%6.2lf%SB";
|
|
||||||
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
|
|
||||||
$iter++;
|
|
||||||
}
|
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
|
||||||
return $imgfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||||
global $config, $installdir;
|
global $config, $installdir;
|
||||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||||
$imgfile = "graphs/" . "$graph";
|
|
||||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
|
||||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||||
$options .= " DEF:bits=$database:bits:AVERAGE";
|
$options .= " DEF:bits=$database:bits:AVERAGE";
|
||||||
@ -417,6 +379,6 @@ function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title,
|
|||||||
$options .= " GPRINT:bits:LAST:\ %6.2lf/sec";
|
$options .= " GPRINT:bits:LAST:\ %6.2lf/sec";
|
||||||
$options .= " GPRINT:bits:AVERAGE:%6.2lf/sec";
|
$options .= " GPRINT:bits:AVERAGE:%6.2lf/sec";
|
||||||
$options .= " GPRINT:bits:MAX:%6.2lf/sec\\\\n";
|
$options .= " GPRINT:bits:MAX:%6.2lf/sec\\\\n";
|
||||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
shell_exec($config['rrdtool'] . " graph $graph $options");
|
||||||
return $imgfile;
|
return $graph;
|
||||||
}
|
}
|
||||||
|
@ -3,33 +3,33 @@
|
|||||||
|
|
||||||
include("config.php");
|
include("config.php");
|
||||||
include("includes/functions.php");
|
include("includes/functions.php");
|
||||||
|
include("includes/functions-poller.inc.php");
|
||||||
|
|
||||||
|
$poller_start = utime();
|
||||||
|
|
||||||
echo("Observer Poller v".$config['version']."\n\n");
|
echo("Observer Poller v".$config['version']."\n\n");
|
||||||
|
|
||||||
if($argv[1] == "--device" && $argv[2]) {
|
$options = getopt("h:t:i:n:d::a::");
|
||||||
$where = "AND `device_id` = '".$argv[2]."'";
|
|
||||||
} elseif ($argv[1] == "--odd") {
|
if ($options['h'] == "odd") {
|
||||||
$where = "AND MOD(device_id,2) = 1";
|
$where = "AND MOD(device_id,2) = 1";
|
||||||
} elseif ($argv[1] == "--even") {
|
$doing = $options['h'];
|
||||||
|
} elseif ($options['h'] == "even") {
|
||||||
$where = "AND MOD(device_id,2) = 0";
|
$where = "AND MOD(device_id,2) = 0";
|
||||||
} elseif ($argv[1] == "--odd3") {
|
$doing = $options['h'];
|
||||||
$where = "AND MOD(device_id,2) = 1 AND device_id NOT LIKE '%1'";
|
} elseif($options['h']) {
|
||||||
} elseif ($argv[1] == "--even3") {
|
$where = "AND `device_id` = '".$options['h']."'";
|
||||||
$where = "AND MOD(device_id,2) = 0 AND device_id NOT LIKE '%2'";
|
$doing = "Host ".$options['h'];
|
||||||
} elseif ($argv[1] == "--other3") {
|
} elseif ($options['i'] && isset($options['n'])) {
|
||||||
$where = "AND (device_id LIKE '%1' OR device_id LIKE '%2')";
|
$where = "AND MOD(device_id,".$options['i'].") = '" . $options['n'] . "'";
|
||||||
|
$doing = "Proc ".$options['n'] ."/".$options['i'];
|
||||||
} elseif ($argv[1] == "--all") {
|
} elseif ($options['h'] == "all") {
|
||||||
|
$where = " ";
|
||||||
} else {
|
$doing = "all";
|
||||||
echo("--device <device id> Poll single device\n");
|
|
||||||
echo("--all Poll all devices\n\n");
|
|
||||||
echo("No polling type specified!\n");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("Starting polling run:\n\n");
|
echo("Starting polling run:\n\n");
|
||||||
|
$i = 0;
|
||||||
$device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' $where ORDER BY `device_id` ASC");
|
$device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' $where ORDER BY `device_id` ASC");
|
||||||
while ($device = mysql_fetch_array($device_query)) {
|
while ($device = mysql_fetch_array($device_query)) {
|
||||||
|
|
||||||
@ -154,10 +154,15 @@ while ($device = mysql_fetch_array($device_query)) {
|
|||||||
echo("Polling temperatures\n");
|
echo("Polling temperatures\n");
|
||||||
include("includes/polling/temperatures.inc.php");
|
include("includes/polling/temperatures.inc.php");
|
||||||
include("includes/polling/device-netstats.inc.php");
|
include("includes/polling/device-netstats.inc.php");
|
||||||
echo("Polling interfaces\n");
|
|
||||||
|
|
||||||
$where = "WHERE device_id = '" . $device['device_id'] . "' AND deleted = '0'";
|
# echo("Polling interfaces\n");
|
||||||
include("includes/polling/interfaces.inc.php");
|
# $where = "WHERE device_id = '" . $device['device_id'] . "' AND deleted = '0'";
|
||||||
|
# include("includes/polling/interfaces.inc.php");
|
||||||
|
|
||||||
|
include("includes/polling/ports.inc.php");
|
||||||
|
include("includes/polling/ports-etherlike.inc.php");
|
||||||
|
include("includes/polling/cisco-mac-accounting.inc.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$update_uptime_attrib = mysql_query("UPDATE devices_attribs SET attrib_value = NOW() WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'polled'");
|
$update_uptime_attrib = mysql_query("UPDATE devices_attribs SET attrib_value = NOW() WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'polled'");
|
||||||
@ -276,9 +281,16 @@ while ($device = mysql_fetch_array($device_query)) {
|
|||||||
} else {
|
} else {
|
||||||
echo("No Changes to " . $device['hostname'] . "\n");
|
echo("No Changes to " . $device['hostname'] . "\n");
|
||||||
}
|
}
|
||||||
|
$i++;
|
||||||
echo("\n");
|
echo("\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);
|
||||||
|
|
||||||
|
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $i devices polled in $poller_time secs";
|
||||||
|
echo("$string\n");
|
||||||
|
shell_exec("echo '".$string."' >> /opt/observer/observer.log");
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
#!/usr/bin/php
|
|
||||||
<?php
|
|
||||||
|
|
||||||
include("config.php");
|
|
||||||
include("includes/functions.php");
|
|
||||||
|
|
||||||
$mac_accounting_query = mysql_query("SELECT * FROM `mac_accounting` as A, `interfaces` AS I, `devices` AS D where A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.status = '1'");
|
|
||||||
while ($acc = mysql_fetch_array($mac_accounting_query)) {
|
|
||||||
|
|
||||||
echo("Polling :" . $acc['ip']. " " . $acc['ifDescr']. " " . $acc['mac'] . " " . $acc['hostname'] . " ");
|
|
||||||
|
|
||||||
$mac = $acc['mac'];
|
|
||||||
|
|
||||||
$oid = hexdec(substr($mac, 0, 2));
|
|
||||||
$oid .= ".".hexdec(substr($mac, 2, 2));
|
|
||||||
$oid .= ".".hexdec(substr($mac, 4, 2));
|
|
||||||
$oid .= ".".hexdec(substr($mac, 6, 2));
|
|
||||||
$oid .= ".".hexdec(substr($mac, 8, 2));
|
|
||||||
$oid .= ".".hexdec(substr($mac, 10, 2));
|
|
||||||
|
|
||||||
$snmp_cmd = $config['snmpget'] . " -m CISCO-IP-STAT-MIB -O Uqnv -" . $acc['snmpver'] . " -c " . $acc['community'] . " " . $acc['hostname'];
|
|
||||||
#$snmp_cmd .= " cipMacSwitchedBytes.". $acc['ifIndex'] .".input." . $oid;
|
|
||||||
#$snmp_cmd .= " cipMacSwitchedBytes.". $acc['ifIndex'] .".output." . $oid;
|
|
||||||
#$snmp_cmd .= " cipMacSwitchedPkts.". $acc['ifIndex'] .".input." . $oid;
|
|
||||||
#$snmp_cmd .= " cipMacSwitchedPkts.". $acc['ifIndex'] .".output." . $oid;
|
|
||||||
$snmp_cmd .= " cipMacHCSwitchedBytes.". $acc['ifIndex'] .".input." . $oid;
|
|
||||||
$snmp_cmd .= " cipMacHCSwitchedBytes.". $acc['ifIndex'] .".output." . $oid;
|
|
||||||
$snmp_cmd .= " cipMacHCSwitchedPkts.". $acc['ifIndex'] .".input." . $oid;
|
|
||||||
$snmp_cmd .= " cipMacHCSwitchedPkts.". $acc['ifIndex'] .".output." . $oid;
|
|
||||||
|
|
||||||
|
|
||||||
$snmp_output = trim(shell_exec($snmp_cmd));
|
|
||||||
|
|
||||||
$snmp_output = preg_replace("[a-zA-Z\ ]", "", $snmp_output);
|
|
||||||
|
|
||||||
list($in,$out,$pktin,$pktout) = explode("\n", $snmp_output);
|
|
||||||
|
|
||||||
$acc_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/mac-accounting";
|
|
||||||
if(!is_dir($acc_rrd)) { mkdir($acc_rrd); echo("Created directory : $acc_rrd\n"); }
|
|
||||||
$old_rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['ip'] . ".rrd";
|
|
||||||
$rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
|
||||||
if(is_file($old_rrdfile) && !is_file($rrdfile)) { rename($old_rrdfile, $rrdfile); echo("Moved $old_rrdfile -> $rrdfile \n"); };
|
|
||||||
$pkts_rrdfile = $acc_rrd . "/" . $acc['ifIndex'] . "-" . $acc['mac'] . "-pkts.rrd";
|
|
||||||
|
|
||||||
if(!is_file($pkts_rrdfile)) {
|
|
||||||
$woo = shell_exec($config['rrdtool'] ." create $pkts_rrdfile \
|
|
||||||
DS:IN:COUNTER:600:0:12500000000 \
|
|
||||||
DS:OUT:COUNTER:600:0:12500000000 \
|
|
||||||
RRA:AVERAGE:0.5:1:600 \
|
|
||||||
RRA:AVERAGE:0.5:6:700 \
|
|
||||||
RRA:AVERAGE:0.5:24:775 \
|
|
||||||
RRA:AVERAGE:0.5:288:797 \
|
|
||||||
RRA:MAX:0.5:1:600 \
|
|
||||||
RRA:MAX:0.5:6:700 \
|
|
||||||
RRA:MAX:0.5:24:775 \
|
|
||||||
RRA:MAX:0.5:288:797");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!is_file($rrdfile)) {
|
|
||||||
$woo = shell_exec($config['rrdtool'] ." create $rrdfile \
|
|
||||||
DS:IN:COUNTER:600:0:12500000000 \
|
|
||||||
DS:OUT:COUNTER:600:0:12500000000 \
|
|
||||||
RRA:AVERAGE:0.5:1:600 \
|
|
||||||
RRA:AVERAGE:0.5:6:700 \
|
|
||||||
RRA:AVERAGE:0.5:24:775 \
|
|
||||||
RRA:AVERAGE:0.5:288:797 \
|
|
||||||
RRA:MAX:0.5:1:600 \
|
|
||||||
RRA:MAX:0.5:6:700 \
|
|
||||||
RRA:MAX:0.5:24:775 \
|
|
||||||
RRA:MAX:0.5:288:797");
|
|
||||||
}
|
|
||||||
|
|
||||||
$woo = "N:".($in+0).":".($out+0);
|
|
||||||
$ret = rrdtool_update("$rrdfile", $woo);
|
|
||||||
|
|
||||||
$woo = "N:".($pktin+0).":".($pktout+0);
|
|
||||||
$ret = rrdtool_update("$pkts_rrdfile", $woo);
|
|
||||||
|
|
||||||
# $rates = interface_rates ($rrdfile);
|
|
||||||
|
|
||||||
# $pkt_rates = interface_rates ($pkts_rrdfile);
|
|
||||||
|
|
||||||
$pkt_rate['in'] = round($pkt_rate['in'] / 8);
|
|
||||||
$pkt_rate['out'] = round($pkt_rate['out'] / 8);
|
|
||||||
|
|
||||||
# mysql_query("UPDATE `mac_accounting` SET bps_in = '" . $rates['in'] . "', bps_out = '" . $rates['out'] . "', pps_in = '" . $pkt_rates['in'] . "', pps_out = '" . $pkt_rates['out'] . "' WHERE ma_id= '" . $acc['ma_id'] . "'");
|
|
||||||
|
|
||||||
# echo(formatRates($rates['in']) . " (" . $pkt_rates['in'] . "pps) in " . formatRates($rates['out']) . " (" . $pkt_rates['out'] . "pps) out \n");
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
84
poller.php
Executable file
84
poller.php
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
|
||||||
|
echo("Observer Poller v".$config['version']."\n\n");
|
||||||
|
|
||||||
|
include("includes/functions.php");
|
||||||
|
include("includes/functions-poller.inc.php");
|
||||||
|
|
||||||
|
$poller_start = utime();
|
||||||
|
|
||||||
|
$options = getopt("h:t:i:n:d::a::");
|
||||||
|
|
||||||
|
if ($options['h'] == "odd") {
|
||||||
|
$where = "AND MOD(device_id,2) = 1";
|
||||||
|
} elseif ($options['h'] == "even") {
|
||||||
|
$where = "AND MOD(device_id,2) = 0";
|
||||||
|
} elseif($options['h']) {
|
||||||
|
$where = "AND `device_id` = '".$options['h']."'";
|
||||||
|
} elseif ($options['i'] && isset($options['n'])) {
|
||||||
|
$where = "AND MOD(device_id,".$options['i'].") = '" . $options['n'] . "'";
|
||||||
|
} elseif ($options['h'] == "all") {
|
||||||
|
$where = " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$where) {
|
||||||
|
echo("-h <device id> Poll single device\n");
|
||||||
|
echo("-h odd Poll odd numbered devices (same as -i 2 -n 0)\n");
|
||||||
|
echo("-h even Poll even numbered devices (same as -i 2 -n 1)\n");
|
||||||
|
echo("-a Poll all devices\n\n");
|
||||||
|
echo("-i <instances> -n <number> Poll as instance <number> of <instances>\n\n");
|
||||||
|
echo("-d Enable some debugging output\n");
|
||||||
|
echo("\n");
|
||||||
|
echo("No polling type specified!\n");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($options['d'])) { echo("DEBUG!\n"); $debug = 1; }
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' AND `disabled` = '0' AND `status` = '1' $where ORDER BY device_id DESC");
|
||||||
|
while ($device = mysql_fetch_array($device_query)) {
|
||||||
|
|
||||||
|
echo("-> " . $device['hostname'] . "\n");
|
||||||
|
|
||||||
|
$device_start = utime(); // Start counting device poll time
|
||||||
|
|
||||||
|
$host_rrd = $config['rrd_dir'] . "/" . $device['hostname'];
|
||||||
|
if(!is_dir($host_rrd)) { mkdir($host_rrd); echo("Created directory : $host_rrd\n"); }
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$device['pingable'] = isPingable($device['hostname']);
|
||||||
|
if($device['pingable']) {
|
||||||
|
$device['snmpable'] = isSNMPable($device['hostname'], $device['community'], $device['snmpver'], $device['port']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($device['pingable'] && $device['snmpable']) { // Reachability Check
|
||||||
|
if($options['t']) {
|
||||||
|
include("includes/polling/".$options['t'].".inc.php");
|
||||||
|
} else {
|
||||||
|
include("includes/polling/ports.inc.php");
|
||||||
|
include("includes/polling/ports-etherlike.inc.php");
|
||||||
|
include("includes/polling/cisco-mac-accounting.inc.php");
|
||||||
|
}
|
||||||
|
} else { echo(" Unreachable"); } // End Reachability Check
|
||||||
|
|
||||||
|
unset($array); // Clear $array SNMP cache
|
||||||
|
|
||||||
|
$device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5);
|
||||||
|
|
||||||
|
echo("Polled in $device_time seconds\n");
|
||||||
|
#shell_exec("echo 'Polled ".$device['hostname']." in $device_time seconds' >> /opt/observer/observer.log");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);
|
||||||
|
|
||||||
|
$string = $argv[0] . " " . date("F j, Y, G:i") . " - $i devices polled in $poller_time secs";
|
||||||
|
echo("$string\n");
|
||||||
|
|
||||||
|
shell_exec("echo '".$string."' >> /opt/observer/observer.log");
|
||||||
|
|
||||||
|
?>
|
13
scripts/update-sql.php
Executable file
13
scripts/update-sql.php
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
$data = trim(shell_exec("cat ".$argv[1]));
|
||||||
|
|
||||||
|
foreach( explode("\n", $data) as $line) {
|
||||||
|
$update = mysql_query($line);
|
||||||
|
echo("$line \n");
|
||||||
|
}
|
||||||
|
?>
|
@ -4,7 +4,7 @@
|
|||||||
include("config.php");
|
include("config.php");
|
||||||
include("includes/functions.php");
|
include("includes/functions.php");
|
||||||
|
|
||||||
$start = utime();
|
$poller_start = utime();
|
||||||
|
|
||||||
### Observer Device Polling Test
|
### Observer Device Polling Test
|
||||||
|
|
||||||
@ -43,16 +43,17 @@ $device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where O
|
|||||||
while ($device = mysql_fetch_array($device_query)) {
|
while ($device = mysql_fetch_array($device_query)) {
|
||||||
|
|
||||||
echo("\n" . $device['hostname'] ."\n");
|
echo("\n" . $device['hostname'] ."\n");
|
||||||
|
$host_rrd = $config['rrd_dir'] . "/" . $device['hostname'];
|
||||||
|
$where = "WHERE device_id = '" . $device['device_id'] . "' AND deleted = '0'";
|
||||||
include("includes/polling/".$type.".inc.php");
|
include("includes/polling/".$type.".inc.php");
|
||||||
|
|
||||||
echo("\n"); $devices_polled++;
|
echo("\n"); $devices_polled++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$end = utime(); $run = $end - $start;
|
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);
|
||||||
$proctime = substr($run, 0, 5);
|
|
||||||
|
|
||||||
echo("$devices_polled devices polled in $proctime secs\n");
|
|
||||||
|
|
||||||
|
$string = $argv[0] . " " . date("F j, Y, G:i") . " - $i devices polled in $poller_time secs";
|
||||||
|
echo("$string\n");
|
||||||
|
shell_exec("echo '".$string."' >> /opt/observer/observer.log");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user