redesigned graph defining system (still seems a bit batshit, but nevermind). lots of improvements to various pollers, only writing RRDs if valid data is returned, etc.

git-svn-id: http://www.observium.org/svn/observer/trunk@1506 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-07-28 19:43:02 +00:00
parent 927c92e8dd
commit f29e7b755b
67 changed files with 264 additions and 338 deletions

View File

@@ -43,3 +43,8 @@ CREATE TABLE IF NOT EXISTS `perf_times` ( `type` varchar(8) NOT NULL, `doing`
## 0.10.7.1 ## 0.10.7.1
ALTER TABLE `bills` ADD `bill_autoadded` BOOLEAN NOT NULL DEFAULT '0' ALTER TABLE `bills` ADD `bill_autoadded` BOOLEAN NOT NULL DEFAULT '0'
ALTER TABLE `bill_ports` ADD `bill_port_autoadded` BOOLEAN NOT NULL DEFAULT '0' ALTER TABLE `bill_ports` ADD `bill_port_autoadded` BOOLEAN NOT NULL DEFAULT '0'
CREATE TABLE IF NOT EXISTS `device_graphs` ( `device_id` int(11) NOT NULL, `graph` varchar(32) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `graph_types`;
CREATE TABLE IF NOT EXISTS `graph_types` ( `graph_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_subtype` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_section` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_descr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `graph_order` int(11) NOT NULL, KEY `graph_type` (`graph_type`), KEY `graph_subtype` (`graph_subtype`), KEY `graph_section` (`graph_section`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `graph_types` (`graph_type`, `graph_subtype`, `graph_section`, `graph_descr`, `graph_order`) VALUES('device', 'bits', 'netstats', 'Total Traffic', 0),('device', 'hr_users', 'system', 'Users Logged In', 0),('device', 'ucd_load', 'system', 'Load Averages', 0),('device', 'ucd_cpu', 'system', 'Detailed Processor Usage', 0),('device', 'ucd_memory', 'system', 'Detailed Memory Usage', 0),('device', 'netstat_tcp', 'netstats', 'TCP Statistics', 0),('device', 'netstat_icmp_info', 'netstats', 'ICMP Informational Statistics', 0),('device', 'netstat_icmp_stat', 'netstats', 'ICMP Statistics', 0),('device', 'netstat_ip', 'netstats', 'IP Statistics', 0),('device', 'netstat_ip_frag', 'netstats', 'IP Fragmentation Statistics', 0),('device', 'netstat_udp', 'netstats', 'UDP Statistics', 0),('device', 'netstat_snmp', 'netstats', 'SNMP Statistics', 0),('device', 'temperatures', 'system', 'Temperatures', 0),('device', 'mempools', 'system', 'Memory Pool Usage', 0),('device', 'processors', 'system', 'Processor Usage', 0),('device', 'storage', 'system', 'Filesystem Usage', 0),('device', 'hr_processes', 'system', 'Running Processes', 0),('device', 'uptime', 'system', 'System Uptime', ''),('device', 'ipsystemstats_ipv4', 'netstats', 'IPv4 Packet Statistics', 0),('device', 'ipsystemstats_ipv6_frag', 'netstats', 'IPv6 Fragmentation Statistics', 0),('device', 'ipsystemstats_ipv6', 'netstats', 'IPv6 Packet Statistics', 0),('device', 'ipsystemstats_ipv4_frag', 'netstats', 'IPv4 Fragmentation Statistics', 0),('device', 'fortigate_sessions', 'firewall', 'Active Sessions', ''), ('device', 'screenos_settings', 'firewall', 'Active Sessions', '');

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
html/images/icons/netstats.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

View File

@@ -6,6 +6,4 @@ if(is_numeric($id)) {
$title = generatedevicelink($device); $title = generatedevicelink($device);
?> ?>

View File

@@ -1,38 +0,0 @@
<?php
$device = device_by_id_cache($id);
$query = mysql_query("SELECT * FROM `processors` where `device_id` = '".$id."'");
$i=0;
while($proc = mysql_fetch_array($query)) {
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd");
if(is_file($rrd_filename)) {
$descr = short_hrDeviceDescr($proc['processor_descr']);
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $descr;
$rrd_list[$i]['rra'] = "usage";
$i++;
}
}
$unit_text = "Load %";
$units='%';
$total_units='%';
$colours='mixed';
$scale_min = "0";
$scale_max = "100";
$nototal = 1;
if ($rrd_list) {
include ("includes/graphs/generic_multi_line.inc.php");
}
?>

View File

@@ -1,28 +0,0 @@
<?php
$device = device_by_id_cache($id);
$unit_text = "Load %";
$units='%';
$total_units='%';
$colours='mixed';
$scale_min = "0";
$scale_max = "100";
$nototal = 1;
include("includes/graphs/common.inc.php");
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/powerconnect-cpu.rrd";
$rrd_options .= " DEF:load=$database:LOAD:AVERAGE";
$rrd_options .= " DEF:load_max=$database:LOAD:MAX";
$rrd_options .= " DEF:load_min=$database:LOAD:MIN";
$rrd_options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
$rrd_options .= " AREA:load#ffee99: LINE1.25:load#aa2200:Load\ %";
$rrd_options .= " GPRINT:load:LAST:%6.2lf\ GPRINT:load_min:AVERAGE:%6.2lf\ ";
$rrd_options .= " GPRINT:load_max:MAX:%6.2lf\ GPRINT:load:AVERAGE:%6.2lf\\\\n";
?>

View File

@@ -1,28 +0,0 @@
<?php
$device = device_by_id_cache($id);
$unit_text = "Load %";
$units='%';
$total_units='%';
$colours='mixed';
$scale_min = "0";
$scale_max = "100";
$nototal = 1;
include("includes/graphs/common.inc.php");
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/procurve-cpu.rrd";
$rrd_options .= " DEF:load=$database:LOAD:AVERAGE";
$rrd_options .= " DEF:load_max=$database:LOAD:MAX";
$rrd_options .= " DEF:load_min=$database:LOAD:MIN";
$rrd_options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
$rrd_options .= " AREA:load#ffee99: LINE1.25:load#aa2200:Load\ %";
$rrd_options .= " GPRINT:load:LAST:%6.2lf\ GPRINT:load_min:AVERAGE:%6.2lf\ ";
$rrd_options .= " GPRINT:load_max:MAX:%6.2lf\ GPRINT:load:AVERAGE:%6.2lf\\\\n";
?>

View File

@@ -6,7 +6,7 @@ $scale_min = "0";
include("includes/graphs/common.inc.php"); include("includes/graphs/common.inc.php");
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrSystem.rrd"; $database = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_processes.rrd";
$rrd_options .= " DEF:procs=$database:procs:AVERAGE"; $rrd_options .= " DEF:procs=$database:procs:AVERAGE";
$rrd_options .= " COMMENT:Processes\ \ \ \ Cur\ \ \ \ \ Ave\ \ \ \ \ \ Min\ \ \ \ \ Max\\\\n"; $rrd_options .= " COMMENT:Processes\ \ \ \ Cur\ \ \ \ \ Ave\ \ \ \ \ \ Min\ \ \ \ \ Max\\\\n";

View File

@@ -6,7 +6,7 @@ $scale_min = "0";
include("includes/graphs/common.inc.php"); include("includes/graphs/common.inc.php");
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrSystem.rrd"; $database = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_users.rrd";
$rrd_options .= " DEF:users=$database:users:AVERAGE"; $rrd_options .= " DEF:users=$database:users:AVERAGE";
$rrd_options .= " DEF:users_max=$database:users:MAX"; $rrd_options .= " DEF:users_max=$database:users:MAX";

View File

@@ -0,0 +1,64 @@
<?php
include("includes/graphs/common.inc.php");
$device = device_by_id_cache($id);
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/ipSystemStats-ipv4.rrd";
$rrd_options .= " DEF:ipInDelivers=$rrd_filename:InDelivers:AVERAGE";
$rrd_options .= " DEF:ipReasmReqds=$rrd_filename:ReasmReqds:AVERAGE";
$rrd_options .= " DEF:ipReasmOKs=$rrd_filename:ReasmOKs:AVERAGE";
$rrd_options .= " DEF:ipReasmFails=$rrd_filename:ReasmFails:AVERAGE";
$rrd_options .= " DEF:ipFragFails=$rrd_filename:OutFragFails:AVERAGE";
$rrd_options .= " DEF:ipFragCreates=$rrd_filename:OutFragCreates:AVERAGE";
$rrd_options .= " DEF:MipInDelivers=$rrd_filename:InDelivers:MAX";
$rrd_options .= " DEF:MipReasmOKs=$rrd_filename:ReasmOKs:MAX";
$rrd_options .= " DEF:MipReasmReqds=$rrd_filename:ReasmReqds:MAX";
$rrd_options .= " DEF:MipReasmFails=$rrd_filename:ReasmFails:MAX";
$rrd_options .= " DEF:MipFragFails=$rrd_filename:OutFragFails:MAX";
$rrd_options .= " DEF:MipFragCreates=$rrd_filename:OutFragCreates:MAX";
$rrd_options .= " CDEF:ReasmReqds=ipReasmReqds,ipInDelivers,/,100,*";
$rrd_options .= " CDEF:ReasmOKs=ipReasmOKs,ipInDelivers,/,100,*";
$rrd_options .= " CDEF:ReasmFails=ipReasmFails,ipInDelivers,/,100,*";
$rrd_options .= " CDEF:FragFails=ipFragFails,ipInDelivers,/,100,*";
$rrd_options .= " CDEF:FragCreates=ipFragCreates,ipInDelivers,/,100,*";
$rrd_options .= " CDEF:FragFails_n=FragFails,-1,*";
$rrd_options .= " CDEF:FragCreates_n=FragCreates,-1,*";
$rrd_options .= " CDEF:MReasmReqds=MipReasmReqds,MipInDelivers,/,100,*";
$rrd_options .= " CDEF:MReasmOKs=MipReasmOKs,MipInDelivers,/,100,*";
$rrd_options .= " CDEF:MReasmFails=MipReasmFails,MipInDelivers,/,100,*";
$rrd_options .= " CDEF:MFragFails=MipFragFails,MipInDelivers,/,100,*";
$rrd_options .= " CDEF:MFragCreates=MipFragCreates,MipInDelivers,/,100,*";
$rrd_options .= " COMMENT:'% ipInDelivers Current Average Maximum\\n'";
$rrd_options .= " LINE1.25:FragFails_n#cc0000:'Frag Fail '";
$rrd_options .= " GPRINT:FragFails:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:FragFails:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:MFragFails:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:FragCreates#00cc:'Frag Create '";
$rrd_options .= " GPRINT:FragCreates:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:FragCreates:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:MFragCreates:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:ReasmOKs#006600:'Reasm OK '";
$rrd_options .= " GPRINT:ReasmOKs:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:ReasmOKs:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:MReasmOKs:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:ReasmFails#660000:'Reasm Fail '";
$rrd_options .= " GPRINT:ReasmFails:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:ReasmFails:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:MReasmFails:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:ReasmReqds#000066:'Reasm Reqd '";
$rrd_options .= " GPRINT:ReasmReqds:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:ReasmReqds:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:MReasmReqds:MAX:%6.2lf%s\\\\n";
?>

View File

@@ -1,35 +0,0 @@
<?php
$scale_min = "0";
include("includes/graphs/common.inc.php");
$device = device_by_id_cache($id);
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/procurve-mem.rrd";
$rrd_options .= " -b 1024";
$rrd_options .= " DEF:TOTAL=$rrd_filename:TOTAL:AVERAGE";
$rrd_options .= " DEF:FREE=$rrd_filename:FREE:AVERAGE";
$rrd_options .= " DEF:USED=$rrd_filename:USED:AVERAGE";
$rrd_options .= " DEF:FREE_max=$rrd_filename:FREE:MAX";
$rrd_options .= " DEF:USED_max=$rrd_filename:USED:MAX";
$rrd_options .= " DEF:FREE_min=$rrd_filename:FREE:MIN";
$rrd_options .= " DEF:USED_min=$rrd_filename:USED:MIN";
$rrd_options .= " CDEF:tot=FREE,USED,+";
$rrd_options .= " COMMENT:'Bytes Current Average Maximum\\n'";
$rrd_options .= " LINE1:USED#d0b080:";
$rrd_options .= " AREA:USED#f0e0a0:used";
$rrd_options .= " GPRINT:USED:LAST:\ \ \ %7.2lf%sB";
$rrd_options .= " GPRINT:USED:AVERAGE:%7.2lf%sB";
$rrd_options .= " GPRINT:USED:MAX:%7.2lf%sB\\\\n";
$rrd_options .= " AREA:FREE#e5e5e5:free:STACK";
$rrd_options .= " GPRINT:FREE:LAST:\ \ \ %7.2lf%sB";
$rrd_options .= " GPRINT:FREE:AVERAGE:%7.2lf%sB";
$rrd_options .= " GPRINT:FREE:MAX:%7.2lf%sB\\\\n";
$rrd_options .= " LINE1.5:USED#c03030:";
$rrd_options .= " LINE1.5:TOTAL#808080:";
?>

View File

@@ -1,42 +1,5 @@
<?php <?php
$query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($_GET['id'])."' AND hrDeviceType = 'hrDeviceProcessor'");
$device = device_by_id_cache(mres($device_id));
$i=0;
while($proc = mysql_fetch_array($query)) {
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd");
if(is_file($rrd_filename)) {
$descr = short_hrDeviceDescr($proc['hrDeviceDescr']);
$descr = str_replace(":", "\:", $descr);
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $descr;
$rrd_list[$i]['rra'] = "usage";
$i++;
}
}
$unit_text = "Load %";
$units='%';
$total_units='%';
$colours='mixed';
$scale_min = "0";
$scale_max = "100";
$nototal = 1;
if ($rrd_list) {
include ("includes/graphs/generic_multi_line.inc.php");
} else {
include("includes/graphs/common.inc.php"); include("includes/graphs/common.inc.php");
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . "ucd_cpu.rrd"; $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . "ucd_cpu.rrd";
$rrd_options .= " DEF:user=$rrd_filename:user:AVERAGE"; $rrd_options .= " DEF:user=$rrd_filename:user:AVERAGE";
@@ -66,6 +29,4 @@ include ("includes/graphs/generic_multi_line.inc.php");
$rrd_options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%"; $rrd_options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
$rrd_options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n"; $rrd_options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
}
?> ?>

View File

@@ -3,7 +3,7 @@
include("includes/graphs/common.inc.php"); include("includes/graphs/common.inc.php");
$device = device_by_id_cache($id); $device = device_by_id_cache($id);
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/ucd_load.rrd"; $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/ucd_load.rrd";
$rrd_options .= " DEF:1min=$rrd_filename:1min:AVERAGE"; $rrd_options .= " DEF:1min=$rrd_filename:1min:AVERAGE";
$rrd_options .= " DEF:5min=$rrd_filename:5min:AVERAGE"; $rrd_options .= " DEF:5min=$rrd_filename:5min:AVERAGE";

View File

@@ -12,6 +12,7 @@ if($_GET['debug']) {
include("../config.php"); include("../config.php");
include("../includes/common.php"); include("../includes/common.php");
include("../includes/rewrites.php"); include("../includes/rewrites.php");
include("includes/functions.inc.php");
include("includes/authenticate.inc.php"); include("includes/authenticate.inc.php");
if(!$config['allow_unauth_graphs']) { if(!$config['allow_unauth_graphs']) {
@@ -47,9 +48,8 @@ if($_GET['debug']) {
$graphfile = $config['temp_dir'] . "/" . strgen() . ".png"; $graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
$os = gethostosbyid($device_id); # $os = gethostosbyid($device_id);
if($config['os'][$os]['group']) {$os_group = $config['os'][$os]['group'];} # if($config['os'][$os]['group']) {$os_group = $config['os'][$os]['group'];}
# if(is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php")) { # if(is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php")) {
# /// Type + OS Specific # /// Type + OS Specific
# include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php"); # include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php");
@@ -62,6 +62,7 @@ if($_GET['debug']) {
# } # }
if(is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) { if(is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) {
include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php");
include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php"); include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php");
} }

View File

@@ -1,5 +1,7 @@
<?php <?php
### FIXME : remove link when port/host is not in the database (things /seen/ but not *discovered*)
include("../includes/defaults.inc.php"); include("../includes/defaults.inc.php");
include("../config.php"); include("../config.php");
include("../includes/functions.php"); include("../includes/functions.php");

View File

@@ -4,16 +4,15 @@ $bg="#ffffff";
echo('<div style="clear: both;">'); echo('<div style="clear: both;">');
$datas = array('System','Network');
if(!$_GET['opta']) { $_GET['opta'] = strtolower($datas[0]); }
print_optionbar_start('', ''); print_optionbar_start('', '');
$sep = ""; $sep = "";
foreach ($datas as $texttype) $query = mysql_query("SELECT graph_section FROM device_graphs AS D, graph_types AS G WHERE D.device_id = '".$device['device_id']."' AND G.graph_subtype = D.graph AND G.graph_type = 'device' GROUP BY G.graph_section ORDER BY graph_section");
while($section = mysql_fetch_assoc($query))
{ {
$type = strtolower($texttype); $type = strtolower($section['graph_section']);
if(!$_GET['opta']) { $_GET['opta'] = $type; }
echo($sep); echo($sep);
if ($_GET['opta'] == $type) if ($_GET['opta'] == $type)
{ {
@@ -24,29 +23,24 @@ foreach ($datas as $texttype)
{ {
echo('<img src="images/icons/greyscale/'.$type.'.png" class="optionicon" />'); echo('<img src="images/icons/greyscale/'.$type.'.png" class="optionicon" />');
} }
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/graphs/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $texttype ."</a>\n"); echo("<a href='".$config['base_url']."/device/".$device['device_id']."/graphs/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $type ."</a>\n");
if ($_GET['opta'] == $type) { echo("</strong>"); } if ($_GET['opta'] == $type) { echo("</strong>"); }
$sep = " | "; $sep = " | ";
} }
unset ($sep); unset ($sep);
print_optionbar_end(); print_optionbar_end();
#echo('<div style="float: right;">'); $sql = "SELECT * FROM device_graphs AS D, graph_types AS G WHERE D.device_id = '".$device['device_id']."'";
$sql .=" AND G.graph_subtype = D.graph AND G.graph_type = 'device' AND G.graph_section = '".mres($_GET['opta'])."' ORDER BY graph_order, graph_subtype";
$query = mysql_query($sql);
while($graph = mysql_fetch_assoc($query))
{
include_dir("/html/pages/device/graphs/".mres($_GET['opta'])); $graph_title = $graph['graph_descr'];
$graph_type = "device_" . $graph['graph_subtype'];
include ("includes/print-device-graph.php");
#if ($config['os'][$device['os']]['group']) { $os_group = $config['os'][$device['os']]['group']; } }
#if (is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php")) {
# /// OS Specific
# include($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php");
#} elseif ($os_group && is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$os_group.".inc.php")) {
# /// OS Group Specific
# include($config['install_dir'] . "/html/pages/device/graphs/os-".$os_group.".inc.php");
#} else {
# echo("No graph definitions found for OS " . $device['os'] . "!");
#}
# echo("</div>");
?> ?>

View File

@@ -0,0 +1,9 @@
<?php
if($device['os'] == "fortigate" || $device['os_group'] == "fortigate") {
$graph_title = "Firewall Sessions";
$graph_type = "fortigate_sessions";
include ("includes/print-device-graph.php");
}
?>

View File

@@ -0,0 +1,4 @@
<?php
?>

View File

@@ -0,0 +1,10 @@
<?php
if($device['os'] == "netscreen" || $device['os_group'] == "netscreen") {
$graph_title = "Firewall Sessions";
$graph_type = "netscreen_sessions"; include ("includes/print-device-graph.php");
}
?>

View File

@@ -1,9 +0,0 @@
<?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ucd_load.rrd")) {
$graph_title = "System Load";
$graph_type = "device_laload";
include ("includes/print-device-graph.php");
}
?>

View File

@@ -2,7 +2,7 @@
$storage = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0); $storage = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0);
$diskio = mysql_result(mysql_query("select count(*) from ucd_diskio WHERE device_id = '" . $device['device_id'] . "'"), 0); $diskio = mysql_result(mysql_query("select count(*) from ucd_diskio WHERE device_id = '" . $device['device_id'] . "'"), 0);
$memory = mysql_result(mysql_query("select count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"), 0); $mempools = mysql_result(mysql_query("select count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"), 0);
$processor = mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0); $processor = mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0);
$temperatures = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "'"), 0); $temperatures = mysql_result(mysql_query("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "'"), 0);
@@ -14,7 +14,7 @@ $freqs = mysql_result(mysql_query("select count(*) from frequency WHERE device_i
$datas[] = 'overview'; $datas[] = 'overview';
if ($processor) { $datas[] = 'processors'; } if ($processor) { $datas[] = 'processors'; }
if ($memory) { $datas[] = 'memory'; } if ($mempools) { $datas[] = 'mempools'; }
if ($storage) { $datas[] = 'storage'; } if ($storage) { $datas[] = 'storage'; }
if ($diskio) { $datas[] = 'diskio'; } if ($diskio) { $datas[] = 'diskio'; }
if ($temperatures) { $datas[] = 'temperatures'; } if ($temperatures) { $datas[] = 'temperatures'; }
@@ -28,7 +28,7 @@ if ($current) { $datas[] = 'current'; }
$type_text['overview'] = "Overview"; $type_text['overview'] = "Overview";
$type_text['temperatures'] = "Temperatures"; $type_text['temperatures'] = "Temperatures";
$type_text['humidity'] = "Humidity"; $type_text['humidity'] = "Humidity";
$type_text['memory'] = "Memory Pools"; $type_text['mempools'] = "Memory Pools";
$type_text['storage'] = "Disk Usage"; $type_text['storage'] = "Disk Usage";
$type_text['diskio'] = "Disk I/O"; $type_text['diskio'] = "Disk I/O";
$type_text['processors'] = "Processor Usage"; $type_text['processors'] = "Processor Usage";

View File

@@ -14,6 +14,8 @@ if(is_numeric($_GET['optd'])) { $to = $_GET['optd']; } else { $to = $now; }
if(isset($config['graph'][$type][$subtype])) { $descr = $config['graph'][$type][$subtype]; } else { $descr = $graph_type; } if(isset($config['graph'][$type][$subtype])) { $descr = $config['graph'][$type][$subtype]; } else { $descr = $graph_type; }
$descr = mysql_result(mysql_query("SELECT `graph_descr` FROM `graph_types` WHERE `graph_type` = '".$type."' AND `graph_subtype` = '".$subtype."'"),0);
if(is_file("includes/graphs/".$type."/auth.inc.php")) if(is_file("includes/graphs/".$type."/auth.inc.php"))
{ {
include("includes/graphs/".$type."/auth.inc.php"); include("includes/graphs/".$type."/auth.inc.php");

View File

@@ -2,6 +2,28 @@
## Common Functions ## Common Functions
function get_port_by_id($port_id)
{
if(is_numeric($port_id)) {
$port = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '".$port_id."'"));
}
if(is_array($port)){
return $port;
} else {
return FALSE;
}
}
function ifclass($ifOperStatus, $ifAdminStatus)
{
$ifclass = "interface-upup";
if ($ifAdminStatus == "down") { $ifclass = "interface-admindown"; }
if ($ifAdminStatus == "up" && $ifOperStatus== "down") { $ifclass = "interface-updown"; }
if ($ifAdminStatus == "up" && $ifOperStatus== "up") { $ifclass = "interface-upup"; }
return $ifclass;
}
function device_by_id_cache($device_id) function device_by_id_cache($device_id)
{ {
global $device_cache; global $device_cache;

View File

@@ -89,19 +89,6 @@ function device_array($device_id)
return $device; return $device;
} }
function get_port_by_id($port_id)
{
if(is_numeric($port_id)) {
$port = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '".$port_id."'"));
}
if(is_array($port)){
return $port;
} else {
return FALSE;
}
}
function get_device_id_by_interface_id($interface_id) { function get_device_id_by_interface_id($interface_id) {
if(is_numeric($interface_id)) { if(is_numeric($interface_id)) {
$device_id = mysql_result(mysql_query("SELECT `device_id` FROM `ports` WHERE `interface_id` = '".$interface_id."'"),0); $device_id = mysql_result(mysql_query("SELECT `device_id` FROM `ports` WHERE `interface_id` = '".$interface_id."'"),0);
@@ -406,15 +393,6 @@ function isValidInterface($if) {
} else { return 0; } } else { return 0; }
} }
function ifclass($ifOperStatus, $ifAdminStatus)
{
$ifclass = "interface-upup";
if ($ifAdminStatus == "down") { $ifclass = "interface-admindown"; }
if ($ifAdminStatus == "up" && $ifOperStatus== "down") { $ifclass = "interface-updown"; }
if ($ifAdminStatus == "up" && $ifOperStatus== "up") { $ifclass = "interface-upup"; }
return $ifclass;
}
function utime() function utime()
{ {
$time = explode( " ", microtime()); $time = explode( " ", microtime());

View File

@@ -3,14 +3,14 @@
/// HOST-RESOURCES-MIB /// HOST-RESOURCES-MIB
// Generic System Statistics // Generic System Statistics
$hrSystem_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrSystem.rrd";
$oid_list = "hrSystemProcesses.0 hrSystemNumUsers.0"; $oid_list = "hrSystemProcesses.0 hrSystemNumUsers.0";
$hrSystem = snmp_get_multi ($device, $oid_list, "-OUQs", "HOST-RESOURCES-MIB"); $hrSystem = snmp_get_multi ($device, $oid_list, "-OUQs", "HOST-RESOURCES-MIB");
if(isset($hrSystem[0]['hrSystemProcesses'])) echo("HR Stats:");
if(is_numeric($hrSystem[0]['hrSystemProcesses']))
{ {
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr-processes.rrd"; $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_processes.rrd";
if (!is_file($rrd_file)) { if (!is_file($rrd_file)) {
shell_exec($config['rrdtool'] . " create $rrd_file \ shell_exec($config['rrdtool'] . " create $rrd_file \
--step 300 \ --step 300 \
@@ -24,13 +24,14 @@ if(isset($hrSystem[0]['hrSystemProcesses']))
RRA:MAX:0.5:24:800 \ RRA:MAX:0.5:24:800 \
RRA:MAX:0.5:288:800"); RRA:MAX:0.5:288:800");
} }
rrdtool_update($rrd_file, "N:$hrSystemProcesses"); rrdtool_update($rrd_file, "N:".$hrSystem[0]['hrSystemProcesses']);
$graphs['hrprocesses'] = TRUE; $graphs['hr_processes'] = TRUE;
echo(" Processes");
} }
if(isset($hrSystem[0]['hrSystemNumUsers'])) if(is_numeric($hrSystem[0]['hrSystemNumUsers']))
{ {
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr-users.rrd"; $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_users.rrd";
if (!is_file($rrd_file)) { if (!is_file($rrd_file)) {
shell_exec($config['rrdtool'] . " create $rrd_file \ shell_exec($config['rrdtool'] . " create $rrd_file \
--step 300 \ --step 300 \
@@ -44,9 +45,11 @@ if(isset($hrSystem[0]['hrSystemNumUsers']))
RRA:MAX:0.5:24:800 \ RRA:MAX:0.5:24:800 \
RRA:MAX:0.5:288:800"); RRA:MAX:0.5:288:800");
} }
rrdtool_update($rrd_file, "N:$hrSystemNumUsers"); rrdtool_update($rrd_file, "N:".$hrSystem[0]['hrSystemNumUsers']);
$graphs['hrusers'] = TRUE; $graphs['hr_users'] = TRUE;
echo(" Users");
} }
echo("\n");
?> ?>

View File

@@ -90,9 +90,9 @@
unset($rrdupdate, $rrd_create); unset($rrdupdate, $rrd_create);
## FIXME per-AF? ## FIXME per-AF?
$graphs['ipSystemStats'] = TRUE; $graphs['ipsystemstats_'.$af] = TRUE;
$graphs['ipsystemstats_'.$af.'_frag'] = TRUE;
} }
} }

View File

@@ -42,11 +42,10 @@ if($device[os] != "Snom") {
if(isset($data_array[$device['device_id']][0]['icmpInMsgs']) && isset($data_array[$device['device_id']][0]['icmpOutMsgs'])) { if(isset($data_array[$device['device_id']][0]['icmpInMsgs']) && isset($data_array[$device['device_id']][0]['icmpOutMsgs'])) {
if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
rrdtool_update($rrd_file, $rrdupdate); rrdtool_update($rrd_file, $rrdupdate);
$graphs['netstats-icmp'] = TRUE; $graphs['netstat_icmp'] = TRUE;
} $graphs['netstat_icmp_info'] = TRUE;
}
unset($oids, $data, $data_array, $oid, $protos);
unset($oids, $data, $data_array, $oid, $protos);
} }
?> ?>

View File

@@ -36,12 +36,11 @@ if($device[os] != "Snom") {
$rrdupdate .= ":$value"; $rrdupdate .= ":$value";
} }
print_r($data);
if(isset($data[0]['ipOutRequests']) && isset($data[0]['ipInReceives'])) { if(isset($data[0]['ipOutRequests']) && isset($data[0]['ipInReceives'])) {
if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
rrdtool_update($rrd_file, $rrdupdate); rrdtool_update($rrd_file, $rrdupdate);
$graphs['netstats-ip'] = TRUE; $graphs['netstat_ip'] = TRUE;
$graphs['netstat_ip_frag'] = TRUE;
} }

View File

@@ -38,7 +38,8 @@ if($device[os] != "Snom") {
if(isset($data_array[$device['device_id']][0]['snmpInPkts']) && isset($data_array[$device['device_id']][0]['snmpOutPkts'])) { if(isset($data_array[$device['device_id']][0]['snmpInPkts']) && isset($data_array[$device['device_id']][0]['snmpOutPkts'])) {
if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
rrdtool_update($rrd_file, $rrdupdate); rrdtool_update($rrd_file, $rrdupdate);
$graphs['netstats-snmp'] = TRUE; $graphs['netstat_snmp'] = TRUE;
$graphs['netstat_snmp_pkt'] = TRUE;
} }
unset($oids, $data, $data_array, $oid, $protos); unset($oids, $data, $data_array, $oid, $protos);

View File

@@ -45,7 +45,7 @@ if($device[os] != "Snom") {
if(isset($data[0]['tcpInSegs']) && isset($data[0]['tcpOutSegs'])) { if(isset($data[0]['tcpInSegs']) && isset($data[0]['tcpOutSegs'])) {
if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
rrdtool_update($rrd_file, $rrdupdate); rrdtool_update($rrd_file, $rrdupdate);
$graphs['netstats-tcp'] = TRUE; $graphs['netstat_tcp'] = TRUE;
} }
unset($oids, $data, $data_array, $oid, $protos); unset($oids, $data, $data_array, $oid, $protos);

View File

@@ -37,7 +37,7 @@ if($device[os] != "Snom") {
if(isset($data[0]['udpInDatagrams']) && isset($data[0]['udpOutDatagrams'])) { if(isset($data[0]['udpInDatagrams']) && isset($data[0]['udpOutDatagrams'])) {
if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
rrdtool_update($rrd_file, $rrdupdate); rrdtool_update($rrd_file, $rrdupdate);
$graphs['netstats-udp'] = TRUE; $graphs['netstat_udp'] = TRUE;
} }
} }
unset($oids, $data, $data_array, $oid, $protos, $snmpstring); unset($oids, $data, $data_array, $oid, $protos, $snmpstring);

View File

@@ -47,6 +47,4 @@ $version = str_replace("\"","", $version);
$features = str_replace("\"","", $features); $features = str_replace("\"","", $features);
$hardware = str_replace("\"","", $hardware); $hardware = str_replace("\"","", $hardware);
include("includes/polling/hr-mib.inc.php");
?> ?>

View File

@@ -41,7 +41,4 @@ $version = str_replace("\"","", $version);
$features = str_replace("\"","", $features); $features = str_replace("\"","", $features);
$hardware = str_replace("\"","", $hardware); $hardware = str_replace("\"","", $hardware);
include("includes/polling/hr-mib.inc.php");
?> ?>

View File

@@ -10,37 +10,25 @@ $serial = shell_exec($config['snmpget']. " -M ".$config['mibdir']." -m FOR
$version = preg_replace("/(.+)\ (.+),(.+),(.+)/", "Fortinet \\1||\\2||\\3||\\4", $fnSysVersion); $version = preg_replace("/(.+)\ (.+),(.+),(.+)/", "Fortinet \\1||\\2||\\3||\\4", $fnSysVersion);
list($hardware,$version,$features) = explode("||", $version); list($hardware,$version,$features) = explode("||", $version);
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-cpu.rrd"; #$cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m FORTINET-MIB-280 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-memory.rrd"; #$cmd .= " fnSysCpuUsage.0 fnSysMemUsage.0 fnSysSesCount.0 fnSysMemCapacity.0";
$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-sessions.rrd"; #$data = shell_exec($cmd);
#list ($cpu, $mem, $ses, $memsize) = explode("\n", $data);
$cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m FORTINET-MIB-280 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname']; $sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate_sessions.rrd";
$cmd .= " fnSysCpuUsage.0 fnSysMemUsage.0 fnSysSesCount.0 fnSysMemCapacity.0";
$data = shell_exec($cmd);
list ($cpu, $mem, $ses, $memsize) = explode("\n", $data);
if (!is_file($cpurrd)) { $sessions = snmp_get($device, "fnSysSesCount.0", "FORTINET-MIB-280");
shell_exec($config['rrdtool']." create $cpurrd --step 300 DS:cpu:GAUGE:600:0:100 \
RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \
RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800");
}
if (!is_file($memrrd)) { if(is_numeric($sessions)
{
shell_exec($config['rrdtool'] . " create $memrrd --step 300 \ if (!is_file($sessrrd))
DS:mem:GAUGE:600:0:10000000000 DS:memcapacity:GAUGE:600:0:10000000000 \ {
RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \
RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800");
}
if (!is_file($sessrrd)) {
`rrdtool create $sessrrd --step 300 DS:sessions:GAUGE:600:0:3000000 \ `rrdtool create $sessrrd --step 300 DS:sessions:GAUGE:600:0:3000000 \
RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \ RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 \
RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800`; RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800`;
}
shell_exec($config['rrdtool'] . " update $sessrrd N:$ses");
$graphs['fortigate_sessions']
} }
shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu");
shell_exec($config['rrdtool'] . " update $memrrd N:$mem:$memsize");
shell_exec($config['rrdtool'] . " update $sessrrd N:$ses");
?> ?>

View File

@@ -17,8 +17,6 @@ list($version) = explode("]", $jun_ver);
list(,$version) = explode("[", $version); list(,$version) = explode("[", $version);
$features = ""; $features = "";
echo("$hardware - $version - $features - $serial\n");
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/junos-cpu.rrd"; $cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/junos-cpu.rrd";
#$cpu_cmd = $config['snmpget'] . " -m JUNIPER-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; #$cpu_cmd = $config['snmpget'] . " -m JUNIPER-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
@@ -46,6 +44,4 @@ if (is_numeric($cpu_usage))
rrdtool_update($cpurrd, " N:$cpu_usage"); rrdtool_update($cpurrd, " N:$cpu_usage");
} }
include("includes/polling/hr-mib.inc.php");
?> ?>

View File

@@ -18,17 +18,10 @@ list(,$version) = explode("(", $version);
list($features) = explode("]", $junose_version); list($features) = explode("]", $junose_version);
list(,$features) = explode("[", $features); list(,$features) = explode("[", $features);
echo("$hardware - $version - $features - $serial\n");
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/junose-cpu.rrd"; $cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/junose-cpu.rrd";
#$cpu_cmd = $config['snmpget'] . " -m JUNIPER-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; #$cpu_cmd = $config['snmpget'] . " -m JUNIPER-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
#$cpu_cmd .= " .1.3.6.1.4.1.2636.3.1.13.1.8.9.1.0.0"; #$cpu_cmd .= " .1.3.6.1.4.1.2636.3.1.13.1.8.9.1.0.0";
#$cpu_usage = trim(shell_exec($cpu_cmd)); #$cpu_usage = trim(shell_exec($cpu_cmd));
include("includes/polling/hr-mib.inc.php");
include("includes/polling/junose-atm-vp.inc.php");
?> ?>

View File

@@ -1,6 +1,4 @@
<?php <?php
include("includes/polling/ucd-mib.inc.php");
include("includes/polling/hr-mib.inc.php");
?> ?>

View File

@@ -3,11 +3,9 @@
echo("Doing Juniper Netscreen (ScreenOS)"); echo("Doing Juniper Netscreen (ScreenOS)");
$version = preg_replace("/(.+)\ version\ (.+)\ \(SN:\ (.+)\,\ (.+)\)/", "Juniper Netscreen \\1||\\2||\\3||\\4", $sysDescr); $version = preg_replace("/(.+)\ version\ (.+)\ \(SN:\ (.+)\,\ (.+)\)/", "Juniper Netscreen \\1||\\2||\\3||\\4", $sysDescr);
#echo("$version\n");
list($hardware,$version,$serial,$features) = explode("||", $version); list($hardware,$version,$serial,$features) = explode("||", $version);
$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/screenos-sessions.rrd"; $sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/screenos-sessions.rrd";
$sess_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname']; $sess_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$sess_cmd .= " .1.3.6.1.4.1.3224.16.3.2.0 .1.3.6.1.4.1.3224.16.3.3.0 .1.3.6.1.4.1.3224.16.3.4.0"; $sess_cmd .= " .1.3.6.1.4.1.3224.16.3.2.0 .1.3.6.1.4.1.3224.16.3.3.0 .1.3.6.1.4.1.3224.16.3.4.0";
$sess_data = shell_exec($sess_cmd); $sess_data = shell_exec($sess_cmd);
@@ -30,4 +28,6 @@ if (!is_file($sessrrd)) {
rrdtool_update("$sessrrd", "N:$sessalloc:$sessmax:$sessfailed"); rrdtool_update("$sessrrd", "N:$sessalloc:$sessmax:$sessfailed");
$graphs['netscreen_sessions'] = TRUE;
?> ?>

View File

@@ -17,8 +17,4 @@ if($loop) {
$version = $matches[1]; $version = $matches[1];
} }
echo("$hardware - $version - $features - $serial\n");
#include("hr-mib.inc.php");
?> ?>

View File

@@ -46,7 +46,4 @@
if(strpos($hw, "No") !== FALSE) { unset($hw); } else { $hardware = "Dell " . $hw; } if(strpos($hw, "No") !== FALSE) { unset($hw); } else { $hardware = "Dell " . $hw; }
} }
echo("$version - $hardware - $features "); ?>
include("includes/polling/ucd-mib.inc.php");
include("includes/polling/hr-mib.inc.php");

View File

@@ -32,7 +32,4 @@
### Detect processor type? : I.E. x86 Family 15 Model 2 Stepping 7 ### Detect processor type? : I.E. x86 Family 15 Model 2 Stepping 7
include("includes/polling/ucd-mib.inc.php");
include("includes/polling/hr-mib.inc.php");
?> ?>

View File

@@ -52,6 +52,7 @@
### This is how we currently collect. We should collect one RRD per stat, for ease of handling differen formats, ### This is how we currently collect. We should collect one RRD per stat, for ease of handling differen formats,
### and because it is per-host and no big performance hit. See new format below ### and because it is per-host and no big performance hit. See new format below
### FIXME REMOVE
if(is_numeric($ss['ssCpuRawUser']) && is_numeric($ss['ssCpuRawNice']) && is_numeric($ss['ssCpuRawSystem']) && is_numeric($ss['ssCpuRawIdle'])) if(is_numeric($ss['ssCpuRawUser']) && is_numeric($ss['ssCpuRawNice']) && is_numeric($ss['ssCpuRawSystem']) && is_numeric($ss['ssCpuRawIdle']))
{ {
@@ -78,9 +79,18 @@
rrdtool_create($filename, " --step 300 DS:value:COUNTER:600:0:U RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800"); rrdtool_create($filename, " --step 300 DS:value:COUNTER:600:0:U RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800 RRA:MAX:0.5:1:800 RRA:MAX:0.5:6:800 RRA:MAX:0.5:24:800 RRA:MAX:0.5:288:800");
} }
rrdtool_update($filename, "N:".$value); rrdtool_update($filename, "N:".$value);
$graphs['ucd_cpu'] = TRUE;
} }
} }
### Set various graphs if we've seen the right OIDs.
if(is_numeric($ss['ssRawSwapIn'])) { $graphs['ucd_swap_io'] = TRUE; }
if(is_numeric($ss['ssIORawSent'])) { $graphs['ucd_io'] = TRUE; }
if(is_numeric($ss['ssRawContexts'])) { $graphs['ucd_contexts'] = TRUE; }
if(is_numeric($ss['ssRawInterrupts'])) { $graphs['ucd_interrupts'] = TRUE; }
############################################################################################################################################ ############################################################################################################################################
### Poll mem for load memory utilisation stats on UNIX-like hosts running UCD/Net-SNMPd ### Poll mem for load memory utilisation stats on UNIX-like hosts running UCD/Net-SNMPd
@@ -130,6 +140,7 @@
rrdtool_create($mem_rrd, $mem_rrd_create); rrdtool_create($mem_rrd, $mem_rrd_create);
} }
rrdtool_update($mem_rrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:".($memShared+0).":".($memBuffer+0).":".($memCached+0)); rrdtool_update($mem_rrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:".($memShared+0).":".($memBuffer+0).":".($memCached+0));
$graphs['ucd_memory'] = TRUE;
} }
########################################################################################################################################################## ##########################################################################################################################################################
@@ -164,4 +175,5 @@
rrdtool_create($load_rrd, $la_load_create); rrdtool_create($load_rrd, $la_load_create);
} }
rrdtool_update($load_rrd, "N:$load1:$load5:$load10"); rrdtool_update($load_rrd, "N:$load1:$load5:$load10");
$graphs['ucd_load'] = "TRUE";
} }

View File

@@ -12,7 +12,7 @@ function ifNameDescr($interface, $device = NULL) {
function ifLabel ($interface, $device = NULL) { function ifLabel ($interface, $device = NULL) {
global $config; global $config;
if(!$device) { $device = device_array($interface['device_id']); } if(!$device) { $device = device_by_id_cache($interface['device_id']); }
$os = strtolower($device['os']); $os = strtolower($device['os']);
if (isset($config['os'][$os]['ifname'])) { if (isset($config['os'][$os]['ifname'])) {

View File

@@ -7,9 +7,9 @@ $config['afi']['ipv4']['vpn'] = "VPNv4";
$config['afi']['ipv6']['unicast'] = "IPv6"; $config['afi']['ipv6']['unicast'] = "IPv6";
$config['afi']['ipv6']['multicast'] = "IPv6 Multicast"; $config['afi']['ipv6']['multicast'] = "IPv6 Multicast";
$config['os']['default']['over'][0]['graph'] = "device_cpu"; $config['os']['default']['over'][0]['graph'] = "device_processors";
$config['os']['default']['over'][0]['text'] = "Processor Usage"; $config['os']['default']['over'][0]['text'] = "Processor Usage";
$config['os']['default']['over'][1]['graph'] = "device_memory"; $config['os']['default']['over'][1]['graph'] = "device_mempools";
$config['os']['default']['over'][1]['text'] = "Memory Usage"; $config['os']['default']['over'][1]['text'] = "Memory Usage";
$os = "generic"; $os = "generic";
@@ -65,9 +65,9 @@ $config['os'][$os]['type'] = "network";
$config['os'][$os]['ifXmcbc'] = 1; $config['os'][$os]['ifXmcbc'] = 1;
$config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['graph'] = "device_bits";
$config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][0]['text'] = "Device Traffic";
$config['os'][$os]['over'][1]['graph'] = "device_cpu"; $config['os'][$os]['over'][1]['graph'] = "device_processors";
$config['os'][$os]['over'][1]['text'] = "CPU Usage"; $config['os'][$os]['over'][1]['text'] = "CPU Usage";
$config['os'][$os]['over'][2]['graph'] = "device_memory"; $config['os'][$os]['over'][2]['graph'] = "device_mempools";
$config['os'][$os]['over'][2]['text'] = "Memory Usage"; $config['os'][$os]['over'][2]['text'] = "Memory Usage";
$os = "cat1900"; $os = "cat1900";
@@ -134,9 +134,9 @@ $config['os'][$os]['type'] = "network";
$config['os'][$os]['nobulk'] = 1; $config['os'][$os]['nobulk'] = 1;
$config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['graph'] = "device_bits";
$config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][0]['text'] = "Device Traffic";
$config['os'][$os]['over'][1]['graph'] = "device_cpu"; $config['os'][$os]['over'][1]['graph'] = "device_processors";
$config['os'][$os]['over'][1]['text'] = "CPU Usage"; $config['os'][$os]['over'][1]['text'] = "CPU Usage";
$config['os'][$os]['over'][2]['graph'] = "device_memory"; $config['os'][$os]['over'][2]['graph'] = "device_mempools";
$config['os'][$os]['over'][2]['text'] = "Memory Usage"; $config['os'][$os]['over'][2]['text'] = "Memory Usage";
$os = "junose"; $os = "junose";
@@ -188,9 +188,9 @@ $config['os'][$os]['ifname'] = 1;
$config['os'][$os]['type'] = "network"; $config['os'][$os]['type'] = "network";
$config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['graph'] = "device_bits";
$config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][0]['text'] = "Device Traffic";
$config['os'][$os]['over'][1]['graph'] = "device_cpu"; $config['os'][$os]['over'][1]['graph'] = "device_processors";
$config['os'][$os]['over'][1]['text'] = "CPU Usage"; $config['os'][$os]['over'][1]['text'] = "CPU Usage";
#$config['os'][$os]['over'][2]['graph'] = "device_memory"; #$config['os'][$os]['over'][2]['graph'] = "device_mempools";
#$config['os'][$os]['over'][2]['text'] = "Memory Usage"; #$config['os'][$os]['over'][2]['text'] = "Memory Usage";
$os = "powervault"; $os = "powervault";
@@ -438,6 +438,17 @@ $config['graph']['device']['processors'] = "Processor Usage";
$config['graph']['device']['cpu'] = "Processor Usage"; $config['graph']['device']['cpu'] = "Processor Usage";
$config['graph']['device']['storage'] = "Disk Usage"; $config['graph']['device']['storage'] = "Disk Usage";
$config['graph']['device']['ucd_load'] = "Load Averages";
$config['graph']['device']['ucd_cpu'] = "Detailed Processor Usage";
$config['graph']['device']['ucd_mem'] = "Detailed Memory Usage";
$config['graph']['device']['netstats_tcp'] = "TCP Statistics";
$config['graph']['device']['netstats_icmp_info'] = "ICMP Informational Statistics";
$config['graph']['device']['netstats_icmp_stat'] = "ICMP Statistics";
$config['graph']['device']['netstats_ip'] = "IP Statistics";
$config['graph']['device']['netstats_ip_frag'] = "IP Fragmentation Statistics";
$config['graph']['device']['netstats_udp'] = "UDP Statistics";
$config['graph']['device']['netstats_snmp'] = "SNMP Statistics";
############################## ##############################

View File

@@ -94,19 +94,33 @@ while ($device = mysql_fetch_array($device_query))
if ($status == "1") if ($status == "1")
{ {
$graphs = array();
$snmp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; $snmp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$snmp_cmd .= " sysUpTime.0 sysLocation.0 sysContact.0 sysName.0"; $snmp_cmd .= " sysUpTime.0 sysLocation.0 sysContact.0 sysName.0";
$snmpdata = str_replace('"','',trim(shell_exec($snmp_cmd))); $snmpdata = str_replace('"','',trim(shell_exec($snmp_cmd)));
list($sysUptime, $sysLocation, $sysContact, $sysName) = explode("\n", $snmpdata); list($sysUptime, $sysLocation, $sysContact, $sysName) = explode("\n", $snmpdata);
$snmp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$snmp_cmd .= " HOST-RESOURCES-MIB::hrSystemUptime.0";
$snmpdata = str_replace('"','',trim(shell_exec($snmp_cmd)));
list($hrSystemUptime) = explode("\n", $snmpdata);
$sysDescr = trim(shell_exec($config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0")); $sysDescr = trim(shell_exec($config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0"));
$sysName = strtolower($sysName); $sysName = strtolower($sysName);
$hrSystemUptime = snmp_get($device, ".1.3.6.1.2.1.25.1.1.0", "-Oqv", "HOST-RESOURCES-MIB");
echo("UPTIMES: ".$hrSystemUptime."|".$sysUptime."]");
#SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31
$sysUptime = str_replace("(", "", $sysUptime);
$sysUptime = str_replace(")", "", $sysUptime);
list($days, $hours, $mins, $secs) = explode(":", $sysUptime);
list($secs, $microsecs) = explode(".", $secs);
$hours = $hours + ($days * 24);
$mins = $mins + ($hours * 60);
$secs = $secs + ($mins * 60);
$uptime = $secs;
if ($hrSystemUptime != "No Such Object available on this agent at this OID" && $hrSystemUptime != "") if ($hrSystemUptime != "No Such Object available on this agent at this OID" && $hrSystemUptime != "")
{ {
$agent_uptime = $uptime; ## Move uptime into agent_uptime
#HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65 #HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65
$hrSystemUptime = str_replace("(", "", $hrSystemUptime); $hrSystemUptime = str_replace("(", "", $hrSystemUptime);
$hrSystemUptime = str_replace(")", "", $hrSystemUptime); $hrSystemUptime = str_replace(")", "", $hrSystemUptime);
@@ -118,21 +132,12 @@ while ($device = mysql_fetch_array($device_query))
$uptime = $secs; $uptime = $secs;
if ($device['os'] == "windows") { $uptime /= 10; } if ($device['os'] == "windows") { $uptime /= 10; }
} }
else
{
#SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31
$sysUptime = str_replace("(", "", $sysUptime);
$sysUptime = str_replace(")", "", $sysUptime);
list($days, $hours, $mins, $secs) = explode(":", $sysUptime);
list($secs, $microsecs) = explode(".", $secs);
$hours = $hours + ($days * 24);
$mins = $mins + ($hours * 60);
$secs = $secs + ($mins * 60);
$uptime = $secs;
}
if ($uptime) if (is_numeric($uptime))
{ {
$graphs['uptime'] = TRUE;
if ( $uptime < $device['uptime'] ) { if ( $uptime < $device['uptime'] ) {
notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago."); notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago.");
log_event('Device rebooted after '.formatUptime($device['uptime']), $device['device_id'], 'reboot', $device['uptime']); log_event('Device rebooted after '.formatUptime($device['uptime']), $device['device_id'], 'reboot', $device['uptime']);
@@ -184,6 +189,8 @@ while ($device = mysql_fetch_array($device_query))
include("includes/polling/mempools.inc.php"); include("includes/polling/mempools.inc.php");
include("includes/polling/storage.inc.php"); include("includes/polling/storage.inc.php");
include("includes/polling/netstats.inc.php"); include("includes/polling/netstats.inc.php");
include("includes/polling/hr-mib.inc.php");
include("includes/polling/ucd-mib.inc.php");
include("includes/polling/ipSystemStats.inc.php"); include("includes/polling/ipSystemStats.inc.php");
include("includes/polling/ports.inc.php"); include("includes/polling/ports.inc.php");
include("includes/polling/altiga-ssl.inc.php"); include("includes/polling/altiga-ssl.inc.php");
@@ -252,12 +259,34 @@ while ($device = mysql_fetch_array($device_query))
} }
## FIX ME EVENTLOGGING
### This code cycles through the graphs already known in the database and the ones we've defined as being polled here
### If there any don't match, they're added/deleted from the database.
### Ideally we should hold graphs for xx days/weeks/polls so that we don't needlessly hide information.
$query = mysql_query("SELECT `graph` FROM `device_graphs` WHERE `device_id` = '".$device['device_id']."'");
while($graph = mysql_fetch_array($query)){
if(!isset($graphs[$graph[0]]))
{
mysql_query("DELETE FROM `device_graphs` WHERE `device_id` = '".$device['device_id']."' AND `graph` = '".$graph[0]."'");
} else {
$oldgraphs[$graph[0]] = TRUE;
}
}
foreach($graphs as $graph => $value)
{
if(!isset($oldgraphs[$graph]))
{
mysql_query("INSERT INTO `device_graphs` (`device_id`, `graph`) VALUES ('".$device['device_id']."','".$graph."')");
}
}
$device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5); $device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5);
$poll_update .= $poll_separator . "`last_polled_timetaken` = '$device_time'"; $poll_update .= $poll_separator . "`last_polled_timetaken` = '$device_time'";
echo("$device_end - $device_start; $device_time $device_run"); echo("$device_end - $device_start; $device_time $device_run");
echo("Polled in $device_time seconds\n"); echo("Polled in $device_time seconds\n");
$poll_update_query = "UPDATE `devices` SET "; $poll_update_query = "UPDATE `devices` SET ";
$poll_update_query .= $poll_update; $poll_update_query .= $poll_update;
$poll_update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'"; $poll_update_query .= " WHERE `device_id` = '" . $device['device_id'] . "'";