diff --git a/check-errors.php b/check-errors.php index 9290425ef..702004f91 100755 --- a/check-errors.php +++ b/check-errors.php @@ -10,51 +10,50 @@ * @subpackage alerts * @author Adam Armstrong * @copyright (C) 2006 - 2012 Adam Armstrong - * */ chdir(dirname($argv[0])); -include("includes/defaults.inc.php"); -include("config.php"); -include("includes/definitions.inc.php"); -include("includes/functions.php"); -include("html/includes/functions.inc.php"); +require 'includes/defaults.inc.php'; +require 'config.php'; +require 'includes/definitions.inc.php'; +require 'includes/functions.php'; +require 'html/includes/functions.inc.php'; // Check all of our interface RRD files for errors +if ($argv[1]) { + $where = 'AND `port_id` = ?'; + $params = array($argv[1]); +} -if ($argv[1]) { $where = "AND `port_id` = ?"; $params = array($argv[1]); } - -$i = 0; +$i = 0; $errored = 0; -foreach (dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where", $params) as $interface) -{ - $errors = $interface['ifInErrors_delta'] + $interface['ifOutErrors_delta']; - if ($errors > '1') - { - $errored[] = generate_device_link($interface, $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $interface['ifInErrors_delta'] . " - " . $interface['ifOutErrors_delta']); - $errored++; - } - $i++; -} +foreach (dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where", $params) as $interface) { + $errors = ($interface['ifInErrors_delta'] + $interface['ifOutErrors_delta']); + if ($errors > '1') { + $errored[] = generate_device_link($interface, $interface['hostname'].' - '.$interface['ifDescr'].' - '.$interface['ifAlias'].' - '.$interface['ifInErrors_delta'].' - '.$interface['ifOutErrors_delta']); + $errored++; + } -echo("Checked $i interfaces\n"); - -if (is_array($errored)) -{ // If there are errored ports - $i = 0; - $msg = "Interfaces with errors : \n\n"; - - foreach ($errored as $int) - { - $msg .= "$int\n"; // Add a line to the report email warning about them $i++; - } - // Send the alert email - notify($device, $config['project_name'] . " detected errors on $i interface" . ($i != 1 ? 's' : ''), $msg); } -echo("$errored interfaces with errors over the past 5 minutes.\n"); +echo "Checked $i interfaces\n"; -?> +if (is_array($errored)) { + // If there are errored ports + $i = 0; + $msg = "Interfaces with errors : \n\n"; + + foreach ($errored as $int) { + $msg .= "$int\n"; + // Add a line to the report email warning about them + $i++; + } + + // Send the alert email + notify($device, $config['project_name']." detected errors on $i interface".($i != 1 ? 's' : ''), $msg); +} + +echo "$errored interfaces with errors over the past 5 minutes.\n"; diff --git a/check-services.php b/check-services.php index 2f6f33ab6..6cbba11ec 100755 --- a/check-services.php +++ b/check-services.php @@ -1,7 +1,7 @@ #!/usr/bin/env php * @copyright (C) 2006 - 2012 Adam Armstrong - * */ chdir(dirname($argv[0])); -include("includes/defaults.inc.php"); -include("config.php"); -include("includes/definitions.inc.php"); -include("includes/functions.php"); +require 'includes/defaults.inc.php'; +require 'config.php'; +require 'includes/definitions.inc.php'; +require 'includes/functions.php'; -foreach (dbFetchRows("SELECT * FROM `devices` AS D, `services` AS S WHERE S.device_id = D.device_id ORDER by D.device_id DESC") as $service) -{ - if ($service['status'] = "1") - { - unset($check, $service_status, $time, $status); - $service_status = $service['service_status']; - $service_type = strtolower($service['service_type']); - $service_param = $service['service_param']; - $checker_script = $config['install_dir'] . "/includes/services/" . $service_type . "/check.inc"; +foreach (dbFetchRows('SELECT * FROM `devices` AS D, `services` AS S WHERE S.device_id = D.device_id ORDER by D.device_id DESC') as $service) { + if ($service['status'] = '1') { + unset($check, $service_status, $time, $status); + $service_status = $service['service_status']; + $service_type = strtolower($service['service_type']); + $service_param = $service['service_param']; + $checker_script = $config['install_dir'].'/includes/services/'.$service_type.'/check.inc'; - if (is_file($checker_script)) - { - include($checker_script); + if (is_file($checker_script)) { + include $checker_script; + } + else { + $status = '2'; + $check = "Error : Script not found ($checker_script)"; + } + + $update = array(); + + if ($service_status != $status) { + $update['service_changed'] = time(); + + if ($service['sysContact']) { + $email = $service['sysContact']; + } + else { + $email = $config['email_default']; + } + + if ($status == '1') { + $msg = 'Service Up: '.$service['service_type'].' on '.$service['hostname']; + notify($device, 'Service Up: '.$service['service_type'].' on '.$service['hostname'], $msg); + } + else if ($status == '0') { + $msg = 'Service Down: '.$service['service_type'].' on '.$service['hostname']; + notify($device, 'Service Down: '.$service['service_type'].' on '.$service['hostname'], $msg); + } + } + else { + unset($updated); + } + + $update = array_merge(array('service_status' => $status, 'service_message' => $check, 'service_checked' => time()), $update); + dbUpdate($update, 'services', '`service_id` = ?', array($service['service_id'])); + unset($update); } - else - { - $status = "2"; - $check = "Error : Script not found ($checker_script)"; + else { + $status = '0'; + }//end if + + $rrd = $config['rrd_dir'].'/'.$service['hostname'].'/'.safename('service-'.$service['service_type'].'-'.$service['service_id'].'.rrd'); + + if (!is_file($rrd)) { + rrdtool_create($rrd, 'DS:status:GAUGE:600:0:1 '.$config['rrd_rra']); } - $update = array(); - - if ($service_status != $status) - { - $update['service_changed'] = time(); - - if ($service['sysContact']) { $email = $service['sysContact']; } else { $email = $config['email_default']; } - if ($status == "1") - { - $msg = "Service Up: " . $service['service_type'] . " on " . $service['hostname']; - notify($device, "Service Up: " . $service['service_type'] . " on " . $service['hostname'], $msg); - } - elseif ($status == "0") - { - $msg = "Service Down: " . $service['service_type'] . " on " . $service['hostname']; - notify($device, "Service Down: " . $service['service_type'] . " on " . $service['hostname'], $msg); - } - } else { unset($updated); } - - $update = array_merge(array('service_status' => $status, 'service_message' => $check, 'service_checked' => time()), $update); - dbUpdate($update, 'services', '`service_id` = ?', array($service['service_id'])); - unset($update); - - } else { - $status = "0"; - } - - $rrd = $config['rrd_dir'] . "/" . $service['hostname'] . "/" . safename("service-" . $service['service_type'] . "-" . $service['service_id'] . ".rrd"); - - if (!is_file($rrd)) - { - rrdtool_create ($rrd, "DS:status:GAUGE:600:0:1 ".$config['rrd_rra']); - } - if ($status == "1" || $status == "0") - { - rrdtool_update($rrd,"N:".$status); - } else { - rrdtool_update($rrd,"N:U"); - } - -} # while - -?> + if ($status == '1' || $status == '0') { + rrdtool_update($rrd, 'N:'.$status); + } + else { + rrdtool_update($rrd, 'N:U'); + } +} //end foreach diff --git a/config_to_json.php b/config_to_json.php index ae4a32d82..e1012a788 100644 --- a/config_to_json.php +++ b/config_to_json.php @@ -1,33 +1,31 @@ - -*/ + * Configuration to JSON converter + * Written by Job Snijders + * + */ $defaults_file = 'includes/defaults.inc.php'; -$config_file = 'config.php'; +$config_file = 'config.php'; // move to install dir chdir(dirname($argv[0])); -function iscli() { - - if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { - return true; - } else { - return false; - } +function iscli() +{ + if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { + return true; + } + else { + return false; + } + } // check if we are running throw the CLI, otherwise abort - -if ( iscli() ) { - - require_once($defaults_file); - require_once($config_file); - print(json_encode($config)); +if (iscli()) { + include_once $defaults_file; + include_once $config_file; + print (json_encode($config)); } - -?> diff --git a/html/includes/collectd/config.php b/html/includes/collectd/config.php index f65db26e8..812c5857a 100644 --- a/html/includes/collectd/config.php +++ b/html/includes/collectd/config.php @@ -1,53 +1,91 @@ -'hour', 'label'=>'past hour', 'seconds'=>3600), - array('name'=>'day', 'label'=>'past day', 'seconds'=>86400), - array('name'=>'week', 'label'=>'past week', 'seconds'=>604800), - array('name'=>'month', 'label'=>'past month', 'seconds'=>2678400), - array('name'=>'year', 'label'=>'past year', 'seconds'=>31622400)); +$config['timespan'] = array( + array( + 'name' => 'hour', + 'label' => 'past hour', + 'seconds' => 3600, + ), + array( + 'name' => 'day', + 'label' => 'past day', + 'seconds' => 86400, + ), + array( + 'name' => 'week', + 'label' => 'past week', + 'seconds' => 604800, + ), + array( + 'name' => 'month', + 'label' => 'past month', + 'seconds' => 2678400, + ), + array( + 'name' => 'year', + 'label' => 'past year', + 'seconds' => 31622400, + ), +); // Interval at which values are collectd (currently ignored) -$config['rrd_interval'] = 10; +$config['rrd_interval'] = 10; // Average rows/rra (currently ignored) -$config['rrd_rows'] = 2400; +$config['rrd_rows'] = 2400; // Additional options to pass to rrdgraph -#$config['rrd_opts'] = (isset($config['rrdgraph_defaults']) ? $config['rrdgraph_defaults'] : ''); -#$config['rrd_opts'] = array('-E', "-c", "SHADEA#a5a5a5", "-c", "SHADEB#a5a5a5", "-c", "FONT#000000", "-c", "CANVAS#FFFFFF", "-c", "GRID#aaaaaa", -# "-c", "MGRID#FFAAAA", "-c", "FRAME#3e3e3e", "-c", "ARROW#5e5e5e", "-R", "normal"); +// $config['rrd_opts'] = (isset($config['rrdgraph_defaults']) ? $config['rrdgraph_defaults'] : ''); +// $config['rrd_opts'] = array('-E', "-c", "SHADEA#a5a5a5", "-c", "SHADEB#a5a5a5", "-c", "FONT#000000", "-c", "CANVAS#FFFFFF", "-c", "GRID#aaaaaa", +// "-c", "MGRID#FFAAAA", "-c", "FRAME#3e3e3e", "-c", "ARROW#5e5e5e", "-R", "normal"); // Predefined set of colors for use by collectd_draw_rrd() -$config['rrd_colors'] = array( - 'h_1'=>'F7B7B7', 'f_1'=>'FF0000', // Red - 'h_2'=>'B7EFB7', 'f_2'=>'00E000', // Green - 'h_3'=>'B7B7F7', 'f_3'=>'0000FF', // Blue - 'h_4'=>'F3DFB7', 'f_4'=>'F0A000', // Yellow - 'h_5'=>'B7DFF7', 'f_5'=>'00A0FF', // Cyan - 'h_6'=>'DFB7F7', 'f_6'=>'A000FF', // Magenta - 'h_7'=>'FFC782', 'f_7'=>'FF8C00', // Orange - 'h_8'=>'DCFF96', 'f_8'=>'AAFF00', // Lime - 'h_9'=>'83FFCD', 'f_9'=>'00FF99', - 'h_10'=>'81D9FF', 'f_10'=>'00B2FF', - 'h_11'=>'FF89F5', 'f_11'=>'FF00EA', - 'h_12'=>'FF89AE', 'f_12'=>'FF0051', - 'h_13'=>'BBBBBB', 'f_13'=>'555555', - ); +$config['rrd_colors'] = array( + 'h_1' => 'F7B7B7', + 'f_1' => 'FF0000', // Red + 'h_2' => 'B7EFB7', + 'f_2' => '00E000', // Green + 'h_3' => 'B7B7F7', + 'f_3' => '0000FF', // Blue + 'h_4' => 'F3DFB7', + 'f_4' => 'F0A000', // Yellow + 'h_5' => 'B7DFF7', + 'f_5' => '00A0FF', // Cyan + 'h_6' => 'DFB7F7', + 'f_6' => 'A000FF', // Magenta + 'h_7' => 'FFC782', + 'f_7' => 'FF8C00', // Orange + 'h_8' => 'DCFF96', + 'f_8' => 'AAFF00', // Lime + 'h_9' => '83FFCD', + 'f_9' => '00FF99', + 'h_10' => '81D9FF', + 'f_10' => '00B2FF', + 'h_11' => 'FF89F5', + 'f_11' => 'FF00EA', + 'h_12' => 'FF89AE', + 'f_12' => 'FF0051', + 'h_13' => 'BBBBBB', + 'f_13' => '555555', +); /* * URL to collectd's unix socket (unixsock plugin) * enabled: 'unix:///var/run/collectd/collectd-unixsock' @@ -58,11 +96,9 @@ $config['collectd_sock'] = null; * Path to TTF font file to use in error images * (fallback when file does not exist is GD fixed font) */ -$config['error_font'] = '/usr/share/fonts/corefonts/arial.ttf'; +$config['error_font'] = '/usr/share/fonts/corefonts/arial.ttf'; /* * Constant defining full path to rrdtool */ define('RRDTOOL', $config['rrdtool']); - -?> diff --git a/html/includes/graphs/XXX_device_memory_windows.inc.php b/html/includes/graphs/XXX_device_memory_windows.inc.php index cd964a856..7122762da 100644 --- a/html/includes/graphs/XXX_device_memory_windows.inc.php +++ b/html/includes/graphs/XXX_device_memory_windows.inc.php @@ -1,12 +1,12 @@ \ No newline at end of file +$rrd_options .= ' LINE1:totalreal#050505:total'; +$rrd_options .= ' GPRINT:totalreal:AVERAGE:\ \ %7.2lf%sB'; diff --git a/html/includes/graphs/accesspoints/auth.inc.php b/html/includes/graphs/accesspoints/auth.inc.php index 7f479a0f2..16f3c57ba 100644 --- a/html/includes/graphs/accesspoints/auth.inc.php +++ b/html/includes/graphs/accesspoints/auth.inc.php @@ -1,17 +1,13 @@ diff --git a/html/includes/graphs/accesspoints/interference.inc.php b/html/includes/graphs/accesspoints/interference.inc.php index 03128f2ad..07bb8e393 100644 --- a/html/includes/graphs/accesspoints/interference.inc.php +++ b/html/includes/graphs/accesspoints/interference.inc.php @@ -1,25 +1,21 @@ diff --git a/html/includes/graphs/accesspoints/numasoclients.inc.php b/html/includes/graphs/accesspoints/numasoclients.inc.php index e0ee8a15d..9f4bde6fe 100644 --- a/html/includes/graphs/accesspoints/numasoclients.inc.php +++ b/html/includes/graphs/accesspoints/numasoclients.inc.php @@ -1,25 +1,21 @@ diff --git a/html/includes/graphs/accesspoints/nummonbssid.inc.php b/html/includes/graphs/accesspoints/nummonbssid.inc.php index c3f5c4ac6..85b3b10b5 100644 --- a/html/includes/graphs/accesspoints/nummonbssid.inc.php +++ b/html/includes/graphs/accesspoints/nummonbssid.inc.php @@ -1,26 +1,21 @@ diff --git a/html/includes/graphs/accesspoints/nummonclients.inc.php b/html/includes/graphs/accesspoints/nummonclients.inc.php index 9033ac1d8..5539f5af6 100644 --- a/html/includes/graphs/accesspoints/nummonclients.inc.php +++ b/html/includes/graphs/accesspoints/nummonclients.inc.php @@ -1,25 +1,21 @@ diff --git a/html/includes/graphs/accesspoints/radioutil.inc.php b/html/includes/graphs/accesspoints/radioutil.inc.php index cde1ed17e..d012ed294 100644 --- a/html/includes/graphs/accesspoints/radioutil.inc.php +++ b/html/includes/graphs/accesspoints/radioutil.inc.php @@ -1,25 +1,21 @@ diff --git a/html/includes/graphs/accesspoints/txpow.inc.php b/html/includes/graphs/accesspoints/txpow.inc.php index 86ecf0729..1dab4340d 100644 --- a/html/includes/graphs/accesspoints/txpow.inc.php +++ b/html/includes/graphs/accesspoints/txpow.inc.php @@ -1,26 +1,21 @@ diff --git a/html/includes/graphs/altiga_ssl_sessions.inc.php b/html/includes/graphs/altiga_ssl_sessions.inc.php index e9e93c9f1..a69f68178 100644 --- a/html/includes/graphs/altiga_ssl_sessions.inc.php +++ b/html/includes/graphs/altiga_ssl_sessions.inc.php @@ -1,33 +1,31 @@ \ No newline at end of file diff --git a/html/includes/graphs/application/auth.inc.php b/html/includes/graphs/application/auth.inc.php index b1662bc85..15c8f01ca 100644 --- a/html/includes/graphs/application/auth.inc.php +++ b/html/includes/graphs/application/auth.inc.php @@ -1,12 +1,9 @@ diff --git a/html/includes/graphs/application/drbd_queue.inc.php b/html/includes/graphs/application/drbd_queue.inc.php index 08a90f8c3..a04a4080b 100644 --- a/html/includes/graphs/application/drbd_queue.inc.php +++ b/html/includes/graphs/application/drbd_queue.inc.php @@ -1,37 +1,37 @@ 'Local I/O', - 'pe' => 'Pending', - 'ua' => 'UnAcked', - 'ap' => 'App Pending', -); + 'lo' => 'Local I/O', + 'pe' => 'Pending', + 'ua' => 'UnAcked', + 'ap' => 'App Pending', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 0; -$unit_text = ""; +$unit_text = ''; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mailscanner_reject.inc.php b/html/includes/graphs/application/mailscanner_reject.inc.php index b45e72398..9298460db 100644 --- a/html/includes/graphs/application/mailscanner_reject.inc.php +++ b/html/includes/graphs/application/mailscanner_reject.inc.php @@ -1,36 +1,32 @@ array('descr' => 'Rejected'), - 'msg_relay' => array('descr' => 'Relayed'), - 'msg_waiting' => array('descr' => 'Waiting'), - ); + 'msg_rejected' => array('descr' => 'Rejected'), + 'msg_relay' => array('descr' => 'Relayed'), + 'msg_waiting' => array('descr' => 'Waiting'), + ); -$i = 0; -$x = 0; +$i = 0; +$x = 0; -if (is_file($rrd_filename)) -{ - $max_colours = count($config['graph_colours'][$colours]); - foreach ($array as $ds => $vars) - { - $x = (($x<=$max_colours) ? $x : 0); - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$x]; - $i++; - $x++; - } +if (is_file($rrd_filename)) { + $max_colours = count($config['graph_colours'][$colours]); + foreach ($array as $ds => $vars) { + $x = (($x <= $max_colours) ? $x : 0); + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$x]; + $i++; + $x++; + } } -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/mailscanner_sent.inc.php b/html/includes/graphs/application/mailscanner_sent.inc.php index c006f5c5a..f9cb4c4a6 100644 --- a/html/includes/graphs/application/mailscanner_sent.inc.php +++ b/html/includes/graphs/application/mailscanner_sent.inc.php @@ -1,27 +1,24 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/application/mailscanner_spam.inc.php b/html/includes/graphs/application/mailscanner_spam.inc.php index 2e913f65c..f68b5200b 100644 --- a/html/includes/graphs/application/mailscanner_spam.inc.php +++ b/html/includes/graphs/application/mailscanner_spam.inc.php @@ -1,30 +1,32 @@ array('descr' => 'Spam', 'colour' => 'FF8800'), - 'virus' => array('descr' => 'Virus', 'colour' => 'FF0000') - ); + 'spam' => array( + 'descr' => 'Spam', + 'colour' => 'FF8800', + ), + 'virus' => array( + 'descr' => 'Virus', + 'colour' => 'FF0000', + ), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } } -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/memcached.inc.php b/html/includes/graphs/application/memcached.inc.php index 8afd6bd1c..6bd8d5882 100644 --- a/html/includes/graphs/application/memcached.inc.php +++ b/html/includes/graphs/application/memcached.inc.php @@ -1,7 +1,5 @@ diff --git a/html/includes/graphs/application/memcached_commands.inc.php b/html/includes/graphs/application/memcached_commands.inc.php index e7f0788b3..d3665e98b 100644 --- a/html/includes/graphs/application/memcached_commands.inc.php +++ b/html/includes/graphs/application/memcached_commands.inc.php @@ -1,25 +1,23 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/application/memcached_data.inc.php b/html/includes/graphs/application/memcached_data.inc.php index 6aec349b6..9b2f43db7 100644 --- a/html/includes/graphs/application/memcached_data.inc.php +++ b/html/includes/graphs/application/memcached_data.inc.php @@ -1,34 +1,41 @@ array('descr' => 'Capacity', 'colour' => '555555'), - 'bytes' => array('descr' => 'Used', 'colour' => 'cc0000', 'areacolour' => 'ff999955'), - ); +$scale_min = 0; +$colours = 'mixed'; +$nototal = 0; +$unit_text = 'Packets/sec'; +$array = array( + 'limit_maxbytes' => array( + 'descr' => 'Capacity', + 'colour' => '555555', + ), + 'bytes' => array( + 'descr' => 'Used', + 'colour' => 'cc0000', + 'areacolour' => 'ff999955', + ), +); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - if (!empty($vars['areacolour'])) { $rrd_list[$i]['areacolour'] = $vars['areacolour']; } - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + if (!empty($vars['areacolour'])) { + $rrd_list[$i]['areacolour'] = $vars['areacolour']; + } + + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/memcached_items.inc.php b/html/includes/graphs/application/memcached_items.inc.php index 5d8b41d36..067c6496c 100644 --- a/html/includes/graphs/application/memcached_items.inc.php +++ b/html/includes/graphs/application/memcached_items.inc.php @@ -1,33 +1,36 @@ array('descr' => 'Items', 'colour' => '555555'), - ); +$scale_min = 0; +$colours = 'mixed'; +$nototal = 0; +$unit_text = 'Items'; +$array = array( + 'curr_items' => array( + 'descr' => 'Items', + 'colour' => '555555', + ), +); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - if (!empty($vars['areacolour'])) { $rrd_list[$i]['areacolour'] = $vars['areacolour']; } - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + if (!empty($vars['areacolour'])) { + $rrd_list[$i]['areacolour'] = $vars['areacolour']; + } + + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/memcached_threads.inc.php b/html/includes/graphs/application/memcached_threads.inc.php index 1802f44e7..0792bd971 100644 --- a/html/includes/graphs/application/memcached_threads.inc.php +++ b/html/includes/graphs/application/memcached_threads.inc.php @@ -1,20 +1,18 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/application/memcached_uptime.inc.php b/html/includes/graphs/application/memcached_uptime.inc.php index ed76dda95..3a18bad68 100644 --- a/html/includes/graphs/application/memcached_uptime.inc.php +++ b/html/includes/graphs/application/memcached_uptime.inc.php @@ -1,18 +1,16 @@ diff --git a/html/includes/graphs/application/mysql_command_counters.inc.php b/html/includes/graphs/application/mysql_command_counters.inc.php index a8e17557c..5ca5d7d68 100644 --- a/html/includes/graphs/application/mysql_command_counters.inc.php +++ b/html/includes/graphs/application/mysql_command_counters.inc.php @@ -1,37 +1,63 @@ array('descr' => 'Delete', 'colour' => '22FF22'), - 'CIt' => array('descr' => 'Insert', 'colour' => '0022FF'), - 'CISt' => array('descr' => 'Insert Select', 'colour' => 'FF0000'), - 'CLd' => array('descr' => 'Load Data', 'colour' => '00AAAA'), - 'CRe' => array('descr' => 'Replace', 'colour' => 'FF00FF'), - 'CRSt' => array('descr' => 'Replace Select', 'colour' => 'FFA500'), - 'CSt' => array('descr' => 'Select', 'colour' => 'CC0000'), - 'CUe' => array('descr' => 'Update', 'colour' => '0000CC'), - 'CUMi' => array('descr' => 'Update Multiple', 'colour' => '0080C0'), -); +$array = array( + 'CDe' => array( + 'descr' => 'Delete', + 'colour' => '22FF22', + ), + 'CIt' => array( + 'descr' => 'Insert', + 'colour' => '0022FF', + ), + 'CISt' => array( + 'descr' => 'Insert Select', + 'colour' => 'FF0000', + ), + 'CLd' => array( + 'descr' => 'Load Data', + 'colour' => '00AAAA', + ), + 'CRe' => array( + 'descr' => 'Replace', + 'colour' => 'FF00FF', + ), + 'CRSt' => array( + 'descr' => 'Replace Select', + 'colour' => 'FFA500', + ), + 'CSt' => array( + 'descr' => 'Select', + 'colour' => 'CC0000', + ), + 'CUe' => array( + 'descr' => 'Update', + 'colour' => '0000CC', + ), + 'CUMi' => array( + 'descr' => 'Update Multiple', + 'colour' => '0080C0', + ), + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; -# $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { echo("file missing: $file"); } +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + // $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Commands"; +$unit_text = 'Commands'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_connections.inc.php b/html/includes/graphs/application/mysql_connections.inc.php index 5feb7bf49..d8024a9ed 100644 --- a/html/includes/graphs/application/mysql_connections.inc.php +++ b/html/includes/graphs/application/mysql_connections.inc.php @@ -1,36 +1,54 @@ array('descr' => 'Max Connections', 'colour' => '22FF22'), - 'MUCs' => array('descr' => 'Max Used Connections', 'colour' => '0022FF'), - 'ACs' => array('descr' => 'Aborted Clients', 'colour' => 'FF0000'), - 'AdCs' => array('descr' => 'Aborted Connects', 'colour' => '0080C0'), - 'TCd' => array('descr' => 'Threads Connected', 'colour' => 'FF0000'), - 'Cs' => array('descr' => 'New Connections', 'colour' => '0080C0'), -); +$array = array( + 'MaCs' => array( + 'descr' => 'Max Connections', + 'colour' => '22FF22', + ), + 'MUCs' => array( + 'descr' => 'Max Used Connections', + 'colour' => '0022FF', + ), + 'ACs' => array( + 'descr' => 'Aborted Clients', + 'colour' => 'FF0000', + ), + 'AdCs' => array( + 'descr' => 'Aborted Connects', + 'colour' => '0080C0', + ), + 'TCd' => array( + 'descr' => 'Threads Connected', + 'colour' => 'FF0000', + ), + 'Cs' => array( + 'descr' => 'New Connections', + 'colour' => '0080C0', + ), + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; -# $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { echo("file missing: $file"); } +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + // $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Connections"; +$unit_text = 'Connections'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_files_tables.inc.php b/html/includes/graphs/application/mysql_files_tables.inc.php index 758ec51e6..f02593e60 100644 --- a/html/includes/graphs/application/mysql_files_tables.inc.php +++ b/html/includes/graphs/application/mysql_files_tables.inc.php @@ -1,32 +1,32 @@ array('descr' => 'Table Cache'), - 'OFs' => array('descr' => 'Open Files'), - 'OTs' => array('descr' => 'Open Tables'), - 'OdTs' => array('descr' => 'Opened Tables'), -); +$array = array( + 'TOC' => array('descr' => 'Table Cache'), + 'OFs' => array('descr' => 'Open Files'), + 'OTs' => array('descr' => 'Open Tables'), + 'OdTs' => array('descr' => 'Opened Tables'), + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; -# $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { echo("file missing: $file"); } +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + // $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = ""; +$unit_text = ''; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_innodb_buffer_pool.inc.php b/html/includes/graphs/application/mysql_innodb_buffer_pool.inc.php index 84adc77ba..6f9255ffa 100644 --- a/html/includes/graphs/application/mysql_innodb_buffer_pool.inc.php +++ b/html/includes/graphs/application/mysql_innodb_buffer_pool.inc.php @@ -1,36 +1,37 @@ 'Buffer Pool Size', - 'IBPDBp' => 'Database Pages', - 'IBPFe' => 'Free Pages', - 'IBPMps' => 'Modified Pages', -); +$array = array( + 'IBPse' => 'Buffer Pool Size', + 'IBPDBp' => 'Database Pages', + 'IBPFe' => 'Free Pages', + 'IBPMps' => 'Modified Pages', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Commands"; +$unit_text = 'Commands'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_innodb_buffer_pool_activity.inc.php b/html/includes/graphs/application/mysql_innodb_buffer_pool_activity.inc.php index 11f282488..e2e3f8441 100644 --- a/html/includes/graphs/application/mysql_innodb_buffer_pool_activity.inc.php +++ b/html/includes/graphs/application/mysql_innodb_buffer_pool_activity.inc.php @@ -1,35 +1,36 @@ 'Pages Read', - 'IBCd' => 'Pages Created', - 'IBWr' => 'Pages Written', -); +$array = array( + 'IBRd' => 'Pages Read', + 'IBCd' => 'Pages Created', + 'IBWr' => 'Pages Written', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "activity"; +$unit_text = 'activity'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_innodb_insert_buffer.inc.php b/html/includes/graphs/application/mysql_innodb_insert_buffer.inc.php index da09b08ce..9cbde97ff 100644 --- a/html/includes/graphs/application/mysql_innodb_insert_buffer.inc.php +++ b/html/includes/graphs/application/mysql_innodb_insert_buffer.inc.php @@ -1,35 +1,36 @@ 'Inserts', - 'IBIMRd' => 'Merged Records', - 'IBIMs' => 'Merges', -); +$array = array( + 'IBIIs' => 'Inserts', + 'IBIMRd' => 'Merged Records', + 'IBIMs' => 'Merges', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = ""; +$unit_text = ''; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_innodb_io.inc.php b/html/includes/graphs/application/mysql_innodb_io.inc.php index 8af3ff1b6..014030370 100644 --- a/html/includes/graphs/application/mysql_innodb_io.inc.php +++ b/html/includes/graphs/application/mysql_innodb_io.inc.php @@ -1,12 +1,11 @@ diff --git a/html/includes/graphs/application/mysql_innodb_io_pending.inc.php b/html/includes/graphs/application/mysql_innodb_io_pending.inc.php index 7214675d7..7b578e052 100644 --- a/html/includes/graphs/application/mysql_innodb_io_pending.inc.php +++ b/html/includes/graphs/application/mysql_innodb_io_pending.inc.php @@ -1,39 +1,40 @@ 'AIO Log', - 'IBISc' => 'AIO Sync', - 'IBIFLg' => 'Buf Pool Flush', - 'IBFBl' => 'Log Flushes', - 'IBIIAo' => 'Insert Buf AIO Read', - 'IBIAd' => 'Normal AIO Read', - 'IBIAe' => 'Normal AIO Writes', -); +$array = array( + 'IBILog' => 'AIO Log', + 'IBISc' => 'AIO Sync', + 'IBIFLg' => 'Buf Pool Flush', + 'IBFBl' => 'Log Flushes', + 'IBIIAo' => 'Insert Buf AIO Read', + 'IBIAd' => 'Normal AIO Read', + 'IBIAe' => 'Normal AIO Writes', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = ""; +$unit_text = ''; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_innodb_log.inc.php b/html/includes/graphs/application/mysql_innodb_log.inc.php index 89750845d..b68890b84 100644 --- a/html/includes/graphs/application/mysql_innodb_log.inc.php +++ b/html/includes/graphs/application/mysql_innodb_log.inc.php @@ -1,12 +1,11 @@ diff --git a/html/includes/graphs/application/mysql_innodb_row_operations.inc.php b/html/includes/graphs/application/mysql_innodb_row_operations.inc.php index f178387a7..f3b74a58b 100644 --- a/html/includes/graphs/application/mysql_innodb_row_operations.inc.php +++ b/html/includes/graphs/application/mysql_innodb_row_operations.inc.php @@ -1,36 +1,37 @@ 'Deletes', - 'IDBRId' => 'Inserts', - 'IDBRRd' => 'Reads', - 'IDBRUd' => 'Updates', -); +$array = array( + 'IDBRDd' => 'Deletes', + 'IDBRId' => 'Inserts', + 'IDBRRd' => 'Reads', + 'IDBRUd' => 'Updates', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 0; -$unit_text = "Rows"; +$unit_text = 'Rows'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_innodb_semaphores.inc.php b/html/includes/graphs/application/mysql_innodb_semaphores.inc.php index 27e33aa18..4b259ed7a 100644 --- a/html/includes/graphs/application/mysql_innodb_semaphores.inc.php +++ b/html/includes/graphs/application/mysql_innodb_semaphores.inc.php @@ -1,35 +1,36 @@ 'Spin Rounds', - 'IBSWs' => 'Spin Waits', - 'IBOWs' => 'OS Waits', -); +$array = array( + 'IBSRs' => 'Spin Rounds', + 'IBSWs' => 'Spin Waits', + 'IBOWs' => 'OS Waits', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Semaphores"; +$unit_text = 'Semaphores'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_innodb_transactions.inc.php b/html/includes/graphs/application/mysql_innodb_transactions.inc.php index 2f53e561b..87e64f73e 100644 --- a/html/includes/graphs/application/mysql_innodb_transactions.inc.php +++ b/html/includes/graphs/application/mysql_innodb_transactions.inc.php @@ -1,33 +1,32 @@ 'Transactions created', -); +$array = array('IBTNx' => 'Transactions created'); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "transactions"; +$unit_text = 'transactions'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_myisam_indexes.inc.php b/html/includes/graphs/application/mysql_myisam_indexes.inc.php index 883b496b1..a4d8a36e3 100644 --- a/html/includes/graphs/application/mysql_myisam_indexes.inc.php +++ b/html/includes/graphs/application/mysql_myisam_indexes.inc.php @@ -1,36 +1,37 @@ 'read requests', - 'KRs' => 'reads', - 'KWR' => 'write requests', - 'KWs' => 'writes', -); +$array = array( + 'KRRs' => 'read requests', + 'KRs' => 'reads', + 'KWR' => 'write requests', + 'KWs' => 'writes', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Keys"; +$unit_text = 'Keys'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_network_traffic.inc.php b/html/includes/graphs/application/mysql_network_traffic.inc.php index d606a1cdd..c37372eee 100644 --- a/html/includes/graphs/application/mysql_network_traffic.inc.php +++ b/html/includes/graphs/application/mysql_network_traffic.inc.php @@ -1,19 +1,16 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/application/mysql_query_cache.inc.php b/html/includes/graphs/application/mysql_query_cache.inc.php index 132e66dd0..1de063436 100644 --- a/html/includes/graphs/application/mysql_query_cache.inc.php +++ b/html/includes/graphs/application/mysql_query_cache.inc.php @@ -1,38 +1,52 @@ array('descr' => 'Queries in cache', 'colour' => '22FF22'), - 'QCHs' => array('descr' => 'Cache hits', 'colour' => '0022FF'), - 'QCIs' => array('descr' => 'Inserts', 'colour' => 'FF0000'), - 'QCNCd' => array('descr' => 'Not cached', 'colour' => '00AAAA'), - 'QCLMPs' => array('descr' => 'Low-memory prunes', 'colour' => 'FF00FF'), -); +$array = array( + 'QCQICe' => array( + 'descr' => 'Queries in cache', + 'colour' => '22FF22', + ), + 'QCHs' => array( + 'descr' => 'Cache hits', + 'colour' => '0022FF', + ), + 'QCIs' => array( + 'descr' => 'Inserts', + 'colour' => 'FF0000', + ), + 'QCNCd' => array( + 'descr' => 'Not cached', + 'colour' => '00AAAA', + ), + 'QCLMPs' => array( + 'descr' => 'Low-memory prunes', + 'colour' => 'FF00FF', + ), + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; -# $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { echo("file missing: $file"); } +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + // $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Commands"; +$unit_text = 'Commands'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_query_cache_memory.inc.php b/html/includes/graphs/application/mysql_query_cache_memory.inc.php index bc72499d5..f4dcf4737 100644 --- a/html/includes/graphs/application/mysql_query_cache_memory.inc.php +++ b/html/includes/graphs/application/mysql_query_cache_memory.inc.php @@ -1,34 +1,35 @@ 'Cache size', - 'QCeFy' => 'Free mem', -); +$array = array( + 'QCs' => 'Cache size', + 'QCeFy' => 'Free mem', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Bytes"; +$unit_text = 'Bytes'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_select_types.inc.php b/html/includes/graphs/application/mysql_select_types.inc.php index 7d25324e4..77f15948f 100644 --- a/html/includes/graphs/application/mysql_select_types.inc.php +++ b/html/includes/graphs/application/mysql_select_types.inc.php @@ -1,37 +1,38 @@ 'Full Join', - 'SFRJn' => 'Full Range', - 'SRe' => 'Range', - 'SRCk' => 'Range Check', - 'SSn' => 'Scan', -); +$array = array( + 'SFJn' => 'Full Join', + 'SFRJn' => 'Full Range', + 'SRe' => 'Range', + 'SRCk' => 'Range Check', + 'SSn' => 'Scan', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 0; -$unit_text = "Queries"; +$unit_text = 'Queries'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_slow_queries.inc.php b/html/includes/graphs/application/mysql_slow_queries.inc.php index 6abffdd0c..c8304c678 100644 --- a/html/includes/graphs/application/mysql_slow_queries.inc.php +++ b/html/includes/graphs/application/mysql_slow_queries.inc.php @@ -1,34 +1,32 @@ 'Slow queries', -); +$array = array('SQs' => 'Slow queries'); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Queries"; +$unit_text = 'Queries'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_sorts.inc.php b/html/includes/graphs/application/mysql_sorts.inc.php index d2f44720b..15396df98 100644 --- a/html/includes/graphs/application/mysql_sorts.inc.php +++ b/html/includes/graphs/application/mysql_sorts.inc.php @@ -1,37 +1,37 @@ 'Rows Sorted', - 'SRange' => 'Range', - 'SMPs' => 'Merge Passes', - 'SScan' => 'Scan', -); + 'SRows' => 'Rows Sorted', + 'SRange' => 'Range', + 'SMPs' => 'Merge Passes', + 'SScan' => 'Scan', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 0; -$unit_text = ""; +$unit_text = ''; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_status.inc.php b/html/includes/graphs/application/mysql_status.inc.php index ffbb8c176..9e8b1fa06 100644 --- a/html/includes/graphs/application/mysql_status.inc.php +++ b/html/includes/graphs/application/mysql_status.inc.php @@ -1,51 +1,51 @@ 'd2', - 'State_copying_to_tmp_table' => 'd3', - 'State_end' => 'd4', - 'State_freeing_items' => 'd5', - 'State_init' => 'd6', - 'State_locked' => 'd7', - 'State_login' => 'd8', - 'State_preparing' => 'd9', - 'State_reading_from_net' => 'da', - 'State_sending_data' => 'db', - 'State_sorting_result' => 'dc', - 'State_statistics' => 'dd', - 'State_updating' => 'de', - 'State_writing_to_net' => 'df', - 'State_none' => 'dg', - 'State_other' => 'dh' + 'State_closing_tables' => 'd2', + 'State_copying_to_tmp_table' => 'd3', + 'State_end' => 'd4', + 'State_freeing_items' => 'd5', + 'State_init' => 'd6', + 'State_locked' => 'd7', + 'State_login' => 'd8', + 'State_preparing' => 'd9', + 'State_reading_from_net' => 'da', + 'State_sending_data' => 'db', + 'State_sorting_result' => 'dc', + 'State_statistics' => 'dd', + 'State_updating' => 'de', + 'State_writing_to_net' => 'df', + 'State_none' => 'dg', + 'State_other' => 'dh', ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $vars => $ds) - { - $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; +if (is_file($rrd_filename)) { + foreach ($array as $vars => $ds) { + $rrd_list[$i]['filename'] = $rrd_filename; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['descr'] = str_replace('_', ' ', $rrd_list[$i]['descr']); + $rrd_list[$i]['descr'] = str_replace('State ', '', $rrd_list[$i]['descr']); + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['descr'] = str_replace("_", " ", $rrd_list[$i]['descr']); - $rrd_list[$i]['descr'] = str_replace("State ", "", $rrd_list[$i]['descr']); - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "activity"; +$unit_text = 'activity'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_table_locks.inc.php b/html/includes/graphs/application/mysql_table_locks.inc.php index 08234d735..7a7b0ed0a 100644 --- a/html/includes/graphs/application/mysql_table_locks.inc.php +++ b/html/includes/graphs/application/mysql_table_locks.inc.php @@ -1,35 +1,35 @@ 'immed', - 'TLWd' => 'waited', -); + 'TLIe' => 'immed', + 'TLWd' => 'waited', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 0; -$unit_text = "Table locks"; +$unit_text = 'Table locks'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/mysql_temporary_objects.inc.php b/html/includes/graphs/application/mysql_temporary_objects.inc.php index ec22c6925..149ec713e 100644 --- a/html/includes/graphs/application/mysql_temporary_objects.inc.php +++ b/html/includes/graphs/application/mysql_temporary_objects.inc.php @@ -1,36 +1,36 @@ 'disk tables', - 'CTMPTs' => 'tables', - 'CTMPFs' => 'files', -); + 'CTMPDTs' => 'disk tables', + 'CTMPTs' => 'tables', + 'CTMPFs' => 'files', + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - if (is_array($vars)) - { - $rrd_list[$i]['descr'] = $vars['descr']; - } else { - $rrd_list[$i]['descr'] = $vars; +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + if (is_array($vars)) { + $rrd_list[$i]['descr'] = $vars['descr']; + } + else { + $rrd_list[$i]['descr'] = $vars; + } + + $rrd_list[$i]['ds'] = $ds; + $i++; } - $rrd_list[$i]['ds'] = $ds; - $i++; - } -} else { echo("file missing: $file"); } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 0; -$unit_text = "Temp"; +$unit_text = 'Temp'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/nginx_connections.inc.php b/html/includes/graphs/application/nginx_connections.inc.php index d2dc35915..44e2e3a5d 100644 --- a/html/includes/graphs/application/nginx_connections.inc.php +++ b/html/includes/graphs/application/nginx_connections.inc.php @@ -2,33 +2,45 @@ $scale_min = 0; -include("includes/graphs/common.inc.php"); +require 'includes/graphs/common.inc.php'; -$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-nginx-".$app['app_id'].".rrd"; +$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nginx-'.$app['app_id'].'.rrd'; -$array = array('Reading' => array('descr' => 'Reading', 'colour' => '750F7DFF'), - 'Writing' => array('descr' => 'Writing', 'colour' => '00FF00FF'), - 'Waiting' => array('descr' => 'Waiting', 'colour' => '4444FFFF'), - 'Active' => array('descr' => 'Starting', 'colour' => '157419FF'), -); +$array = array( + 'Reading' => array( + 'descr' => 'Reading', + 'colour' => '750F7DFF', + ), + 'Writing' => array( + 'descr' => 'Writing', + 'colour' => '00FF00FF', + ), + 'Waiting' => array( + 'descr' => 'Waiting', + 'colour' => '4444FFFF', + ), + 'Active' => array( + 'descr' => 'Starting', + 'colour' => '157419FF', + ), + ); $i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { echo("file missing: $file"); } +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; +} -$colours = "mixed"; +$colours = 'mixed'; $nototal = 1; -$unit_text = "Workers"; +$unit_text = 'Workers'; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/nginx_req.inc.php b/html/includes/graphs/application/nginx_req.inc.php index a512b9a94..97bff73ae 100644 --- a/html/includes/graphs/application/nginx_req.inc.php +++ b/html/includes/graphs/application/nginx_req.inc.php @@ -1,25 +1,22 @@ diff --git a/html/includes/graphs/application/ntpclient_freq.inc.php b/html/includes/graphs/application/ntpclient_freq.inc.php index 01288ad9f..36d580a50 100644 --- a/html/includes/graphs/application/ntpclient_freq.inc.php +++ b/html/includes/graphs/application/ntpclient_freq.inc.php @@ -1,21 +1,18 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/application/ntpclient_stats.inc.php b/html/includes/graphs/application/ntpclient_stats.inc.php index c83993ebd..b7c668054 100644 --- a/html/includes/graphs/application/ntpclient_stats.inc.php +++ b/html/includes/graphs/application/ntpclient_stats.inc.php @@ -1,34 +1,31 @@ array('descr' => 'Offset'), - 'jitter' => array('descr' => 'Jitter'), - 'noise' => array('descr' => 'Noise'), - 'stability' => array('descr' => 'Stability') - ); + 'offset' => array('descr' => 'Offset'), + 'jitter' => array('descr' => 'Jitter'), + 'noise' => array('descr' => 'Noise'), + 'stability' => array('descr' => 'Stability'), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i]; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i]; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/ntpdserver_bits.inc.php b/html/includes/graphs/application/ntpdserver_bits.inc.php index f3cbb7428..b96f3c5a5 100644 --- a/html/includes/graphs/application/ntpdserver_bits.inc.php +++ b/html/includes/graphs/application/ntpdserver_bits.inc.php @@ -1,35 +1,30 @@ +// include("includes/graphs/generic_bits.inc.php"); +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/application/ntpdserver_buffer.inc.php b/html/includes/graphs/application/ntpdserver_buffer.inc.php index 47c930f8e..3e47555f9 100644 --- a/html/includes/graphs/application/ntpdserver_buffer.inc.php +++ b/html/includes/graphs/application/ntpdserver_buffer.inc.php @@ -1,34 +1,31 @@ array('descr' => 'Received'), - 'buffer_used' => array('descr' => 'Used'), - 'buffer_free' => array('descr' => 'Free') - ); + 'buffer_recv' => array('descr' => 'Received'), + 'buffer_used' => array('descr' => 'Used'), + 'buffer_free' => array('descr' => 'Free'), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i]; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i]; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/ntpdserver_freq.inc.php b/html/includes/graphs/application/ntpdserver_freq.inc.php index f74fc0d09..13f64c295 100644 --- a/html/includes/graphs/application/ntpdserver_freq.inc.php +++ b/html/includes/graphs/application/ntpdserver_freq.inc.php @@ -1,21 +1,18 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/application/ntpdserver_packets.inc.php b/html/includes/graphs/application/ntpdserver_packets.inc.php index 780039700..6eee73cab 100644 --- a/html/includes/graphs/application/ntpdserver_packets.inc.php +++ b/html/includes/graphs/application/ntpdserver_packets.inc.php @@ -1,34 +1,36 @@ array('descr' => 'Dropped', 'colour' => '880000FF'), - 'packets_ignore' => array('descr' => 'Ignored', 'colour' => 'FF8800FF') - ); + 'packets_drop' => array( + 'descr' => 'Dropped', + 'colour' => '880000FF', + ), + 'packets_ignore' => array( + 'descr' => 'Ignored', + 'colour' => 'FF8800FF', + ), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; } -// include("includes/graphs/generic_multi_line.inc.php"); - -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +// include("includes/graphs/generic_multi_line.inc.php"); +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/ntpdserver_stats.inc.php b/html/includes/graphs/application/ntpdserver_stats.inc.php index 70e129557..e6d79d292 100644 --- a/html/includes/graphs/application/ntpdserver_stats.inc.php +++ b/html/includes/graphs/application/ntpdserver_stats.inc.php @@ -1,34 +1,31 @@ array('descr' => 'Offset'), - 'jitter' => array('descr' => 'Jitter'), - 'noise' => array('descr' => 'Noise'), - 'stability' => array('descr' => 'Stability') - ); + 'offset' => array('descr' => 'Offset'), + 'jitter' => array('descr' => 'Jitter'), + 'noise' => array('descr' => 'Noise'), + 'stability' => array('descr' => 'Stability'), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i]; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i]; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/ntpdserver_stratum.inc.php b/html/includes/graphs/application/ntpdserver_stratum.inc.php index e0d59019c..debff062e 100644 --- a/html/includes/graphs/application/ntpdserver_stratum.inc.php +++ b/html/includes/graphs/application/ntpdserver_stratum.inc.php @@ -1,21 +1,18 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/application/ntpdserver_uptime.inc.php b/html/includes/graphs/application/ntpdserver_uptime.inc.php index 03c94ce8a..e1b007f3d 100644 --- a/html/includes/graphs/application/ntpdserver_uptime.inc.php +++ b/html/includes/graphs/application/ntpdserver_uptime.inc.php @@ -1,40 +1,37 @@ +$rrd_options .= ' AREA:cuptime#'.$colour_area.':'; +$rrd_options .= ' LINE1.25:cuptime#'.$colour_line.':Uptime'; +$rrd_options .= ' GPRINT:cuptime:LAST:%6.2lf'; +$rrd_options .= ' GPRINT:cuptime:AVERAGE:%6.2lf'; +$rrd_options .= ' GPRINT:cuptime:MAX:%6.2lf'; +$rrd_options .= " GPRINT:cuptime:AVERAGE:%6.2lf\\n"; diff --git a/html/includes/graphs/application/powerdns_fail.inc.php b/html/includes/graphs/application/powerdns_fail.inc.php index a5b92fb65..469b633ac 100644 --- a/html/includes/graphs/application/powerdns_fail.inc.php +++ b/html/includes/graphs/application/powerdns_fail.inc.php @@ -1,34 +1,40 @@ array('descr' => 'Corrupt', 'colour' => 'FF8800FF'), - 'servfailPackets' => array('descr' => 'Failed', 'colour' => 'FF0000FF'), - 'q_timedout' => array('descr' => 'Timedout', 'colour' => 'FFFF00FF'), - ); + 'corruptPackets' => array( + 'descr' => 'Corrupt', + 'colour' => 'FF8800FF', + ), + 'servfailPackets' => array( + 'descr' => 'Failed', + 'colour' => 'FF0000FF', + ), + 'q_timedout' => array( + 'descr' => 'Timedout', + 'colour' => 'FFFF00FF', + ), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/powerdns_latency.inc.php b/html/includes/graphs/application/powerdns_latency.inc.php index fb8ceb5ff..5e716a8dc 100644 --- a/html/includes/graphs/application/powerdns_latency.inc.php +++ b/html/includes/graphs/application/powerdns_latency.inc.php @@ -1,21 +1,18 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/application/powerdns_packetcache.inc.php b/html/includes/graphs/application/powerdns_packetcache.inc.php index 13f574b4a..abd3297cc 100644 --- a/html/includes/graphs/application/powerdns_packetcache.inc.php +++ b/html/includes/graphs/application/powerdns_packetcache.inc.php @@ -1,34 +1,40 @@ array('descr' => 'Hits', 'colour' => '008800FF'), - 'pc_miss' => array('descr' => 'Misses', 'colour' => '880000FF'), - 'pc_size' => array('descr' => 'Size', 'colour' => '006699FF'), - ); + 'pc_hit' => array( + 'descr' => 'Hits', + 'colour' => '008800FF', + ), + 'pc_miss' => array( + 'descr' => 'Misses', + 'colour' => '880000FF', + ), + 'pc_size' => array( + 'descr' => 'Size', + 'colour' => '006699FF', + ), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/powerdns_queries.inc.php b/html/includes/graphs/application/powerdns_queries.inc.php index 71b2a0be0..49f5b8d20 100644 --- a/html/includes/graphs/application/powerdns_queries.inc.php +++ b/html/includes/graphs/application/powerdns_queries.inc.php @@ -1,35 +1,44 @@ array('descr' => 'TCP Answers', 'colour' => '008800FF'), - 'q_tcpQueries' => array('descr' => 'TCP Queries', 'colour' => '00FF00FF'), - 'q_udpAnswers' => array('descr' => 'UDP Answers', 'colour' => '336699FF'), - 'q_udpQueries' => array('descr' => 'UDP Queries', 'colour' => '6699CCFF'), - ); + 'q_tcpAnswers' => array( + 'descr' => 'TCP Answers', + 'colour' => '008800FF', + ), + 'q_tcpQueries' => array( + 'descr' => 'TCP Queries', + 'colour' => '00FF00FF', + ), + 'q_udpAnswers' => array( + 'descr' => 'UDP Answers', + 'colour' => '336699FF', + ), + 'q_udpQueries' => array( + 'descr' => 'UDP Queries', + 'colour' => '6699CCFF', + ), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/powerdns_queries_udp.inc.php b/html/includes/graphs/application/powerdns_queries_udp.inc.php index ef2b6afd7..e680f72da 100644 --- a/html/includes/graphs/application/powerdns_queries_udp.inc.php +++ b/html/includes/graphs/application/powerdns_queries_udp.inc.php @@ -1,35 +1,44 @@ array('descr' => 'UDP4 Answers', 'colour' => '00008888'), - 'q_udp4Queries' => array('descr' => 'UDP4 Queries', 'colour' => '000088FF'), - 'q_udp6Answers' => array('descr' => 'UDP6 Answers', 'colour' => '88000088'), - 'q_udp6Queries' => array('descr' => 'UDP6 Queries', 'colour' => '880000FF'), - ); + 'q_udp4Answers' => array( + 'descr' => 'UDP4 Answers', + 'colour' => '00008888', + ), + 'q_udp4Queries' => array( + 'descr' => 'UDP4 Queries', + 'colour' => '000088FF', + ), + 'q_udp6Answers' => array( + 'descr' => 'UDP6 Answers', + 'colour' => '88000088', + ), + 'q_udp6Queries' => array( + 'descr' => 'UDP6 Queries', + 'colour' => '880000FF', + ), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/powerdns_querycache.inc.php b/html/includes/graphs/application/powerdns_querycache.inc.php index 1ad4f3821..694bb88f7 100644 --- a/html/includes/graphs/application/powerdns_querycache.inc.php +++ b/html/includes/graphs/application/powerdns_querycache.inc.php @@ -1,33 +1,36 @@ array('descr' => 'Misses', 'colour' => '750F7DFF'), - 'qc_hit' => array('descr' => 'Hits', 'colour' => '00FF00FF'), - ); + 'qc_miss' => array( + 'descr' => 'Misses', + 'colour' => '750F7DFF', + ), + 'qc_hit' => array( + 'descr' => 'Hits', + 'colour' => '00FF00FF', + ), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/powerdns_recursing.inc.php b/html/includes/graphs/application/powerdns_recursing.inc.php index 758b3ee23..32a94799a 100644 --- a/html/includes/graphs/application/powerdns_recursing.inc.php +++ b/html/includes/graphs/application/powerdns_recursing.inc.php @@ -1,33 +1,36 @@ array('descr' => 'Questions', 'colour' => '6699CCFF'), - 'rec_answers' => array('descr' => 'Answers', 'colour' => '336699FF'), - ); + 'rec_questions' => array( + 'descr' => 'Questions', + 'colour' => '6699CCFF', + ), + 'rec_answers' => array( + 'descr' => 'Answers', + 'colour' => '336699FF', + ), + ); -$i = 0; +$i = 0; -if (is_file($rrd_filename)) -{ - foreach ($array as $ds => $vars) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $vars['descr']; - $rrd_list[$i]['ds'] = $ds; - $rrd_list[$i]['colour'] = $vars['colour']; - $i++; - } -} else { - echo("file missing: $file"); +if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } +} +else { + echo "file missing: $file"; } -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/shoutcast_bits.inc.php b/html/includes/graphs/application/shoutcast_bits.inc.php index e1ac058d8..020ce76b9 100644 --- a/html/includes/graphs/application/shoutcast_bits.inc.php +++ b/html/includes/graphs/application/shoutcast_bits.inc.php @@ -1,27 +1,25 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/application/shoutcast_multi_bits.inc.php b/html/includes/graphs/application/shoutcast_multi_bits.inc.php index 3d9ba7d70..69b7b482b 100644 --- a/html/includes/graphs/application/shoutcast_multi_bits.inc.php +++ b/html/includes/graphs/application/shoutcast_multi_bits.inc.php @@ -2,55 +2,49 @@ $device = device_by_id_cache($vars['id']); -$units = "b"; -$total_units = "B"; -$colours_in = "greens"; -$multiplier = "8"; -$colours_out = "blues"; +$units = 'b'; +$total_units = 'B'; +$colours_in = 'greens'; +$multiplier = '8'; +$colours_out = 'blues'; -$nototal = 1; +$nototal = 1; -$ds_in = "traf_in"; -$ds_out = "traf_out"; +$ds_in = 'traf_in'; +$ds_out = 'traf_out'; -$graph_title = "Traffic Statistic"; +$graph_title = 'Traffic Statistic'; -$colour_line_in = "006600"; -$colour_line_out = "000099"; -$colour_area_in = "CDEB8B"; -$colour_area_out = "C3D9FF"; +$colour_line_in = '006600'; +$colour_line_out = '000099'; +$colour_area_in = 'CDEB8B'; +$colour_area_out = 'C3D9FF'; -$rrddir = $config['rrd_dir']."/".$device['hostname']; -$files = array(); -$i = 0; +$rrddir = $config['rrd_dir'].'/'.$device['hostname']; +$files = array(); +$i = 0; -if ($handle = opendir($rrddir)) -{ - while (false !== ($file = readdir($handle))) - { - if ($file != "." && $file != "..") +if ($handle = opendir($rrddir)) { + while (false !== ($file = readdir($handle))) { - if (eregi("app-shoutcast-".$app['app_id'], $file)) - { - array_push($files, $file); - } + if ($file != '.' && $file != '..') { + if (eregi('app-shoutcast-'.$app['app_id'], $file)) { + array_push($files, $file); + } + } } - } } -foreach ($files as $id => $file) -{ - $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); - $hostname = eregi_replace('.rrd', '', $hostname); - list($host, $port) = split('_', $hostname, 2); - $rrd_filenames[] = $rrddir."/".$file; - $rrd_list[$i]['filename'] = $rrddir."/".$file; - $rrd_list[$i]['descr'] = $host.":".$port; - $rrd_list[$i]['ds_in'] = $ds_in; - $rrd_list[$i]['ds_out'] = $ds_out; - $i++; +foreach ($files as $id => $file) { + $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); + $hostname = eregi_replace('.rrd', '', $hostname); + list($host, $port) = split('_', $hostname, 2); + $rrd_filenames[] = $rrddir.'/'.$file; + $rrd_list[$i]['filename'] = $rrddir.'/'.$file; + $rrd_list[$i]['descr'] = $host.':'.$port; + $rrd_list[$i]['ds_in'] = $ds_in; + $rrd_list[$i]['ds_out'] = $ds_out; + $i++; } -include("includes/graphs/generic_multi_bits_separated.inc.php"); - -?> +require 'includes/graphs/generic_multi_bits_separated.inc.php'; diff --git a/html/includes/graphs/application/shoutcast_multi_stats.inc.php b/html/includes/graphs/application/shoutcast_multi_stats.inc.php index e0345a95b..3d901e14b 100644 --- a/html/includes/graphs/application/shoutcast_multi_stats.inc.php +++ b/html/includes/graphs/application/shoutcast_multi_stats.inc.php @@ -2,103 +2,106 @@ $device = device_by_id_cache($vars['id']); -//$colour = "random"; -$unit_text = "ShoutCast Server"; -$total_text = "Total of all ShoutCast Servers"; +// $colour = "random"; +$unit_text = 'ShoutCast Server'; +$total_text = 'Total of all ShoutCast Servers'; $nototal = 0; -$rrddir = $config['rrd_dir']."/".$device['hostname']; -$files = array(); -$i = 0; -$x = 0; +$rrddir = $config['rrd_dir'].'/'.$device['hostname']; +$files = array(); +$i = 0; +$x = 0; -if ($handle = opendir($rrddir)) -{ - while (false !== ($file = readdir($handle))) - { - if ($file != "." && $file != "..") +if ($handle = opendir($rrddir)) { + while (false !== ($file = readdir($handle))) { - if (eregi("app-shoutcast-".$app['app_id'], $file)) - { - array_push($files, $file); - } + if ($file != '.' && $file != '..') { + if (eregi('app-shoutcast-'.$app['app_id'], $file)) { + array_push($files, $file); + } + } } - } } -foreach ($files as $id => $file) -{ - $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); - $hostname = eregi_replace('.rrd', '', $hostname); - list($host, $port) = split('_', $hostname, 2); - $rrd_filenames[] = $rrddir."/".$file; - $rrd_list[$i]['filename'] = $rrddir."/".$file; - $rrd_list[$i]['descr'] = $host.":".$port; - $rrd_list[$i]['colour'] = $colour; - $i++; +foreach ($files as $id => $file) { + $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); + $hostname = eregi_replace('.rrd', '', $hostname); + list($host, $port) = split('_', $hostname, 2); + $rrd_filenames[] = $rrddir.'/'.$file; + $rrd_list[$i]['filename'] = $rrddir.'/'.$file; + $rrd_list[$i]['descr'] = $host.':'.$port; + $rrd_list[$i]['colour'] = $colour; + $i++; } -include("includes/graphs/common.inc.php"); +require 'includes/graphs/common.inc.php'; -if ($width > "500") -{ - $descr_len = 38; -} else { - $descr_len = 8; - $descr_len += round(($width - 250) / 8); +if ($width > '500') { + $descr_len = 38; +} +else { + $descr_len = 8; + $descr_len += round(($width - 250) / 8); } -if ($width > "500") -{ - $rrd_options .= " COMMENT:\"".substr(str_pad($unit_text, $descr_len+2), 0, $descr_len+2)." Current Unique Average Peak\\n\""; -} else { - $rrd_options .= " COMMENT:\"".substr(str_pad($unit_text, $descr_len+5), 0, $descr_len+5)." Now Unique Average Peak\\n\""; +if ($width > '500') { + $rrd_options .= ' COMMENT:"'.substr(str_pad($unit_text, ($descr_len + 2)), 0, ($descr_len + 2))." Current Unique Average Peak\\n\""; +} +else { + $rrd_options .= ' COMMENT:"'.substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." Now Unique Average Peak\\n\""; } -foreach ($rrd_list as $rrd) -{ - $colours = (isset($rrd['colour']) ? $rrd['colour'] : "default"); - $strlen = ((strlen($rrd['descr'])<$descr_len) ? ($descr_len - strlen($rrd['descr'])) : "0"); - $descr = (isset($rrd['descr']) ? rrdtool_escape($rrd['descr'], $desc_len+$strlen) : "Unkown"); - for ($z=0; $z<$strlen; $z++) { $descr .= " "; } - if ($i) { $stack = "STACK"; } +foreach ($rrd_list as $rrd) { + $colours = (isset($rrd['colour']) ? $rrd['colour'] : 'default'); + $strlen = ((strlen($rrd['descr']) < $descr_len) ? ($descr_len - strlen($rrd['descr'])) : '0'); + $descr = (isset($rrd['descr']) ? rrdtool_escape($rrd['descr'], ($desc_len + $strlen)) : 'Unkown'); + for ($z = 0; $z < $strlen; + $z++) { + $descr .= ' '; + } + + if ($i) { + $stack = 'STACK'; + } + $colour = $config['graph_colours'][$colours][$x]; - $rrd_options .= " DEF:cur".$x."=".$rrd['filename'].":current:AVERAGE"; - $rrd_options .= " DEF:peak".$x."=".$rrd['filename'].":peak:MAX"; - $rrd_options .= " DEF:unique".$x."=".$rrd['filename'].":unique:AVERAGE"; - $rrd_options .= " VDEF:avg".$x."=cur".$x.",AVERAGE"; - $rrd_options .= " AREA:cur".$x."#".$colour.":\"".$descr."\":$stack"; - $rrd_options .= " GPRINT:cur".$x.":LAST:\"%6.2lf\""; - $rrd_options .= " GPRINT:unique".$x.":LAST:\"%6.2lf%s\""; - $rrd_options .= " GPRINT:avg".$x.":\"%6.2lf\""; - $rrd_options .= " GPRINT:peak".$x.":LAST:\"%6.2lf\""; + $rrd_options .= ' DEF:cur'.$x.'='.$rrd['filename'].':current:AVERAGE'; + $rrd_options .= ' DEF:peak'.$x.'='.$rrd['filename'].':peak:MAX'; + $rrd_options .= ' DEF:unique'.$x.'='.$rrd['filename'].':unique:AVERAGE'; + $rrd_options .= ' VDEF:avg'.$x.'=cur'.$x.',AVERAGE'; + $rrd_options .= ' AREA:cur'.$x.'#'.$colour.':"'.$descr."\":$stack"; + $rrd_options .= ' GPRINT:cur'.$x.':LAST:"%6.2lf"'; + $rrd_options .= ' GPRINT:unique'.$x.':LAST:"%6.2lf%s"'; + $rrd_options .= ' GPRINT:avg'.$x.':"%6.2lf"'; + $rrd_options .= ' GPRINT:peak'.$x.':LAST:"%6.2lf"'; $rrd_options .= " COMMENT:\"\\n\""; - if ($x) - { - $totcur .= ",cur".$x.",+"; - $totpeak .= ",peak".$x.",+"; - $totunique .= ",unique".$x.",+"; + if ($x) { + $totcur .= ',cur'.$x.',+'; + $totpeak .= ',peak'.$x.',+'; + $totunique .= ',unique'.$x.',+'; } - $x = (($x +if (!$nototal) { + $strlen = ((strlen($total_text) < $descr_len) ? ($descr_len - strlen($total_text)) : '0'); + $descr = (isset($total_text) ? rrdtool_escape($total_text, ($desc_len + $strlen)) : 'Total'); + $colour = $config['graph_colours'][$colours][$x]; + for ($z = 0; $z < $strlen; + $z++) { + $descr .= ' '; + } + + $rrd_options .= ' CDEF:totcur=cur0'.$totcur; + $rrd_options .= ' CDEF:totunique=unique0'.$totunique; + $rrd_options .= ' CDEF:totpeak=peak0'.$totpeak; + $rrd_options .= ' VDEF:totavg=totcur,AVERAGE'; + $rrd_options .= ' LINE2:totcur#'.$colour.':"'.$descr.'"'; + $rrd_options .= ' GPRINT:totcur:LAST:"%6.2lf"'; + $rrd_options .= ' GPRINT:totunique:LAST:"%6.2lf%s"'; + $rrd_options .= ' GPRINT:totavg:"%6.2lf"'; + $rrd_options .= ' GPRINT:totpeak:LAST:"%6.2lf"'; + $rrd_options .= " COMMENT:\"\\n\""; +} diff --git a/html/includes/graphs/application/shoutcast_stats.inc.php b/html/includes/graphs/application/shoutcast_stats.inc.php index c383fc5ca..15f1e654a 100644 --- a/html/includes/graphs/application/shoutcast_stats.inc.php +++ b/html/includes/graphs/application/shoutcast_stats.inc.php @@ -1,45 +1,43 @@ = 355) -{ - $rrd_options .= " GPRINT:cur:LAST:\"\:%8.2lf\""; - $rrd_options .= " GPRINT:max:LAST:\"from%8.2lf\""; - $rrd_options .= " GPRINT:bitrate:LAST:\"(bitrate\:%8.2lf%s\""; - $rrd_options .= " COMMENT:\")\\n\""; -} else { - $rrd_options .= " GPRINT:cur:LAST:\"\:%8.2lf\\n\""; +if ($width >= 355) { + $rrd_options .= ' GPRINT:cur:LAST:"\:%8.2lf"'; + $rrd_options .= ' GPRINT:max:LAST:"from%8.2lf"'; + $rrd_options .= ' GPRINT:bitrate:LAST:"(bitrate\:%8.2lf%s"'; + $rrd_options .= " COMMENT:\")\\n\""; +} +else { + $rrd_options .= " GPRINT:cur:LAST:\"\:%8.2lf\\n\""; } -$rrd_options .= " AREA:unique#AADEFEFF:\"Unique Listeners \""; +$rrd_options .= ' AREA:unique#AADEFEFF:"Unique Listeners "'; $rrd_options .= " GPRINT:unique:LAST:\"\:%8.2lf%s\\n\""; -$rrd_options .= " HRULE:avg#FF9000FF:\"Average Listeners\""; +$rrd_options .= ' HRULE:avg#FF9000FF:"Average Listeners"'; $rrd_options .= " GPRINT:avg:\"\:%8.2lf\\n\""; -$rrd_options .= " LINE1:peak#C000FFFF:\"Peak Listeners \""; +$rrd_options .= ' LINE1:peak#C000FFFF:"Peak Listeners "'; $rrd_options .= " GPRINT:peak:LAST:\"\:%8.2lf\\n\""; $rrd_options .= " TICK:stream_offline#B4FF00FF:1.0:\"Streaming client offline\\n\""; -$rrd_options .= " TICK:server_offline".$warn_colour_b."FF:1.0:\"Streaming server offline\""; - -?> +$rrd_options .= ' TICK:server_offline'.$warn_colour_b.'FF:1.0:"Streaming server offline"'; diff --git a/html/includes/graphs/atmvp/auth.inc.php b/html/includes/graphs/atmvp/auth.inc.php index b307266b6..caf963e38 100644 --- a/html/includes/graphs/atmvp/auth.inc.php +++ b/html/includes/graphs/atmvp/auth.inc.php @@ -1,18 +1,17 @@ +$vp = dbFetchRow('SELECT * FROM `juniAtmVp` as J, `ports` AS I, `devices` AS D WHERE J.juniAtmVp_id = ? AND I.port_id = J.port_id AND I.device_id = D.device_id', array($atm_vp_id)); + +if ($auth || port_permitted($vp['port_id'])) { + $port = $vp; + $device = device_by_id_cache($port['device_id']); + $title = generate_device_link($device); + $title .= ' :: Port '.generate_port_link($port); + $title .= ' :: VP '.$vp['vp_id']; + $auth = true; + $rrd_filename = $config['rrd_dir'].'/'.$vp['hostname'].'/'.safename('vp-'.$vp['ifIndex'].'-'.$vp['vp_id'].'.rrd'); +} diff --git a/html/includes/graphs/atmvp/bits.inc.php b/html/includes/graphs/atmvp/bits.inc.php index a571ec7ed..f158d9c7a 100644 --- a/html/includes/graphs/atmvp/bits.inc.php +++ b/html/includes/graphs/atmvp/bits.inc.php @@ -1,8 +1,6 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/atmvp/cells.inc.php b/html/includes/graphs/atmvp/cells.inc.php index dc4387f58..36d067b6c 100644 --- a/html/includes/graphs/atmvp/cells.inc.php +++ b/html/includes/graphs/atmvp/cells.inc.php @@ -1,19 +1,17 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/atmvp/errors.inc.php b/html/includes/graphs/atmvp/errors.inc.php index 7035a5385..b36562f58 100644 --- a/html/includes/graphs/atmvp/errors.inc.php +++ b/html/includes/graphs/atmvp/errors.inc.php @@ -1,20 +1,18 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/atmvp/packets.inc.php b/html/includes/graphs/atmvp/packets.inc.php index 34c5b8c93..fbfc62797 100644 --- a/html/includes/graphs/atmvp/packets.inc.php +++ b/html/includes/graphs/atmvp/packets.inc.php @@ -1,19 +1,17 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/bgp/auth.inc.php b/html/includes/graphs/bgp/auth.inc.php index 96d999555..79ab1be2c 100644 --- a/html/includes/graphs/bgp/auth.inc.php +++ b/html/includes/graphs/bgp/auth.inc.php @@ -1,18 +1,13 @@ diff --git a/html/includes/graphs/bgp/prefixes.inc.php b/html/includes/graphs/bgp/prefixes.inc.php index 7a6170b36..db9290fb2 100644 --- a/html/includes/graphs/bgp/prefixes.inc.php +++ b/html/includes/graphs/bgp/prefixes.inc.php @@ -1,18 +1,16 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/bgp/prefixes_ipv4multicast.inc.php b/html/includes/graphs/bgp/prefixes_ipv4multicast.inc.php index 77dede1ba..8f2cfe54d 100644 --- a/html/includes/graphs/bgp/prefixes_ipv4multicast.inc.php +++ b/html/includes/graphs/bgp/prefixes_ipv4multicast.inc.php @@ -1,7 +1,5 @@ +require 'includes/graphs/bgp/prefixes.inc.php'; diff --git a/html/includes/graphs/bgp/prefixes_ipv4unicast.inc.php b/html/includes/graphs/bgp/prefixes_ipv4unicast.inc.php index 4efdd65be..6fbfa01cc 100644 --- a/html/includes/graphs/bgp/prefixes_ipv4unicast.inc.php +++ b/html/includes/graphs/bgp/prefixes_ipv4unicast.inc.php @@ -1,7 +1,5 @@ +require 'includes/graphs/bgp/prefixes.inc.php'; diff --git a/html/includes/graphs/bgp/prefixes_ipv4vpn.inc.php b/html/includes/graphs/bgp/prefixes_ipv4vpn.inc.php index 810b3525e..9ff56248e 100644 --- a/html/includes/graphs/bgp/prefixes_ipv4vpn.inc.php +++ b/html/includes/graphs/bgp/prefixes_ipv4vpn.inc.php @@ -1,7 +1,5 @@ +require 'includes/graphs/bgp/prefixes.inc.php'; diff --git a/html/includes/graphs/bgp/prefixes_ipv6multicast.inc.php b/html/includes/graphs/bgp/prefixes_ipv6multicast.inc.php index d6dc8d14a..8ed9bc649 100644 --- a/html/includes/graphs/bgp/prefixes_ipv6multicast.inc.php +++ b/html/includes/graphs/bgp/prefixes_ipv6multicast.inc.php @@ -1,7 +1,5 @@ +require 'includes/graphs/bgp/prefixes.inc.php'; diff --git a/html/includes/graphs/bgp/prefixes_ipv6unicast.inc.php b/html/includes/graphs/bgp/prefixes_ipv6unicast.inc.php index f902af499..f1b6a49ad 100644 --- a/html/includes/graphs/bgp/prefixes_ipv6unicast.inc.php +++ b/html/includes/graphs/bgp/prefixes_ipv6unicast.inc.php @@ -1,7 +1,5 @@ +require 'includes/graphs/bgp/prefixes.inc.php'; diff --git a/html/includes/graphs/bgp/prefixes_ipv6vpn.inc.php b/html/includes/graphs/bgp/prefixes_ipv6vpn.inc.php index 633d06aaf..730f66d31 100644 --- a/html/includes/graphs/bgp/prefixes_ipv6vpn.inc.php +++ b/html/includes/graphs/bgp/prefixes_ipv6vpn.inc.php @@ -1,7 +1,5 @@ +require 'includes/graphs/bgp/prefixes.inc.php'; diff --git a/html/includes/graphs/bgp/updates.inc.php b/html/includes/graphs/bgp/updates.inc.php index 04d8f44b2..2458a453b 100644 --- a/html/includes/graphs/bgp/updates.inc.php +++ b/html/includes/graphs/bgp/updates.inc.php @@ -1,24 +1,22 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/bill/auth.inc.php b/html/includes/graphs/bill/auth.inc.php index af4363b57..524082501 100644 --- a/html/includes/graphs/bill/auth.inc.php +++ b/html/includes/graphs/bill/auth.inc.php @@ -1,21 +1,17 @@ diff --git a/html/includes/graphs/bill/bits.inc.php b/html/includes/graphs/bill/bits.inc.php index 55edf988f..2e80ef792 100644 --- a/html/includes/graphs/bill/bits.inc.php +++ b/html/includes/graphs/bill/bits.inc.php @@ -1,41 +1,36 @@ +require 'includes/graphs/generic_multi_bits_separated.inc.php'; diff --git a/html/includes/graphs/c6kxbar/auth.inc.php b/html/includes/graphs/c6kxbar/auth.inc.php index 96076c92c..57212efb8 100644 --- a/html/includes/graphs/c6kxbar/auth.inc.php +++ b/html/includes/graphs/c6kxbar/auth.inc.php @@ -1,18 +1,14 @@ diff --git a/html/includes/graphs/c6kxbar/util.inc.php b/html/includes/graphs/c6kxbar/util.inc.php index c3b3145a6..dbf8eb8d7 100644 --- a/html/includes/graphs/c6kxbar/util.inc.php +++ b/html/includes/graphs/c6kxbar/util.inc.php @@ -1,19 +1,17 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/cefswitching/auth.inc.php b/html/includes/graphs/cefswitching/auth.inc.php index d95498efa..3db047851 100644 --- a/html/includes/graphs/cefswitching/auth.inc.php +++ b/html/includes/graphs/cefswitching/auth.inc.php @@ -1,19 +1,15 @@ diff --git a/html/includes/graphs/cefswitching/graph.inc.php b/html/includes/graphs/cefswitching/graph.inc.php index 212dba9c8..5a1b31419 100644 --- a/html/includes/graphs/cefswitching/graph.inc.php +++ b/html/includes/graphs/cefswitching/graph.inc.php @@ -1,28 +1,26 @@ +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/device/agent.inc.php b/html/includes/graphs/device/agent.inc.php index 56a46c10d..f37f864f9 100644 --- a/html/includes/graphs/device/agent.inc.php +++ b/html/includes/graphs/device/agent.inc.php @@ -2,27 +2,25 @@ $scale_min = 0; -require "includes/graphs/common.inc.php"; +require 'includes/graphs/common.inc.php'; -$agent_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/agent.rrd"; +$agent_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/agent.rrd'; if (is_file($agent_rrd)) { $rrd_filename = $agent_rrd; } -$ds = "time"; +$ds = 'time'; -$colour_area = "EEEEEE"; -$colour_line = "36393D"; +$colour_area = 'EEEEEE'; +$colour_line = '36393D'; -$colour_area_max = "FFEE99"; +$colour_area_max = 'FFEE99'; -$graph_max = 1; -$multiplier = 1000; -$multiplier_action = "/"; +$graph_max = 1; +$multiplier = 1000; +$multiplier_action = '/'; -$unit_text = "Seconds"; +$unit_text = 'Seconds'; -require "includes/graphs/generic_simplex.inc.php"; - -?> +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/device/arubacontroller_numaps.inc.php b/html/includes/graphs/device/arubacontroller_numaps.inc.php index ea071fc2a..1aa6b2c62 100644 --- a/html/includes/graphs/device/arubacontroller_numaps.inc.php +++ b/html/includes/graphs/device/arubacontroller_numaps.inc.php @@ -1,22 +1,20 @@ diff --git a/html/includes/graphs/device/arubacontroller_numclients.inc.php b/html/includes/graphs/device/arubacontroller_numclients.inc.php index 6b7669c18..e86b4d758 100644 --- a/html/includes/graphs/device/arubacontroller_numclients.inc.php +++ b/html/includes/graphs/device/arubacontroller_numclients.inc.php @@ -1,26 +1,21 @@ diff --git a/html/includes/graphs/device/cipsec_flow_bits.inc.php b/html/includes/graphs/device/cipsec_flow_bits.inc.php index 7d19dafbb..861c01252 100644 --- a/html/includes/graphs/device/cipsec_flow_bits.inc.php +++ b/html/includes/graphs/device/cipsec_flow_bits.inc.php @@ -1,10 +1,8 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/device/cipsec_flow_pkts.inc.php b/html/includes/graphs/device/cipsec_flow_pkts.inc.php index 639dcbef8..526b02011 100644 --- a/html/includes/graphs/device/cipsec_flow_pkts.inc.php +++ b/html/includes/graphs/device/cipsec_flow_pkts.inc.php @@ -1,21 +1,19 @@ \ No newline at end of file +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/device/cipsec_flow_tunnels.inc.php b/html/includes/graphs/device/cipsec_flow_tunnels.inc.php index e1e77f7a1..f45a73736 100644 --- a/html/includes/graphs/device/cipsec_flow_tunnels.inc.php +++ b/html/includes/graphs/device/cipsec_flow_tunnels.inc.php @@ -1,15 +1,13 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/device/cras_sessions.inc.php b/html/includes/graphs/device/cras_sessions.inc.php index 90ae4b539..9feeefa25 100644 --- a/html/includes/graphs/device/cras_sessions.inc.php +++ b/html/includes/graphs/device/cras_sessions.inc.php @@ -1,10 +1,10 @@ diff --git a/html/includes/graphs/device/current.inc.php b/html/includes/graphs/device/current.inc.php index 4fb096550..23f8ef43e 100644 --- a/html/includes/graphs/device/current.inc.php +++ b/html/includes/graphs/device/current.inc.php @@ -1,9 +1,7 @@ +require 'includes/graphs/device/sensor.inc.php'; diff --git a/html/includes/graphs/device/dbm.inc.php b/html/includes/graphs/device/dbm.inc.php index 6243f739b..3c2fda3dc 100644 --- a/html/includes/graphs/device/dbm.inc.php +++ b/html/includes/graphs/device/dbm.inc.php @@ -1,9 +1,7 @@ +require 'includes/graphs/device/sensor.inc.php'; diff --git a/html/includes/graphs/device/diskio.inc.php b/html/includes/graphs/device/diskio.inc.php index 6fb4fa419..58f751509 100644 --- a/html/includes/graphs/device/diskio.inc.php +++ b/html/includes/graphs/device/diskio.inc.php @@ -1,5 +1,3 @@ \ No newline at end of file +require 'diskio_ops.inc.php'; diff --git a/html/includes/graphs/device/diskio_common.inc.php b/html/includes/graphs/device/diskio_common.inc.php index 36b0b56f2..2fbb00336 100644 --- a/html/includes/graphs/device/diskio_common.inc.php +++ b/html/includes/graphs/device/diskio_common.inc.php @@ -2,17 +2,13 @@ $i = 1; -foreach (dbFetchRows("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE D.device_id = ? AND U.device_id = D.device_id", array($device['device_id'])) as $disk) -{ - $rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd"); - if (is_file($rrd_filename)) - { - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = $disk['diskio_descr']; - $rrd_list[$i]['ds_in'] = $ds_in; - $rrd_list[$i]['ds_out'] = $ds_out; - $i++; - } +foreach (dbFetchRows('SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE D.device_id = ? AND U.device_id = D.device_id', array($device['device_id'])) as $disk) { + $rrd_filename = $config['rrd_dir'].'/'.$disk['hostname'].'/ucd_diskio-'.safename($disk['diskio_descr'].'.rrd'); + if (is_file($rrd_filename)) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $disk['diskio_descr']; + $rrd_list[$i]['ds_in'] = $ds_in; + $rrd_list[$i]['ds_out'] = $ds_out; + $i++; + } } - -?> diff --git a/html/includes/graphs/device/fanspeed.inc.php b/html/includes/graphs/device/fanspeed.inc.php index 7680f3372..21692b1e3 100644 --- a/html/includes/graphs/device/fanspeed.inc.php +++ b/html/includes/graphs/device/fanspeed.inc.php @@ -1,9 +1,7 @@ +require 'includes/graphs/device/sensor.inc.php'; diff --git a/html/includes/graphs/device/fortigate_cpu.inc.php b/html/includes/graphs/device/fortigate_cpu.inc.php index 4733263f6..d4474641c 100644 --- a/html/includes/graphs/device/fortigate_cpu.inc.php +++ b/html/includes/graphs/device/fortigate_cpu.inc.php @@ -1,20 +1,18 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/device/fortigate_sessions.inc.php b/html/includes/graphs/device/fortigate_sessions.inc.php index c2bfcef00..18d8f902f 100644 --- a/html/includes/graphs/device/fortigate_sessions.inc.php +++ b/html/includes/graphs/device/fortigate_sessions.inc.php @@ -1,20 +1,18 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/device/frequency.inc.php b/html/includes/graphs/device/frequency.inc.php index 41cd6a772..d1fdbcb38 100644 --- a/html/includes/graphs/device/frequency.inc.php +++ b/html/includes/graphs/device/frequency.inc.php @@ -1,9 +1,7 @@ +require 'includes/graphs/device/sensor.inc.php'; diff --git a/html/includes/graphs/device/hr_processes.inc.php b/html/includes/graphs/device/hr_processes.inc.php index 290f40838..07f451bed 100644 --- a/html/includes/graphs/device/hr_processes.inc.php +++ b/html/includes/graphs/device/hr_processes.inc.php @@ -1,21 +1,19 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/device/hr_users.inc.php b/html/includes/graphs/device/hr_users.inc.php index a8469e174..6d54484a3 100644 --- a/html/includes/graphs/device/hr_users.inc.php +++ b/html/includes/graphs/device/hr_users.inc.php @@ -1,21 +1,19 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/device/humidity.inc.php b/html/includes/graphs/device/humidity.inc.php index 58cd7b5bb..078cbc382 100644 --- a/html/includes/graphs/device/humidity.inc.php +++ b/html/includes/graphs/device/humidity.inc.php @@ -1,9 +1,7 @@ +require 'includes/graphs/device/sensor.inc.php'; diff --git a/html/includes/graphs/device/ipSystemStats.inc.php b/html/includes/graphs/device/ipSystemStats.inc.php index 0a3048f54..afcbc6cb7 100644 --- a/html/includes/graphs/device/ipSystemStats.inc.php +++ b/html/includes/graphs/device/ipSystemStats.inc.php @@ -1,9 +1,9 @@ diff --git a/html/includes/graphs/device/ipsystemstats_ipv4.inc.php b/html/includes/graphs/device/ipsystemstats_ipv4.inc.php index edda01e76..8c280d376 100644 --- a/html/includes/graphs/device/ipsystemstats_ipv4.inc.php +++ b/html/includes/graphs/device/ipsystemstats_ipv4.inc.php @@ -1,8 +1,8 @@ +$rrd_options .= ' LINE1.25:InReceives#9DaB6B:'; +$rrd_options .= ' LINE1.25:OutRequests_n#93a6eF:'; diff --git a/html/includes/graphs/device/ipsystemstats_ipv4_frag.inc.php b/html/includes/graphs/device/ipsystemstats_ipv4_frag.inc.php index a4e5344cf..c59fd3780 100644 --- a/html/includes/graphs/device/ipsystemstats_ipv4_frag.inc.php +++ b/html/includes/graphs/device/ipsystemstats_ipv4_frag.inc.php @@ -1,8 +1,8 @@ diff --git a/html/includes/graphs/device/ipsystemstats_ipv6.inc.php b/html/includes/graphs/device/ipsystemstats_ipv6.inc.php index 57cedb29d..1542b14b5 100644 --- a/html/includes/graphs/device/ipsystemstats_ipv6.inc.php +++ b/html/includes/graphs/device/ipsystemstats_ipv6.inc.php @@ -1,8 +1,8 @@ +$rrd_options .= ' LINE1.25:InReceives#9DaB6B:'; +$rrd_options .= ' LINE1.25:OutRequests_n#93a6eF:'; diff --git a/html/includes/graphs/device/ipsystemstats_ipv6_frag.inc.php b/html/includes/graphs/device/ipsystemstats_ipv6_frag.inc.php index 2b9912df3..1cb81d47b 100644 --- a/html/includes/graphs/device/ipsystemstats_ipv6_frag.inc.php +++ b/html/includes/graphs/device/ipsystemstats_ipv6_frag.inc.php @@ -1,8 +1,8 @@ diff --git a/html/includes/graphs/device/mempool.inc.php b/html/includes/graphs/device/mempool.inc.php index ded4c7531..8c8fba677 100644 --- a/html/includes/graphs/device/mempool.inc.php +++ b/html/includes/graphs/device/mempool.inc.php @@ -1,40 +1,57 @@ +$rrd_options .= ' HRULE:0#999999'; diff --git a/html/includes/graphs/device/netscaler_tcp_bits.inc.php b/html/includes/graphs/device/netscaler_tcp_bits.inc.php index c2bfa177f..401e25f66 100644 --- a/html/includes/graphs/device/netscaler_tcp_bits.inc.php +++ b/html/includes/graphs/device/netscaler_tcp_bits.inc.php @@ -1,12 +1,10 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/device/netscaler_tcp_conn.inc.php b/html/includes/graphs/device/netscaler_tcp_conn.inc.php index 06edbde3d..2e18e777e 100644 --- a/html/includes/graphs/device/netscaler_tcp_conn.inc.php +++ b/html/includes/graphs/device/netscaler_tcp_conn.inc.php @@ -1,24 +1,22 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/device/netscaler_tcp_pkts.inc.php b/html/includes/graphs/device/netscaler_tcp_pkts.inc.php index e95b000f9..ae3015c24 100644 --- a/html/includes/graphs/device/netscaler_tcp_pkts.inc.php +++ b/html/includes/graphs/device/netscaler_tcp_pkts.inc.php @@ -1,21 +1,19 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/device/netstat_icmp.inc.php b/html/includes/graphs/device/netstat_icmp.inc.php index c84409fac..d44b2e320 100644 --- a/html/includes/graphs/device/netstat_icmp.inc.php +++ b/html/includes/graphs/device/netstat_icmp.inc.php @@ -1,36 +1,34 @@ '00cc00', - 'icmpOutMsgs' => '006600', - 'icmpInErrors' => 'cc0000', - 'icmpOutErrors' => '660000', - 'icmpInEchos' => '0066cc', - 'icmpOutEchos' => '003399', - 'icmpInEchoReps' => 'cc00cc', - 'icmpOutEchoReps' => '990099'); +$stats = array( + 'icmpInMsgs' => '00cc00', + 'icmpOutMsgs' => '006600', + 'icmpInErrors' => 'cc0000', + 'icmpOutErrors' => '660000', + 'icmpInEchos' => '0066cc', + 'icmpOutEchos' => '003399', + 'icmpInEchoReps' => 'cc00cc', + 'icmpOutEchoReps' => '990099', +); -$i=0; +$i = 0; -foreach ($stats as $stat => $colour) -{ - $i++; - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = str_replace("icmp", "", $stat); - $rrd_list[$i]['ds'] = $stat; - if (strpos($stat, "Out") !== FALSE) - { - $rrd_list[$i]['invert'] = TRUE; - } +foreach ($stats as $stat => $colour) { + $i++; + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = str_replace('icmp', '', $stat); + $rrd_list[$i]['ds'] = $stat; + if (strpos($stat, 'Out') !== false) { + $rrd_list[$i]['invert'] = true; + } } -$colours='mixed'; +$colours = 'mixed'; -$scale_min = "0"; -$nototal = 1; -$simple_rrd = TRUE; +$scale_min = '0'; +$nototal = 1; +$simple_rrd = true; -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/netstat_icmp_info.inc.php b/html/includes/graphs/device/netstat_icmp_info.inc.php index 9d029320a..38ab1e719 100644 --- a/html/includes/graphs/device/netstat_icmp_info.inc.php +++ b/html/includes/graphs/device/netstat_icmp_info.inc.php @@ -1,36 +1,34 @@ array(), - 'icmpOutSrcQuenchs' => array(), - 'icmpInRedirects' => array(), - 'icmpOutRedirects' => array(), - 'icmpInAddrMasks' => array(), - 'icmpOutAddrMasks' => array(), - 'icmpInAddrMaskReps' => array(), - 'icmpOutAddrMaskReps' => array()); +$stats = array( + 'icmpInSrcQuenchs' => array(), + 'icmpOutSrcQuenchs' => array(), + 'icmpInRedirects' => array(), + 'icmpOutRedirects' => array(), + 'icmpInAddrMasks' => array(), + 'icmpOutAddrMasks' => array(), + 'icmpInAddrMaskReps' => array(), + 'icmpOutAddrMaskReps' => array(), +); -$i=0; +$i = 0; -foreach ($stats as $stat => $array) -{ - $i++; - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = str_replace("icmp", "", $stat); - $rrd_list[$i]['ds'] = $stat; - if (strpos($stat, "Out") !== FALSE) - { - $rrd_list[$i]['invert'] = TRUE; - } +foreach ($stats as $stat => $array) { + $i++; + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = str_replace('icmp', '', $stat); + $rrd_list[$i]['ds'] = $stat; + if (strpos($stat, 'Out') !== false) { + $rrd_list[$i]['invert'] = true; + } } -$colours='mixed'; +$colours = 'mixed'; -$scale_min = "0"; -$nototal = 1; -$simple_rrd = TRUE; +$scale_min = '0'; +$nototal = 1; +$simple_rrd = true; -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/netstat_ip.inc.php b/html/includes/graphs/device/netstat_ip.inc.php index 35fd810b0..4c0dfad3e 100644 --- a/html/includes/graphs/device/netstat_ip.inc.php +++ b/html/includes/graphs/device/netstat_ip.inc.php @@ -1,34 +1,32 @@ array(), - 'ipInDelivers' => array(), - 'ipInReceives' => array(), - 'ipOutRequests' => array(), - 'ipInDiscards' => array(), - 'ipOutDiscards' => array(), - 'ipOutNoRoutes' => array()); +$stats = array( + 'ipForwDatagrams' => array(), + 'ipInDelivers' => array(), + 'ipInReceives' => array(), + 'ipOutRequests' => array(), + 'ipInDiscards' => array(), + 'ipOutDiscards' => array(), + 'ipOutNoRoutes' => array(), +); -$i=0; -foreach ($stats as $stat => $array) -{ - $i++; - $rrd_list[$i]['filename'] = $rrd_filename; - $rrd_list[$i]['descr'] = str_replace("ip", "", $stat); - $rrd_list[$i]['ds'] = $stat; - if (strpos($stat, "Out") !== FALSE) - { - $rrd_list[$i]['invert'] = TRUE; - } +$i = 0; +foreach ($stats as $stat => $array) { + $i++; + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = str_replace('ip', '', $stat); + $rrd_list[$i]['ds'] = $stat; + if (strpos($stat, 'Out') !== false) { + $rrd_list[$i]['invert'] = true; + } } -$colours='mixed'; +$colours = 'mixed'; -$scale_min = "0"; -$nototal = 1; -$simple_rrd = TRUE; +$scale_min = '0'; +$nototal = 1; +$simple_rrd = true; -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/netstat_ip_frag.inc.php b/html/includes/graphs/device/netstat_ip_frag.inc.php index 3fc3ba3ca..da5ea0249 100644 --- a/html/includes/graphs/device/netstat_ip_frag.inc.php +++ b/html/includes/graphs/device/netstat_ip_frag.inc.php @@ -1,8 +1,8 @@ \ No newline at end of file diff --git a/html/includes/graphs/device/netstat_snmp.inc.php b/html/includes/graphs/device/netstat_snmp.inc.php index 0a0bd9704..513872d27 100644 --- a/html/includes/graphs/device/netstat_snmp.inc.php +++ b/html/includes/graphs/device/netstat_snmp.inc.php @@ -1,33 +1,31 @@ +require 'includes/graphs/generic_multi.inc.php'; diff --git a/html/includes/graphs/device/netstat_snmp_pkt.inc.php b/html/includes/graphs/device/netstat_snmp_pkt.inc.php index a87f8eb0f..40883d7be 100644 --- a/html/includes/graphs/device/netstat_snmp_pkt.inc.php +++ b/html/includes/graphs/device/netstat_snmp_pkt.inc.php @@ -1,21 +1,19 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/device/netstat_tcp.inc.php b/html/includes/graphs/device/netstat_tcp.inc.php index 37c76a6ef..7559f3bd7 100644 --- a/html/includes/graphs/device/netstat_tcp.inc.php +++ b/html/includes/graphs/device/netstat_tcp.inc.php @@ -1,27 +1,31 @@ +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/netstat_udp.inc.php b/html/includes/graphs/device/netstat_udp.inc.php index 3b8ca5388..e6ff11b1d 100644 --- a/html/includes/graphs/device/netstat_udp.inc.php +++ b/html/includes/graphs/device/netstat_udp.inc.php @@ -1,27 +1,28 @@ +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/nfsen_common.inc.php b/html/includes/graphs/device/nfsen_common.inc.php index fc36a36c6..774d47e3f 100644 --- a/html/includes/graphs/device/nfsen_common.inc.php +++ b/html/includes/graphs/device/nfsen_common.inc.php @@ -1,49 +1,55 @@ + // convert dots in filename to underscores + $nfsensuffix = ''; + if ($config['nfsen_suffix']) { + $nfsensuffix = $config['nfsen_suffix']; + } + + $basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']); + $nfsen_filename = (strstr($basefilename_underscored, $nfsensuffix, true)); + + if (is_file($nfsenrrds.$nfsen_filename.'.rrd')) { + $rrd_filename = $nfsenrrds.$nfsen_filename.'.rrd'; + + $flowtypes = array('tcp', 'udp', 'icmp', 'other'); + + $rrd_list = array(); + $nfsen_iter = 1; + foreach ($flowtypes as $flowtype) { + $rrd_list[$nfsen_iter]['filename'] = $rrd_filename; + $rrd_list[$nfsen_iter]['descr'] = $flowtype; + $rrd_list[$nfsen_iter]['ds'] = $dsprefix.$flowtype; + + // set a multiplier which in turn will create a CDEF if this var is set + if ($dsprefix == 'traffic_') { + $multiplier = '8'; + } + + $colours = 'blues'; + $nototal = 0; + $units = ''; + $unit_text = $dsdescr; + $scale_min = '0'; + + if ($_GET['debug']) { + print_r($rrd_list); + } + + $nfsen_iter++; + } + } +} + +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/device/nfsen_flows.inc.php b/html/includes/graphs/device/nfsen_flows.inc.php index e1579a988..42701705b 100644 --- a/html/includes/graphs/device/nfsen_flows.inc.php +++ b/html/includes/graphs/device/nfsen_flows.inc.php @@ -1,7 +1,5 @@ +require 'nfsen_common.inc.php'; diff --git a/html/includes/graphs/device/nfsen_packets.inc.php b/html/includes/graphs/device/nfsen_packets.inc.php index e10447e45..9e5ba07b2 100644 --- a/html/includes/graphs/device/nfsen_packets.inc.php +++ b/html/includes/graphs/device/nfsen_packets.inc.php @@ -1,8 +1,6 @@ +require 'nfsen_common.inc.php'; diff --git a/html/includes/graphs/device/nfsen_traffic.inc.php b/html/includes/graphs/device/nfsen_traffic.inc.php index 8210d2851..1f04c3b37 100644 --- a/html/includes/graphs/device/nfsen_traffic.inc.php +++ b/html/includes/graphs/device/nfsen_traffic.inc.php @@ -1,8 +1,6 @@ +require 'nfsen_common.inc.php'; diff --git a/html/includes/graphs/device/panos_sessions.inc.php b/html/includes/graphs/device/panos_sessions.inc.php index cbfe61587..b4d1311b7 100644 --- a/html/includes/graphs/device/panos_sessions.inc.php +++ b/html/includes/graphs/device/panos_sessions.inc.php @@ -1,18 +1,16 @@ +require 'includes/graphs/generic_simplex.inc.php'; diff --git a/html/includes/graphs/device/power.inc.php b/html/includes/graphs/device/power.inc.php index 3c320dda4..2a19fe0e0 100644 --- a/html/includes/graphs/device/power.inc.php +++ b/html/includes/graphs/device/power.inc.php @@ -1,9 +1,7 @@ +require 'includes/graphs/device/sensor.inc.php'; diff --git a/html/includes/graphs/device/processor.inc.php b/html/includes/graphs/device/processor.inc.php index 015a0c187..bc378e671 100644 --- a/html/includes/graphs/device/processor.inc.php +++ b/html/includes/graphs/device/processor.inc.php @@ -1,12 +1,10 @@ diff --git a/html/includes/graphs/device/processor_separate.inc.php b/html/includes/graphs/device/processor_separate.inc.php index c5bcb892f..2b5980256 100644 --- a/html/includes/graphs/device/processor_separate.inc.php +++ b/html/includes/graphs/device/processor_separate.inc.php @@ -2,33 +2,29 @@ $i = 0; -foreach ($procs as $proc) -{ - $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd"); +foreach ($procs as $proc) { + $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']); + 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]['ds'] = "usage"; - $rrd_list[$i]['area'] = 1; - $i++; - } + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = 'usage'; + $rrd_list[$i]['area'] = 1; + $i++; + } } -$unit_text = "Load %"; +$unit_text = 'Load %'; -$units = '%'; +$units = '%'; $total_units = '%'; -$colours ='mixed'; +$colours = 'mixed'; -$scale_min = "0"; -$scale_max = "100"; +$scale_min = '0'; +$scale_max = '100'; $nototal = 1; -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/processor_stack.inc.php b/html/includes/graphs/device/processor_stack.inc.php index 7cdfa0780..dfbd4b355 100644 --- a/html/includes/graphs/device/processor_stack.inc.php +++ b/html/includes/graphs/device/processor_stack.inc.php @@ -2,34 +2,30 @@ $i = 0; -foreach ($procs as $proc) -{ - $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd"); +foreach ($procs as $proc) { + $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']); + 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]['ds'] = "usage"; - $i++; - } + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = 'usage'; + $i++; + } } -$unit_text = "Load %"; +$unit_text = 'Load %'; -$units = '%'; +$units = '%'; $total_units = '%'; -$colours ='oranges'; +$colours = 'oranges'; -$scale_min = "0"; -$scale_max = "100"; +$scale_min = '0'; +$scale_max = '100'; -$divider = $i; +$divider = $i; $text_orig = 1; -$nototal = 1; +$nototal = 1; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/device/screenos_sessions.inc.php b/html/includes/graphs/device/screenos_sessions.inc.php index d15ce2aee..52ff2b3a3 100644 --- a/html/includes/graphs/device/screenos_sessions.inc.php +++ b/html/includes/graphs/device/screenos_sessions.inc.php @@ -1,26 +1,26 @@ +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/smokeping_all_common.inc.php b/html/includes/graphs/device/smokeping_all_common.inc.php index edff0d7e5..962ac8f51 100644 --- a/html/includes/graphs/device/smokeping_all_common.inc.php +++ b/html/includes/graphs/device/smokeping_all_common.inc.php @@ -3,89 +3,82 @@ // Dear Tobias. You write in Perl, this makes me hate you forever. // This is my translation of Smokeping's graphing. // Thanks to Bill Fenner for Perl->Human translation:> +$scale_min = 0; +$scale_rigid = true; -$scale_min = 0; -$scale_rigid = TRUE; +require 'includes/graphs/common.inc.php'; +require 'smokeping_common.inc.php'; -include("includes/graphs/common.inc.php"); -include("smokeping_common.inc.php"); +$i = 0; +$pings = 20; +$iter = 0; +$colourset = 'mixed'; -$i = 0; -$pings = 20; -$iter = 0; -$colourset = "mixed"; - -if($width > "500") -{ - $descr_len = 18; -} else { - $descr_len = 12 + round(($width - 275) / 8); +if ($width > '500') { + $descr_len = 18; +} +else { + $descr_len = (12 + round(($width - 275) / 8)); } -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev\l'"; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." RTT Loss SDev RTT\:SDev\l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." RTT Loss SDev RTT\:SDev\l'"; } -foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filename) -{ +foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filename) { + if (!isset($config['graph_colours'][$colourset][$iter])) { + $iter = 0; + } - if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; } - $colour = $config['graph_colours'][$colourset][$iter]; - $iter++; + $colour = $config['graph_colours'][$colourset][$iter]; + $iter++; - $descr = rrdtool_escape($source, $descr_len); + $descr = rrdtool_escape($source, $descr_len); - $filename = $config['smokeping']['dir'] . $filename; - $rrd_options .= " DEF:median$i=".$filename.":median:AVERAGE "; - $rrd_options .= " DEF:loss$i=".$filename.":loss:AVERAGE"; - $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; - $rrd_options .= " CDEF:dm$i=median$i"; -# $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; + $filename = $config['smokeping']['dir'].$filename; + $rrd_options .= " DEF:median$i=".$filename.':median:AVERAGE '; + $rrd_options .= " DEF:loss$i=".$filename.':loss:AVERAGE'; + $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; + $rrd_options .= " CDEF:dm$i=median$i"; + // $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; + // start emulate Smokeping::calc_stddev + foreach (range(1, $pings) as $p) { + $rrd_options .= ' DEF:pin'.$i.'p'.$p.'='.$filename.':ping'.$p.':AVERAGE'; + $rrd_options .= ' CDEF:p'.$i.'p'.$p.'=pin'.$i.'p'.$p.',UN,0,pin'.$i.'p'.$p.',IF'; + } - // start emulate Smokeping::calc_stddev - foreach (range(1, $pings) as $p) - { - $rrd_options .= " DEF:pin".$i."p".$p."=".$filename.":ping".$p.":AVERAGE"; - $rrd_options .= " CDEF:p".$i."p".$p."=pin".$i."p".$p.",UN,0,pin".$i."p".$p.",IF"; - } + unset($pings_options, $m_options, $sdev_options); - unset($pings_options, $m_options, $sdev_options); + foreach (range(2, $pings) as $p) { + $pings_options .= ',p'.$i.'p'.$p.',UN,+'; + $m_options .= ',p'.$i.'p'.$p.',+'; + $sdev_options .= ',p'.$i.'p'.$p.',m'.$i.',-,DUP,*,+'; + } - foreach (range(2, $pings) as $p) - { - $pings_options .= ",p".$i."p".$p.",UN,+"; - $m_options .= ",p".$i."p".$p.",+"; - $sdev_options .= ",p".$i."p".$p.",m".$i.",-,DUP,*,+"; - } + $rrd_options .= ' CDEF:pings'.$i.'='.$pings.',p'.$i.'p1,UN'.$pings_options.',-'; + $rrd_options .= ' CDEF:m'.$i.'=p'.$i.'p1'.$m_options.',pings'.$i.',/'; + $rrd_options .= ' CDEF:sdev'.$i.'=p'.$i.'p1,m'.$i.',-,DUP,*'.$sdev_options.',pings'.$i.',/,SQRT'; + // end emulate Smokeping::calc_stddev + $rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; + $rrd_options .= " CDEF:s2d$i=sdev$i"; + $rrd_options .= " AREA:dmlow$i"; + $rrd_options .= " AREA:s2d$i#".$colour.'30::STACK'; + $rrd_options .= " LINE1:dm$i#".$colour.":'$descr'"; - $rrd_options .= " CDEF:pings".$i."=".$pings .",p".$i."p1,UN". $pings_options . ",-"; - $rrd_options .= " CDEF:m".$i."=p".$i."p1".$m_options.",pings".$i.",/"; - $rrd_options .= " CDEF:sdev".$i."=p".$i."p1,m".$i.",-,DUP,*".$sdev_options.",pings".$i.",/,SQRT"; - // end emulate Smokeping::calc_stddev + // $rrd_options .= " LINE1:sdev$i#000000:$descr"; + $rrd_options .= " VDEF:avmed$i=median$i,AVERAGE"; + $rrd_options .= " VDEF:avsd$i=sdev$i,AVERAGE"; + $rrd_options .= " CDEF:msr$i=median$i,POP,avmed$i,avsd$i,/"; + $rrd_options .= " VDEF:avmsr$i=msr$i,AVERAGE"; - $rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; - $rrd_options .= " CDEF:s2d$i=sdev$i"; - $rrd_options .= " AREA:dmlow$i"; - $rrd_options .= " AREA:s2d$i#".$colour."30::STACK"; - $rrd_options .= " LINE1:dm$i#".$colour.":'$descr'"; + $rrd_options .= " GPRINT:avmed$i:'%5.1lf%ss'"; + $rrd_options .= " GPRINT:ploss$i:AVERAGE:'%5.1lf%%'"; -# $rrd_options .= " LINE1:sdev$i#000000:$descr"; + $rrd_options .= " GPRINT:avsd$i:'%5.1lf%Ss'"; + $rrd_options .= " GPRINT:avmsr$i:'%5.1lf%s\\l'"; - $rrd_options .= " VDEF:avmed$i=median$i,AVERAGE"; - $rrd_options .= " VDEF:avsd$i=sdev$i,AVERAGE"; - $rrd_options .= " CDEF:msr$i=median$i,POP,avmed$i,avsd$i,/"; - $rrd_options .= " VDEF:avmsr$i=msr$i,AVERAGE"; - - $rrd_options .= " GPRINT:avmed$i:'%5.1lf%ss'"; - $rrd_options .= " GPRINT:ploss$i:AVERAGE:'%5.1lf%%'"; - - $rrd_options .= " GPRINT:avsd$i:'%5.1lf%Ss'"; - $rrd_options .= " GPRINT:avmsr$i:'%5.1lf%s\\l'"; - - $i++; -} - -?> + $i++; +}//end foreach diff --git a/html/includes/graphs/device/smokeping_all_common_avg.inc.php b/html/includes/graphs/device/smokeping_all_common_avg.inc.php index 12681140a..c77d51021 100644 --- a/html/includes/graphs/device/smokeping_all_common_avg.inc.php +++ b/html/includes/graphs/device/smokeping_all_common_avg.inc.php @@ -3,102 +3,95 @@ // Dear Tobias. You write in Perl, this makes me hate you forever. // This is my translation of Smokeping's graphing. // Thanks to Bill Fenner for Perl->Human translation:> +$scale_min = 0; +$scale_rigid = true; -$scale_min = 0; -$scale_rigid = TRUE; +require 'includes/graphs/common.inc.php'; +require 'smokeping_common.inc.php'; -include("includes/graphs/common.inc.php"); -include("smokeping_common.inc.php"); +$i = 0; +$pings = 20; +$iter = 0; +$colourset = 'mixed'; -$i = 0; -$pings = 20; -$iter = 0; -$colourset = "mixed"; - -if($width > "500") -{ - $descr_len = 18; -} else { - $descr_len = 12 + round(($width - 275) / 8); +if ($width > '500') { + $descr_len = 18; +} +else { + $descr_len = (12 + round(($width - 275) / 8)); } // FIXME str_pad really needs a "limit to length" so we can rid of all the substrs all over the code to limit the length as below... -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev\l'"; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." RTT Loss SDev RTT\:SDev\l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." RTT Loss SDev RTT\:SDev\l'"; } -foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filename) -{ +foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filename) { + if (!isset($config['graph_colours'][$colourset][$iter])) { + $iter = 0; + } - if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; } - $colour = $config['graph_colours'][$colourset][$iter]; - $iter++; + $colour = $config['graph_colours'][$colourset][$iter]; + $iter++; - $descr = rrdtool_escape($source, $descr_len); + $descr = rrdtool_escape($source, $descr_len); - $filename = $config['smokeping']['dir'] . $filename; - $rrd_options .= " DEF:median$i=".$filename.":median:AVERAGE "; - $rrd_options .= " CDEF:dm$i=median$i,UN,0,median$i,IF"; - $rrd_options .= " DEF:loss$i=".$filename.":loss:AVERAGE"; - $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; -# $rrd_options .= " CDEF:dm$i=median$i"; -# $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; + $filename = $config['smokeping']['dir'].$filename; + $rrd_options .= " DEF:median$i=".$filename.':median:AVERAGE '; + $rrd_options .= " CDEF:dm$i=median$i,UN,0,median$i,IF"; + $rrd_options .= " DEF:loss$i=".$filename.':loss:AVERAGE'; + $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; + // $rrd_options .= " CDEF:dm$i=median$i"; + // $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; + // start emulate Smokeping::calc_stddev + foreach (range(1, $pings) as $p) { + $rrd_options .= ' DEF:pin'.$i.'p'.$p.'='.$filename.':ping'.$p.':AVERAGE'; + $rrd_options .= ' CDEF:p'.$i.'p'.$p.'=pin'.$i.'p'.$p.',UN,0,pin'.$i.'p'.$p.',IF'; + } - // start emulate Smokeping::calc_stddev - foreach (range(1, $pings) as $p) - { - $rrd_options .= " DEF:pin".$i."p".$p."=".$filename.":ping".$p.":AVERAGE"; - $rrd_options .= " CDEF:p".$i."p".$p."=pin".$i."p".$p.",UN,0,pin".$i."p".$p.",IF"; - } + unset($pings_options, $m_options, $sdev_options); - unset($pings_options, $m_options, $sdev_options); + foreach (range(2, $pings) as $p) { + $pings_options .= ',p'.$i.'p'.$p.',UN,+'; + $m_options .= ',p'.$i.'p'.$p.',+'; + $sdev_options .= ',p'.$i.'p'.$p.',m'.$i.',-,DUP,*,+'; + } - foreach (range(2, $pings) as $p) - { - $pings_options .= ",p".$i."p".$p.",UN,+"; - $m_options .= ",p".$i."p".$p.",+"; - $sdev_options .= ",p".$i."p".$p.",m".$i.",-,DUP,*,+"; - } + $rrd_options .= ' CDEF:pings'.$i.'='.$pings.',p'.$i.'p1,UN'.$pings_options.',-'; + $rrd_options .= ' CDEF:m'.$i.'=p'.$i.'p1'.$m_options.',pings'.$i.',/'; + $rrd_options .= ' CDEF:sdev'.$i.'=p'.$i.'p1,m'.$i.',-,DUP,*'.$sdev_options.',pings'.$i.',/,SQRT'; + // end emulate Smokeping::calc_stddev + $rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; + $rrd_options .= " CDEF:s2d$i=sdev$i"; - $rrd_options .= " CDEF:pings".$i."=".$pings .",p".$i."p1,UN". $pings_options . ",-"; - $rrd_options .= " CDEF:m".$i."=p".$i."p1".$m_options.",pings".$i.",/"; - $rrd_options .= " CDEF:sdev".$i."=p".$i."p1,m".$i.",-,DUP,*".$sdev_options.",pings".$i.",/,SQRT"; - // end emulate Smokeping::calc_stddev + $dm_list .= ",dm$i,+"; + $sd_list .= ",s2d$i,+"; + $ploss_list .= ",ploss$i,+"; - $rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; - $rrd_options .= " CDEF:s2d$i=sdev$i"; + $i++; +}//end foreach - $dm_list .= ",dm$i,+"; - $sd_list .= ",s2d$i,+"; - $ploss_list .= ",ploss$i,+"; +$descr = rrdtool_escape('Average', $descr_len); - $i++; +$rrd_options .= ' CDEF:ploss_all=0'.$ploss_list.",$i,/"; +$rrd_options .= ' CDEF:dm_all=0'.$dm_list.",$i,/"; +// $rrd_options .= " CDEF:dm_all_clean=dm_all,UN,NaN,dm_all,IF"; +$rrd_options .= ' CDEF:sd_all=0'.$sd_list.",$i,/"; +$rrd_options .= ' CDEF:dmlow_all=dm_all,sd_all,2,/,-'; -} - -$descr = rrdtool_escape("Average", $descr_len); - -$rrd_options .= " CDEF:ploss_all=0".$ploss_list.",$i,/"; -$rrd_options .= " CDEF:dm_all=0".$dm_list.",$i,/"; -# $rrd_options .= " CDEF:dm_all_clean=dm_all,UN,NaN,dm_all,IF"; -$rrd_options .= " CDEF:sd_all=0".$sd_list.",$i,/"; -$rrd_options .= " CDEF:dmlow_all=dm_all,sd_all,2,/,-"; - -$rrd_options .= " AREA:dmlow_all"; -$rrd_options .= " AREA:sd_all#AAAAAA::STACK"; +$rrd_options .= ' AREA:dmlow_all'; +$rrd_options .= ' AREA:sd_all#AAAAAA::STACK'; $rrd_options .= " LINE1:dm_all#CC0000:'$descr'"; -$rrd_options .= " VDEF:avmed=dm_all,AVERAGE"; -$rrd_options .= " VDEF:avsd=sd_all,AVERAGE"; -$rrd_options .= " CDEF:msr=dm_all,POP,avmed,avsd,/"; -$rrd_options .= " VDEF:avmsr=msr,AVERAGE"; +$rrd_options .= ' VDEF:avmed=dm_all,AVERAGE'; +$rrd_options .= ' VDEF:avsd=sd_all,AVERAGE'; +$rrd_options .= ' CDEF:msr=dm_all,POP,avmed,avsd,/'; +$rrd_options .= ' VDEF:avmsr=msr,AVERAGE'; $rrd_options .= " GPRINT:avmed:'%5.1lf%ss'"; $rrd_options .= " GPRINT:ploss_all:AVERAGE:'%5.1lf%%'"; $rrd_options .= " GPRINT:avsd:'%5.1lf%Ss'"; $rrd_options .= " GPRINT:avmsr:'%5.1lf%s\\l'"; - -?> diff --git a/html/includes/graphs/device/smokeping_common.inc.php b/html/includes/graphs/device/smokeping_common.inc.php index c158e8267..006eb4197 100644 --- a/html/includes/graphs/device/smokeping_common.inc.php +++ b/html/includes/graphs/device/smokeping_common.inc.php @@ -1,26 +1,25 @@ +} diff --git a/html/includes/graphs/device/smokeping_in_all.inc.php b/html/includes/graphs/device/smokeping_in_all.inc.php index aaee41706..e9c9ca4e5 100644 --- a/html/includes/graphs/device/smokeping_in_all.inc.php +++ b/html/includes/graphs/device/smokeping_in_all.inc.php @@ -1,7 +1,5 @@ +require 'smokeping_all_common.inc.php'; diff --git a/html/includes/graphs/device/smokeping_in_all_avg.inc.php b/html/includes/graphs/device/smokeping_in_all_avg.inc.php index 8344ba94c..fcc5539cf 100644 --- a/html/includes/graphs/device/smokeping_in_all_avg.inc.php +++ b/html/includes/graphs/device/smokeping_in_all_avg.inc.php @@ -1,7 +1,5 @@ +require 'smokeping_all_common_avg.inc.php'; diff --git a/html/includes/graphs/device/smokeping_out_all.inc.php b/html/includes/graphs/device/smokeping_out_all.inc.php index ef1d87f94..923c0bc74 100644 --- a/html/includes/graphs/device/smokeping_out_all.inc.php +++ b/html/includes/graphs/device/smokeping_out_all.inc.php @@ -1,7 +1,5 @@ +require 'smokeping_all_common.inc.php'; diff --git a/html/includes/graphs/device/smokeping_out_all_avg.inc.php b/html/includes/graphs/device/smokeping_out_all_avg.inc.php index 3d3c8645d..b36cb0eb5 100644 --- a/html/includes/graphs/device/smokeping_out_all_avg.inc.php +++ b/html/includes/graphs/device/smokeping_out_all_avg.inc.php @@ -1,7 +1,5 @@ +require 'smokeping_all_common_avg.inc.php'; diff --git a/html/includes/graphs/device/storage.inc.php b/html/includes/graphs/device/storage.inc.php index 211c98cc0..769e9ce91 100644 --- a/html/includes/graphs/device/storage.inc.php +++ b/html/includes/graphs/device/storage.inc.php @@ -1,31 +1,47 @@ + $descr = rrdtool_escape($storage['storage_descr'], 12); + $rrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('storage-'.$storage['storage_mib'].'-'.$storage['storage_descr'].'.rrd'); + $rrd_options .= " DEF:$storage[storage_id]used=$rrd:used:AVERAGE"; + $rrd_options .= " DEF:$storage[storage_id]free=$rrd:free:AVERAGE"; + $rrd_options .= " CDEF:$storage[storage_id]size=$storage[storage_id]used,$storage[storage_id]free,+"; + $rrd_options .= " CDEF:$storage[storage_id]perc=$storage[storage_id]used,$storage[storage_id]size,/,100,*"; + $rrd_options .= " LINE1.25:$storage[storage_id]perc#".$colour.":'$descr'"; + $rrd_options .= " GPRINT:$storage[storage_id]size:LAST:%6.2lf%sB"; + $rrd_options .= " GPRINT:$storage[storage_id]used:LAST:%6.2lf%sB"; + $rrd_options .= " GPRINT:$storage[storage_id]perc:LAST:%5.2lf%%\\\\l"; + $iter++; +}//end foreach diff --git a/html/includes/graphs/device/temperature.inc.php b/html/includes/graphs/device/temperature.inc.php index bcc967485..b3f35c695 100644 --- a/html/includes/graphs/device/temperature.inc.php +++ b/html/includes/graphs/device/temperature.inc.php @@ -1,9 +1,7 @@ +require 'includes/graphs/device/sensor.inc.php'; diff --git a/html/includes/graphs/device/toner.inc.php b/html/includes/graphs/device/toner.inc.php index 06029c8b3..6a974b64a 100644 --- a/html/includes/graphs/device/toner.inc.php +++ b/html/includes/graphs/device/toner.inc.php @@ -1,59 +1,61 @@ + case '6': + $colour['left'] = '36393D'; + break; + + case '7': + default: + $colour['left'] = 'FF0000'; + unset($iter); + break; + }//end switch + }//end if + + $hostname = gethostbyid($toner['device_id']); + + $descr = substr(str_pad($toner['toner_descr'], 16), 0, 16); + $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('toner-'.$toner['toner_index'].'.rrd'); + $toner_id = $toner['toner_id']; + + $rrd_options .= " DEF:toner$toner_id=$rrd_filename:toner:AVERAGE"; + $rrd_options .= " LINE2:toner$toner_id#".$colour['left'].":'".$descr."'"; + $rrd_options .= " GPRINT:toner$toner_id:LAST:'%5.0lf%%'"; + $rrd_options .= " GPRINT:toner$toner_id:MIN:'%5.0lf%%'"; + $rrd_options .= " GPRINT:toner$toner_id:MAX:%5.0lf%%\\\\l"; + + $iter++; +}//end foreach diff --git a/html/includes/graphs/device/ucd_io.inc.php b/html/includes/graphs/device/ucd_io.inc.php index 0a733f5bb..8b9c64f8c 100644 --- a/html/includes/graphs/device/ucd_io.inc.php +++ b/html/includes/graphs/device/ucd_io.inc.php @@ -1,12 +1,10 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/device/ucd_load.inc.php b/html/includes/graphs/device/ucd_load.inc.php index 9a0c45cc8..ccdf61ee5 100644 --- a/html/includes/graphs/device/ucd_load.inc.php +++ b/html/includes/graphs/device/ucd_load.inc.php @@ -1,21 +1,21 @@ diff --git a/html/includes/graphs/device/ucd_memory.inc.php b/html/includes/graphs/device/ucd_memory.inc.php index 992714aba..606fed717 100644 --- a/html/includes/graphs/device/ucd_memory.inc.php +++ b/html/includes/graphs/device/ucd_memory.inc.php @@ -1,8 +1,8 @@ diff --git a/html/includes/graphs/device/ucd_swap_io.inc.php b/html/includes/graphs/device/ucd_swap_io.inc.php index 6697ac8ae..002814538 100644 --- a/html/includes/graphs/device/ucd_swap_io.inc.php +++ b/html/includes/graphs/device/ucd_swap_io.inc.php @@ -1,12 +1,10 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/device/uptime.inc.php b/html/includes/graphs/device/uptime.inc.php index 20235f654..6c9c4ff88 100644 --- a/html/includes/graphs/device/uptime.inc.php +++ b/html/includes/graphs/device/uptime.inc.php @@ -1,17 +1,15 @@ diff --git a/html/includes/graphs/device/voltage.inc.php b/html/includes/graphs/device/voltage.inc.php index 3a2423fc7..efdf3350e 100644 --- a/html/includes/graphs/device/voltage.inc.php +++ b/html/includes/graphs/device/voltage.inc.php @@ -1,9 +1,7 @@ +require 'includes/graphs/device/sensor.inc.php'; diff --git a/html/includes/graphs/device/vpdn_sessions_l2tp.inc.php b/html/includes/graphs/device/vpdn_sessions_l2tp.inc.php index dd203415a..7e4ecc8e8 100644 --- a/html/includes/graphs/device/vpdn_sessions_l2tp.inc.php +++ b/html/includes/graphs/device/vpdn_sessions_l2tp.inc.php @@ -1,24 +1,21 @@ +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/vpdn_tunnels_l2tp.inc.php b/html/includes/graphs/device/vpdn_tunnels_l2tp.inc.php index 36d6c0fb1..9c4a9c01b 100644 --- a/html/includes/graphs/device/vpdn_tunnels_l2tp.inc.php +++ b/html/includes/graphs/device/vpdn_tunnels_l2tp.inc.php @@ -1,24 +1,21 @@ +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/device/wifi_clients.inc.php b/html/includes/graphs/device/wifi_clients.inc.php index 0ff024df4..1c45b1363 100644 --- a/html/includes/graphs/device/wifi_clients.inc.php +++ b/html/includes/graphs/device/wifi_clients.inc.php @@ -1,28 +1,24 @@ \ No newline at end of file diff --git a/html/includes/graphs/diskio/auth.inc.php b/html/includes/graphs/diskio/auth.inc.php index e9388680a..30b6271d7 100644 --- a/html/includes/graphs/diskio/auth.inc.php +++ b/html/includes/graphs/diskio/auth.inc.php @@ -1,19 +1,15 @@ diff --git a/html/includes/graphs/diskio/bits.inc.php b/html/includes/graphs/diskio/bits.inc.php index c61bf6d89..507e94cf1 100644 --- a/html/includes/graphs/diskio/bits.inc.php +++ b/html/includes/graphs/diskio/bits.inc.php @@ -1,10 +1,8 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/diskio/ops.inc.php b/html/includes/graphs/diskio/ops.inc.php index 1b0626757..eac593212 100644 --- a/html/includes/graphs/diskio/ops.inc.php +++ b/html/includes/graphs/diskio/ops.inc.php @@ -1,20 +1,18 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/generic_duplex.inc.php b/html/includes/graphs/generic_duplex.inc.php index 6a11166ef..bddfd09b0 100644 --- a/html/includes/graphs/generic_duplex.inc.php +++ b/html/includes/graphs/generic_duplex.inc.php @@ -2,131 +2,126 @@ // Draw generic bits graph // args: ds_in, ds_out, rrd_filename, bg, legend, from, to, width, height, inverse, $percentile +require 'includes/graphs/common.inc.php'; -include("includes/graphs/common.inc.php"); +$length = '10'; -$length = "10"; - -if (!isset($percentile)) { $length += "2"; } - -if (!isset($out_text)) { $out_text = "Out"; } -if (!isset($in_text)) { $in_text = "In"; } - -$unit_text = str_pad(truncate($unit_text,$length),$length); -$in_text = str_pad(truncate($in_text,$length),$length); -$out_text = str_pad(truncate($out_text,$length),$length); - -$rrd_options .= " DEF:".$out."=".$rrd_filename.":".$ds_out.":AVERAGE"; -$rrd_options .= " DEF:".$in."=".$rrd_filename.":".$ds_in.":AVERAGE"; -$rrd_options .= " DEF:".$out."_max=".$rrd_filename.":".$ds_out.":MAX"; -$rrd_options .= " DEF:".$in."_max=".$rrd_filename.":".$ds_in.":MAX"; -$rrd_options .= " CDEF:dout_max=out_max,-1,*"; -$rrd_options .= " CDEF:dout=out,-1,*"; -$rrd_options .= " CDEF:both=in,out,+"; -if ($print_total) -{ - $rrd_options .= " VDEF:totin=in,TOTAL"; - $rrd_options .= " VDEF:totout=out,TOTAL"; - $rrd_options .= " VDEF:tot=both,TOTAL"; -} -if ($percentile) -{ - $rrd_options .= " VDEF:percentile_in=in,".$percentile.",PERCENT"; - $rrd_options .= " VDEF:percentile_out=out,".$percentile.",PERCENT"; - $rrd_options .= " VDEF:dpercentile_out=dout,".$percentile.",PERCENT"; -} -if ($graph_max) -{ - $rrd_options .= " AREA:in_max#".$colour_area_in_max.":"; - $rrd_options .= " AREA:dout_max#".$colour_area_out_max.":"; +if (!isset($percentile)) { + $length += '2'; } -if($_GET['previous'] == "yes") -{ - $rrd_options .= " DEF:".$out."X=".$rrd_filename.":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " DEF:".$in."X=".$rrd_filename.":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " DEF:".$out."_maxX=".$rrd_filename.":".$ds_out.":MAX:start=".$prev_from.":end=".$from; - $rrd_options .= " DEF:".$in."_maxX=".$rrd_filename.":".$ds_in.":MAX:start=".$prev_from.":end=".$from; - $rrd_options .= " SHIFT:".$out."X:$period"; - $rrd_options .= " SHIFT:".$in."X:$period"; - $rrd_options .= " SHIFT:".$out."_maxX:$period"; - $rrd_options .= " SHIFT:".$in."_maxX:$period"; - $rrd_options .= " CDEF:dout_maxX=out_maxX,-1,*"; - $rrd_options .= " CDEF:doutX=outX,-1,*"; - $rrd_options .= " CDEF:bothX=inX,outX,+"; - if ($print_total) - { - $rrd_options .= " VDEF:totinX=inX,TOTAL"; - $rrd_options .= " VDEF:totoutX=outX,TOTAL"; - $rrd_options .= " VDEF:totX=bothX,TOTAL"; - } - if ($percentile) - { - $rrd_options .= " VDEF:percentile_inX=inX,".$percentile.",PERCENT"; - $rrd_options .= " VDEF:percentile_outX=outX,".$percentile.",PERCENT"; - $rrd_options .= " VDEF:dpercentile_outX=doutX,".$percentile.",PERCENT"; - } - if ($graph_max) - { - $rrd_options .= " AREA:in_max#".$colour_area_in_max.":"; - $rrd_options .= " AREA:dout_max#".$colour_area_out_max.":"; - } +if (!isset($out_text)) { + $out_text = 'Out'; } -$rrd_options .= " AREA:in#".$colour_area_in.":"; -$rrd_options .= " COMMENT:'".$unit_text." Now Ave Max"; +if (!isset($in_text)) { + $in_text = 'In'; +} -if ($percentile) -{ - $rrd_options .= " ".$percentile."th %"; +$unit_text = str_pad(truncate($unit_text, $length), $length); +$in_text = str_pad(truncate($in_text, $length), $length); +$out_text = str_pad(truncate($out_text, $length), $length); + +$rrd_options .= ' DEF:'.$out.'='.$rrd_filename.':'.$ds_out.':AVERAGE'; +$rrd_options .= ' DEF:'.$in.'='.$rrd_filename.':'.$ds_in.':AVERAGE'; +$rrd_options .= ' DEF:'.$out.'_max='.$rrd_filename.':'.$ds_out.':MAX'; +$rrd_options .= ' DEF:'.$in.'_max='.$rrd_filename.':'.$ds_in.':MAX'; +$rrd_options .= ' CDEF:dout_max=out_max,-1,*'; +$rrd_options .= ' CDEF:dout=out,-1,*'; +$rrd_options .= ' CDEF:both=in,out,+'; +if ($print_total) { + $rrd_options .= ' VDEF:totin=in,TOTAL'; + $rrd_options .= ' VDEF:totout=out,TOTAL'; + $rrd_options .= ' VDEF:tot=both,TOTAL'; +} + +if ($percentile) { + $rrd_options .= ' VDEF:percentile_in=in,'.$percentile.',PERCENT'; + $rrd_options .= ' VDEF:percentile_out=out,'.$percentile.',PERCENT'; + $rrd_options .= ' VDEF:dpercentile_out=dout,'.$percentile.',PERCENT'; +} + +if ($graph_max) { + $rrd_options .= ' AREA:in_max#'.$colour_area_in_max.':'; + $rrd_options .= ' AREA:dout_max#'.$colour_area_out_max.':'; +} + +if ($_GET['previous'] == 'yes') { + $rrd_options .= ' DEF:'.$out.'X='.$rrd_filename.':'.$ds_out.':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' DEF:'.$in.'X='.$rrd_filename.':'.$ds_in.':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' DEF:'.$out.'_maxX='.$rrd_filename.':'.$ds_out.':MAX:start='.$prev_from.':end='.$from; + $rrd_options .= ' DEF:'.$in.'_maxX='.$rrd_filename.':'.$ds_in.':MAX:start='.$prev_from.':end='.$from; + $rrd_options .= ' SHIFT:'.$out."X:$period"; + $rrd_options .= ' SHIFT:'.$in."X:$period"; + $rrd_options .= ' SHIFT:'.$out."_maxX:$period"; + $rrd_options .= ' SHIFT:'.$in."_maxX:$period"; + $rrd_options .= ' CDEF:dout_maxX=out_maxX,-1,*'; + $rrd_options .= ' CDEF:doutX=outX,-1,*'; + $rrd_options .= ' CDEF:bothX=inX,outX,+'; + if ($print_total) { + $rrd_options .= ' VDEF:totinX=inX,TOTAL'; + $rrd_options .= ' VDEF:totoutX=outX,TOTAL'; + $rrd_options .= ' VDEF:totX=bothX,TOTAL'; + } + + if ($percentile) { + $rrd_options .= ' VDEF:percentile_inX=inX,'.$percentile.',PERCENT'; + $rrd_options .= ' VDEF:percentile_outX=outX,'.$percentile.',PERCENT'; + $rrd_options .= ' VDEF:dpercentile_outX=doutX,'.$percentile.',PERCENT'; + } + + if ($graph_max) { + $rrd_options .= ' AREA:in_max#'.$colour_area_in_max.':'; + $rrd_options .= ' AREA:dout_max#'.$colour_area_out_max.':'; + } +}//end if + +$rrd_options .= ' AREA:in#'.$colour_area_in.':'; +$rrd_options .= " COMMENT:'".$unit_text.' Now Ave Max'; + +if ($percentile) { + $rrd_options .= ' '.$percentile.'th %'; } $rrd_options .= "\\n'"; -$rrd_options .= " LINE1.25:in#".$colour_line_in.":'".$in_text."'"; -$rrd_options .= " GPRINT:in:LAST:%6.2lf%s"; -$rrd_options .= " GPRINT:in:AVERAGE:%6.2lf%s"; -$rrd_options .= " GPRINT:in_max:MAX:%6.2lf%s"; +$rrd_options .= ' LINE1.25:in#'.$colour_line_in.":'".$in_text."'"; +$rrd_options .= ' GPRINT:in:LAST:%6.2lf%s'; +$rrd_options .= ' GPRINT:in:AVERAGE:%6.2lf%s'; +$rrd_options .= ' GPRINT:in_max:MAX:%6.2lf%s'; -if ($percentile) -{ - $rrd_options .= " GPRINT:percentile_in:%6.2lf%s"; +if ($percentile) { + $rrd_options .= ' GPRINT:percentile_in:%6.2lf%s'; } $rrd_options .= " COMMENT:'\\n'"; -$rrd_options .= " AREA:dout#".$colour_area_out.":"; -$rrd_options .= " LINE1.25:dout#".$colour_line_out.":'".$out_text."'"; -$rrd_options .= " GPRINT:out:LAST:%6.2lf%s"; -$rrd_options .= " GPRINT:out:AVERAGE:%6.2lf%s"; -$rrd_options .= " GPRINT:out_max:MAX:%6.2lf%s"; +$rrd_options .= ' AREA:dout#'.$colour_area_out.':'; +$rrd_options .= ' LINE1.25:dout#'.$colour_line_out.":'".$out_text."'"; +$rrd_options .= ' GPRINT:out:LAST:%6.2lf%s'; +$rrd_options .= ' GPRINT:out:AVERAGE:%6.2lf%s'; +$rrd_options .= ' GPRINT:out_max:MAX:%6.2lf%s'; -if ($percentile) -{ - $rrd_options .= " GPRINT:percentile_out:%6.2lf%s"; +if ($percentile) { + $rrd_options .= ' GPRINT:percentile_out:%6.2lf%s'; } $rrd_options .= " COMMENT:\\\\n"; -if ($print_total) -{ - $rrd_options .= " GPRINT:tot:'Total %6.2lf%s'"; - $rrd_options .= " GPRINT:totin:'(In %6.2lf%s'"; - $rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\\\l'"; +if ($print_total) { + $rrd_options .= " GPRINT:tot:'Total %6.2lf%s'"; + $rrd_options .= " GPRINT:totin:'(In %6.2lf%s'"; + $rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\\\l'"; } -if ($percentile) -{ - $rrd_options .= " LINE1:percentile_in#aa0000"; - $rrd_options .= " LINE1:dpercentile_out#aa0000"; +if ($percentile) { + $rrd_options .= ' LINE1:percentile_in#aa0000'; + $rrd_options .= ' LINE1:dpercentile_out#aa0000'; } -if($_GET['previous'] == "yes") -{ - $rrd_options .= " LINE1.25:in".$format."X#666666:'Prev In \\\\n'"; - $rrd_options .= " AREA:in".$format."X#99999966:"; - $rrd_options .= " LINE1.25:dout".$format."X#666666:'Prev Out'"; - $rrd_options .= " AREA:dout".$format."X#99999966:"; +if ($_GET['previous'] == 'yes') { + $rrd_options .= ' LINE1.25:in'.$format."X#666666:'Prev In \\\\n'"; + $rrd_options .= ' AREA:in'.$format.'X#99999966:'; + $rrd_options .= ' LINE1.25:dout'.$format."X#666666:'Prev Out'"; + $rrd_options .= ' AREA:dout'.$format.'X#99999966:'; } -$rrd_options .= " HRULE:0#999999"; - -?> +$rrd_options .= ' HRULE:0#999999'; diff --git a/html/includes/graphs/generic_multi.inc.php b/html/includes/graphs/generic_multi.inc.php index c9c1053f8..d02e82ebb 100644 --- a/html/includes/graphs/generic_multi.inc.php +++ b/html/includes/graphs/generic_multi.inc.php @@ -1,74 +1,78 @@ "500") -{ - $descr_len=24; -} else { - $descr_len=12; - $descr_len += round(($width - 250) / 8); +if ($width > '500') { + $descr_len = 24; +} +else { + $descr_len = 12; + $descr_len += round(($width - 250) / 8); } -if ($nototal) { $descrlen += "2"; $unitlen += "2";} - -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'"; - if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; } - $rrd_options .= " COMMENT:'\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'"; - +if ($nototal) { + $descrlen += '2'; + $unitlen += '2'; } -$i = 0; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; + if (!$nototal) { + $rrd_options .= " COMMENT:'Total '"; + } + + $rrd_options .= " COMMENT:'\l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; +} + +$i = 0; $iter = 0; -foreach ($rrd_list as $rrd) -{ - if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; } +foreach ($rrd_list as $rrd) { + if (!$config['graph_colours'][$colours][$iter]) { + $iter = 0; + } - $colour=$config['graph_colours'][$colours][$iter]; + $colour = $config['graph_colours'][$colours][$iter]; - $ds = $rrd['ds']; - $filename = $rrd['filename']; + $ds = $rrd['ds']; + $filename = $rrd['filename']; - $descr = rrdtool_escape($rrd['descr'], $descr_len); + $descr = rrdtool_escape($rrd['descr'], $descr_len); - $id = "ds".$i; + $id = 'ds'.$i; - $rrd_options .= " DEF:".$id."=$filename:$ds:AVERAGE"; + $rrd_options .= ' DEF:'.$id."=$filename:$ds:AVERAGE"; - if ($simple_rrd) - { - $rrd_options .= " CDEF:".$id."min=".$id." "; - $rrd_options .= " CDEF:".$id."max=".$id." "; - } else { - $rrd_options .= " DEF:".$id."min=$filename:$ds:MIN"; - $rrd_options .= " DEF:".$id."max=$filename:$ds:MAX"; - } + if ($simple_rrd) { + $rrd_options .= ' CDEF:'.$id.'min='.$id.' '; + $rrd_options .= ' CDEF:'.$id.'max='.$id.' '; + } + else { + $rrd_options .= ' DEF:'.$id."min=$filename:$ds:MIN"; + $rrd_options .= ' DEF:'.$id."max=$filename:$ds:MAX"; + } - if ($rrd['invert']) - { - $rrd_options .= " CDEF:".$id."i=".$id.",-1,*"; - $rrd_optionsc .= " AREA:".$id."i#".$colour.":'$descr':".$cstack; - $rrd_optionsc .= " GPRINT:".$id.":LAST:%5.1lf%s GPRINT:".$id."min:MIN:%5.1lf%s"; - $rrd_optionsc .= " GPRINT:".$id."max:MAX:%5.1lf%s GPRINT:".$id.":AVERAGE:'%5.1lf%s\\n'"; - $cstack = "STACK"; - } else { - $rrd_optionsb .= " AREA:".$id."#".$colour.":'$descr':".$bstack; - $rrd_optionsb .= " GPRINT:".$id.":LAST:%5.1lf%s GPRINT:".$id."min:MIN:%5.1lf%s"; - $rrd_optionsb .= " GPRINT:".$id."max:MAX:%5.1lf%s GPRINT:".$id.":AVERAGE:'%5.1lf%s\\n'"; - $bstack = "STACK"; - } + if ($rrd['invert']) { + $rrd_options .= ' CDEF:'.$id.'i='.$id.',-1,*'; + $rrd_optionsc .= ' AREA:'.$id.'i#'.$colour.":'$descr':".$cstack; + $rrd_optionsc .= ' GPRINT:'.$id.':LAST:%5.1lf%s GPRINT:'.$id.'min:MIN:%5.1lf%s'; + $rrd_optionsc .= ' GPRINT:'.$id.'max:MAX:%5.1lf%s GPRINT:'.$id.":AVERAGE:'%5.1lf%s\\n'"; + $cstack = 'STACK'; + } + else { + $rrd_optionsb .= ' AREA:'.$id.'#'.$colour.":'$descr':".$bstack; + $rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.1lf%s GPRINT:'.$id.'min:MIN:%5.1lf%s'; + $rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.1lf%s GPRINT:'.$id.":AVERAGE:'%5.1lf%s\\n'"; + $bstack = 'STACK'; + } - $i++; $iter++; - -} + $i++; + $iter++; +}//end foreach $rrd_options .= $rrd_optionsb; -$rrd_options .= " HRULE:0#555555"; +$rrd_options .= ' HRULE:0#555555'; $rrd_options .= $rrd_optionsc; - -?> diff --git a/html/includes/graphs/generic_multi_bits.inc.php b/html/includes/graphs/generic_multi_bits.inc.php index 5ea0dfaac..caa765e4d 100644 --- a/html/includes/graphs/generic_multi_bits.inc.php +++ b/html/includes/graphs/generic_multi_bits.inc.php @@ -2,97 +2,104 @@ // Draws aggregate bits graph from multiple RRDs // Variables : colour_[line|area]_[in|out], rrd_filenames +require 'includes/graphs/common.inc.php'; -include("includes/graphs/common.inc.php"); +$i = 0; -$i=0; +foreach ($rrd_filenames as $key => $rrd_filename) { + if ($rrd_inverted[$key]) { + $in = 'out'; + $out = 'in'; + } + else { + $in = 'in'; + $out = 'out'; + } -foreach ($rrd_filenames as $key => $rrd_filename) -{ - if ($rrd_inverted[$key]) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } + $rrd_options .= ' DEF:'.$in.'octets'.$i.'='.$rrd_filename.':'.$ds_in.':AVERAGE'; + $rrd_options .= ' DEF:'.$out.'octets'.$i.'='.$rrd_filename.':'.$ds_out.':AVERAGE'; + $in_thing .= $seperator.'inoctets'.$i.',UN,0,'.'inoctets'.$i.',IF'; + $out_thing .= $seperator.'outoctets'.$i.',UN,0,'.'outoctets'.$i.',IF'; + $pluses .= $plus; + $seperator = ','; + $plus = ',+'; - $rrd_options .= " DEF:".$in."octets" . $i . "=".$rrd_filename.":".$ds_in.":AVERAGE"; - $rrd_options .= " DEF:".$out."octets" . $i . "=".$rrd_filename.":".$ds_out.":AVERAGE"; - $in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF"; - $out_thing .= $seperator . "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF"; - $pluses .= $plus; - $seperator = ","; - $plus = ",+"; + if ($_GET['previous']) { + $rrd_options .= ' DEF:'.$in.'octets'.$i.'X='.$rrd_filename.':'.$ds_in.':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' DEF:'.$out.'octets'.$i.'X='.$rrd_filename.':'.$ds_out.':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' SHIFT:'.$in.'octets'.$i."X:$period"; + $rrd_options .= ' SHIFT:'.$out.'octets'.$i."X:$period"; + $in_thingX .= $seperatorX.'inoctets'.$i.'X,UN,0,'.'inoctets'.$i.'X,IF'; + $out_thingX .= $seperatorX.'outoctets'.$i.'X,UN,0,'.'outoctets'.$i.'X,IF'; + $plusesX .= $plusX; + $seperatorX = ','; + $plusX = ',+'; + } - if ($_GET['previous']) - { - $rrd_options .= " DEF:".$in."octets" . $i . "X=".$rrd_filename.":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " DEF:".$out."octets" . $i . "X=".$rrd_filename.":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " SHIFT:".$in."octets" . $i . "X:$period"; - $rrd_options .= " SHIFT:".$out."octets" . $i . "X:$period"; - $in_thingX .= $seperatorX . "inoctets" . $i . "X,UN,0," . "inoctets" . $i . "X,IF"; - $out_thingX .= $seperatorX . "outoctets" . $i . "X,UN,0," . "outoctets" . $i . "X,IF"; - $plusesX .= $plusX; - $seperatorX = ","; - $plusX = ",+"; - } - $i++; -} + $i++; +}//end foreach -if ($i) -{ - if ($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } - $rrd_options .= " CDEF:".$in."octets=" . $in_thing . $pluses; - $rrd_options .= " CDEF:".$out."octets=" . $out_thing . $pluses; - $rrd_options .= " CDEF:doutoctets=outoctets,-1,*"; - $rrd_options .= " CDEF:inbits=inoctets,8,*"; - $rrd_options .= " CDEF:outbits=outoctets,8,*"; - $rrd_options .= " CDEF:doutbits=doutoctets,8,*"; - $rrd_options .= " VDEF:95thin=inbits,95,PERCENT"; - $rrd_options .= " VDEF:95thout=outbits,95,PERCENT"; - $rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT"; +if ($i) { + if ($inverse) { + $in = 'out'; + $out = 'in'; + } + else { + $in = 'in'; + $out = 'out'; + } - if ($_GET['previous'] == "yes") - { - $rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $pluses; - $rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $pluses; - $rrd_options .= " CDEF:doutoctetsX=outoctetsX,-1,*"; - $rrd_options .= " CDEF:inbitsX=inoctetsX,8,*"; - $rrd_options .= " CDEF:outbitsX=outoctetsX,8,*"; - $rrd_options .= " CDEF:doutbitsX=doutoctetsX,8,*"; - $rrd_options .= " VDEF:95thinX=inbitsX,95,PERCENT"; - $rrd_options .= " VDEF:95thoutX=outbitsX,95,PERCENT"; - $rrd_options .= " VDEF:d95thoutX=doutbitsX,5,PERCENT"; - } + $rrd_options .= ' CDEF:'.$in.'octets='.$in_thing.$pluses; + $rrd_options .= ' CDEF:'.$out.'octets='.$out_thing.$pluses; + $rrd_options .= ' CDEF:doutoctets=outoctets,-1,*'; + $rrd_options .= ' CDEF:inbits=inoctets,8,*'; + $rrd_options .= ' CDEF:outbits=outoctets,8,*'; + $rrd_options .= ' CDEF:doutbits=doutoctets,8,*'; + $rrd_options .= ' VDEF:95thin=inbits,95,PERCENT'; + $rrd_options .= ' VDEF:95thout=outbits,95,PERCENT'; + $rrd_options .= ' VDEF:d95thout=doutbits,5,PERCENT'; - if ($legend == 'no' || $legend == '1') - { - $rrd_options .= " AREA:inbits#".$colour_area_in.":"; - $rrd_options .= " LINE1.25:inbits#".$colour_line_in.":"; - $rrd_options .= " AREA:doutbits#".$colour_area_out.":"; - $rrd_options .= " LINE1.25:doutbits#".$colour_line_out.":"; - } else { - $rrd_options .= " AREA:inbits#".$colour_area_in.":"; - $rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'"; - $rrd_options .= " LINE1.25:inbits#".$colour_line_in.":In\ "; - $rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s"; - $rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s"; - $rrd_options .= " GPRINT:inbits:MAX:%6.2lf%s"; - $rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n"; - $rrd_options .= " AREA:doutbits#".$colour_area_out.":"; - $rrd_options .= " LINE1.25:doutbits#".$colour_line_out.":Out"; - $rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s"; - $rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s"; - $rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s"; - $rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n"; - } + if ($_GET['previous'] == 'yes') { + $rrd_options .= ' CDEF:'.$in.'octetsX='.$in_thingX.$pluses; + $rrd_options .= ' CDEF:'.$out.'octetsX='.$out_thingX.$pluses; + $rrd_options .= ' CDEF:doutoctetsX=outoctetsX,-1,*'; + $rrd_options .= ' CDEF:inbitsX=inoctetsX,8,*'; + $rrd_options .= ' CDEF:outbitsX=outoctetsX,8,*'; + $rrd_options .= ' CDEF:doutbitsX=doutoctetsX,8,*'; + $rrd_options .= ' VDEF:95thinX=inbitsX,95,PERCENT'; + $rrd_options .= ' VDEF:95thoutX=outbitsX,95,PERCENT'; + $rrd_options .= ' VDEF:d95thoutX=doutbitsX,5,PERCENT'; + } - $rrd_options .= " LINE1:95thin#aa0000"; - $rrd_options .= " LINE1:d95thout#aa0000"; + if ($legend == 'no' || $legend == '1') { + $rrd_options .= ' AREA:inbits#'.$colour_area_in.':'; + $rrd_options .= ' LINE1.25:inbits#'.$colour_line_in.':'; + $rrd_options .= ' AREA:doutbits#'.$colour_area_out.':'; + $rrd_options .= ' LINE1.25:doutbits#'.$colour_line_out.':'; + } + else { + $rrd_options .= ' AREA:inbits#'.$colour_area_in.':'; + $rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'"; + $rrd_options .= ' LINE1.25:inbits#'.$colour_line_in.':In\ '; + $rrd_options .= ' GPRINT:inbits:LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbits:AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbits:MAX:%6.2lf%s'; + $rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n"; + $rrd_options .= ' AREA:doutbits#'.$colour_area_out.':'; + $rrd_options .= ' LINE1.25:doutbits#'.$colour_line_out.':Out'; + $rrd_options .= ' GPRINT:outbits:LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbits:AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbits:MAX:%6.2lf%s'; + $rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n"; + } - if ($_GET['previous'] == "yes") - { - $rrd_options .= " AREA:inbitsX#9999966:"; - $rrd_options .= " AREA:doutbitsX#99999966:"; - } + $rrd_options .= ' LINE1:95thin#aa0000'; + $rrd_options .= ' LINE1:d95thout#aa0000'; -} + if ($_GET['previous'] == 'yes') { + $rrd_options .= ' AREA:inbitsX#9999966:'; + $rrd_options .= ' AREA:doutbitsX#99999966:'; + } +}//end if -#$rrd_options .= " HRULE:0#999999"; - -?> +// $rrd_options .= " HRULE:0#999999"; diff --git a/html/includes/graphs/generic_multi_data.inc.php b/html/includes/graphs/generic_multi_data.inc.php index 93ee5b7cf..90f5c908e 100644 --- a/html/includes/graphs/generic_multi_data.inc.php +++ b/html/includes/graphs/generic_multi_data.inc.php @@ -2,108 +2,115 @@ // Draws aggregate bits graph from multiple RRDs // Variables : colour_[line|area]_[in|out], rrd_filenames +require 'includes/graphs/common.inc.php'; -include("includes/graphs/common.inc.php"); - -if($format == "octets" || $format == "bytes") -{ - $units = "Bps"; - $format = "octets"; -} else { - $units = "bps"; - $format = "bits"; +if ($format == 'octets' || $format == 'bytes') { + $units = 'Bps'; + $format = 'octets'; +} +else { + $units = 'bps'; + $format = 'bits'; } -$i=0; +$i = 0; -foreach ($rrd_filenames as $key => $rrd_filename) -{ - if ($rrd_inverted[$key]) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } +foreach ($rrd_filenames as $key => $rrd_filename) { + if ($rrd_inverted[$key]) { + $in = 'out'; + $out = 'in'; + } + else { + $in = 'in'; + $out = 'out'; + } - $rrd_options .= " DEF:".$in."octets" . $i . "=".$rrd_filename.":".$ds_in.":AVERAGE"; - $rrd_options .= " DEF:".$out."octets" . $i . "=".$rrd_filename.":".$ds_out.":AVERAGE"; - $in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF"; - $out_thing .= $seperator . "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF"; - $pluses .= $plus; - $seperator = ","; - $plus = ",+"; + $rrd_options .= ' DEF:'.$in.'octets'.$i.'='.$rrd_filename.':'.$ds_in.':AVERAGE'; + $rrd_options .= ' DEF:'.$out.'octets'.$i.'='.$rrd_filename.':'.$ds_out.':AVERAGE'; + $in_thing .= $seperator.'inoctets'.$i.',UN,0,'.'inoctets'.$i.',IF'; + $out_thing .= $seperator.'outoctets'.$i.',UN,0,'.'outoctets'.$i.',IF'; + $pluses .= $plus; + $seperator = ','; + $plus = ',+'; - if ($_GET['previous']) - { - $rrd_options .= " DEF:".$in."octets" . $i . "X=".$rrd_filename.":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " DEF:".$out."octets" . $i . "X=".$rrd_filename.":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " SHIFT:".$in."octets" . $i . "X:$period"; - $rrd_options .= " SHIFT:".$out."octets" . $i . "X:$period"; - $in_thingX .= $seperatorX . "inoctets" . $i . "X,UN,0," . "inoctets" . $i . "X,IF"; - $out_thingX .= $seperatorX . "outoctets" . $i . "X,UN,0," . "outoctets" . $i . "X,IF"; - $plusesX .= $plusX; - $seperatorX = ","; - $plusX = ",+"; - } - $i++; -} + if ($_GET['previous']) { + $rrd_options .= ' DEF:'.$in.'octets'.$i.'X='.$rrd_filename.':'.$ds_in.':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' DEF:'.$out.'octets'.$i.'X='.$rrd_filename.':'.$ds_out.':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' SHIFT:'.$in.'octets'.$i."X:$period"; + $rrd_options .= ' SHIFT:'.$out.'octets'.$i."X:$period"; + $in_thingX .= $seperatorX.'inoctets'.$i.'X,UN,0,'.'inoctets'.$i.'X,IF'; + $out_thingX .= $seperatorX.'outoctets'.$i.'X,UN,0,'.'outoctets'.$i.'X,IF'; + $plusesX .= $plusX; + $seperatorX = ','; + $plusX = ',+'; + } -if ($i) -{ - if ($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } - $rrd_options .= " CDEF:".$in."octets=" . $in_thing . $pluses; - $rrd_options .= " CDEF:".$out."octets=" . $out_thing . $pluses; - $rrd_options .= " CDEF:doutoctets=outoctets,-1,*"; - $rrd_options .= " CDEF:inbits=inoctets,8,*"; - $rrd_options .= " CDEF:outbits=outoctets,8,*"; - $rrd_options .= " CDEF:doutbits=doutoctets,8,*"; - $rrd_options .= " VDEF:95thin=inbits,95,PERCENT"; - $rrd_options .= " VDEF:95thout=outbits,95,PERCENT"; - $rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT"; + $i++; +}//end foreach - if ($_GET['previous'] == "yes") - { - $rrd_options .= " CDEF:".$in."octetsX=" . $in_thingX . $pluses; - $rrd_options .= " CDEF:".$out."octetsX=" . $out_thingX . $pluses; - $rrd_options .= " CDEF:doutoctetsX=outoctetsX,-1,*"; - $rrd_options .= " CDEF:inbitsX=inoctetsX,8,*"; - $rrd_options .= " CDEF:outbitsX=outoctetsX,8,*"; - $rrd_options .= " CDEF:doutbitsX=doutoctetsX,8,*"; - $rrd_options .= " VDEF:95thinX=inbitsX,95,PERCENT"; - $rrd_options .= " VDEF:95thoutX=outbitsX,95,PERCENT"; - $rrd_options .= " VDEF:d95thoutX=doutbitsX,5,PERCENT"; - } +if ($i) { + if ($inverse) { + $in = 'out'; + $out = 'in'; + } + else { + $in = 'in'; + $out = 'out'; + } - if ($legend == 'no' || $legend == '1') - { - $rrd_options .= " AREA:in".$format."#".$colour_area_in.":"; -# $rrd_options .= " LINE1.25:in".$format."#".$colour_line_in.":"; - $rrd_options .= " AREA:dout".$format."#".$colour_area_out.":"; -# $rrd_options .= " LINE1.25:dout".$format."#".$colour_line_out.":"; - } else { - $rrd_options .= " AREA:in".$format."#".$colour_area_in.":"; - $rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'"; -# $rrd_options .= " LINE1.25:in".$format."#".$colour_line_in.":In\ "; - $rrd_options .= " GPRINT:in".$format.":LAST:%6.2lf%s"; - $rrd_options .= " GPRINT:in".$format.":AVERAGE:%6.2lf%s"; - $rrd_options .= " GPRINT:in".$format.":MAX:%6.2lf%s"; - $rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n"; - $rrd_options .= " AREA:dout".$format."#".$colour_area_out.":"; -# $rrd_options .= " LINE1.25:dout".$format."#".$colour_line_out.":Out"; - $rrd_options .= " GPRINT:out".$format.":LAST:%6.2lf%s"; - $rrd_options .= " GPRINT:out".$format.":AVERAGE:%6.2lf%s"; - $rrd_options .= " GPRINT:out".$format.":MAX:%6.2lf%s"; - $rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n"; - } + $rrd_options .= ' CDEF:'.$in.'octets='.$in_thing.$pluses; + $rrd_options .= ' CDEF:'.$out.'octets='.$out_thing.$pluses; + $rrd_options .= ' CDEF:doutoctets=outoctets,-1,*'; + $rrd_options .= ' CDEF:inbits=inoctets,8,*'; + $rrd_options .= ' CDEF:outbits=outoctets,8,*'; + $rrd_options .= ' CDEF:doutbits=doutoctets,8,*'; + $rrd_options .= ' VDEF:95thin=inbits,95,PERCENT'; + $rrd_options .= ' VDEF:95thout=outbits,95,PERCENT'; + $rrd_options .= ' VDEF:d95thout=doutbits,5,PERCENT'; - $rrd_options .= " LINE1:95thin#aa0000"; - $rrd_options .= " LINE1:d95thout#aa0000"; + if ($_GET['previous'] == 'yes') { + $rrd_options .= ' CDEF:'.$in.'octetsX='.$in_thingX.$pluses; + $rrd_options .= ' CDEF:'.$out.'octetsX='.$out_thingX.$pluses; + $rrd_options .= ' CDEF:doutoctetsX=outoctetsX,-1,*'; + $rrd_options .= ' CDEF:inbitsX=inoctetsX,8,*'; + $rrd_options .= ' CDEF:outbitsX=outoctetsX,8,*'; + $rrd_options .= ' CDEF:doutbitsX=doutoctetsX,8,*'; + $rrd_options .= ' VDEF:95thinX=inbitsX,95,PERCENT'; + $rrd_options .= ' VDEF:95thoutX=outbitsX,95,PERCENT'; + $rrd_options .= ' VDEF:d95thoutX=doutbitsX,5,PERCENT'; + } - if ($_GET['previous'] == "yes") - { - $rrd_options .= " AREA:in".$format."X#99999999:"; - $rrd_options .= " AREA:dout".$format."X#99999999:"; - $rrd_options .= " LINE1:in".$format."X#666666:"; - $rrd_options .= " LINE1:dout".$format."X#666666:"; - } + if ($legend == 'no' || $legend == '1') { + $rrd_options .= ' AREA:in'.$format.'#'.$colour_area_in.':'; + // $rrd_options .= " LINE1.25:in".$format."#".$colour_line_in.":"; + $rrd_options .= ' AREA:dout'.$format.'#'.$colour_area_out.':'; + // $rrd_options .= " LINE1.25:dout".$format."#".$colour_line_out.":"; + } + else { + $rrd_options .= ' AREA:in'.$format.'#'.$colour_area_in.':'; + $rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'"; + // $rrd_options .= " LINE1.25:in".$format."#".$colour_line_in.":In\ "; + $rrd_options .= ' GPRINT:in'.$format.':LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:in'.$format.':AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:in'.$format.':MAX:%6.2lf%s'; + $rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n"; + $rrd_options .= ' AREA:dout'.$format.'#'.$colour_area_out.':'; + // $rrd_options .= " LINE1.25:dout".$format."#".$colour_line_out.":Out"; + $rrd_options .= ' GPRINT:out'.$format.':LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:out'.$format.':AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:out'.$format.':MAX:%6.2lf%s'; + $rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n"; + } -} + $rrd_options .= ' LINE1:95thin#aa0000'; + $rrd_options .= ' LINE1:d95thout#aa0000'; -#$rrd_options .= " HRULE:0#999999"; + if ($_GET['previous'] == 'yes') { + $rrd_options .= ' AREA:in'.$format.'X#99999999:'; + $rrd_options .= ' AREA:dout'.$format.'X#99999999:'; + $rrd_options .= ' LINE1:in'.$format.'X#666666:'; + $rrd_options .= ' LINE1:dout'.$format.'X#666666:'; + } +}//end if -?> +// $rrd_options .= " HRULE:0#999999"; diff --git a/html/includes/graphs/generic_multi_data_separated.inc.php b/html/includes/graphs/generic_multi_data_separated.inc.php index 07d6ee6c0..7865d03de 100644 --- a/html/includes/graphs/generic_multi_data_separated.inc.php +++ b/html/includes/graphs/generic_multi_data_separated.inc.php @@ -1,117 +1,127 @@ "500") -{ - $descr_len=18; -} else { - $descr_len=8; - $descr_len += round(($width - 260) / 9.5); +if ($width > '500') { + $descr_len = 18; +} +else { + $descr_len = 8; + $descr_len += round(($width - 260) / 9.5); } -$unit_text = "Bits/sec"; +$unit_text = 'Bits/sec'; -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." Current Average Maximum '"; - if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; } - $rrd_options .= " COMMENT:'\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." Now Ave Max\l'"; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." Current Average Maximum '"; + if (!$nototal) { + $rrd_options .= " COMMENT:'Total '"; + } + $rrd_options .= " COMMENT:'\l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." Now Ave Max\l'"; } -if(!isset($multiplier)) { $multiplier = "8"; } - -foreach ($rrd_list as $rrd) -{ - if (!$config['graph_colours'][$colours_in][$iter] || !$config['graph_colours'][$colours_out][$iter]) { $iter = 0; } - - $colour_in=$config['graph_colours'][$colours_in][$iter]; - $colour_out=$config['graph_colours'][$colours_out][$iter]; - - if (isset($rrd['descr_in'])) - { - $descr = rrdtool_escape($rrd['descr_in'], $descr_len) . " In"; - } else { - $descr = rrdtool_escape($rrd['descr'], $descr_len) . " In"; - } - $descr_out = rrdtool_escape($rrd['descr_out'], $descr_len) . " Out"; - $descr = str_replace("'", "", $descr); // FIXME does this mean ' should be filtered in rrdtool_escape? probably... - $descr_out = str_replace("'", "", $descr_out); - - $rrd_options .= " DEF:".$in.$i."=".$rrd['filename'].":".$ds_in.":AVERAGE "; - $rrd_options .= " DEF:".$out.$i."=".$rrd['filename'].":".$ds_out.":AVERAGE "; - $rrd_options .= " CDEF:inB".$i."=in".$i.",$multiplier,* "; - $rrd_options .= " CDEF:outB".$i."=out".$i.",$multiplier,*"; - $rrd_options .= " CDEF:outB".$i."_neg=outB".$i.",-1,*"; - $rrd_options .= " CDEF:octets".$i."=inB".$i.",outB".$i.",+"; - - if (!$args['nototal']) - { - - $in_thing .= $seperator . $in . $i . ",UN,0," . $in . $i . ",IF"; - $out_thing .= $seperator . $out . $i . ",UN,0," . $out . $i . ",IF"; - $pluses .= $plus; - $seperator = ","; - $plus = ",+"; - - $rrd_options .= " VDEF:totin".$i."=inB".$i.",TOTAL"; - $rrd_options .= " VDEF:totout".$i."=outB".$i.",TOTAL"; - $rrd_options .= " VDEF:tot".$i."=octets".$i.",TOTAL"; - } - - if ($i) { $stack="STACK"; } - - $rrd_options .= " AREA:inB".$i."#" . $colour_in . ":'" . $descr . "':$stack"; - $rrd_options .= " GPRINT:inB".$i.":LAST:%6.2lf%s$units"; - $rrd_options .= " GPRINT:inB".$i.":AVERAGE:%6.2lf%s$units"; - $rrd_options .= " GPRINT:inB".$i.":MAX:%6.2lf%s$units\l"; - - if (!$nototal) { $rrd_options .= " GPRINT:totin".$i.":%6.2lf%s$total_units"; } - - $rrd_options .= " 'HRULE:0#" . $colour_out.":".$descr_out."'"; - $rrd_optionsb .= " 'AREA:outB".$i."_neg#" . $colour_out . "::$stack'"; - $rrd_options .= " GPRINT:outB".$i.":LAST:%6.2lf%s$units"; - $rrd_options .= " GPRINT:outB".$i.":AVERAGE:%6.2lf%s$units"; - $rrd_options .= " GPRINT:outB".$i.":MAX:%6.2lf%s$units\l"; - - if (!$nototal) { $rrd_options .= " GPRINT:totout".$i.":%6.2lf%s$total_units"; } - - $rrd_options .= " 'COMMENT:\l'"; - $i++; $iter++; +if (!isset($multiplier)) { + $multiplier = '8'; } -if ($custom_graph) { $rrd_options .= $custom_graph; } +foreach ($rrd_list as $rrd) { + if (!$config['graph_colours'][$colours_in][$iter] || !$config['graph_colours'][$colours_out][$iter]) { + $iter = 0; + } -if(!$nototal) -{ - $rrd_options .= " CDEF:".$in."octets=" . $in_thing . $pluses; - $rrd_options .= " CDEF:".$out."octets=" . $out_thing . $pluses; - $rrd_options .= " CDEF:octets=inoctets,outoctets,+"; - $rrd_options .= " CDEF:doutoctets=outoctets,-1,*"; - $rrd_options .= " CDEF:inbits=inoctets,8,*"; - $rrd_options .= " CDEF:outbits=outoctets,8,*"; - $rrd_options .= " CDEF:doutbits=doutoctets,8,*"; + $colour_in = $config['graph_colours'][$colours_in][$iter]; + $colour_out = $config['graph_colours'][$colours_out][$iter]; - $rrd_options .= " VDEF:95thin=inbits,95,PERCENT"; - $rrd_options .= " VDEF:95thout=outbits,95,PERCENT"; - $rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT"; + if (isset($rrd['descr_in'])) { + $descr = rrdtool_escape($rrd['descr_in'], $descr_len).' In'; + } + else { + $descr = rrdtool_escape($rrd['descr'], $descr_len).' In'; + } - $rrd_options .= " VDEF:totin=inoctets,TOTAL"; - $rrd_options .= " VDEF:totout=outoctets,TOTAL"; - $rrd_options .= " VDEF:tot=octets,TOTAL"; + $descr_out = rrdtool_escape($rrd['descr_out'], $descr_len).' Out'; + $descr = str_replace("'", '', $descr); + // FIXME does this mean ' should be filtered in rrdtool_escape? probably... + $descr_out = str_replace("'", '', $descr_out); -# $rrd_options .= " AREA:totin#" . $colour_in . ":'" . $descr . "':$stack"; -# $rrd_options .= " GPRINT:totin:LAST:%6.2lf%s$units"; -# $rrd_options .= " GPRINT:totin:AVERAGE:%6.2lf%s$units"; -# $rrd_options .= " GPRINT:totin:MAX:%6.2lf%s$units\l"; + $rrd_options .= ' DEF:'.$in.$i.'='.$rrd['filename'].':'.$ds_in.':AVERAGE '; + $rrd_options .= ' DEF:'.$out.$i.'='.$rrd['filename'].':'.$ds_out.':AVERAGE '; + $rrd_options .= ' CDEF:inB'.$i.'=in'.$i.",$multiplier,* "; + $rrd_options .= ' CDEF:outB'.$i.'=out'.$i.",$multiplier,*"; + $rrd_options .= ' CDEF:outB'.$i.'_neg=outB'.$i.',-1,*'; + $rrd_options .= ' CDEF:octets'.$i.'=inB'.$i.',outB'.$i.',+'; + if (!$args['nototal']) { + $in_thing .= $seperator.$in.$i.',UN,0,'.$in.$i.',IF'; + $out_thing .= $seperator.$out.$i.',UN,0,'.$out.$i.',IF'; + $pluses .= $plus; + $seperator = ','; + $plus = ',+'; + + $rrd_options .= ' VDEF:totin'.$i.'=inB'.$i.',TOTAL'; + $rrd_options .= ' VDEF:totout'.$i.'=outB'.$i.',TOTAL'; + $rrd_options .= ' VDEF:tot'.$i.'=octets'.$i.',TOTAL'; + } + + if ($i) { + $stack = 'STACK'; + } + + $rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."':$stack"; + $rrd_options .= ' GPRINT:inB'.$i.":LAST:%6.2lf%s$units"; + $rrd_options .= ' GPRINT:inB'.$i.":AVERAGE:%6.2lf%s$units"; + $rrd_options .= ' GPRINT:inB'.$i.":MAX:%6.2lf%s$units\l"; + + if (!$nototal) { + $rrd_options .= ' GPRINT:totin'.$i.":%6.2lf%s$total_units"; + } + + $rrd_options .= " 'HRULE:0#".$colour_out.':'.$descr_out."'"; + $rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out."::$stack'"; + $rrd_options .= ' GPRINT:outB'.$i.":LAST:%6.2lf%s$units"; + $rrd_options .= ' GPRINT:outB'.$i.":AVERAGE:%6.2lf%s$units"; + $rrd_options .= ' GPRINT:outB'.$i.":MAX:%6.2lf%s$units\l"; + + if (!$nototal) { + $rrd_options .= ' GPRINT:totout'.$i.":%6.2lf%s$total_units"; + } + + $rrd_options .= " 'COMMENT:\l'"; + $i++; + $iter++; +}//end foreach + +if ($custom_graph) { + $rrd_options .= $custom_graph; } +if (!$nototal) { + $rrd_options .= ' CDEF:'.$in.'octets='.$in_thing.$pluses; + $rrd_options .= ' CDEF:'.$out.'octets='.$out_thing.$pluses; + $rrd_options .= ' CDEF:octets=inoctets,outoctets,+'; + $rrd_options .= ' CDEF:doutoctets=outoctets,-1,*'; + $rrd_options .= ' CDEF:inbits=inoctets,8,*'; + $rrd_options .= ' CDEF:outbits=outoctets,8,*'; + $rrd_options .= ' CDEF:doutbits=doutoctets,8,*'; + + $rrd_options .= ' VDEF:95thin=inbits,95,PERCENT'; + $rrd_options .= ' VDEF:95thout=outbits,95,PERCENT'; + $rrd_options .= ' VDEF:d95thout=doutbits,5,PERCENT'; + + $rrd_options .= ' VDEF:totin=inoctets,TOTAL'; + $rrd_options .= ' VDEF:totout=outoctets,TOTAL'; + $rrd_options .= ' VDEF:tot=octets,TOTAL'; + + // $rrd_options .= " AREA:totin#" . $colour_in . ":'" . $descr . "':$stack"; + // $rrd_options .= " GPRINT:totin:LAST:%6.2lf%s$units"; + // $rrd_options .= " GPRINT:totin:AVERAGE:%6.2lf%s$units"; + // $rrd_options .= " GPRINT:totin:MAX:%6.2lf%s$units\l"; +}//end if + $rrd_options .= $rrd_optionsb; -$rrd_options .= " HRULE:0#999999"; - -?> +$rrd_options .= ' HRULE:0#999999'; diff --git a/html/includes/graphs/generic_multi_line.inc.php b/html/includes/graphs/generic_multi_line.inc.php index 7117f79e1..c34d78e77 100644 --- a/html/includes/graphs/generic_multi_line.inc.php +++ b/html/includes/graphs/generic_multi_line.inc.php @@ -1,72 +1,80 @@ "500") -{ - $descr_len=24; -} else { - $descr_len=12; - $descr_len += round(($width - 250) / 8); +if ($width > '500') { + $descr_len = 24; +} +else { + $descr_len = 12; + $descr_len += round(($width - 250) / 8); } -if ($nototal) { $descrlen += "2"; $unitlen += "2";} - -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'"; - if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; } - $rrd_options .= " COMMENT:'\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'"; - +if ($nototal) { + $descrlen += '2'; + $unitlen += '2'; } -$i = 0; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; + if (!$nototal) { + $rrd_options .= " COMMENT:'Total '"; + } + + $rrd_options .= " COMMENT:'\l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; +} + +$i = 0; $iter = 0; -foreach ($rrd_list as $rrd) -{ - if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; } +foreach ($rrd_list as $rrd) { + if (!$config['graph_colours'][$colours][$iter]) { + $iter = 0; + } - $colour=$config['graph_colours'][$colours][$iter]; + $colour = $config['graph_colours'][$colours][$iter]; - $ds = $rrd['ds']; - $filename = $rrd['filename']; + $ds = $rrd['ds']; + $filename = $rrd['filename']; - $descr = rrdtool_escape($rrd['descr'], $descr_len); + $descr = rrdtool_escape($rrd['descr'], $descr_len); - $id = "ds".$i; + $id = 'ds'.$i; - $rrd_options .= " DEF:".$id."=$filename:$ds:AVERAGE"; + $rrd_options .= ' DEF:'.$id."=$filename:$ds:AVERAGE"; - if ($simple_rrd) - { - $rrd_options .= " CDEF:".$id."min=".$id." "; - $rrd_options .= " CDEF:".$id."max=".$id." "; - } else { - $rrd_options .= " DEF:".$id."min=$filename:$ds:MIN"; - $rrd_options .= " DEF:".$id."max=$filename:$ds:MAX"; - } + if ($simple_rrd) { + $rrd_options .= ' CDEF:'.$id.'min='.$id.' '; + $rrd_options .= ' CDEF:'.$id.'max='.$id.' '; + } + else { + $rrd_options .= ' DEF:'.$id."min=$filename:$ds:MIN"; + $rrd_options .= ' DEF:'.$id."max=$filename:$ds:MAX"; + } - if ($rrd['invert']) - { - $rrd_options .= " CDEF:".$id."i=".$id.",-1,*"; - $rrd_optionsb .= " LINE1.25:".$id."i#".$colour.":'$descr'"; - if (!empty($rrd['areacolour'])) { $rrd_optionsb .= " AREA:".$id."i#" . $rrd['areacolour']; } - } else { - $rrd_optionsb .= " LINE1.25:".$id."#".$colour.":'$descr'"; - if (!empty($rrd['areacolour'])) { $rrd_optionsb .= " AREA:".$id."#" . $rrd['areacolour']; } - } + if ($rrd['invert']) { + $rrd_options .= ' CDEF:'.$id.'i='.$id.',-1,*'; + $rrd_optionsb .= ' LINE1.25:'.$id.'i#'.$colour.":'$descr'"; + if (!empty($rrd['areacolour'])) { + $rrd_optionsb .= ' AREA:'.$id.'i#'.$rrd['areacolour']; + } + } + else { + $rrd_optionsb .= ' LINE1.25:'.$id.'#'.$colour.":'$descr'"; + if (!empty($rrd['areacolour'])) { + $rrd_optionsb .= ' AREA:'.$id.'#'.$rrd['areacolour']; + } + } - $rrd_optionsb .= " GPRINT:".$id.":LAST:%5.2lf%s GPRINT:".$id."min:MIN:%5.2lf%s"; - $rrd_optionsb .= " GPRINT:".$id."max:MAX:%5.2lf%s GPRINT:".$id.":AVERAGE:'%5.2lf%s\\n'"; + $rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.2lf%s GPRINT:'.$id.'min:MIN:%5.2lf%s'; + $rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s GPRINT:'.$id.":AVERAGE:'%5.2lf%s\\n'"; - $i++; $iter++; - -} + $i++; + $iter++; +}//end foreach $rrd_options .= $rrd_optionsb; -$rrd_options .= " HRULE:0#555555"; - -?> +$rrd_options .= ' HRULE:0#555555'; diff --git a/html/includes/graphs/generic_multi_simplex_seperated.inc.php b/html/includes/graphs/generic_multi_simplex_seperated.inc.php index adc08d957..18df802ae 100644 --- a/html/includes/graphs/generic_multi_simplex_seperated.inc.php +++ b/html/includes/graphs/generic_multi_simplex_seperated.inc.php @@ -1,127 +1,137 @@ "500") -{ - $descr_len = 24; // FIXME may even be more imo? -} else { - $descr_len = 12; - $descr_len += round(($width - 250) / 8); +if ($width > '500') { + $descr_len = 24; + // FIXME may even be more imo? +} +else { + $descr_len = 12; + $descr_len += round(($width - 250) / 8); } -if ($nototal) { $descrlen += "2"; $unitlen += "2";} -$unit_text = str_pad(truncate($unit_text,$unitlen),$unitlen); - -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'"; - if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; } - $rrd_options .= " COMMENT:'\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'"; - +if ($nototal) { + $descrlen += '2'; + $unitlen += '2'; } -$unitlen = "10"; -if ($nototal) { $descrlen += "2"; $unitlen += "2";} -$unit_text = str_pad(truncate($unit_text,$unitlen),$unitlen); +$unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen); -$colour_iter=0; -foreach ($rrd_list as $i => $rrd) -{ - if ($rrd['colour']) - { - $colour = $rrd['colour']; - } else { - if (!$config['graph_colours'][$colours][$colour_iter]) { $colour_iter = 0; } - $colour = $config['graph_colours'][$colours][$colour_iter]; - $colour_iter++; - } - - $descr = rrdtool_escape($rrd['descr'], $descr_len); - - $rrd_options .= " DEF:".$rrd['ds'].$i."=".$rrd['filename'].":".$rrd['ds'].":AVERAGE "; - - if ($simple_rrd) - { - $rrd_options .= " CDEF:".$rrd['ds'].$i."min=".$rrd['ds'].$i." "; - $rrd_options .= " CDEF:".$rrd['ds'].$i."max=".$rrd['ds'].$i." "; - } else { - $rrd_options .= " DEF:".$rrd['ds'].$i."min=".$rrd['filename'].":".$rrd['ds'].":MIN "; - $rrd_options .= " DEF:".$rrd['ds'].$i."max=".$rrd['filename'].":".$rrd['ds'].":MAX "; - } - - if ($_GET['previous']) - { - $rrd_options .= " DEF:".$i . "X=".$rrd['filename'].":".$rrd['ds'].":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " SHIFT:".$i . "X:$period"; - $thingX .= $seperatorX . $i . "X,UN,0," . $i . "X,IF"; - $plusesX .= $plusX; - $seperatorX = ","; - $plusX = ",+"; - } - - // Suppress totalling? - if (!$nototal) - { - $rrd_options .= " VDEF:tot".$rrd['ds'].$i."=".$rrd['ds'].$i.",TOTAL"; - } - - // This this not the first entry? - if ($i) { $stack="STACK"; } - # if we've been passed a multiplier we must make a CDEF based on it! - $g_defname = $rrd['ds']; - if (is_numeric($multiplier)) - { - $g_defname = $rrd['ds'] . "_cdef"; - $rrd_options .= " CDEF:" . $g_defname . $i . "=" . $rrd['ds'] . $i . "," . $multiplier . ",*"; - $rrd_options .= " CDEF:" . $g_defname . $i . "min=" . $rrd['ds'] . $i . "min," . $multiplier . ",*"; - $rrd_options .= " CDEF:" . $g_defname . $i . "max=" . $rrd['ds'] . $i . "max," . $multiplier . ",*"; - - // If we've been passed a divider (divisor!) we make a CDEF for it. - } elseif (is_numeric($divider)) - { - $g_defname = $rrd['ds'] . "_cdef"; - $rrd_options .= " CDEF:" . $g_defname . $i . "=" . $rrd['ds'] . $i . "," . $divider . ",/"; - $rrd_options .= " CDEF:" . $g_defname . $i . "min=" . $rrd['ds'] . $i . "min," . $divider . ",/"; - $rrd_options .= " CDEF:" . $g_defname . $i . "max=" . $rrd['ds'] . $i . "max," . $divider . ",/"; - } - - // Are our text values related to te multiplier/divisor or not? - if (isset($text_orig) && $text_orig) - { - $t_defname = $rrd['ds']; - } else { - $t_defname = $g_defname; - } - - $rrd_options .= " AREA:".$g_defname.$i."#".$colour.":'".$descr."':$stack"; - - $rrd_options .= " GPRINT:".$t_defname.$i.":LAST:%5.2lf%s GPRINT:".$t_defname.$i."min:MIN:%5.2lf%s"; - $rrd_options .= " GPRINT:".$t_defname.$i."max:MAX:%5.2lf%s GPRINT:".$t_defname.$i.":AVERAGE:'%5.2lf%s\\n'"; - - if (!$nototal) { $rrd_options .= " GPRINT:tot".$rrd['ds'].$i.":%6.2lf%s".rrdtool_escape($total_units).""; } - - $rrd_options .= " COMMENT:'\\n'"; -} - - if ($_GET['previous'] == "yes") - { - if (is_numeric($multiplier)) - { - $rrd_options .= " CDEF:X=" . $thingX . $plusesX.",".$multiplier. ",*"; - } elseif (is_numeric($divider)) - { - $rrd_options .= " CDEF:X=" . $thingX . $plusesX.",".$divider. ",/"; - } else - { - $rrd_options .= " CDEF:X=" . $thingX . $plusesX; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; + if (!$nototal) { + $rrd_options .= " COMMENT:'Total '"; } - $rrd_options .= " AREA:X#99999999:"; - $rrd_options .= " LINE1.25:X#666666:"; + $rrd_options .= " COMMENT:'\l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; +} - } +$unitlen = '10'; +if ($nototal) { + $descrlen += '2'; + $unitlen += '2'; +} -?> +$unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen); + +$colour_iter = 0; +foreach ($rrd_list as $i => $rrd) { + if ($rrd['colour']) { + $colour = $rrd['colour']; + } + else { + if (!$config['graph_colours'][$colours][$colour_iter]) { + $colour_iter = 0; + } + + $colour = $config['graph_colours'][$colours][$colour_iter]; + $colour_iter++; + } + + $descr = rrdtool_escape($rrd['descr'], $descr_len); + + $rrd_options .= ' DEF:'.$rrd['ds'].$i.'='.$rrd['filename'].':'.$rrd['ds'].':AVERAGE '; + + if ($simple_rrd) { + $rrd_options .= ' CDEF:'.$rrd['ds'].$i.'min='.$rrd['ds'].$i.' '; + $rrd_options .= ' CDEF:'.$rrd['ds'].$i.'max='.$rrd['ds'].$i.' '; + } + else { + $rrd_options .= ' DEF:'.$rrd['ds'].$i.'min='.$rrd['filename'].':'.$rrd['ds'].':MIN '; + $rrd_options .= ' DEF:'.$rrd['ds'].$i.'max='.$rrd['filename'].':'.$rrd['ds'].':MAX '; + } + + if ($_GET['previous']) { + $rrd_options .= ' DEF:'.$i.'X='.$rrd['filename'].':'.$rrd['ds'].':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' SHIFT:'.$i."X:$period"; + $thingX .= $seperatorX.$i.'X,UN,0,'.$i.'X,IF'; + $plusesX .= $plusX; + $seperatorX = ','; + $plusX = ',+'; + } + + // Suppress totalling? + if (!$nototal) { + $rrd_options .= ' VDEF:tot'.$rrd['ds'].$i.'='.$rrd['ds'].$i.',TOTAL'; + } + + // This this not the first entry? + if ($i) { + $stack = 'STACK'; + } + + // if we've been passed a multiplier we must make a CDEF based on it! + $g_defname = $rrd['ds']; + if (is_numeric($multiplier)) { + $g_defname = $rrd['ds'].'_cdef'; + $rrd_options .= ' CDEF:'.$g_defname.$i.'='.$rrd['ds'].$i.','.$multiplier.',*'; + $rrd_options .= ' CDEF:'.$g_defname.$i.'min='.$rrd['ds'].$i.'min,'.$multiplier.',*'; + $rrd_options .= ' CDEF:'.$g_defname.$i.'max='.$rrd['ds'].$i.'max,'.$multiplier.',*'; + + // If we've been passed a divider (divisor!) we make a CDEF for it. + } + else if (is_numeric($divider)) { + $g_defname = $rrd['ds'].'_cdef'; + $rrd_options .= ' CDEF:'.$g_defname.$i.'='.$rrd['ds'].$i.','.$divider.',/'; + $rrd_options .= ' CDEF:'.$g_defname.$i.'min='.$rrd['ds'].$i.'min,'.$divider.',/'; + $rrd_options .= ' CDEF:'.$g_defname.$i.'max='.$rrd['ds'].$i.'max,'.$divider.',/'; + } + + // Are our text values related to te multiplier/divisor or not? + if (isset($text_orig) && $text_orig) { + $t_defname = $rrd['ds']; + } + else { + $t_defname = $g_defname; + } + + $rrd_options .= ' AREA:'.$g_defname.$i.'#'.$colour.":'".$descr."':$stack"; + + $rrd_options .= ' GPRINT:'.$t_defname.$i.':LAST:%5.2lf%s GPRINT:'.$t_defname.$i.'min:MIN:%5.2lf%s'; + $rrd_options .= ' GPRINT:'.$t_defname.$i.'max:MAX:%5.2lf%s GPRINT:'.$t_defname.$i.":AVERAGE:'%5.2lf%s\\n'"; + + if (!$nototal) { + $rrd_options .= ' GPRINT:tot'.$rrd['ds'].$i.':%6.2lf%s'.rrdtool_escape($total_units).''; + } + + $rrd_options .= " COMMENT:'\\n'"; +}//end foreach + +if ($_GET['previous'] == 'yes') { + if (is_numeric($multiplier)) { + $rrd_options .= ' CDEF:X='.$thingX.$plusesX.','.$multiplier.',*'; + } + else if (is_numeric($divider)) { + $rrd_options .= ' CDEF:X='.$thingX.$plusesX.','.$divider.',/'; + } + else { + $rrd_options .= ' CDEF:X='.$thingX.$plusesX; + } + + $rrd_options .= ' AREA:X#99999999:'; + $rrd_options .= ' LINE1.25:X#666666:'; +} diff --git a/html/includes/graphs/generic_simplex.inc.php b/html/includes/graphs/generic_simplex.inc.php index ddc45ba2a..186cc80a0 100644 --- a/html/includes/graphs/generic_simplex.inc.php +++ b/html/includes/graphs/generic_simplex.inc.php @@ -1,128 +1,117 @@ + if ($percentile) { + $rrd_options .= ' GPRINT:'.$ds.'_percentile:%6.2lf%s'; + } + + $rrd_options .= "\\\\n"; + $rrd_options .= " COMMENT:\\\\n"; + + if ($print_total) { + $rrd_options .= ' GPRINT:'.$ds.'_tot:Total\ %6.2lf%s\)\\\\l'; + } + + if ($percentile) { + $rrd_options .= ' LINE1:'.$ds.'_percentile#aa0000'; + } + + if ($_GET['previous'] == 'yes') { + $rrd_options .= ' LINE1.25:'.$ds."X#666666:'Prev \\\\n'"; + $rrd_options .= ' AREA:'.$ds.'X#99999966:'; + } +}//end if diff --git a/html/includes/graphs/global/auth.inc.php b/html/includes/graphs/global/auth.inc.php index b0ad7e578..c364820b4 100644 --- a/html/includes/graphs/global/auth.inc.php +++ b/html/includes/graphs/global/auth.inc.php @@ -1,8 +1,5 @@ = "5") -{ - $auth = 1; +if ($_SESSION['userlevel'] >= '5') { + $auth = 1; } - -?> diff --git a/html/includes/graphs/global/bits.inc.php b/html/includes/graphs/global/bits.inc.php index 862b39e50..674229ecf 100644 --- a/html/includes/graphs/global/bits.inc.php +++ b/html/includes/graphs/global/bits.inc.php @@ -1,66 +1,58 @@ +require 'includes/graphs/generic_multi_bits_separated.inc.php'; diff --git a/html/includes/graphs/global/processor_separate.inc.php b/html/includes/graphs/global/processor_separate.inc.php index 74b80b923..3afd67250 100644 --- a/html/includes/graphs/global/processor_separate.inc.php +++ b/html/includes/graphs/global/processor_separate.inc.php @@ -2,33 +2,29 @@ $i = 0; -foreach (dbFetchRows("SELECT * FROM `processors` AS P, devices AS D WHERE D.device_id = P.device_id") as $proc) -{ - $rrd_filename = $config['rrd_dir'] . "/".$proc['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd"); +foreach (dbFetchRows('SELECT * FROM `processors` AS P, devices AS D WHERE D.device_id = P.device_id') as $proc) { + $rrd_filename = $config['rrd_dir'].'/'.$proc['hostname'].'/'.safename('processor-'.$proc['processor_type'].'-'.$proc['processor_index'].'.rrd'); - if (is_file($rrd_filename)) - { - $descr = short_hrDeviceDescr($proc['processor_descr']); + 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]['ds'] = "usage"; - $rrd_list[$i]['area'] = 1; - $i++; - } + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = 'usage'; + $rrd_list[$i]['area'] = 1; + $i++; + } } -$unit_text = "Load %"; +$unit_text = 'Load %'; -$units = '%'; +$units = '%'; $total_units = '%'; -$colours ='mixed'; +$colours = 'mixed'; -$scale_min = "0"; -$scale_max = "100"; +$scale_min = '0'; +$scale_max = '100'; $nototal = 1; -include("includes/graphs/generic_multi_line.inc.php"); - -?> +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/global/processor_stack.inc.php b/html/includes/graphs/global/processor_stack.inc.php index ffe3d6225..9c205f144 100644 --- a/html/includes/graphs/global/processor_stack.inc.php +++ b/html/includes/graphs/global/processor_stack.inc.php @@ -2,34 +2,30 @@ $i = 0; -foreach (dbFetchRows("SELECT * FROM `processors` AS P, devices AS D WHERE D.device_id = P.device_id") as $proc) -{ - $rrd_filename = $config['rrd_dir'] . "/".$proc['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd"); +foreach (dbFetchRows('SELECT * FROM `processors` AS P, devices AS D WHERE D.device_id = P.device_id') as $proc) { + $rrd_filename = $config['rrd_dir'].'/'.$proc['hostname'].'/'.safename('processor-'.$proc['processor_type'].'-'.$proc['processor_index'].'.rrd'); - if (is_file($rrd_filename)) - { - $descr = short_hrDeviceDescr($proc['processor_descr']); + 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]['ds'] = "usage"; - $i++; - } + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = 'usage'; + $i++; + } } -$unit_text = "Load %"; +$unit_text = 'Load %'; -$units = '%'; +$units = '%'; $total_units = '%'; -$colours ='oranges'; +$colours = 'oranges'; -$scale_min = "0"; -$scale_max = "100"; +$scale_min = '0'; +$scale_max = '100'; -$divider = $i; +$divider = $i; $text_orig = 1; -$nototal = 1; +$nototal = 1; -include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - -?> +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/ipsectunnel/auth.inc.php b/html/includes/graphs/ipsectunnel/auth.inc.php index f780ac87a..f5aebe2d3 100644 --- a/html/includes/graphs/ipsectunnel/auth.inc.php +++ b/html/includes/graphs/ipsectunnel/auth.inc.php @@ -1,19 +1,15 @@ diff --git a/html/includes/graphs/ipsectunnel/bits.inc.php b/html/includes/graphs/ipsectunnel/bits.inc.php index cd0fa91fd..ce3e84d36 100644 --- a/html/includes/graphs/ipsectunnel/bits.inc.php +++ b/html/includes/graphs/ipsectunnel/bits.inc.php @@ -1,10 +1,8 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/ipsectunnel/pkts.inc.php b/html/includes/graphs/ipsectunnel/pkts.inc.php index d90d03482..48daf4788 100644 --- a/html/includes/graphs/ipsectunnel/pkts.inc.php +++ b/html/includes/graphs/ipsectunnel/pkts.inc.php @@ -1,19 +1,17 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/location/auth.inc.php b/html/includes/graphs/location/auth.inc.php index 1cb224e28..d3229e413 100644 --- a/html/includes/graphs/location/auth.inc.php +++ b/html/includes/graphs/location/auth.inc.php @@ -1,13 +1,9 @@ diff --git a/html/includes/graphs/location/bits.inc.php b/html/includes/graphs/location/bits.inc.php index 99e51c14c..501b39c74 100644 --- a/html/includes/graphs/location/bits.inc.php +++ b/html/includes/graphs/location/bits.inc.php @@ -1,67 +1,60 @@ +require 'includes/graphs/generic_multi_bits_separated.inc.php'; diff --git a/html/includes/graphs/macaccounting/auth.inc.php b/html/includes/graphs/macaccounting/auth.inc.php index dc1a7e84b..971874116 100644 --- a/html/includes/graphs/macaccounting/auth.inc.php +++ b/html/includes/graphs/macaccounting/auth.inc.php @@ -1,43 +1,45 @@ "); - print_r($acc); - echo(""); - } - - if (is_array($acc)) - { - - if ($auth || port_permitted($acc['port_id'])) - { - if ($debug) { echo($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")); } - - if (is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"))) - { - if ($debug) { echo("exists"); } - $rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"); - $port = get_port_by_id($acc['port_id']); - $device = device_by_id_cache($port['device_id']); - $title = generate_device_link($device); - $title .= " :: Port ".generate_port_link($port); - $title .= " :: " . formatMac($acc['mac']); - $auth = TRUE; - } else { - graph_error("file not found"); - } - } else { - graph_error("unauthenticated"); + if ($debug) { + echo '
';
+        print_r($acc);
+        echo '
'; + } + + if (is_array($acc)) { + if ($auth || port_permitted($acc['port_id'])) { + if ($debug) { + echo $config['rrd_dir'].'/'.$acc['hostname'].'/'.safename('cip-'.$acc['ifIndex'].'-'.$acc['mac'].'.rrd'); + } + + if (is_file($config['rrd_dir'].'/'.$acc['hostname'].'/'.safename('cip-'.$acc['ifIndex'].'-'.$acc['mac'].'.rrd'))) { + if ($debug) { + echo 'exists'; + } + + $rrd_filename = $config['rrd_dir'].'/'.$acc['hostname'].'/'.safename('cip-'.$acc['ifIndex'].'-'.$acc['mac'].'.rrd'); + $port = get_port_by_id($acc['port_id']); + $device = device_by_id_cache($port['device_id']); + $title = generate_device_link($device); + $title .= ' :: Port '.generate_port_link($port); + $title .= ' :: '.formatMac($acc['mac']); + $auth = true; + } + else { + graph_error('file not found'); + } + } + else { + graph_error('unauthenticated'); + } + } + else { + graph_error('entry not found'); } - } else { - graph_error("entry not found"); - } -} else { - graph_error("invalid id"); } -?> +else { + graph_error('invalid id'); +} diff --git a/html/includes/graphs/macaccounting/bits.inc.php b/html/includes/graphs/macaccounting/bits.inc.php index e0f0f5e0a..7b650081b 100644 --- a/html/includes/graphs/macaccounting/bits.inc.php +++ b/html/includes/graphs/macaccounting/bits.inc.php @@ -1,8 +1,6 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/macaccounting/pkts.inc.php b/html/includes/graphs/macaccounting/pkts.inc.php index 2a9457642..b0f0eb6c7 100644 --- a/html/includes/graphs/macaccounting/pkts.inc.php +++ b/html/includes/graphs/macaccounting/pkts.inc.php @@ -1,19 +1,17 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/mempool/usage.inc.php b/html/includes/graphs/mempool/usage.inc.php index 6fec6aa98..e3bde5516 100644 --- a/html/includes/graphs/mempool/usage.inc.php +++ b/html/includes/graphs/mempool/usage.inc.php @@ -1,33 +1,33 @@ "500") -{ - $descr_len=13; -} else { - $descr_len=8; - $descr_len += round(($width - 250) / 8); +if ($width > '500') { + $descr_len = 13; +} +else { + $descr_len = 8; + $descr_len += round(($width - 250) / 8); } -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Total Used Free( Min Max Ave)'"; - $rrd_options .= " COMMENT:'\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Total Used Free\l'"; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Total Used Free( Min Max Ave)'"; + $rrd_options .= " COMMENT:'\l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Total Used Free\l'"; } $descr = rrdtool_escape(short_hrDeviceDescr($mempool['mempool_descr']), $descr_len); -$perc = round($mempool['mempool_perc'], 0); +$perc = round($mempool['mempool_perc'], 0); $background = get_percentage_colours($perc); $rrd_options .= " DEF:$mempool[mempool_id]used=$rrd_filename:used:AVERAGE"; @@ -35,33 +35,31 @@ $rrd_options .= " DEF:$mempool[mempool_id]free=$rrd_filename:free:AVERAGE"; $rrd_options .= " CDEF:$mempool[mempool_id]size=$mempool[mempool_id]used,$mempool[mempool_id]free,+"; $rrd_options .= " CDEF:$mempool[mempool_id]perc=$mempool[mempool_id]used,$mempool[mempool_id]size,/,100,*"; $rrd_options .= " CDEF:$mempool[mempool_id]percx=100,$mempool[mempool_id]perc,-"; -$rrd_options .= " AREA:$mempool[mempool_id]perc#" . $background['right'] . ":"; +$rrd_options .= " AREA:$mempool[mempool_id]perc#".$background['right'].':'; -if($width > "500") -{ - $rrd_options .= " LINE1.25:$mempool[mempool_id]perc#" . $background['left'] . ":'$descr'"; - $rrd_options .= " GPRINT:$mempool[mempool_id]size:LAST:%6.2lf%sB"; - $rrd_options .= " GPRINT:$mempool[mempool_id]used:LAST:%6.2lf%sB"; - $rrd_options .= " GPRINT:$mempool[mempool_id]free:LAST:%6.2lf%sB"; - $rrd_options .= " GPRINT:$mempool[mempool_id]free:MIN:%5.2lf%sB"; - $rrd_options .= " GPRINT:$mempool[mempool_id]free:MAX:%5.2lf%sB"; - $rrd_options .= " GPRINT:$mempool[mempool_id]free:AVERAGE:%5.2lf%sB\\\\n"; - $rrd_options .= " COMMENT:'".substr(str_pad('', $descr_len+12),0,$descr_len+12)." '"; - $rrd_options .= " GPRINT:$mempool[mempool_id]perc:LAST:'%5.2lf%% '"; - $rrd_options .= " GPRINT:$mempool[mempool_id]percx:LAST:'%5.2lf%% '"; - $rrd_options .= " GPRINT:$mempool[mempool_id]perc:MIN:'%5.2lf%% '"; - $rrd_options .= " GPRINT:$mempool[mempool_id]perc:MAX:'%5.2lf%% '"; - $rrd_options .= " GPRINT:$mempool[mempool_id]perc:AVERAGE:%5.2lf%%\\\\n"; -} else { - $rrd_options .= " LINE1.25:$mempool[mempool_id]perc#" . $background['left'] . ":'$descr'"; - $rrd_options .= " GPRINT:$mempool[mempool_id]size:LAST:%6.2lf%sB"; - $rrd_options .= " GPRINT:$mempool[mempool_id]used:LAST:%6.2lf%sB"; - $rrd_options .= " GPRINT:$mempool[mempool_id]free:LAST:%6.2lf%sB"; - $rrd_options .= " COMMENT:'\l'"; - $rrd_options .= " COMMENT:'".substr(str_pad('', $descr_len+12),0,$descr_len+12)." '"; - $rrd_options .= " GPRINT:$mempool[mempool_id]perc:LAST:'%5.2lf%% '"; - $rrd_options .= " GPRINT:$mempool[mempool_id]percx:LAST:'%5.2lf%% '"; - $rrd_options .= " COMMENT:'\l'"; +if ($width > '500') { + $rrd_options .= " LINE1.25:$mempool[mempool_id]perc#".$background['left'].":'$descr'"; + $rrd_options .= " GPRINT:$mempool[mempool_id]size:LAST:%6.2lf%sB"; + $rrd_options .= " GPRINT:$mempool[mempool_id]used:LAST:%6.2lf%sB"; + $rrd_options .= " GPRINT:$mempool[mempool_id]free:LAST:%6.2lf%sB"; + $rrd_options .= " GPRINT:$mempool[mempool_id]free:MIN:%5.2lf%sB"; + $rrd_options .= " GPRINT:$mempool[mempool_id]free:MAX:%5.2lf%sB"; + $rrd_options .= " GPRINT:$mempool[mempool_id]free:AVERAGE:%5.2lf%sB\\\\n"; + $rrd_options .= " COMMENT:'".substr(str_pad('', ($descr_len + 12)), 0, ($descr_len + 12))." '"; + $rrd_options .= " GPRINT:$mempool[mempool_id]perc:LAST:'%5.2lf%% '"; + $rrd_options .= " GPRINT:$mempool[mempool_id]percx:LAST:'%5.2lf%% '"; + $rrd_options .= " GPRINT:$mempool[mempool_id]perc:MIN:'%5.2lf%% '"; + $rrd_options .= " GPRINT:$mempool[mempool_id]perc:MAX:'%5.2lf%% '"; + $rrd_options .= " GPRINT:$mempool[mempool_id]perc:AVERAGE:%5.2lf%%\\\\n"; } - -?> +else { + $rrd_options .= " LINE1.25:$mempool[mempool_id]perc#".$background['left'].":'$descr'"; + $rrd_options .= " GPRINT:$mempool[mempool_id]size:LAST:%6.2lf%sB"; + $rrd_options .= " GPRINT:$mempool[mempool_id]used:LAST:%6.2lf%sB"; + $rrd_options .= " GPRINT:$mempool[mempool_id]free:LAST:%6.2lf%sB"; + $rrd_options .= " COMMENT:'\l'"; + $rrd_options .= " COMMENT:'".substr(str_pad('', ($descr_len + 12)), 0, ($descr_len + 12))." '"; + $rrd_options .= " GPRINT:$mempool[mempool_id]perc:LAST:'%5.2lf%% '"; + $rrd_options .= " GPRINT:$mempool[mempool_id]percx:LAST:'%5.2lf%% '"; + $rrd_options .= " COMMENT:'\l'"; +}//end if diff --git a/html/includes/graphs/multiport/auth.inc.php b/html/includes/graphs/multiport/auth.inc.php index 3ffe44929..603c6a945 100644 --- a/html/includes/graphs/multiport/auth.inc.php +++ b/html/includes/graphs/multiport/auth.inc.php @@ -1,21 +1,11 @@ +$title = 'Multi Port :: '; diff --git a/html/includes/graphs/multiport/bits.inc.php b/html/includes/graphs/multiport/bits.inc.php index 907bd06ad..de3206c23 100644 --- a/html/includes/graphs/multiport/bits.inc.php +++ b/html/includes/graphs/multiport/bits.inc.php @@ -2,30 +2,25 @@ $i = 1; -foreach (explode(",", $vars['id']) as $ifid) -{ - if (strstr($ifid, "!")) - { - $rrd_inverted[$i] = TRUE; - $ifid = str_replace("!", "", $ifid); - } +foreach (explode(',', $vars['id']) as $ifid) { + if (strstr($ifid, '!')) { + $rrd_inverted[$i] = true; + $ifid = str_replace('!', '', $ifid); + } - $int = dbFetchRow("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid)); - if (is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd"))) - { - $rrd_filenames[$i] = $config['rrd_dir'] . "/" . $int['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd"); - $i++; - } + $int = dbFetchRow('SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid)); + if (is_file($config['rrd_dir'].'/'.$int['hostname'].'/port-'.safename($int['ifIndex'].'.rrd'))) { + $rrd_filenames[$i] = $config['rrd_dir'].'/'.$int['hostname'].'/port-'.safename($int['ifIndex'].'.rrd'); + $i++; + } } -$ds_in = "INOCTETS"; -$ds_out = "OUTOCTETS"; +$ds_in = 'INOCTETS'; +$ds_out = 'OUTOCTETS'; -$colour_line_in = "006600"; -$colour_line_out = "000099"; -$colour_area_in = "CDEB8B"; -$colour_area_out = "C3D9FF"; +$colour_line_in = '006600'; +$colour_line_out = '000099'; +$colour_area_in = 'CDEB8B'; +$colour_area_out = 'C3D9FF'; -include("includes/graphs/generic_multi_data.inc.php"); - -?> +require 'includes/graphs/generic_multi_data.inc.php'; diff --git a/html/includes/graphs/multiport/bits_duo.inc.php b/html/includes/graphs/multiport/bits_duo.inc.php index 8393ece82..205ca3834 100644 --- a/html/includes/graphs/multiport/bits_duo.inc.php +++ b/html/includes/graphs/multiport/bits_duo.inc.php @@ -1,122 +1,133 @@ +$rrd_options .= ' CDEF:'.$in.'octets='.$in_thing.$pluses; +$rrd_options .= ' CDEF:'.$out.'octets='.$out_thing.$pluses; +$rrd_options .= ' CDEF:'.$in.'octetsb='.$in_thingb.$plusesb; +$rrd_options .= ' CDEF:'.$out.'octetsb='.$out_thingb.$plusesb; +$rrd_options .= ' CDEF:doutoctets=outoctets,-1,*'; +$rrd_options .= ' CDEF:inbits=inoctets,8,*'; +$rrd_options .= ' CDEF:outbits=outoctets,8,*'; +$rrd_options .= ' CDEF:doutbits=doutoctets,8,*'; +$rrd_options .= ' CDEF:doutoctetsb=outoctetsb,-1,*'; +$rrd_options .= ' CDEF:inbitsb=inoctetsb,8,*'; +$rrd_options .= ' CDEF:outbitsb=outoctetsb,8,*'; +$rrd_options .= ' CDEF:doutbitsb=doutoctetsb,8,*'; +$rrd_options .= ' CDEF:inbits_tot=inbits,inbitsb,+'; +$rrd_options .= ' CDEF:outbits_tot=outbits,outbitsb,+'; +$rrd_options .= ' CDEF:doutbits_tot=outbits_tot,-1,*'; +$rrd_options .= ' CDEF:nothing=outbits_tot,outbits_tot,-'; + +if ($legend == 'no') { + $rrd_options .= ' AREA:inbits_tot#cdeb8b:'; + $rrd_options .= ' AREA:inbits#ffcc99:'; + $rrd_options .= ' AREA:doutbits_tot#C3D9FF:'; + $rrd_options .= ' AREA:doutbits#ffcc99:'; + $rrd_options .= ' LINE1:inbits#aa9966:'; + $rrd_options .= ' LINE1:doutbits#aa9966:'; + // $rrd_options .= " LINE1:inbitsb#006600:"; + // $rrd_options .= " LINE1:doutbitsb#000066:"; + $rrd_options .= ' LINE1.25:inbits_tot#006600:'; + $rrd_options .= ' LINE1.25:doutbits_tot#000099:'; + $rrd_options .= ' LINE0.5:nothing#555555:'; +} +else { + $rrd_options .= " COMMENT:bps\ \ \ \ \ \ \ \ \ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Min\ \ \ \ \ \ Max\\\\n"; + $rrd_options .= ' AREA:inbits_tot#cdeb8b:Peering\ In\ '; + $rrd_options .= ' GPRINT:inbitsb:LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbitsb:AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbitsb:MIN:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbitsb:MAX:%6.2lf%s\\\\l'; + $rrd_options .= ' AREA:doutbits_tot#C3D9FF:'; + $rrd_options .= ' COMMENT:\ \ \ \ \ \ \ \ \ \ Out'; + $rrd_options .= ' GPRINT:outbitsb:LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbitsb:AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbitsb:MIN:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbitsb:MAX:%6.2lf%s\\\\l'; + + $rrd_options .= ' AREA:inbits#ffcc99:Transit\ In\ '; + $rrd_options .= ' GPRINT:inbits:LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbits:AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbits:MIN:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbits:MAX:%6.2lf%s\\\\l'; + $rrd_options .= ' AREA:doutbits#ffcc99:'; + $rrd_options .= ' COMMENT:\ \ \ \ \ \ \ \ \ \ Out'; + $rrd_options .= ' GPRINT:outbits:LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbits:AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbits:MIN:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbits:MAX:%6.2lf%s\\\\l'; + + $rrd_options .= ' COMMENT:Total\ \ \ \ \ In\ '; + $rrd_options .= ' GPRINT:inbits_tot:LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbits_tot:AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbits_tot:MIN:%6.2lf%s'; + $rrd_options .= ' GPRINT:inbits_tot:MAX:%6.2lf%s\\\\l'; + $rrd_options .= ' COMMENT:\ \ \ \ \ \ \ \ \ \ Out'; + $rrd_options .= ' GPRINT:outbits_tot:LAST:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbits_tot:AVERAGE:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbits_tot:MIN:%6.2lf%s'; + $rrd_options .= ' GPRINT:outbits_tot:MAX:%6.2lf%s\\\\l'; + + $rrd_options .= ' LINE1:inbits#aa9966:'; + $rrd_options .= ' LINE1:doutbits#aa9966:'; + // $rrd_options .= " LINE1.25:inbitsb#006600:"; + // $rrd_options .= " LINE1.25:doutbitsb#006600:"; + $rrd_options .= ' LINE1.25:inbits_tot#006600:'; + $rrd_options .= ' LINE1.25:doutbits_tot#000099:'; + $rrd_options .= ' LINE0.5:nothing#555555:'; +}//end if + +if ($width <= '300') { + $rrd_options .= ' --font LEGEND:7:'.$config['mono_font'].' --font AXIS:6:'.$config['mono_font'].' --font-render-mode normal'; +} diff --git a/html/includes/graphs/multiport/bits_separate.inc.php b/html/includes/graphs/multiport/bits_separate.inc.php index 3419078ad..d54259d02 100644 --- a/html/includes/graphs/multiport/bits_separate.inc.php +++ b/html/includes/graphs/multiport/bits_separate.inc.php @@ -2,30 +2,26 @@ $i = 0; -foreach (explode(",", $vars['id']) as $ifid) -{ - $port = dbFetchRow("SELECT * FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid)); - if (is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd"))) - { - $port = ifLabel($port); - $rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd"); - $rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr']; - $rrd_list[$i]['descr_in'] = $port['hostname']; - $rrd_list[$i]['descr_out'] = makeshortif($port['label']); - $i++; - } +foreach (explode(',', $vars['id']) as $ifid) { + $port = dbFetchRow('SELECT * FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid)); + if (is_file($config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd'))) { + $port = ifLabel($port); + $rrd_list[$i]['filename'] = $config['rrd_dir'].'/'.$port['hostname'].'/port-'.safename($port['ifIndex'].'.rrd'); + $rrd_list[$i]['descr'] = $port['hostname'].' '.$port['ifDescr']; + $rrd_list[$i]['descr_in'] = $port['hostname']; + $rrd_list[$i]['descr_out'] = makeshortif($port['label']); + $i++; + } } -$units = 'bps'; -$total_units='B'; -$colours_in='greens'; -$multiplier = "8"; +$units = 'bps'; +$total_units = 'B'; +$colours_in = 'greens'; +$multiplier = '8'; $colours_out = 'blues'; $nototal = 1; -$ds_in = "INOCTETS"; -$ds_out = "OUTOCTETS"; +$ds_in = 'INOCTETS'; +$ds_out = 'OUTOCTETS'; -include("includes/graphs/generic_multi_bits_separated.inc.php"); - -?> +require 'includes/graphs/generic_multi_bits_separated.inc.php'; diff --git a/html/includes/graphs/multiport/bits_trio.inc.php b/html/includes/graphs/multiport/bits_trio.inc.php index 4506c67b2..a1112a677 100644 --- a/html/includes/graphs/multiport/bits_trio.inc.php +++ b/html/includes/graphs/multiport/bits_trio.inc.php @@ -1,172 +1,197 @@ diff --git a/html/includes/graphs/munin/graph.inc.php b/html/includes/graphs/munin/graph.inc.php index 1d6be7dc9..21521c60a 100644 --- a/html/includes/graphs/munin/graph.inc.php +++ b/html/includes/graphs/munin/graph.inc.php @@ -2,63 +2,59 @@ // Attempt to draw a graph out of DSes we've collected from Munin plugins. // Reverse engineering ftw! - $scale_min = 0; -include("includes/graphs/common.inc.php"); +require 'includes/graphs/common.inc.php'; -if($width > "500") -{ - $descr_len=24; -} else { - $descr_len=14; - $descr_len += round(($width - 230) / 8.2); +if ($width > '500') { + $descr_len = 24; +} +else { + $descr_len = 14; + $descr_len += round(($width - 230) / 8.2); } -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($mplug['mplug_vlabel'], $descr_len),0,$descr_len)." Current Average Maximum\l'"; - $rrd_options .= " COMMENT:'\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($mplug['mplug_vlabel'], $descr_len),0,$descr_len)." Current Average Maximum\l'"; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($mplug['mplug_vlabel'], $descr_len), 0, $descr_len)." Current Average Maximum\l'"; + $rrd_options .= " COMMENT:'\l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($mplug['mplug_vlabel'], $descr_len), 0, $descr_len)." Current Average Maximum\l'"; } $c_i = 0; -$dbq = dbFetchRows("SELECT * FROM `munin_plugins_ds` WHERE `mplug_id` = ?", array($mplug['mplug_id'])); -foreach ($dbq as $ds) -{ - $ds_filename = $plugfile."_".$ds['ds_name'].".rrd"; - $ds_name = $ds['ds_name']; +$dbq = dbFetchRows('SELECT * FROM `munin_plugins_ds` WHERE `mplug_id` = ?', array($mplug['mplug_id'])); +foreach ($dbq as $ds) { + $ds_filename = $plugfile.'_'.$ds['ds_name'].'.rrd'; + $ds_name = $ds['ds_name']; - $cmd_def .= " DEF:".$ds['ds_name']."=".$ds_filename.":val:AVERAGE"; + $cmd_def .= ' DEF:'.$ds['ds_name'].'='.$ds_filename.':val:AVERAGE'; - if (!empty($ds['ds_cdef'])) - { - $cmd_cdef .= ""; - $ds_name = $ds['ds_name']."_cdef"; - } - - if ($ds['ds_graph'] == "yes") - { - if (empty($ds['colour'])) - { - if (!$config['graph_colours']['mixed'][$c_i]) { $c_i = 0; } - $colour=$config['graph_colours']['mixed'][$c_i]; $c_i++; - } else { - $colour = $ds['colour']; + if (!empty($ds['ds_cdef'])) { + $cmd_cdef .= ''; + $ds_name = $ds['ds_name'].'_cdef'; } - $descr = rrdtool_escape($ds['ds_label'], $descr_len); + if ($ds['ds_graph'] == 'yes') { + if (empty($ds['colour'])) { + if (!$config['graph_colours']['mixed'][$c_i]) { + $c_i = 0; + } - $cmd_graph .= ' '.$ds['ds_draw'].':'.$ds_name.'#'.$colour.':"'.$descr.'"'; - $cmd_graph .= ' GPRINT:'.$ds_name.':LAST:"%6.2lf%s"'; - $cmd_graph .= ' GPRINT:'.$ds_name.':AVERAGE:"%6.2lf%s"'; - $cmd_graph .= ' GPRINT:'.$ds_name.':MAX:"%6.2lf%s\\n"'; + $colour = $config['graph_colours']['mixed'][$c_i]; + $c_i++; + } + else { + $colour = $ds['colour']; + } - } + $descr = rrdtool_escape($ds['ds_label'], $descr_len); -} + $cmd_graph .= ' '.$ds['ds_draw'].':'.$ds_name.'#'.$colour.':"'.$descr.'"'; + $cmd_graph .= ' GPRINT:'.$ds_name.':LAST:"%6.2lf%s"'; + $cmd_graph .= ' GPRINT:'.$ds_name.':AVERAGE:"%6.2lf%s"'; + $cmd_graph .= ' GPRINT:'.$ds_name.':MAX:"%6.2lf%s\\n"'; + } +}//end foreach -$rrd_options .= $cmd_def . $cmd_cdef . $cmd_graph; - -?> +$rrd_options .= $cmd_def.$cmd_cdef.$cmd_graph; diff --git a/html/includes/graphs/netscalervsvr/auth.inc.php b/html/includes/graphs/netscalervsvr/auth.inc.php index 6b90b0632..dbeb11450 100644 --- a/html/includes/graphs/netscalervsvr/auth.inc.php +++ b/html/includes/graphs/netscalervsvr/auth.inc.php @@ -1,20 +1,15 @@ diff --git a/html/includes/graphs/netscalervsvr/bits.inc.php b/html/includes/graphs/netscalervsvr/bits.inc.php index 17707bbb3..58ef562b6 100644 --- a/html/includes/graphs/netscalervsvr/bits.inc.php +++ b/html/includes/graphs/netscalervsvr/bits.inc.php @@ -1,8 +1,6 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/netscalervsvr/conns.inc.php b/html/includes/graphs/netscalervsvr/conns.inc.php index 9f17d874a..38927dc18 100644 --- a/html/includes/graphs/netscalervsvr/conns.inc.php +++ b/html/includes/graphs/netscalervsvr/conns.inc.php @@ -1,22 +1,20 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/netscalervsvr/hitmiss.inc.php b/html/includes/graphs/netscalervsvr/hitmiss.inc.php index 31e557dcb..cc4e63395 100644 --- a/html/includes/graphs/netscalervsvr/hitmiss.inc.php +++ b/html/includes/graphs/netscalervsvr/hitmiss.inc.php @@ -1,23 +1,23 @@ +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/netscalervsvr/pkts.inc.php b/html/includes/graphs/netscalervsvr/pkts.inc.php index 988e0c2f0..dd5ccec32 100644 --- a/html/includes/graphs/netscalervsvr/pkts.inc.php +++ b/html/includes/graphs/netscalervsvr/pkts.inc.php @@ -1,19 +1,17 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/netscalervsvr/reqs.inc.php b/html/includes/graphs/netscalervsvr/reqs.inc.php index d39c6f9cb..758536538 100644 --- a/html/includes/graphs/netscalervsvr/reqs.inc.php +++ b/html/includes/graphs/netscalervsvr/reqs.inc.php @@ -1,22 +1,20 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/old_generic_simplex.inc.php b/html/includes/graphs/old_generic_simplex.inc.php index bbf6f9e02..24a93147c 100644 --- a/html/includes/graphs/old_generic_simplex.inc.php +++ b/html/includes/graphs/old_generic_simplex.inc.php @@ -2,97 +2,90 @@ // Draw generic bits graph // args: ds_in, ds_out, rrd_filename, bg, legend, from, to, width, height, inverse, percentile +require 'includes/graphs/common.inc.php'; -include("includes/graphs/common.inc.php"); +$unit_text = str_pad(truncate($unit_text, 18, ''), 18); +$line_text = str_pad(truncate($line_text, 12, ''), 12); -$unit_text = str_pad(truncate($unit_text,18,''),18); -$line_text = str_pad(truncate($line_text,12,''),12); - -if ($multiplier) -{ - if (empty($multiplier_action)) { - $multiplier_action = "*"; - } - $rrd_options .= " DEF:".$ds."_o=".$rrd_filename.":".$ds.":AVERAGE"; - $rrd_options .= " CDEF:".$ds."=".$ds."_o,$multiplier,$multiplier_action"; -} else { - $rrd_options .= " DEF:".$ds."=".$rrd_filename.":".$ds.":AVERAGE"; -} -if ($print_total) -{ - $rrd_options .= " VDEF:".$ds."_total=ds,TOTAL"; -} - -if ($percentile) -{ - $rrd_options .= " VDEF:".$ds."_percentile=".$ds.",".$percentile.",PERCENT"; -} - -if($_GET['previous'] == "yes") -{ - if ($multiplier) - { +if ($multiplier) { if (empty($multiplier_action)) { - $multiplier_action = "*"; + $multiplier_action = '*'; } - $rrd_options .= " DEF:".$ds."_oX=".$rrd_filename.":".$ds.":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " SHIFT:".$ds."_oX:$period"; - $rrd_options .= " CDEF:".$ds."X=".$ds."_oX,$multiplier,*"; - } else { - $rrd_options .= " DEF:".$ds."X=".$rrd_filename.":".$ds.":AVERAGE:start=".$prev_from.":end=".$from; - $rrd_options .= " SHIFT:".$ds."X:$period"; - } - if ($print_total) - { - $rrd_options .= " VDEF:".$ds."_totalX=ds,TOTAL"; - } - if ($percentile) - { - $rrd_options .= " VDEF:".$ds."_percentileX=".$ds.",".$percentile.",PERCENT"; - } -# if ($graph_max) -# { -# $rrd_options .= " AREA:".$ds."_max#".$colour_area_max.":"; -# } + + $rrd_options .= ' DEF:'.$ds.'_o='.$rrd_filename.':'.$ds.':AVERAGE'; + $rrd_options .= ' CDEF:'.$ds.'='.$ds."_o,$multiplier,$multiplier_action"; +} +else { + $rrd_options .= ' DEF:'.$ds.'='.$rrd_filename.':'.$ds.':AVERAGE'; } -$rrd_options .= " AREA:".$ds."#".$colour_area.":"; +if ($print_total) { + $rrd_options .= ' VDEF:'.$ds.'_total=ds,TOTAL'; +} -$rrd_options .= " COMMENT:'".$unit_text."Now Ave Max"; +if ($percentile) { + $rrd_options .= ' VDEF:'.$ds.'_percentile='.$ds.','.$percentile.',PERCENT'; +} -if ($percentile) -{ - $rrd_options .= " ".$percentile."th %"; +if ($_GET['previous'] == 'yes') { + if ($multiplier) { + if (empty($multiplier_action)) { + $multiplier_action = '*'; + } + + $rrd_options .= ' DEF:'.$ds.'_oX='.$rrd_filename.':'.$ds.':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' SHIFT:'.$ds."_oX:$period"; + $rrd_options .= ' CDEF:'.$ds.'X='.$ds."_oX,$multiplier,*"; + } + else { + $rrd_options .= ' DEF:'.$ds.'X='.$rrd_filename.':'.$ds.':AVERAGE:start='.$prev_from.':end='.$from; + $rrd_options .= ' SHIFT:'.$ds."X:$period"; + } + + if ($print_total) { + $rrd_options .= ' VDEF:'.$ds.'_totalX=ds,TOTAL'; + } + + if ($percentile) { + $rrd_options .= ' VDEF:'.$ds.'_percentileX='.$ds.','.$percentile.',PERCENT'; + } + + // if ($graph_max) + // { + // $rrd_options .= " AREA:".$ds."_max#".$colour_area_max.":"; + // } +}//end if + +$rrd_options .= ' AREA:'.$ds.'#'.$colour_area.':'; + +$rrd_options .= " COMMENT:'".$unit_text.'Now Ave Max'; + +if ($percentile) { + $rrd_options .= ' '.$percentile.'th %'; } $rrd_options .= "\\n'"; -$rrd_options .= " LINE1.25:".$ds."#".$colour_line.":'".$line_text."'"; -$rrd_options .= " GPRINT:".$ds.":LAST:%6.2lf%s"; -$rrd_options .= " GPRINT:".$ds.":AVERAGE:%6.2lf%s"; -$rrd_options .= " GPRINT:".$ds.":MAX:%6.2lf%s"; +$rrd_options .= ' LINE1.25:'.$ds.'#'.$colour_line.":'".$line_text."'"; +$rrd_options .= ' GPRINT:'.$ds.':LAST:%6.2lf%s'; +$rrd_options .= ' GPRINT:'.$ds.':AVERAGE:%6.2lf%s'; +$rrd_options .= ' GPRINT:'.$ds.':MAX:%6.2lf%s'; -if ($percentile) -{ - $rrd_options .= " GPRINT:".$ds."_percentile:%6.2lf%s"; +if ($percentile) { + $rrd_options .= ' GPRINT:'.$ds.'_percentile:%6.2lf%s'; } $rrd_options .= "\\\\n"; $rrd_options .= " COMMENT:\\\\n"; -if ($print_total) -{ - $rrd_options .= " GPRINT:".$ds."_tot:Total\ %6.2lf%s\)\\\\l"; +if ($print_total) { + $rrd_options .= ' GPRINT:'.$ds.'_tot:Total\ %6.2lf%s\)\\\\l'; } -if ($percentile) -{ - $rrd_options .= " LINE1:".$ds."_percentile#aa0000"; +if ($percentile) { + $rrd_options .= ' LINE1:'.$ds.'_percentile#aa0000'; } -if($_GET['previous'] == "yes") -{ - $rrd_options .= " LINE1.25:".$ds."X#666666:'Prev \\\\n'"; - $rrd_options .= " AREA:".$ds."X#99999966:"; +if ($_GET['previous'] == 'yes') { + $rrd_options .= ' LINE1.25:'.$ds."X#666666:'Prev \\\\n'"; + $rrd_options .= ' AREA:'.$ds.'X#99999966:'; } - -?> diff --git a/html/includes/graphs/port/adsl_attainable.inc.php b/html/includes/graphs/port/adsl_attainable.inc.php index 8ca0186f2..ad84314a0 100644 --- a/html/includes/graphs/port/adsl_attainable.inc.php +++ b/html/includes/graphs/port/adsl_attainable.inc.php @@ -1,28 +1,25 @@ \ No newline at end of file diff --git a/html/includes/graphs/port/adsl_attenuation.inc.php b/html/includes/graphs/port/adsl_attenuation.inc.php index 1c30b4a48..74cb1e2d3 100644 --- a/html/includes/graphs/port/adsl_attenuation.inc.php +++ b/html/includes/graphs/port/adsl_attenuation.inc.php @@ -1,28 +1,25 @@ \ No newline at end of file diff --git a/html/includes/graphs/port/adsl_power.inc.php b/html/includes/graphs/port/adsl_power.inc.php index eb5fd36dc..5b7d8957a 100644 --- a/html/includes/graphs/port/adsl_power.inc.php +++ b/html/includes/graphs/port/adsl_power.inc.php @@ -1,28 +1,25 @@ \ No newline at end of file diff --git a/html/includes/graphs/port/adsl_snr.inc.php b/html/includes/graphs/port/adsl_snr.inc.php index adf8f325e..9c369cda6 100644 --- a/html/includes/graphs/port/adsl_snr.inc.php +++ b/html/includes/graphs/port/adsl_snr.inc.php @@ -1,28 +1,25 @@ diff --git a/html/includes/graphs/port/adsl_speed.inc.php b/html/includes/graphs/port/adsl_speed.inc.php index da0c4b20b..25a080980 100644 --- a/html/includes/graphs/port/adsl_speed.inc.php +++ b/html/includes/graphs/port/adsl_speed.inc.php @@ -1,28 +1,25 @@ \ No newline at end of file diff --git a/html/includes/graphs/port/bits.inc.php b/html/includes/graphs/port/bits.inc.php index 8101cb933..c24f376dd 100644 --- a/html/includes/graphs/port/bits.inc.php +++ b/html/includes/graphs/port/bits.inc.php @@ -1,8 +1,6 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/port/errors.inc.php b/html/includes/graphs/port/errors.inc.php index 8f26b14b4..bb9e8b0a2 100644 --- a/html/includes/graphs/port/errors.inc.php +++ b/html/includes/graphs/port/errors.inc.php @@ -1,30 +1,28 @@ \ No newline at end of file +require 'includes/graphs/generic_multi_seperated.inc.php'; diff --git a/html/includes/graphs/port/etherlike.inc.php b/html/includes/graphs/port/etherlike.inc.php index c021b1e73..b997b3050 100644 --- a/html/includes/graphs/port/etherlike.inc.php +++ b/html/includes/graphs/port/etherlike.inc.php @@ -1,34 +1,39 @@ +require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/port/mac_acc_total.inc.php b/html/includes/graphs/port/mac_acc_total.inc.php index c00d5ade7..eb9f0622a 100644 --- a/html/includes/graphs/port/mac_acc_total.inc.php +++ b/html/includes/graphs/port/mac_acc_total.inc.php @@ -1,108 +1,134 @@ +$rrd_options .= ' HRULE:0#999999'; diff --git a/html/includes/graphs/port/nupkts.inc.php b/html/includes/graphs/port/nupkts.inc.php index 1614b5f5e..e26f5e449 100644 --- a/html/includes/graphs/port/nupkts.inc.php +++ b/html/includes/graphs/port/nupkts.inc.php @@ -1,63 +1,58 @@ + include 'includes/graphs/generic_duplex.inc.php'; +}//end if diff --git a/html/includes/graphs/port/pagp_bits.inc.php b/html/includes/graphs/port/pagp_bits.inc.php index 43e715ad6..6c5663b08 100644 --- a/html/includes/graphs/port/pagp_bits.inc.php +++ b/html/includes/graphs/port/pagp_bits.inc.php @@ -1,28 +1,23 @@ +require 'includes/graphs/generic_multi_bits_separated.inc.php'; diff --git a/html/includes/graphs/port/upkts.inc.php b/html/includes/graphs/port/upkts.inc.php index e8cf22bdc..b0578c323 100644 --- a/html/includes/graphs/port/upkts.inc.php +++ b/html/includes/graphs/port/upkts.inc.php @@ -1,19 +1,17 @@ \ No newline at end of file +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/graphs/rserver/auth.inc.php b/html/includes/graphs/rserver/auth.inc.php index 6f0a1e274..d179370bc 100644 --- a/html/includes/graphs/rserver/auth.inc.php +++ b/html/includes/graphs/rserver/auth.inc.php @@ -1,20 +1,16 @@ diff --git a/html/includes/graphs/screenos_sessions.inc.php b/html/includes/graphs/screenos_sessions.inc.php index e33da7f34..24117d9d0 100644 --- a/html/includes/graphs/screenos_sessions.inc.php +++ b/html/includes/graphs/screenos_sessions.inc.php @@ -1,30 +1,29 @@ \ No newline at end of file +require 'generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/sensor/auth.inc.php b/html/includes/graphs/sensor/auth.inc.php index d24d1d229..c86920ecf 100644 --- a/html/includes/graphs/sensor/auth.inc.php +++ b/html/includes/graphs/sensor/auth.inc.php @@ -1,21 +1,17 @@ diff --git a/html/includes/graphs/sensor/current.inc.php b/html/includes/graphs/sensor/current.inc.php index 381d1e270..b496c002a 100644 --- a/html/includes/graphs/sensor/current.inc.php +++ b/html/includes/graphs/sensor/current.inc.php @@ -1,20 +1,23 @@ +if (is_numeric($sensor['sensor_limit_low'])) { + $rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes'; +} diff --git a/html/includes/graphs/sensor/dbm.inc.php b/html/includes/graphs/sensor/dbm.inc.php index a4ea9191f..5880ddafc 100644 --- a/html/includes/graphs/sensor/dbm.inc.php +++ b/html/includes/graphs/sensor/dbm.inc.php @@ -1,20 +1,23 @@ +if (is_numeric($sensor['sensor_limit_low'])) { + $rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes'; +} diff --git a/html/includes/graphs/sensor/fanspeed.inc.php b/html/includes/graphs/sensor/fanspeed.inc.php index 82ec16cc9..c1fad583c 100644 --- a/html/includes/graphs/sensor/fanspeed.inc.php +++ b/html/includes/graphs/sensor/fanspeed.inc.php @@ -1,17 +1,20 @@ +if (is_numeric($sensor['sensor_limit_low'])) { + $rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes'; +} diff --git a/html/includes/graphs/sensor/frequency.inc.php b/html/includes/graphs/sensor/frequency.inc.php index 27629e65c..16dfe8ac5 100644 --- a/html/includes/graphs/sensor/frequency.inc.php +++ b/html/includes/graphs/sensor/frequency.inc.php @@ -1,19 +1,22 @@ +if (is_numeric($sensor['sensor_limit_low'])) { + $rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes'; +} diff --git a/html/includes/graphs/sensor/humidity.inc.php b/html/includes/graphs/sensor/humidity.inc.php index 153d435dd..37ee96d63 100644 --- a/html/includes/graphs/sensor/humidity.inc.php +++ b/html/includes/graphs/sensor/humidity.inc.php @@ -1,29 +1,32 @@ +if (is_numeric($sensor['sensor_limit_low'])) { + $rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes'; +} diff --git a/html/includes/graphs/sensor/power.inc.php b/html/includes/graphs/sensor/power.inc.php index 1731a3d09..c279bb80a 100644 --- a/html/includes/graphs/sensor/power.inc.php +++ b/html/includes/graphs/sensor/power.inc.php @@ -1,25 +1,28 @@ +if (is_numeric($sensor['sensor_limit_low'])) { + $rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes'; +} diff --git a/html/includes/graphs/sensor/temperature.inc.php b/html/includes/graphs/sensor/temperature.inc.php index 39b0381a5..c8ffb312d 100644 --- a/html/includes/graphs/sensor/temperature.inc.php +++ b/html/includes/graphs/sensor/temperature.inc.php @@ -1,27 +1,30 @@ +if (is_numeric($sensor['sensor_limit_low'])) { + $rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes'; +} diff --git a/html/includes/graphs/sensor/voltage.inc.php b/html/includes/graphs/sensor/voltage.inc.php index ca3ea023d..634c7a54e 100644 --- a/html/includes/graphs/sensor/voltage.inc.php +++ b/html/includes/graphs/sensor/voltage.inc.php @@ -1,25 +1,28 @@ +if (is_numeric($sensor['sensor_limit_low'])) { + $rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes'; +} diff --git a/html/includes/graphs/service/auth.inc.php b/html/includes/graphs/service/auth.inc.php index 0d66f6946..eb30d023a 100644 --- a/html/includes/graphs/service/auth.inc.php +++ b/html/includes/graphs/service/auth.inc.php @@ -1,20 +1,16 @@ diff --git a/html/includes/graphs/smokeping/auth.inc.php b/html/includes/graphs/smokeping/auth.inc.php index 55e9f80ee..a82cfd71d 100644 --- a/html/includes/graphs/smokeping/auth.inc.php +++ b/html/includes/graphs/smokeping/auth.inc.php @@ -1,11 +1,8 @@ diff --git a/html/includes/graphs/smokeping/in.inc.php b/html/includes/graphs/smokeping/in.inc.php index 5488422ad..ecd63a2e3 100644 --- a/html/includes/graphs/smokeping/in.inc.php +++ b/html/includes/graphs/smokeping/in.inc.php @@ -1,94 +1,89 @@ Human translation:> +$scale_min = 0; +$scale_rigid = true; -$scale_min = 0; -$scale_rigid = TRUE; +require 'includes/graphs/common.inc.php'; +require 'smokeping_common.inc.php'; -include("includes/graphs/common.inc.php"); -include("smokeping_common.inc.php"); +$i = 0; +$pings = 20; +$iter = 0; +$colourset = 'mixed'; -$i = 0; -$pings = 20; -$iter = 0; -$colourset = "mixed"; - -if($width > "500") -{ - $descr_len = 18; -} else { - $descr_len = 12 + round(($width - 275) / 8); +if ($width > '500') { + $descr_len = 18; +} +else { + $descr_len = (12 + round(($width - 275) / 8)); } -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev \l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev \l'"; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." RTT Loss SDev RTT\:SDev \l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." RTT Loss SDev RTT\:SDev \l'"; } -if($src['hostname'] == $config['own_hostname']) -{ - $filename = $config['smokeping']['dir'] . $device['hostname'].'.rrd'; - if (!file_exists($filename)) - { - // Try with dots in hostname replaced by underscores - $filename = $config['smokeping']['dir'] . str_replace(".", "_", $device['hostname']).'.rrd'; - } -} else { - $filename = $config['smokeping']['dir'] . $device['hostname'] .'~'.$src['hostname'].'.rrd'; - if (!file_exists($filename)) - { - // Try with dots in hostname replaced by underscores - $filename = $config['smokeping']['dir'] . str_replace(".", "-", $device['hostname']) .'~'.$src['hostname'].'.rrd'; - } +if ($src['hostname'] == $config['own_hostname']) { + $filename = $config['smokeping']['dir'].$device['hostname'].'.rrd'; + if (!file_exists($filename)) { + // Try with dots in hostname replaced by underscores + $filename = $config['smokeping']['dir'].str_replace('.', '_', $device['hostname']).'.rrd'; + } +} +else { + $filename = $config['smokeping']['dir'].$device['hostname'].'~'.$src['hostname'].'.rrd'; + if (!file_exists($filename)) { + // Try with dots in hostname replaced by underscores + $filename = $config['smokeping']['dir'].str_replace('.', '-', $device['hostname']).'~'.$src['hostname'].'.rrd'; + } +} + +if (!isset($config['graph_colours'][$colourset][$iter])) { + $iter = 0; } - if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; } $colour = $config['graph_colours'][$colourset][$iter]; $iter++; - $descr = rrdtool_escape($source,$descr_len); + $descr = rrdtool_escape($source, $descr_len); - $rrd_options .= " DEF:median$i=".$filename.":median:AVERAGE "; - $rrd_options .= " DEF:loss$i=".$filename.":loss:AVERAGE"; + $rrd_options .= " DEF:median$i=".$filename.':median:AVERAGE '; + $rrd_options .= " DEF:loss$i=".$filename.':loss:AVERAGE'; $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; $rrd_options .= " CDEF:dm$i=median$i"; -# $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; - +// $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; // start emulate Smokeping::calc_stddev - foreach (range(1, $pings) as $p) - { - $rrd_options .= " DEF:pin".$i."p".$p."=".$filename.":ping".$p.":AVERAGE"; - $rrd_options .= " CDEF:p".$i."p".$p."=pin".$i."p".$p.",UN,0,pin".$i."p".$p.",IF"; - } +foreach (range(1, $pings) as $p) { + $rrd_options .= ' DEF:pin'.$i.'p'.$p.'='.$filename.':ping'.$p.':AVERAGE'; + $rrd_options .= ' CDEF:p'.$i.'p'.$p.'=pin'.$i.'p'.$p.',UN,0,pin'.$i.'p'.$p.',IF'; +} unset($pings_options, $m_options, $sdev_options); - foreach (range(2, $pings) as $p) - { - $pings_options .= ",p".$i."p".$p.",UN,+"; - $m_options .= ",p".$i."p".$p.",+"; - $sdev_options .= ",p".$i."p".$p.",m".$i.",-,DUP,*,+"; - } +foreach (range(2, $pings) as $p) { + $pings_options .= ',p'.$i.'p'.$p.',UN,+'; + $m_options .= ',p'.$i.'p'.$p.',+'; + $sdev_options .= ',p'.$i.'p'.$p.',m'.$i.',-,DUP,*,+'; +} - $rrd_options .= " CDEF:pings".$i."=".$pings .",p".$i."p1,UN". $pings_options . ",-"; - $rrd_options .= " CDEF:m".$i."=p".$i."p1".$m_options.",pings".$i.",/"; - $rrd_options .= " CDEF:sdev".$i."=p".$i."p1,m".$i.",-,DUP,*".$sdev_options.",pings".$i.",/,SQRT"; + $rrd_options .= ' CDEF:pings'.$i.'='.$pings.',p'.$i.'p1,UN'.$pings_options.',-'; + $rrd_options .= ' CDEF:m'.$i.'=p'.$i.'p1'.$m_options.',pings'.$i.',/'; + $rrd_options .= ' CDEF:sdev'.$i.'=p'.$i.'p1,m'.$i.',-,DUP,*'.$sdev_options.',pings'.$i.',/,SQRT'; // end emulate Smokeping::calc_stddev - $rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; $rrd_options .= " CDEF:s2d$i=sdev$i"; $rrd_options .= " AREA:dmlow$i"; - $rrd_options .= " AREA:s2d$i#".$colour."30::STACK"; + $rrd_options .= " AREA:s2d$i#".$colour.'30::STACK'; $rrd_options .= " LINE1:dm$i#".$colour.":'$descr'"; -# $rrd_options .= " LINE1:sdev$i#000000:$descr"; - +// $rrd_options .= " LINE1:sdev$i#000000:$descr"; $rrd_options .= " VDEF:avmed$i=median$i,AVERAGE"; $rrd_options .= " VDEF:avsd$i=sdev$i,AVERAGE"; $rrd_options .= " CDEF:msr$i=median$i,POP,avmed$i,avsd$i,/"; @@ -101,5 +96,3 @@ if($src['hostname'] == $config['own_hostname']) $rrd_options .= " GPRINT:avmsr$i:'%5.1lf%s\\l'"; $i++; - -?> diff --git a/html/includes/graphs/smokeping/out.inc.php b/html/includes/graphs/smokeping/out.inc.php index 6ebfdc9e0..714aa9064 100644 --- a/html/includes/graphs/smokeping/out.inc.php +++ b/html/includes/graphs/smokeping/out.inc.php @@ -1,94 +1,89 @@ Human translation:> +$scale_min = 0; +$scale_rigid = true; -$scale_min = 0; -$scale_rigid = TRUE; +require 'includes/graphs/common.inc.php'; +require 'smokeping_common.inc.php'; -include("includes/graphs/common.inc.php"); -include("smokeping_common.inc.php"); +$i = 0; +$pings = 20; +$iter = 0; +$colourset = 'mixed'; -$i = 0; -$pings = 20; -$iter = 0; -$colourset = "mixed"; - -if($width > "500") -{ - $descr_len = 18; -} else { - $descr_len = 12 + round(($width - 275) / 8); +if ($width > '500') { + $descr_len = 18; +} +else { + $descr_len = (12 + round(($width - 275) / 8)); } -if($width > "500") -{ - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev \l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev \l'"; +if ($width > '500') { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." RTT Loss SDev RTT\:SDev \l'"; +} +else { + $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))." RTT Loss SDev RTT\:SDev \l'"; } -if($device['hostname'] == $config['own_hostname']) -{ - $filename = $config['smokeping']['dir'] . $dest['hostname'].'.rrd'; - if (!file_exists($filename)) - { - // Try with dots in hostname replaced by underscores - $filename = $config['smokeping']['dir'] . str_replace(".", "_", $dest['hostname']).'.rrd'; - } -} else { - $filename = $config['smokeping']['dir'] . $dest['hostname'] .'~'.$device['hostname'].'.rrd'; - if (!file_exists($filename)) - { - // Try with dots in hostname replaced by underscores - $filename = $config['smokeping']['dir'] . str_replace(".", "_", $dest['hostname']) .'~'.$device['hostname'].'.rrd'; - } +if ($device['hostname'] == $config['own_hostname']) { + $filename = $config['smokeping']['dir'].$dest['hostname'].'.rrd'; + if (!file_exists($filename)) { + // Try with dots in hostname replaced by underscores + $filename = $config['smokeping']['dir'].str_replace('.', '_', $dest['hostname']).'.rrd'; + } +} +else { + $filename = $config['smokeping']['dir'].$dest['hostname'].'~'.$device['hostname'].'.rrd'; + if (!file_exists($filename)) { + // Try with dots in hostname replaced by underscores + $filename = $config['smokeping']['dir'].str_replace('.', '_', $dest['hostname']).'~'.$device['hostname'].'.rrd'; + } +} + +if (!isset($config['graph_colours'][$colourset][$iter])) { + $iter = 0; } - if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; } $colour = $config['graph_colours'][$colourset][$iter]; $iter++; - $descr = rrdtool_escape($source,$descr_len); + $descr = rrdtool_escape($source, $descr_len); - $rrd_options .= " DEF:median$i=".$filename.":median:AVERAGE "; - $rrd_options .= " DEF:loss$i=".$filename.":loss:AVERAGE"; + $rrd_options .= " DEF:median$i=".$filename.':median:AVERAGE '; + $rrd_options .= " DEF:loss$i=".$filename.':loss:AVERAGE'; $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; $rrd_options .= " CDEF:dm$i=median$i"; -# $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; - +// $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; // start emulate Smokeping::calc_stddev - foreach (range(1, $pings) as $p) - { - $rrd_options .= " DEF:pin".$i."p".$p."=".$filename.":ping".$p.":AVERAGE"; - $rrd_options .= " CDEF:p".$i."p".$p."=pin".$i."p".$p.",UN,0,pin".$i."p".$p.",IF"; - } +foreach (range(1, $pings) as $p) { + $rrd_options .= ' DEF:pin'.$i.'p'.$p.'='.$filename.':ping'.$p.':AVERAGE'; + $rrd_options .= ' CDEF:p'.$i.'p'.$p.'=pin'.$i.'p'.$p.',UN,0,pin'.$i.'p'.$p.',IF'; +} unset($pings_options, $m_options, $sdev_options); - foreach (range(2, $pings) as $p) - { - $pings_options .= ",p".$i."p".$p.",UN,+"; - $m_options .= ",p".$i."p".$p.",+"; - $sdev_options .= ",p".$i."p".$p.",m".$i.",-,DUP,*,+"; - } +foreach (range(2, $pings) as $p) { + $pings_options .= ',p'.$i.'p'.$p.',UN,+'; + $m_options .= ',p'.$i.'p'.$p.',+'; + $sdev_options .= ',p'.$i.'p'.$p.',m'.$i.',-,DUP,*,+'; +} - $rrd_options .= " CDEF:pings".$i."=".$pings .",p".$i."p1,UN". $pings_options . ",-"; - $rrd_options .= " CDEF:m".$i."=p".$i."p1".$m_options.",pings".$i.",/"; - $rrd_options .= " CDEF:sdev".$i."=p".$i."p1,m".$i.",-,DUP,*".$sdev_options.",pings".$i.",/,SQRT"; + $rrd_options .= ' CDEF:pings'.$i.'='.$pings.',p'.$i.'p1,UN'.$pings_options.',-'; + $rrd_options .= ' CDEF:m'.$i.'=p'.$i.'p1'.$m_options.',pings'.$i.',/'; + $rrd_options .= ' CDEF:sdev'.$i.'=p'.$i.'p1,m'.$i.',-,DUP,*'.$sdev_options.',pings'.$i.',/,SQRT'; // end emulate Smokeping::calc_stddev - $rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; $rrd_options .= " CDEF:s2d$i=sdev$i"; $rrd_options .= " AREA:dmlow$i"; - $rrd_options .= " AREA:s2d$i#".$colour."30::STACK"; + $rrd_options .= " AREA:s2d$i#".$colour.'30::STACK'; $rrd_options .= " LINE1:dm$i#".$colour.":'$descr'"; -# $rrd_options .= " LINE1:sdev$i#000000:$descr"; - +// $rrd_options .= " LINE1:sdev$i#000000:$descr"; $rrd_options .= " VDEF:avmed$i=median$i,AVERAGE"; $rrd_options .= " VDEF:avsd$i=sdev$i,AVERAGE"; $rrd_options .= " CDEF:msr$i=median$i,POP,avmed$i,avsd$i,/"; @@ -101,5 +96,3 @@ if($device['hostname'] == $config['own_hostname']) $rrd_options .= " GPRINT:avmsr$i:'%5.1lf%s\\l'"; $i++; - -?> diff --git a/html/includes/graphs/storage/usage.inc.php b/html/includes/graphs/storage/usage.inc.php index c42d339e6..60b01e418 100644 --- a/html/includes/graphs/storage/usage.inc.php +++ b/html/includes/graphs/storage/usage.inc.php @@ -1,20 +1,20 @@ diff --git a/html/includes/graphs/vserver/auth.inc.php b/html/includes/graphs/vserver/auth.inc.php index 3f400c1fd..2d16279db 100644 --- a/html/includes/graphs/vserver/auth.inc.php +++ b/html/includes/graphs/vserver/auth.inc.php @@ -1,20 +1,16 @@ diff --git a/html/includes/graphs/vserver/bits.inc.php b/html/includes/graphs/vserver/bits.inc.php index 28d4ac4c9..edafe2186 100644 --- a/html/includes/graphs/vserver/bits.inc.php +++ b/html/includes/graphs/vserver/bits.inc.php @@ -1,8 +1,6 @@ +require 'includes/graphs/generic_data.inc.php'; diff --git a/html/includes/graphs/vserver/pkts.inc.php b/html/includes/graphs/vserver/pkts.inc.php index be538a926..8590633ac 100644 --- a/html/includes/graphs/vserver/pkts.inc.php +++ b/html/includes/graphs/vserver/pkts.inc.php @@ -1,19 +1,17 @@ +require 'includes/graphs/generic_duplex.inc.php'; diff --git a/html/includes/port-edit.inc.php b/html/includes/port-edit.inc.php index a0348c785..abfba6053 100644 --- a/html/includes/port-edit.inc.php +++ b/html/includes/port-edit.inc.php @@ -1,78 +1,65 @@ $val) -{ - if (strncmp($key,"oldign_",7) == 0) - { - # Interface identifier passed as part of the field name +foreach ($_POST as $key => $val) { + if (strncmp($key, 'oldign_', 7) == 0) { + // Interface identifier passed as part of the field name + $port_id = intval(substr($key, 7)); - $port_id = intval(substr($key,7)); + $oldign = intval($val) ? 1 : 0; + $newign = $_POST['ignore_'.$port_id] ? 1 : 0; - $oldign = intval($val) ? 1 : 0; - $newign = $_POST['ignore_'.$port_id] ? 1 : 0; + // As checkboxes are not posted when unset - we effectively need to do a diff to work + // out a set->unset case. + if ($oldign == $newign) { + continue; + } - # As checkboxes are not posted when unset - we effectively need to do a diff to work - # out a set->unset case. + $n = dbUpdate(array('ignore' => $newign), 'ports', '`device_id` = ? AND `port_id` = ?', array($device_id, $port_id)); - if ($oldign == $newign) - { - continue; + if ($n < 0) { + $rows_updated = -1; + break; + } + + $rows_updated += $n; } + else if (strncmp($key, 'olddis_', 7) == 0) { + // Interface identifier passed as part of the field name + $port_id = intval(substr($key, 7)); - $n = dbUpdate(array('ignore' => $newign), 'ports', '`device_id` = ? AND `port_id` = ?', array($device_id, $port_id)); + $olddis = intval($val) ? 1 : 0; + $newdis = $_POST['disabled_'.$port_id] ? 1 : 0; - if ($n <0) - { - $rows_updated = -1; - break; - } + // As checkboxes are not posted when unset - we effectively need to do a diff to work + // out a set->unset case. + if ($olddis == $newdis) { + continue; + } - $rows_updated += $n; - } - elseif (strncmp($key,"olddis_",7) == 0) - { - # Interface identifier passed as part of the field name + $n = dbUpdate(array('disabled' => $newdis), 'ports', '`device_id` = ? AND `port_id` = ?', array($device_id, $port_id)); - $port_id = intval(substr($key,7)); + if ($n < 0) { + $rows_updated = -1; + break; + } - $olddis = intval($val) ? 1 : 0; - $newdis = $_POST['disabled_'.$port_id] ? 1 : 0; + $rows_updated += $n; + }//end if +}//end foreach - # As checkboxes are not posted when unset - we effectively need to do a diff to work - # out a set->unset case. - - if ($olddis == $newdis) - { - continue; - } - - $n = dbUpdate(array('disabled' => $newdis), 'ports', '`device_id` = ? AND `port_id` = ?', array($device_id, $port_id)); - - if ($n <0) - { - $rows_updated = -1; - break; - } - - $rows_updated += $n; - } +if ($rows_updated > 0) { + $update_message = $rows_updated.' Device record updated.'; + $updated = 1; } - -if ($rows_updated > 0) -{ - $update_message = $rows_updated . " Device record updated."; - $updated = 1; -} elseif ($rows_updated = '-1') { - $update_message = "Device record unchanged. No update necessary."; - $updated = -1; -} else { - $update_message = "Device record update error."; - $updated = 0; +else if ($rows_updated = '-1') { + $update_message = 'Device record unchanged. No update necessary.'; + $updated = -1; +} +else { + $update_message = 'Device record update error.'; + $updated = 0; } - -?> diff --git a/html/includes/print-accesspoint-graphs.inc.php b/html/includes/print-accesspoint-graphs.inc.php index 28960cfd5..cb0498d09 100644 --- a/html/includes/print-accesspoint-graphs.inc.php +++ b/html/includes/print-accesspoint-graphs.inc.php @@ -2,12 +2,10 @@ global $config; -$graph_array['height'] = "100"; -$graph_array['width'] = "215"; +$graph_array['height'] = '100'; +$graph_array['width'] = '215'; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $ap['accesspoint_id']; $graph_array['type'] = $graph_type; -include("includes/print-graphrow.inc.php"); - -?> +require 'includes/print-graphrow.inc.php'; diff --git a/html/includes/print-accesspoint.inc.php b/html/includes/print-accesspoint.inc.php index e41e6dd69..a3a1dcbe6 100644 --- a/html/includes/print-accesspoint.inc.php +++ b/html/includes/print-accesspoint.inc.php @@ -1,92 +1,92 @@ - "); -echo(" " . generate_ap_link($ap, " $text
")); -echo(""); -echo("$break".$ap['mac_addr']."
".$ap['type']. " - channel ".$ap['channel']); -echo("
txpow $ap[txpow]"); -echo("
"); -echo(""); +echo " + "; +echo ' '.generate_ap_link($ap, " $text
"); +echo ''; +echo "$break".$ap['mac_addr'].'
'.$ap['type'].' - channel '.$ap['channel']; +echo "
txpow $ap[txpow]"; +echo '
'; +echo ''; -echo(""); -$ap['graph_type'] = "accesspoints_numasoclients"; -echo(generate_ap_link($ap, "")); -echo("
\n"); -$ap['graph_type'] = "accesspoints_radioutil"; -echo(generate_ap_link($ap, "")); -echo("
\n"); -$ap['graph_type'] = "accesspoints_interference"; -echo(generate_ap_link($ap, "")); -echo("
\n"); +echo ''; +$ap['graph_type'] = 'accesspoints_numasoclients'; +echo generate_ap_link($ap, ""); +echo "
\n"; +$ap['graph_type'] = 'accesspoints_radioutil'; +echo generate_ap_link($ap, ""); +echo "
\n"; +$ap['graph_type'] = 'accesspoints_interference'; +echo generate_ap_link($ap, ""); +echo "
\n"; -echo(""); +echo ''; -echo(" ".format_bi($ap[numasoclients])." Clients
"); -echo(" ".format_bi($ap[radioutil])." % busy
"); -echo(" ".format_bi($ap[interference])." interference index
"); +echo " ".format_bi($ap[numasoclients]).' Clients
'; +echo " ".format_bi($ap[radioutil]).' % busy
'; +echo " ".format_bi($ap[interference]).' interference index
'; -echo(""); +echo ''; -if ($vars['tab'] == "accesspoint") { +if ($vars['tab'] == 'accesspoint') { + $graph_type = 'accesspoints_numasoclients'; + echo ""; + echo "
Associated Clients
"; + include 'includes/print-accesspoint-graphs.inc.php'; + echo ''; + $graph_type = 'accesspoints_interference'; + echo ""; + echo "
Interference
"; + include 'includes/print-accesspoint-graphs.inc.php'; + echo ''; - $graph_type='accesspoints_numasoclients'; - echo(""); - echo("
Associated Clients
"); - include("includes/print-accesspoint-graphs.inc.php"); - echo(""); + $graph_type = 'accesspoints_channel'; + echo ""; + echo "
Channel
"; + include 'includes/print-accesspoint-graphs.inc.php'; + echo ''; - $graph_type='accesspoints_interference'; - echo(""); - echo("
Interference
"); - include("includes/print-accesspoint-graphs.inc.php"); - echo(""); + $graph_type = 'accesspoints_txpow'; + echo ""; + echo "
Transmit Power
"; + include 'includes/print-accesspoint-graphs.inc.php'; + echo ''; - $graph_type='accesspoints_channel'; - echo(""); - echo("
Channel
"); - include("includes/print-accesspoint-graphs.inc.php"); - echo(""); + $graph_type = 'accesspoints_radioutil'; + echo ""; + echo "
Radio Utilization
"; + include 'includes/print-accesspoint-graphs.inc.php'; + echo ''; - $graph_type='accesspoints_txpow'; - echo(""); - echo("
Transmit Power
"); - include("includes/print-accesspoint-graphs.inc.php"); - echo(""); + $graph_type = 'accesspoints_nummonclients'; + echo ""; + echo "
Monitored Clients
"; + include 'includes/print-accesspoint-graphs.inc.php'; + echo ''; - $graph_type='accesspoints_radioutil'; - echo(""); - echo("
Radio Utilization
"); - include("includes/print-accesspoint-graphs.inc.php"); - echo(""); - - $graph_type='accesspoints_nummonclients'; - echo(""); - echo("
Monitored Clients
"); - include("includes/print-accesspoint-graphs.inc.php"); - echo(""); - - $graph_type='accesspoints_nummonbssid'; - echo(""); - echo("
Number of monitored BSSIDs
"); - include("includes/print-accesspoint-graphs.inc.php"); - echo(""); - - } - -?> + $graph_type = 'accesspoints_nummonbssid'; + echo ""; + echo "
Number of monitored BSSIDs
"; + include 'includes/print-accesspoint-graphs.inc.php'; + echo ''; +}//end if diff --git a/html/includes/print-device-graph.php b/html/includes/print-device-graph.php index aeda550da..cf629b884 100644 --- a/html/includes/print-device-graph.php +++ b/html/includes/print-device-graph.php @@ -1,19 +1,26 @@ '); -echo('
'.$graph_title.'
'); +echo '
'; +echo '
'.$graph_title.'
'; -include("includes/print-graphrow.inc.php"); +require 'includes/print-graphrow.inc.php'; -echo('
'); +echo ''; $g_i++; - -?> - diff --git a/html/includes/print-interface-adsl.inc.php b/html/includes/print-interface-adsl.inc.php index a53d2fc1b..fa891bbbc 100644 --- a/html/includes/print-interface-adsl.inc.php +++ b/html/includes/print-interface-adsl.inc.php @@ -1,106 +1,115 @@ 0 || $port['ifOutErrors_delta'] > 0) -{ - $error_img = generate_port_link($port,"Interface Errors","port_errors"); -} else { - $error_img = ""; +if (!is_integer($i / 2)) { + $row_colour = $list_colour_a; +} +else { + $row_colour = $list_colour_b; } -echo(" - "); -echo(" - " . generate_port_link($port, $port['ifIndex'] . ". ".$port['label']) . " -
".$port['ifAlias'].""); - -if ($port['ifAlias']) { echo("
"); } - -unset ($break); -if ($port_details) -{ - foreach (dbFetchRows("SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?", array($port['port_id'])) as $ip) - { - echo("$break ".$ip['ipv4_address']."/".$ip['ipv4_prefixlen'].""); - $break = ","; - } - foreach (dbFetchRows("SELECT * FROM `ipv6_addresses` WHERE `port_id` = ?", array($port['port_id'])) as $ip6); - { - echo("$break ".Net_IPv6::compress($ip6['ipv6_address'])."/".$ip6['ipv6_prefixlen'].""); - $break = ","; - } +if ($port['ifInErrors_delta'] > 0 || $port['ifOutErrors_delta'] > 0) { + $error_img = generate_port_link($port, "Interface Errors", 'port_errors'); +} +else { + $error_img = ''; } -echo(""); +echo " + "; +echo ' + '.generate_port_link($port, $port['ifIndex'].'. '.$port['label']).' +
'.$port['ifAlias'].''; -$width="120"; $height="40"; $from = $config['time']['day']; +if ($port['ifAlias']) { + echo '
'; +} -echo(""); -echo(formatRates($port['ifInOctets_rate'] * 8)." ".formatRates($port['ifOutOctets_rate'] * 8)); -echo("
"); -$port['graph_type'] = "port_bits"; -echo(generate_port_link($port, "", $port['graph_type'])); +unset($break); +if ($port_details) { + foreach (dbFetchRows('SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?', array($port['port_id'])) as $ip) { + echo "$break ".$ip['ipv4_address'].'/'.$ip['ipv4_prefixlen'].''; + $break = ','; + } -echo(""); -echo("".formatRates($port['adslAturChanCurrTxRate']) . "/". formatRates($port['adslAtucChanCurrTxRate'])); -echo("
"); -$port['graph_type'] = "port_adsl_speed"; -echo(generate_port_link($port, "", $port['graph_type'])); + foreach (dbFetchRows('SELECT * FROM `ipv6_addresses` WHERE `port_id` = ?', array($port['port_id'])) as $ip6) { ; + echo "$break ".Net_IPv6::compress($ip6['ipv6_address']).'/'.$ip6['ipv6_prefixlen'].''; + $break = ','; + } +} -echo(""); -echo("".formatRates($port['adslAturCurrAttainableRate']) . "/". formatRates($port['adslAtucCurrAttainableRate'])); -echo("
"); -$port['graph_type'] = "port_adsl_attainable"; -echo(generate_port_link($port, "", $port['graph_type'])); +echo ''; -echo(""); -echo("".$port['adslAturCurrAtn'] . "dB/". $port['adslAtucCurrAtn'] . "dB"); -echo("
"); -$port['graph_type'] = "port_adsl_attenuation"; -echo(generate_port_link($port, "", $port['graph_type'])); +$width = '120'; +$height = '40'; +$from = $config['time']['day']; -echo(""); -echo("".$port['adslAturCurrSnrMgn'] . "dB/". $port['adslAtucCurrSnrMgn'] . "dB"); -echo("
"); -$port['graph_type'] = "port_adsl_snr"; -echo(generate_port_link($port, "", $port['graph_type'])); +echo ''; +echo (formatRates(($port['ifInOctets_rate'] * 8))." ".formatRates(($port['ifOutOctets_rate'] * 8))); +echo '
'; +$port['graph_type'] = 'port_bits'; +echo generate_port_link( + $port, + "", + $port['graph_type'] +); -echo(""); -echo("".$port['adslAturCurrOutputPwr'] . "dBm/". $port['adslAtucCurrOutputPwr'] . "dBm"); -echo("
"); -$port['graph_type'] = "port_adsl_power"; -echo(generate_port_link($port, "", $port['graph_type'])); +echo ''; +echo ''.formatRates($port['adslAturChanCurrTxRate']).'/'.formatRates($port['adslAtucChanCurrTxRate']); +echo '
'; +$port['graph_type'] = 'port_adsl_speed'; +echo generate_port_link( + $port, + "", + $port['graph_type'] +); -# if ($port[ifDuplex] != unknown) { echo("Duplex " . $port['ifDuplex'] . ""); } else { echo("-"); } +echo ''; +echo ''.formatRates($port['adslAturCurrAttainableRate']).'/'.formatRates($port['adslAtucCurrAttainableRate']); +echo '
'; +$port['graph_type'] = 'port_adsl_attainable'; +echo generate_port_link( + $port, + "", + $port['graph_type'] +); -# echo(""); -# echo($port_adsl['adslLineCoding']."/".$port_adsl['adslLineType']); -# echo("
"); -# echo("Sync:".formatRates($port_adsl['adslAtucChanCurrTxRate']) . "/". formatRates($port_adsl['adslAturChanCurrTxRate'])); -# echo("
"); -# echo("Max:".formatRates($port_adsl['adslAtucCurrAttainableRate']) . "/". formatRates($port_adsl['adslAturCurrAttainableRate'])); -# echo(""); -# echo("Atten:".$port_adsl['adslAtucCurrAtn'] . "dB/". $port_adsl['adslAturCurrAtn'] . "dB"); -# echo("
"); -# echo("SNR:".$port_adsl['adslAtucCurrSnrMgn'] . "dB/". $port_adsl['adslAturCurrSnrMgn']. "dB"); +echo ''; +echo ''.$port['adslAturCurrAtn'].'dB/'.$port['adslAtucCurrAtn'].'dB'; +echo '
'; +$port['graph_type'] = 'port_adsl_attenuation'; +echo generate_port_link( + $port, + "", + $port['graph_type'] +); -echo(""); +echo ''; +echo ''.$port['adslAturCurrSnrMgn'].'dB/'.$port['adslAtucCurrSnrMgn'].'dB'; +echo '
'; +$port['graph_type'] = 'port_adsl_snr'; +echo generate_port_link( + $port, + "", + $port['graph_type'] +); -?> +echo ''; +echo ''.$port['adslAturCurrOutputPwr'].'dBm/'.$port['adslAtucCurrOutputPwr'].'dBm'; +echo '
'; +$port['graph_type'] = 'port_adsl_power'; +echo generate_port_link( + $port, + "", + $port['graph_type'] +); + +echo ''; diff --git a/html/includes/print-interface-graphs.inc.php b/html/includes/print-interface-graphs.inc.php index 1049c7d80..7971fccff 100644 --- a/html/includes/print-interface-graphs.inc.php +++ b/html/includes/print-interface-graphs.inc.php @@ -2,12 +2,10 @@ global $config; -$graph_array['height'] = "100"; -$graph_array['width'] = "215"; +$graph_array['height'] = '100'; +$graph_array['width'] = '215'; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $port['port_id']; $graph_array['type'] = $graph_type; -include("includes/print-graphrow.inc.php"); - -?> +require 'includes/print-graphrow.inc.php'; diff --git a/html/includes/print-service.inc.php b/html/includes/print-service.inc.php index 8d776cd7d..e91535d79 100644 --- a/html/includes/print-service.inc.php +++ b/html/includes/print-service.inc.php @@ -1,48 +1,59 @@ $service_type"; } -elseif ($service[service_status] == '1') { $status = "$service_type"; } -elseif ($service[service_status] == '2') { $status = "$service_type"; } - -$message = trim($service['service_message']); -$message = str_replace("\n", "
", $message); - -$since = time() - $service['service_changed']; -$since = formatUptime($since); - -if ($service['service_checked']) -{ - $checked = time() - $service['service_checked']; - $checked = formatUptime($checked); -} else { $checked = "Never"; } - -$mini_url = "graph.php?id=".$service['service_id']."&type=service_availability&from=".$config['time']['day']."&to=".$config['time']['now']."&width=80&height=20&bg=efefef"; - -$popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$service['service_type']; -$popup .= "
"; -$popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; - -echo(" - "); - -if ($device_id) -{ - if (!$samehost) - { - echo("" . generate_device_link($device) . ""); - } else { - echo(""); - } +if ($service[service_status] == '0') { + $status = "$service_type"; +} +else if ($service[service_status] == '1') { + $status = "$service_type"; +} +else if ($service[service_status] == '2') { + $status = "$service_type"; } -echo(" +$message = trim($service['service_message']); +$message = str_replace("\n", '
', $message); + +$since = (time() - $service['service_changed']); +$since = formatUptime($since); + +if ($service['service_checked']) { + $checked = (time() - $service['service_checked']); + $checked = formatUptime($checked); +} +else { + $checked = 'Never'; +} + +$mini_url = 'graph.php?id='.$service['service_id'].'&type=service_availability&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=80&height=20&bg=efefef'; + +$popup = "onmouseover=\"return overlib('
".$device['hostname'].' - '.$service['service_type']; +$popup .= "
"; +$popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"'; + +echo " + "; + +if ($device_id) { + if (!$samehost) { + echo "".generate_device_link($device).''; + } + else { + echo ''; + } +} + +echo " $status @@ -53,8 +64,6 @@ echo(" $message - "); + "; $i++; - -?> diff --git a/html/includes/print-vlan.inc.php b/html/includes/print-vlan.inc.php index 9b496035c..6fa489411 100644 --- a/html/includes/print-vlan.inc.php +++ b/html/includes/print-vlan.inc.php @@ -1,52 +1,52 @@ "); - -echo(" Vlan " . $vlan['vlan_vlan'] . ""); -echo("" . $vlan['vlan_name'] . ""); -echo(""); - - $vlan_ports = array(); - $otherports = dbFetchRows("SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.port_id = V.port_id", array($device['device_id'], $vlan['vlan_vlan'])); - foreach ($otherports as $otherport) - { - $vlan_ports[$otherport[ifIndex]] = $otherport; - } - $otherports = dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?", array($device['device_id'], $vlan['vlan_vlan'])); - foreach ($otherports as $otherport) - { - $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('untagged' => '1')); - } - ksort($vlan_ports); - -foreach ($vlan_ports as $port) -{ - $port = ifLabel($port, $device); - if ($vars['view'] == "graphs") - { - echo("
-
".makeshortif($port['ifDescr'])."
- ".$device['hostname']." - ".$port['ifDescr']."
\ - ".$port['ifAlias']." \ - \ - ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". - " - -
".truncate(short_port_descr($port['ifAlias']), 22, '')."
- "); - } - else - { - echo($vlan['port_sep'] . generate_port_link($port, makeshortif($port['label']))); - $vlan['port_sep'] = ", "; - if ($port['untagged']) { echo("(U)"); } - - } +if (!is_integer($i / 2)) { + $bg_colour = $list_colour_a; +} +else { + $bg_colour = $list_colour_b; } -echo(''); +echo ""; -?> +echo ' Vlan '.$vlan['vlan_vlan'].''; +echo ''.$vlan['vlan_name'].''; +echo ''; + + $vlan_ports = array(); + $otherports = dbFetchRows('SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.port_id = V.port_id', array($device['device_id'], $vlan['vlan_vlan'])); +foreach ($otherports as $otherport) { + $vlan_ports[$otherport[ifIndex]] = $otherport; +} + + $otherports = dbFetchRows('SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?', array($device['device_id'], $vlan['vlan_vlan'])); +foreach ($otherports as $otherport) { + $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('untagged' => '1')); +} + + ksort($vlan_ports); + +foreach ($vlan_ports as $port) { + $port = ifLabel($port, $device); + if ($vars['view'] == 'graphs') { + echo "
+
".makeshortif($port['ifDescr'])."
+ ".$device['hostname'].' - '.$port['ifDescr'].'
\ + '.$port['ifAlias']." \ + \ + ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >"." + +
".truncate(short_port_descr($port['ifAlias']), 22, '').'
+ '; + } + else { + echo $vlan['port_sep'].generate_port_link($port, makeshortif($port['label'])); + $vlan['port_sep'] = ', '; + if ($port['untagged']) { + echo '(U)'; + } + } +}//end foreach + +echo ''; diff --git a/html/includes/print-vm.inc.php b/html/includes/print-vm.inc.php index c75866a39..e69730001 100644 --- a/html/includes/print-vm.inc.php +++ b/html/includes/print-vm.inc.php @@ -1,43 +1,37 @@ '); +echo ''; -echo(''); +echo ''; -if (getidbyname($vm['vmwVmDisplayName'])) -{ - echo(generate_device_link(device_by_name($vm['vmwVmDisplayName']))); -} else { - echo $vm['vmwVmDisplayName']; +if (getidbyname($vm['vmwVmDisplayName'])) { + echo generate_device_link(device_by_name($vm['vmwVmDisplayName'])); +} +else { + echo $vm['vmwVmDisplayName']; } -echo(""); -echo('' . $vm['vmwVmState'] . ""); +echo ''; +echo ''.$vm['vmwVmState'].''; -if ($vm['vmwVmGuestOS'] == "E: tools not installed") -{ - echo('Unknown (VMware Tools not installed)'); +if ($vm['vmwVmGuestOS'] == 'E: tools not installed') { + echo 'Unknown (VMware Tools not installed)'; } -else if ($vm['vmwVmGuestOS'] == "") -{ - echo('(Unknown)'); +else if ($vm['vmwVmGuestOS'] == '') { + echo '(Unknown)'; } -elseif (isset($config['vmware_guestid'][$vm['vmwVmGuestOS']])) -{ - echo('' . $config['vmware_guestid'][$vm['vmwVmGuestOS']] . ""); +else if (isset($config['vmware_guestid'][$vm['vmwVmGuestOS']])) { + echo ''.$config['vmware_guestid'][$vm['vmwVmGuestOS']].''; } -else -{ - echo('' . $vm['vmwVmGuestOS'] . ""); +else { + echo ''.$vm['vmwVmGuestOS'].''; } -if ($vm['vmwVmMemSize'] >= 1024) -{ - echo("" . sprintf("%.2f",$vm['vmwVmMemSize']/1024) . " GB"); -} else { - echo("" . sprintf("%.2f",$vm['vmwVmMemSize']) . " MB"); +if ($vm['vmwVmMemSize'] >= 1024) { + echo (''.sprintf('%.2f', ($vm['vmwVmMemSize'] / 1024)).' GB'); +} +else { + echo ''.sprintf('%.2f', $vm['vmwVmMemSize']).' MB'; } -echo('' . $vm['vmwVmCpus'] . " CPU"); - -?> +echo ''.$vm['vmwVmCpus'].' CPU'; diff --git a/html/includes/print-vrf.inc.php b/html/includes/print-vrf.inc.php index abc680eb8..1fe1afb87 100644 --- a/html/includes/print-vrf.inc.php +++ b/html/includes/print-vrf.inc.php @@ -1,39 +1,39 @@ "); - -echo("" . $vrf['vrf_name'] . ""); -echo("" . $vrf['mplsVpnVrfDescription'] . ""); -echo("" . $vrf['mplsVpnVrfRouteDistinguisher'] . ""); - -echo(''); -foreach (dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVrf` = ?", array($device['device_id'], $vrf['vrf_id'])) as $port) -{ - if ($vars['view'] == "graphs") - { - $graph_type = "port_" . $vars['graph']; - echo("
-
".makeshortif($port['ifDescr'])."
- ".$device['hostname']." - ".$port['ifDescr']."
\ - ".$port['ifAlias']." \ - \ - ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". - " - -
".truncate(short_port_descr($port['ifAlias']), 22, '')."
- "); - } else { - echo($vrf['port_sep'] . generate_port_link($port, makeshortif($port['ifDescr']))); - $vrf['port_sep'] = ", "; - } +if (is_integer($i / 2)) { + $bg_colour = $list_colour_a; +} +else { + $bg_colour = $list_colour_b; } -echo(""); -echo(""); +echo ""; -?> +echo "".$vrf['vrf_name'].''; +echo ''.$vrf['mplsVpnVrfDescription'].''; +echo ''.$vrf['mplsVpnVrfRouteDistinguisher'].''; + +echo ''; +foreach (dbFetchRows('SELECT * FROM ports WHERE `device_id` = ? AND `ifVrf` = ?', array($device['device_id'], $vrf['vrf_id'])) as $port) { + if ($vars['view'] == 'graphs') { + $graph_type = 'port_'.$vars['graph']; + echo "
+
".makeshortif($port['ifDescr'])."
+ ".$device['hostname'].' - '.$port['ifDescr'].'
\ + '.$port['ifAlias']." \ + \ + ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >"." + +
".truncate(short_port_descr($port['ifAlias']), 22, '').'
+ '; + } + else { + echo $vrf['port_sep'].generate_port_link($port, makeshortif($port['ifDescr'])); + $vrf['port_sep'] = ', '; + } +} + +echo ''; +echo ''; diff --git a/html/includes/service-delete.inc.php b/html/includes/service-delete.inc.php index 2cf580c2d..9ea114dc5 100644 --- a/html/includes/service-delete.inc.php +++ b/html/includes/service-delete.inc.php @@ -4,10 +4,7 @@ $affected = dbDelete('services', '`service_id` = ?', array($_POST['service'])); - if ($affected) - { - $message .= $message_break . $rows . " service deleted!"; - $message_break .= "
"; - } - -?> +if ($affected) { + $message .= $message_break.$rows.' service deleted!'; + $message_break .= '
'; +} diff --git a/html/pages/apps/overview.inc.php b/html/pages/apps/overview.inc.php index 69d898375..029ded341 100644 --- a/html/pages/apps/overview.inc.php +++ b/html/pages/apps/overview.inc.php @@ -1,53 +1,50 @@ '); - echo('

'.generate_link(nicecase($app['app_type']),array('page'=>'apps','app'=>$app['app_type'])).'

'); - $app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($app['app_type'])); +foreach ($app_list as $app) { + echo '
'; + echo '

'.generate_link(nicecase($app['app_type']), array('page' => 'apps', 'app' => $app['app_type'])).'

'; + $app_devices = dbFetchRows('SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?', array($app['app_type'])); - foreach ($app_devices as $app_device) - { + foreach ($app_devices as $app_device) { $graph_type = $graphs[$app['app_type']][0]; - $graph_array['type'] = "application_".$app['app_type']."_".$graph_type; - $graph_array['id'] = $app_device['app_id']; - $graph_array_zoom['type'] = "application_".$app['app_type']."_".$graph_type; - $graph_array_zoom['id'] = $app_device['app_id']; + $graph_array['type'] = 'application_'.$app['app_type'].'_'.$graph_type; + $graph_array['id'] = $app_device['app_id']; + $graph_array_zoom['type'] = 'application_'.$app['app_type'].'_'.$graph_type; + $graph_array_zoom['id'] = $app_device['app_id']; - $link_array = $graph_array; - $link_array['page'] = "device"; - $link_array['device'] = $app_device['device_id']; - $link_array['tab'] = "apps"; - $link_array['app'] = $app['app_type']; - unset($link_array['height'], $link_array['width']); - $overlib_url = generate_url($link_array); + $link_array = $graph_array; + $link_array['page'] = 'device'; + $link_array['device'] = $app_device['device_id']; + $link_array['tab'] = 'apps'; + $link_array['app'] = $app['app_type']; + unset($link_array['height'], $link_array['width']); + $overlib_url = generate_url($link_array); - $overlib_link = ''.shorthost($app_device['hostname']).""; - if (!empty($app_device['app_instance'])) - { - $overlib_link .= ''.$app_device['app_instance'].""; - $app_device['content_add'] = '('.$app_device['app_instance'].')'; - } - $overlib_link .= "
"; - $overlib_link .= generate_graph_tag($graph_array); - $overlib_content = generate_overlib_content($graph_array, $app_device['hostname'] . " - ". $app_device['app_type'] . $app_device['content_add']); + $overlib_link = ''.shorthost($app_device['hostname']).''; + if (!empty($app_device['app_instance'])) { + $overlib_link .= ''.$app_device['app_instance'].''; + $app_device['content_add'] = '('.$app_device['app_instance'].')'; + } - echo("
"); - echo(overlib_link($overlib_url, $overlib_link, $overlib_content)); - echo("
"); - } - echo('
'); -} + $overlib_link .= '
'; + $overlib_link .= generate_graph_tag($graph_array); + $overlib_content = generate_overlib_content($graph_array, $app_device['hostname'].' - '.$app_device['app_type'].$app_device['content_add']); -?> + echo "
"; + echo overlib_link($overlib_url, $overlib_link, $overlib_content); + echo '
'; + }//end foreach + + echo ''; +}//end foreach diff --git a/html/pages/bill/actions.inc.php b/html/pages/bill/actions.inc.php index b63038cf3..d55c2944c 100644 --- a/html/pages/bill/actions.inc.php +++ b/html/pages/bill/actions.inc.php @@ -1,86 +1,107 @@ Bill Deleted. Redirecting to Bills list."); - - echo(""); -} - -if ($_POST['action'] == "reset_bill" && ($_POST['confirm'] == "rrd" || $_POST['confirm'] == "mysql")) -{ - if ($_POST['confirm'] == "mysql") { - foreach (dbFetchRows("SELECT * FROM `bill_ports` WHERE `bill_id` = ?", array($bill_id)) as $port_data) +if ($_POST['action'] == 'delete_bill' && $_POST['confirm'] == 'confirm') { + foreach (dbFetchRows('SELECT * FROM `bill_ports` WHERE `bill_id` = ?', array($bill_id)) as $port_data) { - dbDelete('port_in_measurements', '`port_id` = ?', array($port_data['bill_id'])); - dbDelete('port_out_measurements', '`port_id` = ?', array($port_data['bill_id'])); + dbDelete('port_in_measurements', '`port_id` = ?', array($port_data['bill_id'])); + dbDelete('port_out_measurements', '`port_id` = ?', array($port_data['bill_id'])); } + dbDelete('bill_hist', '`bill_id` = ?', array($bill_id)); + dbDelete('bill_ports', '`bill_id` = ?', array($bill_id)); dbDelete('bill_data', '`bill_id` = ?', array($bill_id)); - } - if ($_POST['confirm'] == "rrd") { - // Stil todo - } + dbDelete('bill_perms', '`bill_id` = ?', array($bill_id)); + dbDelete('bills', '`bill_id` = ?', array($bill_id)); - echo("
Bill Reseting. Redirecting to Bills list.
"); + echo '
Bill Deleted. Redirecting to Bills list.
'; - echo(""); + echo ""; } -if ($_POST['action'] == "add_bill_port") -{ - dbInsert(array('bill_id' => $_POST['bill_id'], 'port_id' => $_POST['port_id']), 'bill_ports'); -} -if ($_POST['action'] == "delete_bill_port") -{ - dbDelete('bill_ports', "`bill_id` = ? AND `port_id` = ?", array($bill_id, $_POST['port_id'])); -} -if ($_POST['action'] == "update_bill") -{ - if (isset($_POST['bill_quota']) or isset($_POST['bill_cdr'])) - { - if ($_POST['bill_type'] == "quota") - { - if (isset($_POST['bill_quota_type'])) - { - if ($_POST['bill_quota_type'] == "MB") { $multiplier = 1 * $config['billing']['base']; } - if ($_POST['bill_quota_type'] == "GB") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base']; } - if ($_POST['bill_quota_type'] == "TB") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base'] * $config['billing']['base']; } - $bill_quota = (is_numeric($_POST['bill_quota']) ? $_POST['bill_quota'] * $config['billing']['base'] * $multiplier : 0); - $bill_cdr = 0; - } +if ($_POST['action'] == 'reset_bill' && ($_POST['confirm'] == 'rrd' || $_POST['confirm'] == 'mysql')) { + if ($_POST['confirm'] == 'mysql') { + foreach (dbFetchRows('SELECT * FROM `bill_ports` WHERE `bill_id` = ?', array($bill_id)) as $port_data) { + dbDelete('port_in_measurements', '`port_id` = ?', array($port_data['bill_id'])); + dbDelete('port_out_measurements', '`port_id` = ?', array($port_data['bill_id'])); + } + + dbDelete('bill_hist', '`bill_id` = ?', array($bill_id)); + dbDelete('bill_data', '`bill_id` = ?', array($bill_id)); } - if ($_POST['bill_type'] == "cdr") - { - if (isset($_POST['bill_cdr_type'])) - { - if ($_POST['bill_cdr_type'] == "Kbps") { $multiplier = 1 * $config['billing']['base']; } - if ($_POST['bill_cdr_type'] == "Mbps") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base']; } - if ($_POST['bill_cdr_type'] == "Gbps") { $multiplier = 1 * $config['billing']['base'] * $config['billing']['base'] * $config['billing']['base']; } - $bill_cdr = (is_numeric($_POST['bill_cdr']) ? $_POST['bill_cdr'] * $multiplier : 0); - $bill_quota = 0; - } - } - } - if (dbUpdate(array('bill_name' => $_POST['bill_name'], 'bill_day' => $_POST['bill_day'], 'bill_quota' => $bill_quota, - 'bill_cdr' => $bill_cdr, 'bill_type' => $_POST['bill_type'], 'bill_custid' => $_POST['bill_custid'], - 'bill_ref' => $_POST['bill_ref'], 'bill_notes' => $_POST['bill_notes']), 'bills', '`bill_id` = ?', array($bill_id))) - { - print_message("Bill Properties Updated"); - } + if ($_POST['confirm'] == 'rrd') { + // Stil todo + } + + echo '
Bill Reseting. Redirecting to Bills list.
'; + + echo ""; } -?> +if ($_POST['action'] == 'add_bill_port') { + dbInsert(array('bill_id' => $_POST['bill_id'], 'port_id' => $_POST['port_id']), 'bill_ports'); +} + +if ($_POST['action'] == 'delete_bill_port') { + dbDelete('bill_ports', '`bill_id` = ? AND `port_id` = ?', array($bill_id, $_POST['port_id'])); +} + +if ($_POST['action'] == 'update_bill') { + if (isset($_POST['bill_quota']) or isset($_POST['bill_cdr'])) { + if ($_POST['bill_type'] == 'quota') { + if (isset($_POST['bill_quota_type'])) { + if ($_POST['bill_quota_type'] == 'MB') { + $multiplier = (1 * $config['billing']['base']); + } + + if ($_POST['bill_quota_type'] == 'GB') { + $multiplier = (1 * $config['billing']['base'] * $config['billing']['base']); + } + + if ($_POST['bill_quota_type'] == 'TB') { + $multiplier = (1 * $config['billing']['base'] * $config['billing']['base'] * $config['billing']['base']); + } + + $bill_quota = (is_numeric($_POST['bill_quota']) ? $_POST['bill_quota'] * $config['billing']['base'] * $multiplier : 0); + $bill_cdr = 0; + } + } + + if ($_POST['bill_type'] == 'cdr') { + if (isset($_POST['bill_cdr_type'])) { + if ($_POST['bill_cdr_type'] == 'Kbps') { + $multiplier = (1 * $config['billing']['base']); + } + + if ($_POST['bill_cdr_type'] == 'Mbps') { + $multiplier = (1 * $config['billing']['base'] * $config['billing']['base']); + } + + if ($_POST['bill_cdr_type'] == 'Gbps') { + $multiplier = (1 * $config['billing']['base'] * $config['billing']['base'] * $config['billing']['base']); + } + + $bill_cdr = (is_numeric($_POST['bill_cdr']) ? $_POST['bill_cdr'] * $multiplier : 0); + $bill_quota = 0; + } + } + }//end if + + if (dbUpdate( + array( + 'bill_name' => $_POST['bill_name'], + 'bill_day' => $_POST['bill_day'], + 'bill_quota' => $bill_quota, + 'bill_cdr' => $bill_cdr, + 'bill_type' => $_POST['bill_type'], + 'bill_custid' => $_POST['bill_custid'], + 'bill_ref' => $_POST['bill_ref'], + 'bill_notes' => $_POST['bill_notes'], + ), + 'bills', + '`bill_id` = ?', + array($bill_id) + )) { + print_message('Bill Properties Updated'); + } +}//end if diff --git a/html/pages/bill/pdf_css.inc.php b/html/pages/bill/pdf_css.inc.php index 05ac3ed37..24b12c2c8 100644 --- a/html/pages/bill/pdf_css.inc.php +++ b/html/pages/bill/pdf_css.inc.php @@ -75,5 +75,3 @@ $css = << EOF; - -?> \ No newline at end of file diff --git a/html/pages/deleted-ports.inc.php b/html/pages/deleted-ports.inc.php index d0d6c3479..373557b58 100644 --- a/html/pages/deleted-ports.inc.php +++ b/html/pages/deleted-ports.inc.php @@ -1,40 +1,37 @@ Deleted ".generate_device_link($interface)." - ".generate_port_link($interface).""); + if (port_permitted($interface['port_id'], $interface['device_id'])) { + delete_port($interface['port_id']); + echo '
Deleted '.generate_device_link($interface).' - '.generate_port_link($interface).'
'; + } } - } -} elseif ($vars['purge']) { - $interface = dbFetchRow("SELECT * from `ports` AS P, `devices` AS D WHERE `port_id` = ? AND D.device_id = P.device_id", array($vars['purge'])); - if (port_permitted($interface['port_id'], $interface['device_id'])) - delete_port($interface['port_id']); - echo("
Deleted ".generate_device_link($interface)." - ".generate_port_link($interface)."
"); +} +else if ($vars['purge']) { + $interface = dbFetchRow('SELECT * from `ports` AS P, `devices` AS D WHERE `port_id` = ? AND D.device_id = P.device_id', array($vars['purge'])); + if (port_permitted($interface['port_id'], $interface['device_id'])) { + delete_port($interface['port_id']); + } + + echo '
Deleted '.generate_device_link($interface).' - '.generate_port_link($interface).'
'; } -echo(""); -echo(""); +echo '
Purge All
'; +echo ""; -foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id") as $interface) -{ - $interface = ifLabel($interface, $interface); - if (port_permitted($interface['port_id'], $interface['device_id'])) - { - echo(""); - echo(""); - echo(""); - echo(""); - echo(""); - } +foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id") as $interface) { + $interface = ifLabel($interface, $interface); + if (port_permitted($interface['port_id'], $interface['device_id'])) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ""; + } } -echo("
Purge All
".generate_device_link($interface)."".generate_port_link($interface)." Purge
'.generate_device_link($interface).''.generate_port_link($interface).' Purge
"); - -?> +echo ''; diff --git a/html/pages/device/accesspoint.inc.php b/html/pages/device/accesspoint.inc.php index ee4c46a3a..39463069c 100644 --- a/html/pages/device/accesspoint.inc.php +++ b/html/pages/device/accesspoint.inc.php @@ -1,20 +1,13 @@ "); +echo "
"; -$i = "1"; +$i = '1'; -$ap = dbFetchRow("SELECT * FROM `accesspoint` WHERE `device_id` = ? AND `accesspoint_id` = ? AND `deleted` = '0' ORDER BY `name`,`radio_number` ASC", array($device['device_id'],$vars['ap'])); +$ap = dbFetchRow("SELECT * FROM `accesspoint` WHERE `device_id` = ? AND `accesspoint_id` = ? AND `deleted` = '0' ORDER BY `name`,`radio_number` ASC", array($device['device_id'], $vars['ap'])); -echo("
"); +echo "
"; -include("includes/print-accesspoint.inc.php"); +require 'includes/print-accesspoint.inc.php'; -echo("
"); - - - - - - -?> +echo ''; diff --git a/html/pages/device/apps.inc.php b/html/pages/device/apps.inc.php index 5bf5a21d6..7d1412ebb 100644 --- a/html/pages/device/apps.inc.php +++ b/html/pages/device/apps.inc.php @@ -2,55 +2,61 @@ print_optionbar_start(); -echo("Apps » "); +echo "Apps » "; unset($sep); -$link_array = array('page' => 'device', - 'device' => $device['device_id'], - 'tab' => 'apps'); +$link_array = array( + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'apps', +); -foreach (dbFetchRows("SELECT * FROM `applications` WHERE `device_id` = ?", array($device['device_id'])) as $app) -{ - echo($sep); +foreach (dbFetchRows('SELECT * FROM `applications` WHERE `device_id` = ?', array($device['device_id'])) as $app) { + echo $sep; - if (!$vars['app']) { $vars['app'] = $app['app_type']; } + if (!$vars['app']) { + $vars['app'] = $app['app_type']; + } - if ($vars['app'] == $app['app_type']) - { - echo(""); - #echo(''); - } else { - #echo(''); - } - $link_add = array('app'=>$app['app_type']); - $text = nicecase($app['app_type']); - if (!empty($app['app_instance'])) - { - $text .= "(".$app['app_instance'].")"; - $link_add['instance'] = $app['app_id']; - } - echo(generate_link($text,$link_array,$link_add)); - if ($vars['app'] == $app['app_type']) { echo(""); } - $sep = " | "; + if ($vars['app'] == $app['app_type']) { + echo ""; + // echo(''); + } + else { + // echo(''); + } + + $link_add = array('app' => $app['app_type']); + $text = nicecase($app['app_type']); + if (!empty($app['app_instance'])) { + $text .= '('.$app['app_instance'].')'; + $link_add['instance'] = $app['app_id']; + } + + echo generate_link($text, $link_array, $link_add); + if ($vars['app'] == $app['app_type']) { + echo ''; + } + + $sep = ' | '; } print_optionbar_end(); -$where_array = array($device['device_id'], $vars['app']); -if($vars['instance']) -{ - $where = " AND `app_id` = ?"; - $where_array[] = $vars['instance']; +$where_array = array( + $device['device_id'], + $vars['app'], +); +if ($vars['instance']) { + $where = ' AND `app_id` = ?'; + $where_array[] = $vars['instance']; } -$app = dbFetchRow("SELECT * FROM `applications` WHERE `device_id` = ? AND `app_type` = ?".$where, $where_array); +$app = dbFetchRow('SELECT * FROM `applications` WHERE `device_id` = ? AND `app_type` = ?'.$where, $where_array); -if (is_file("pages/device/apps/".mres($vars['app']).".inc.php")) -{ - include("pages/device/apps/".mres($vars['app']).".inc.php"); +if (is_file('pages/device/apps/'.mres($vars['app']).'.inc.php')) { + include 'pages/device/apps/'.mres($vars['app']).'.inc.php'; } -$pagetitle[] = "Apps"; - -?> +$pagetitle[] = 'Apps'; diff --git a/html/pages/device/apps/apache.inc.php b/html/pages/device/apps/apache.inc.php index 7715051e2..c5975ea5b 100644 --- a/html/pages/device/apps/apache.inc.php +++ b/html/pages/device/apps/apache.inc.php @@ -2,28 +2,27 @@ global $config; -$graphs = array('apache_bits' => 'Traffic', - 'apache_hits' => 'Hits', - 'apache_cpu' => 'CPU Utilisation', - 'apache_scoreboard' => 'Scoreboard Statistics'); +$graphs = array( + 'apache_bits' => 'Traffic', + 'apache_hits' => 'Hits', + 'apache_cpu' => 'CPU Utilisation', + 'apache_scoreboard' => 'Scoreboard Statistics', +); -foreach ($graphs as $key => $text) -{ - $graph_type = "apache_scoreboard"; +foreach ($graphs as $key => $text) { + $graph_type = 'apache_scoreboard'; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; - echo('

'.$text.'

'); + echo '

'.$text.'

'; - echo(""); + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); + echo ''; } - -?> diff --git a/html/pages/device/apps/drbd.inc.php b/html/pages/device/apps/drbd.inc.php index 36af19ddf..842e27440 100644 --- a/html/pages/device/apps/drbd.inc.php +++ b/html/pages/device/apps/drbd.inc.php @@ -1,28 +1,26 @@ '.$app['app_instance'].''); +echo '

'.$app['app_instance'].'

'; -$graphs = array('drbd_network_bits' => 'Network Traffic', - 'drbd_disk_bits' => 'Disk Traffic', - 'drbd_unsynced' => 'Unsynced Data', - 'drbd_queue' => 'Queues'); +$graphs = array( + 'drbd_network_bits' => 'Network Traffic', + 'drbd_disk_bits' => 'Disk Traffic', + 'drbd_unsynced' => 'Unsynced Data', + 'drbd_queue' => 'Queues', +); -foreach ($graphs as $key => $text) -{ +foreach ($graphs as $key => $text) { + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; + echo '

'.$text.'

'; - echo('

'.$text.'

'); + echo ""; - echo(""); + include 'includes/print-graphrow.inc.php'; - include("includes/print-graphrow.inc.php"); - - echo(""); + echo ''; } - -?> diff --git a/html/pages/device/apps/mailscanner.inc.php b/html/pages/device/apps/mailscanner.inc.php index 231886f9c..5a6bd6f34 100644 --- a/html/pages/device/apps/mailscanner.inc.php +++ b/html/pages/device/apps/mailscanner.inc.php @@ -2,25 +2,24 @@ global $config; -$graphs = array('mailscanner_sent' => 'Mailscanner - Sent / Received', - 'mailscanner_spam' => 'Mailscanner - Spam / Virus', - 'mailscanner_reject' => 'Mailscanner - Rejected / Waiting / Relayed'); +$graphs = array( + 'mailscanner_sent' => 'Mailscanner - Sent / Received', + 'mailscanner_spam' => 'Mailscanner - Spam / Virus', + 'mailscanner_reject' => 'Mailscanner - Rejected / Waiting / Relayed', +); -foreach ($graphs as $key => $text) -{ - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; +foreach ($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; - echo('

'.$text.'

'); - echo(""); + echo '

'.$text.'

'; + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); + echo ''; } - -?> \ No newline at end of file diff --git a/html/pages/device/apps/memcached.inc.php b/html/pages/device/apps/memcached.inc.php index 7b7c71540..d17b23d53 100644 --- a/html/pages/device/apps/memcached.inc.php +++ b/html/pages/device/apps/memcached.inc.php @@ -2,31 +2,28 @@ global $config; -$graphs = array('memcached_bits' => 'Traffic', - 'memcached_commands' => 'Commands', - 'memcached_data' => 'Data Size', - 'memcached_items' => 'Items', - 'memcached_uptime' => 'Uptime', - 'memcached_threads' => 'Threads', +$graphs = array( + 'memcached_bits' => 'Traffic', + 'memcached_commands' => 'Commands', + 'memcached_data' => 'Data Size', + 'memcached_items' => 'Items', + 'memcached_uptime' => 'Uptime', + 'memcached_threads' => 'Threads', ); -foreach ($graphs as $key => $text) -{ +foreach ($graphs as $key => $text) { + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; + echo '

'.$text.'

'; - echo('

'.$text.'

'); + echo ""; - echo(""); + include 'includes/print-graphrow.inc.php'; - include("includes/print-graphrow.inc.php"); - - echo(""); + echo ''; } - -?> diff --git a/html/pages/device/apps/mysql.inc.php b/html/pages/device/apps/mysql.inc.php index 511edf3cd..851498787 100644 --- a/html/pages/device/apps/mysql.inc.php +++ b/html/pages/device/apps/mysql.inc.php @@ -3,74 +3,78 @@ global $config; print_optionbar_start(); -echo("".nicecase($app['app_type'])." » "); +echo "".nicecase($app['app_type']).' » '; -$app_sections = array('system' => "System", - 'queries' => "Queries", - 'innodb' => "InnoDB"); +$app_sections = array( + 'system' => 'System', + 'queries' => 'Queries', + 'innodb' => 'InnoDB', +); unset($sep); -foreach ($app_sections as $app_section => $app_section_text) -{ - echo($sep); +foreach ($app_sections as $app_section => $app_section_text) { + echo $sep; - if (!$vars['app_section']) { $vars['app_section'] = $app_section; } + if (!$vars['app_section']) { + $vars['app_section'] = $app_section; + } - if ($vars['app_section'] == $app_section) - { - echo(""); - } - echo(generate_link($app_section_text,$vars,array('app_section'=>$app_section))); - if ($vars['app_section'] == $app_section) { echo(""); } - $sep = " | "; + if ($vars['app_section'] == $app_section) { + echo ""; + } + + echo generate_link($app_section_text, $vars, array('app_section' => $app_section)); + if ($vars['app_section'] == $app_section) { + echo ''; + } + + $sep = ' | '; } + print_optionbar_end(); $graphs['system'] = array( - 'mysql_connections' => 'Connections', - 'mysql_files_tables' => 'Files and Tables', - 'mysql_myisam_indexes' => 'MyISAM Indexes', - 'mysql_network_traffic' => 'Network Traffic', - 'mysql_table_locks' => 'Table Locks', - 'mysql_temporary_objects' => 'Temporary Objects' - ); + 'mysql_connections' => 'Connections', + 'mysql_files_tables' => 'Files and Tables', + 'mysql_myisam_indexes' => 'MyISAM Indexes', + 'mysql_network_traffic' => 'Network Traffic', + 'mysql_table_locks' => 'Table Locks', + 'mysql_temporary_objects' => 'Temporary Objects', +); $graphs['queries'] = array( - 'mysql_command_counters' => 'Command Counters', - 'mysql_query_cache' => 'Query Cache', - 'mysql_query_cache_memory' => 'Query Cache Memory', - 'mysql_select_types' => 'Select Types', - 'mysql_slow_queries' => 'Slow Queries', - 'mysql_sorts' => 'Sorts', - ); + 'mysql_command_counters' => 'Command Counters', + 'mysql_query_cache' => 'Query Cache', + 'mysql_query_cache_memory' => 'Query Cache Memory', + 'mysql_select_types' => 'Select Types', + 'mysql_slow_queries' => 'Slow Queries', + 'mysql_sorts' => 'Sorts', +); $graphs['innodb'] = array( - 'mysql_innodb_buffer_pool' => 'InnoDB Buffer Pool', - 'mysql_innodb_buffer_pool_activity' => 'InnoDB Buffer Pool Activity', - 'mysql_innodb_insert_buffer' => 'InnoDB Insert Buffer', - 'mysql_innodb_io' => 'InnoDB IO', - 'mysql_innodb_io_pending' => 'InnoDB IO Pending', - 'mysql_innodb_log' => 'InnoDB Log', - 'mysql_innodb_row_operations' => 'InnoDB Row Operations', - 'mysql_innodb_semaphores' => 'InnoDB semaphores', - 'mysql_innodb_transactions' => 'InnoDB Transactions', - ); + 'mysql_innodb_buffer_pool' => 'InnoDB Buffer Pool', + 'mysql_innodb_buffer_pool_activity' => 'InnoDB Buffer Pool Activity', + 'mysql_innodb_insert_buffer' => 'InnoDB Insert Buffer', + 'mysql_innodb_io' => 'InnoDB IO', + 'mysql_innodb_io_pending' => 'InnoDB IO Pending', + 'mysql_innodb_log' => 'InnoDB Log', + 'mysql_innodb_row_operations' => 'InnoDB Row Operations', + 'mysql_innodb_semaphores' => 'InnoDB semaphores', + 'mysql_innodb_transactions' => 'InnoDB Transactions', +); -foreach ($graphs[$vars['app_section']] as $key => $text) -{ - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; - echo('

'.$text.'

'); +foreach ($graphs[$vars['app_section']] as $key => $text) { + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; + echo '

'.$text.'

'; - echo(""); + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); + echo ''; } - -?> diff --git a/html/pages/device/apps/nginx.inc.php b/html/pages/device/apps/nginx.inc.php index a1d3d2506..f78ba4d1b 100644 --- a/html/pages/device/apps/nginx.inc.php +++ b/html/pages/device/apps/nginx.inc.php @@ -2,24 +2,23 @@ global $config; -$graphs = array('nginx_connections' => 'nginx Connections', - 'nginx_req' => 'nginx requests'); +$graphs = array( + 'nginx_connections' => 'nginx Connections', + 'nginx_req' => 'nginx requests', +); -foreach ($graphs as $key => $text) -{ - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; - echo('

'.$text.'

'); +foreach ($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; + echo '

'.$text.'

'; - echo(""); + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); + echo ''; } - -?> \ No newline at end of file diff --git a/html/pages/device/apps/ntp-client.inc.php b/html/pages/device/apps/ntp-client.inc.php index 881b27c82..11980b420 100644 --- a/html/pages/device/apps/ntp-client.inc.php +++ b/html/pages/device/apps/ntp-client.inc.php @@ -2,22 +2,22 @@ global $config; -$graphs = array('ntpclient_stats' => 'NTP Client - Statistics', - 'ntpclient_freq' => 'NTP Client - Frequency'); +$graphs = array( + 'ntpclient_stats' => 'NTP Client - Statistics', + 'ntpclient_freq' => 'NTP Client - Frequency', +); foreach ($graphs as $key => $text) { - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; - echo('

'.$text.'

'); - echo(""); + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; + echo '

'.$text.'

'; + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); + echo ''; } - -?> \ No newline at end of file diff --git a/html/pages/device/apps/ntpd-server.inc.php b/html/pages/device/apps/ntpd-server.inc.php index 26875d6cc..1b4adaf86 100644 --- a/html/pages/device/apps/ntpd-server.inc.php +++ b/html/pages/device/apps/ntpd-server.inc.php @@ -2,27 +2,27 @@ global $config; -$graphs = array('ntpdserver_stats' => 'NTPD Server - Statistics', - 'ntpdserver_freq' => 'NTPD Server - Frequency', - 'ntpdserver_stratum' => 'NTPD Server - Stratum', - 'ntpdserver_buffer' => 'NTPD Server - Buffer', - 'ntpdserver_bits' => 'NTPD Server - Packets Sent/Received', - 'ntpdserver_packets' => 'NTPD Server - Packets Dropped/Ignored', - 'ntpdserver_uptime' => 'NTPD Server - Uptime'); +$graphs = array( + 'ntpdserver_stats' => 'NTPD Server - Statistics', + 'ntpdserver_freq' => 'NTPD Server - Frequency', + 'ntpdserver_stratum' => 'NTPD Server - Stratum', + 'ntpdserver_buffer' => 'NTPD Server - Buffer', + 'ntpdserver_bits' => 'NTPD Server - Packets Sent/Received', + 'ntpdserver_packets' => 'NTPD Server - Packets Dropped/Ignored', + 'ntpdserver_uptime' => 'NTPD Server - Uptime', +); foreach ($graphs as $key => $text) { - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; - echo('

'.$text.'

'); - echo(""); + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; + echo '

'.$text.'

'; + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); + echo ''; } - -?> \ No newline at end of file diff --git a/html/pages/device/apps/powerdns.inc.php b/html/pages/device/apps/powerdns.inc.php index 4aa7f2b3d..774b9af2a 100644 --- a/html/pages/device/apps/powerdns.inc.php +++ b/html/pages/device/apps/powerdns.inc.php @@ -2,30 +2,29 @@ global $config; -$graphs = array('powerdns_latency' => 'PowerDNS - Latency', - 'powerdns_fail' => 'PowerDNS - Corrupt / Failed / Timed out', - 'powerdns_packetcache' => 'PowerDNS - Packet Cache', - 'powerdns_querycache' => 'PowerDNS - Query Cache', - 'powerdns_recursing' => 'PowerDNS - Recursing Queries and Answers', - 'powerdns_queries' => 'PowerDNS - Total UDP/TCP Queries and Answers', - 'powerdns_queries_udp' => 'PowerDNS - Detail UDP IPv4/IPv6 Queries and Answers'); +$graphs = array( + 'powerdns_latency' => 'PowerDNS - Latency', + 'powerdns_fail' => 'PowerDNS - Corrupt / Failed / Timed out', + 'powerdns_packetcache' => 'PowerDNS - Packet Cache', + 'powerdns_querycache' => 'PowerDNS - Query Cache', + 'powerdns_recursing' => 'PowerDNS - Recursing Queries and Answers', + 'powerdns_queries' => 'PowerDNS - Total UDP/TCP Queries and Answers', + 'powerdns_queries_udp' => 'PowerDNS - Detail UDP IPv4/IPv6 Queries and Answers', +); -foreach ($graphs as $key => $text) -{ - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; +foreach ($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; - echo('

'.$text.'

'); + echo '

'.$text.'

'; - echo(""); + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); + echo ''; } - -?> \ No newline at end of file diff --git a/html/pages/device/apps/shoutcast.inc.php b/html/pages/device/apps/shoutcast.inc.php index cceb5ffc1..1dea2fdd5 100644 --- a/html/pages/device/apps/shoutcast.inc.php +++ b/html/pages/device/apps/shoutcast.inc.php @@ -2,75 +2,67 @@ global $config; -$total = true; +$total = true; -$rrddir = $config['rrd_dir']."/".$device['hostname']; -$files = array(); +$rrddir = $config['rrd_dir'].'/'.$device['hostname']; +$files = array(); -if ($handle = opendir($rrddir)) -{ - while (false !== ($file = readdir($handle))) - { - if ($file != "." && $file != "..") +if ($handle = opendir($rrddir)) { + while (false !== ($file = readdir($handle))) { - if (eregi("app-shoutcast-".$app['app_id'], $file)) - { - array_push($files, $file); - } + if ($file != '.' && $file != '..') { + if (eregi('app-shoutcast-'.$app['app_id'], $file)) { + array_push($files, $file); + } + } } - } } -if (isset($total) && $total == true) -{ - $graphs = array( - 'shoutcast_multi_bits' => 'Traffic Statistics - Total of all Shoutcast servers', - 'shoutcast_multi_stats' => 'Shoutcast Statistics - Total of all Shoutcast servers' - ); +if (isset($total) && $total == true) { + $graphs = array( + 'shoutcast_multi_bits' => 'Traffic Statistics - Total of all Shoutcast servers', + 'shoutcast_multi_stats' => 'Shoutcast Statistics - Total of all Shoutcast servers', + ); - foreach ($graphs as $key => $text) - { - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; - echo('

'.$text.'

'); - echo(""); + foreach ($graphs as $key => $text) + { + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; + echo '

'.$text.'

'; + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); - } + echo ''; + } } -foreach ($files as $id => $file) -{ - $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); - $hostname = eregi_replace('.rrd', '', $hostname); - list($host, $port) = split('_', $hostname, 2); - $graphs = array( - 'shoutcast_bits' => 'Traffic Statistics - '.$host.' (Port: '.$port.')', - 'shoutcast_stats' => 'Shoutcast Statistics - '.$host.' (Port: '.$port.')' - ); +foreach ($files as $id => $file) { + $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); + $hostname = eregi_replace('.rrd', '', $hostname); + list($host, $port) = split('_', $hostname, 2); + $graphs = array( + 'shoutcast_bits' => 'Traffic Statistics - '.$host.' (Port: '.$port.')', + 'shoutcast_stats' => 'Shoutcast Statistics - '.$host.' (Port: '.$port.')', + ); - foreach ($graphs as $key => $text) - { - $graph_type = $key; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $app['app_id']; - $graph_array['type'] = "application_".$key; - $graph_array['hostname'] = $hostname; - echo('

'.$text.'

'); - echo(""); + foreach ($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; + $graph_array['hostname'] = $hostname; + echo '

'.$text.'

'; + echo ""; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); - } + echo ''; + } } - -?> \ No newline at end of file diff --git a/html/pages/device/collectd.inc.php b/html/pages/device/collectd.inc.php index 11be70a95..dabbb7d52 100644 --- a/html/pages/device/collectd.inc.php +++ b/html/pages/device/collectd.inc.php @@ -1,4 +1,4 @@ - * @@ -16,97 +16,115 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02150-1301, USA. */ -error_reporting(E_ALL | E_NOTICE | E_WARNING); +error_reporting((E_ALL | E_NOTICE | E_WARNING)); -require('includes/collectd/config.php'); -require('includes/collectd/functions.php'); -require('includes/collectd/definitions.php'); - -#require('config.php'); -#require('functions.php'); -#require('definitions.php'); +require 'includes/collectd/config.php'; +require 'includes/collectd/functions.php'; +require 'includes/collectd/definitions.php'; load_graph_definitions(); + /** * Send back new list content * @items Array of options values to return to browser * @method Name of Javascript method that will be called to process data */ -function dhtml_response_list(&$items, $method) { - header("Content-Type: text/xml"); +function dhtml_response_list(&$items, $method) +{ + header('Content-Type: text/xml'); + + print (''."\n"); + print ("\n"); + printf(" %s\n", htmlspecialchars($method)); + print (" \n"); + foreach ($items as &$item) { + printf(' '."\n", htmlspecialchars($item)); + } + + print (" \n"); + print (''); + +}//end dhtml_response_list() - print(''."\n"); - print("\n"); - printf(" %s\n", htmlspecialchars($method)); - print(" \n"); - foreach ($items as &$item) - printf(' '."\n", htmlspecialchars($item)); - print(" \n"); - print(""); -} print_optionbar_start(); -$link_array = array('page' => 'device', - 'device' => $device['device_id'], - 'tab' => 'collectd'); +$link_array = array( + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'collectd', +); - $plugins = collectd_list_plugins($device['hostname']); - unset($sep); - foreach ($plugins as &$plugin) { - if (!$vars['plugin']) { $vars['plugin'] = $plugin; } - echo($sep); - if ($vars['plugin'] == $plugin) { echo(""); } - echo(generate_link(htmlspecialchars($plugin),$link_array,array('plugin'=>$plugin))); - if ($vars['plugin'] == $plugin) { echo(""); } - $sep = ' | '; +$plugins = collectd_list_plugins($device['hostname']); +unset($sep); +foreach ($plugins as &$plugin) { + if (!$vars['plugin']) { + $vars['plugin'] = $plugin; } - unset ($sep); + + echo $sep; + if ($vars['plugin'] == $plugin) { + echo ""; + } + + echo generate_link(htmlspecialchars($plugin), $link_array, array('plugin' => $plugin)); + if ($vars['plugin'] == $plugin) { + echo ''; + } + + $sep = ' | '; +} + +unset($sep); print_optionbar_end(); - $i=0; +$i = 0; - $pinsts = collectd_list_pinsts($device['hostname'], $vars['plugin']); - foreach ($pinsts as &$instance) { +$pinsts = collectd_list_pinsts($device['hostname'], $vars['plugin']); +foreach ($pinsts as &$instance) { + $types = collectd_list_types($device['hostname'], $vars['plugin'], $instance); + foreach ($types as &$type) { + $typeinstances = collectd_list_tinsts($device['hostname'], $vars['plugin'], $instance, $type); - $types = collectd_list_types($device['hostname'], $vars['plugin'], $instance); - foreach ($types as &$type) { + if ($MetaGraphDefs[$type]) { + $typeinstances = array($MetaGraphDefs[$type]); + } - $typeinstances = collectd_list_tinsts($device['hostname'], $vars['plugin'], $instance, $type); + foreach ($typeinstances as &$tinst) { + $i++; + if (!is_integer($i / 2)) { + $row_colour = $list_colour_a; + } + else { + $row_colour = $list_colour_b; + } - if ($MetaGraphDefs[$type]) { $typeinstances = array($MetaGraphDefs[$type]); } + echo '
'; + echo '
'; + if ($tinst) { + echo $vars['plugin']." $instance - $type - $tinst"; + } + else { + echo $vars['plugin']." $instance - $type"; + } - foreach ($typeinstances as &$tinst) { - $i++; - if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + echo '
'; - echo('
'); - echo('
'); - if ($tinst) { - echo($vars['plugin']." $instance - $type - $tinst"); - } else { - echo($vars['plugin']." $instance - $type"); - } - echo("
"); + $graph_array['type'] = 'device_collectd'; + $graph_array['device'] = $device['device_id']; - $graph_array['type'] = "device_collectd"; - $graph_array['device'] = $device['device_id']; + $graph_array['c_plugin'] = $vars['plugin']; + $graph_array['c_plugin_instance'] = $instance; + $graph_array['c_type'] = $type; + $graph_array['c_type_instance'] = $tinst; - $graph_array['c_plugin'] = $vars['plugin']; - $graph_array['c_plugin_instance'] = $instance; - $graph_array['c_type'] = $type; - $graph_array['c_type_instance'] = $tinst; - - include("includes/print-graphrow.inc.php"); - - echo("
"); - - } - } + include 'includes/print-graphrow.inc.php'; + echo '
'; + } } +} -$pagetitle[] = "CollectD"; -?> +$pagetitle[] = 'CollectD'; diff --git a/html/pages/device/edit/icon.inc.php b/html/pages/device/edit/icon.inc.php index 62184c94a..3adb7d915 100644 --- a/html/pages/device/edit/icon.inc.php +++ b/html/pages/device/edit/icon.inc.php @@ -1,36 +1,34 @@ "7") - { - $param = array('icon' => $_POST['icon']); +if ($_POST['editing']) { + if ($_SESSION['userlevel'] > '7') { + $param = array('icon' => $_POST['icon']); - $rows_updated = dbUpdate($param, 'devices', '`device_id` = ?', array($device['device_id'])); + $rows_updated = dbUpdate($param, 'devices', '`device_id` = ?', array($device['device_id'])); - if ($rows_updated > 0 || $updated) - { - $update_message = "Device icon updated."; - $updated = 1; - $device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id'])); - } elseif ($rows_updated = '-1') { - $update_message = "Device icon unchanged. No update necessary."; - $updated = -1; - } else { - $update_message = "Device icon update error."; + if ($rows_updated > 0 || $updated) { + $update_message = 'Device icon updated.'; + $updated = 1; + $device = dbFetchRow('SELECT * FROM `devices` WHERE `device_id` = ?', array($device['device_id'])); + } + else if ($rows_updated = '-1') { + $update_message = 'Device icon unchanged. No update necessary.'; + $updated = -1; + } + else { + $update_message = 'Device icon update error.'; + } + } + else { + include 'includes/error-no-perm.inc.php'; } - } - else - { - include("includes/error-no-perm.inc.php"); - } } -if ($updated && $update_message) -{ - print_message($update_message); -} elseif ($update_message) { - print_error($update_message); +if ($updated && $update_message) { + print_message($update_message); +} +else if ($update_message) { + print_error($update_message); } ?> @@ -44,26 +42,23 @@ if ($updated && $update_message) \n"); +echo " \n"; -# Default icon +// Default icon $icon = $config['os'][$device['os']]['icon']; -echo(' ' . "\n"); +echo ' '."\n"; -for ($i = 0;$i < count($config['os'][$device['os']]['icons']);$i++) -{ - $icon = $config['os'][$device['os']]['icons'][$i]; - echo(' ' . "\n"); +for ($i = 0; $i < count($config['os'][$device['os']]['icons']); $i++) { + $icon = $config['os'][$device['os']]['icons'][$i]; + echo ' '."\n"; } -if ($numicons %10 == 0) -{ - echo(" \n"); - echo(" \n"); +if (($numicons % 10) == 0) { + echo " \n"; + echo " \n"; } ?> diff --git a/html/pages/device/entphysical.inc.php b/html/pages/device/entphysical.inc.php index dc34aae56..af167b4dd 100644 --- a/html/pages/device/entphysical.inc.php +++ b/html/pages/device/entphysical.inc.php @@ -1,92 +1,113 @@ "); - - if ($ent['entPhysicalClass'] == "chassis") { echo(" "); } - if ($ent['entPhysicalClass'] == "module") { echo(" "); } - if ($ent['entPhysicalClass'] == "port") { echo(" "); } - if ($ent['entPhysicalClass'] == "container") { echo(" "); } - if ($ent['entPhysicalClass'] == "sensor") + $ents = dbFetchRows('SELECT * FROM `entPhysical` WHERE device_id = ? AND entPhysicalContainedIn = ? ORDER BY entPhysicalContainedIn,entPhysicalIndex', array($device['device_id'], $ent)); + foreach ($ents as $ent) { - echo(" "); - $sensor = dbFetchRow("SELECT * FROM `sensors` WHERE `device_id` = ? AND (`entPhysicalIndex` = ? OR `sensor_index` = ?)", array($device['device_id'], $ent['entPhysicalIndex'], $ent['entPhysicalIndex'])); - if (count($sensor)) - { - $link = " href='device/device=".$device['device_id']."/tab=health/metric=".$sensor['sensor_class']."/' onmouseover=\"return overlib('', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\""; - } - } else { unset ($link); } + echo " +
  • "; - if ($ent['entPhysicalClass'] == "backplane") { echo(" "); } - if ($ent['entPhysicalParentRelPos'] > '-1') {echo("".$ent['entPhysicalParentRelPos'].". "); } + if ($ent['entPhysicalClass'] == 'chassis') { + echo " "; + } - if ($link) {echo(""); } + if ($ent['entPhysicalClass'] == 'module') { + echo " "; + } - if ($ent['ifIndex']) - { - $interface = dbFetchRow("SELECT * FROM `ports` WHERE ifIndex = ? AND device_id = ?", array($ent['ifIndex'], $device['device_id'])); - $ent['entPhysicalName'] = generate_port_link($interface); - } + if ($ent['entPhysicalClass'] == 'port') { + echo " "; + } - if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) - { - echo("".$ent['entPhysicalModelName'] . " (".$ent['entPhysicalName'].")"); - } elseif ($ent['entPhysicalModelName']) { - echo("".$ent['entPhysicalModelName'] . ""); - } elseif (is_numeric($ent['entPhysicalName']) && $ent['entPhysicalVendorType']) { - echo("".$ent['entPhysicalName']." ".$ent['entPhysicalVendorType'].""); - } elseif ($ent['entPhysicalName']) { - echo("".$ent['entPhysicalName'].""); - } elseif ($ent['entPhysicalDescr']) { - echo("".$ent['entPhysicalDescr'].""); - } + if ($ent['entPhysicalClass'] == 'container') { + echo " "; + } - if ($ent['entPhysicalClass'] == "sensor") - { - echo(" (".$ent['entSensorValue'] ." ". $ent['entSensorType'].")"); - } + if ($ent['entPhysicalClass'] == 'sensor') { + echo " "; + $sensor = dbFetchRow('SELECT * FROM `sensors` WHERE `device_id` = ? AND (`entPhysicalIndex` = ? OR `sensor_index` = ?)', array($device['device_id'], $ent['entPhysicalIndex'], $ent['entPhysicalIndex'])); + if (count($sensor)) { + $link = " href='device/device=".$device['device_id'].'/tab=health/metric='.$sensor['sensor_class']."/' onmouseover=\"return overlib('', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\""; + } + } else { + unset($link); + } - echo("
    " . $ent['entPhysicalDescr']); + if ($ent['entPhysicalClass'] == 'backplane') { + echo " "; + } - if ($link) { echo(""); } + if ($ent['entPhysicalParentRelPos'] > '-1') { + echo ''.$ent['entPhysicalParentRelPos'].'. '; + } - if ($ent['entPhysicalSerialNum']) - { - echo("
    Serial No. ".$ent['entPhysicalSerialNum']." "); - } + if ($link) { + echo ""; + } - echo("
    "); + if ($ent['ifIndex']) { + $interface = dbFetchRow('SELECT * FROM `ports` WHERE ifIndex = ? AND device_id = ?', array($ent['ifIndex'], $device['device_id'])); + $ent['entPhysicalName'] = generate_port_link($interface); + } - $count = dbFetchCell("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"); - if ($count) - { - echo("
      "); - printEntPhysical($ent['entPhysicalIndex'], $level+1, ''); - echo("
    "); - } + if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) { + echo ''.$ent['entPhysicalModelName'].' ('.$ent['entPhysicalName'].')'; + } + else if ($ent['entPhysicalModelName']) { + echo ''.$ent['entPhysicalModelName'].''; + } + else if (is_numeric($ent['entPhysicalName']) && $ent['entPhysicalVendorType']) { + echo ''.$ent['entPhysicalName'].' '.$ent['entPhysicalVendorType'].''; + } + else if ($ent['entPhysicalName']) { + echo ''.$ent['entPhysicalName'].''; + } + else if ($ent['entPhysicalDescr']) { + echo ''.$ent['entPhysicalDescr'].''; + } - echo("
  • "); - } -} + if ($ent['entPhysicalClass'] == 'sensor') { + echo ' ('.$ent['entSensorValue'].' '.$ent['entSensorType'].')'; + } -echo("
    + echo "
    ".$ent['entPhysicalDescr']; + + if ($link) { + echo ''; + } + + if ($ent['entPhysicalSerialNum']) { + echo "
    Serial No. ".$ent['entPhysicalSerialNum'].' '; + } + + echo '
    '; + + $count = dbFetchCell("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"); + if ($count) { + echo '
      '; + printEntPhysical($ent['entPhysicalIndex'], ($level + 1), ''); + echo '
    '; + } + + echo ''; + }//end foreach + +}//end printEntPhysical() + + +echo ""); +
    "; -echo("
      "); -$level = "0"; -$ent['entPhysicalIndex'] = "0"; -printEntPhysical($ent['entPhysicalIndex'], $level, "liOpen"); -echo("
    "); +echo "
      "; +$level = '0'; +$ent['entPhysicalIndex'] = '0'; +printEntPhysical($ent['entPhysicalIndex'], $level, 'liOpen'); +echo '
    '; -$pagetitle = "Inventory"; - -?> +$pagetitle = 'Inventory'; diff --git a/html/pages/device/graphs/cpu.inc.php b/html/pages/device/graphs/cpu.inc.php index e9b870bce..10b1086d0 100644 --- a/html/pages/device/graphs/cpu.inc.php +++ b/html/pages/device/graphs/cpu.inc.php @@ -1,11 +1,8 @@ diff --git a/html/pages/device/graphs/fortigate-sessions.inc.php b/html/pages/device/graphs/fortigate-sessions.inc.php index 6af7229bf..e0167873a 100644 --- a/html/pages/device/graphs/fortigate-sessions.inc.php +++ b/html/pages/device/graphs/fortigate-sessions.inc.php @@ -1,11 +1,8 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/hrprocesses.inc.php b/html/pages/device/graphs/hrprocesses.inc.php index 5e7eb9dd9..a90776b5f 100644 --- a/html/pages/device/graphs/hrprocesses.inc.php +++ b/html/pages/device/graphs/hrprocesses.inc.php @@ -1,11 +1,8 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/hrusers.inc.php b/html/pages/device/graphs/hrusers.inc.php index ff5acb4a4..8bb5fef3e 100644 --- a/html/pages/device/graphs/hrusers.inc.php +++ b/html/pages/device/graphs/hrusers.inc.php @@ -1,11 +1,8 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/ipSytemStats.inc.php b/html/pages/device/graphs/ipSytemStats.inc.php index 5666b5311..34873a3d1 100644 --- a/html/pages/device/graphs/ipSytemStats.inc.php +++ b/html/pages/device/graphs/ipSytemStats.inc.php @@ -1,24 +1,20 @@ diff --git a/html/pages/device/graphs/memory.inc.php b/html/pages/device/graphs/memory.inc.php index f4830a668..3b1f7a477 100644 --- a/html/pages/device/graphs/memory.inc.php +++ b/html/pages/device/graphs/memory.inc.php @@ -1,11 +1,8 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/netstats.inc.php b/html/pages/device/graphs/netstats.inc.php index 16b36750d..2e47aeb75 100644 --- a/html/pages/device/graphs/netstats.inc.php +++ b/html/pages/device/graphs/netstats.inc.php @@ -1,79 +1,70 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_icmp_info.inc.php b/html/pages/device/graphs/netstats_icmp_info.inc.php index 9e798d2c7..827b1694a 100644 --- a/html/pages/device/graphs/netstats_icmp_info.inc.php +++ b/html/pages/device/graphs/netstats_icmp_info.inc.php @@ -1,11 +1,8 @@ diff --git a/html/pages/device/graphs/netstats_icmp_stat.inc.php b/html/pages/device/graphs/netstats_icmp_stat.inc.php index ddb758b68..2ba52c4b1 100644 --- a/html/pages/device/graphs/netstats_icmp_stat.inc.php +++ b/html/pages/device/graphs/netstats_icmp_stat.inc.php @@ -1,11 +1,8 @@ diff --git a/html/pages/device/graphs/netstats_ip.inc.php b/html/pages/device/graphs/netstats_ip.inc.php index 516f5732b..46b5831e4 100644 --- a/html/pages/device/graphs/netstats_ip.inc.php +++ b/html/pages/device/graphs/netstats_ip.inc.php @@ -1,16 +1,13 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_snmp.inc.php b/html/pages/device/graphs/netstats_snmp.inc.php index 453b9a7b9..e8da71c5f 100644 --- a/html/pages/device/graphs/netstats_snmp.inc.php +++ b/html/pages/device/graphs/netstats_snmp.inc.php @@ -1,16 +1,13 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_tcp.inc.php b/html/pages/device/graphs/netstats_tcp.inc.php index fa4fa0575..686fc5193 100644 --- a/html/pages/device/graphs/netstats_tcp.inc.php +++ b/html/pages/device/graphs/netstats_tcp.inc.php @@ -1,11 +1,8 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/netstats_udp.inc.php b/html/pages/device/graphs/netstats_udp.inc.php index 2ef2d9603..5eb134e04 100644 --- a/html/pages/device/graphs/netstats_udp.inc.php +++ b/html/pages/device/graphs/netstats_udp.inc.php @@ -1,11 +1,8 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/screenos-sessions.inc.php b/html/pages/device/graphs/screenos-sessions.inc.php index 080c5b470..66e25a701 100644 --- a/html/pages/device/graphs/screenos-sessions.inc.php +++ b/html/pages/device/graphs/screenos-sessions.inc.php @@ -1,11 +1,8 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/screenos.inc.php b/html/pages/device/graphs/screenos.inc.php index 4cd4cdb19..8065e8c0c 100644 --- a/html/pages/device/graphs/screenos.inc.php +++ b/html/pages/device/graphs/screenos.inc.php @@ -1,11 +1,8 @@ \ No newline at end of file diff --git a/html/pages/device/graphs/uptime.inc.php b/html/pages/device/graphs/uptime.inc.php index c025b413c..0beb16403 100644 --- a/html/pages/device/graphs/uptime.inc.php +++ b/html/pages/device/graphs/uptime.inc.php @@ -1,8 +1,6 @@ \ No newline at end of file +require 'includes/print-device-graph.php'; diff --git a/html/pages/device/graphs/wireless.inc.php b/html/pages/device/graphs/wireless.inc.php index 98afa48d7..699b07d17 100644 --- a/html/pages/device/graphs/wireless.inc.php +++ b/html/pages/device/graphs/wireless.inc.php @@ -1,11 +1,8 @@ diff --git a/html/pages/device/health/dbm.inc.php b/html/pages/device/health/dbm.inc.php index 4d264d98f..7da8dc68a 100644 --- a/html/pages/device/health/dbm.inc.php +++ b/html/pages/device/health/dbm.inc.php @@ -1,9 +1,7 @@ +require 'sensors.inc.php'; diff --git a/html/pages/device/health/diskio.inc.php b/html/pages/device/health/diskio.inc.php index 03e151662..dd425d273 100644 --- a/html/pages/device/health/diskio.inc.php +++ b/html/pages/device/health/diskio.inc.php @@ -1,51 +1,54 @@ '); - -#echo(" -# -# -# -# -# "); +echo '

    ' . nicecase($icon) . '

    '); -echo('


    '.nicecase($icon).'

    '; +echo '


    ' . nicecase($icon) . '

    '); - echo('


    '.nicecase($icon).'

    '; + echo '

    DriveUsageFree
    '; +// echo(" +// +// +// +// +// "); $row = 1; -foreach (dbFetchRows("SELECT * FROM `ucd_diskio` WHERE device_id = ? ORDER BY diskio_descr", array($device['device_id'])) as $drive) -{ - if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } +foreach (dbFetchRows('SELECT * FROM `ucd_diskio` WHERE device_id = ? ORDER BY diskio_descr', array($device['device_id'])) as $drive) { + if (is_integer($row / 2)) { + $row_colour = $list_colour_a; + } + else { + $row_colour = $list_colour_b; + } - $fs_url = "device/device=".$device['device_id']."/tab=health/metric=diskio/"; + $fs_url = 'device/device='.$device['device_id'].'/tab=health/metric=diskio/'; - $graph_array_zoom['id'] = $drive['diskio_id']; - $graph_array_zoom['type'] = "diskio_ops"; - $graph_array_zoom['width'] = "400"; - $graph_array_zoom['height'] = "125"; - $graph_array_zoom['from'] = $config['time']['twoday']; - $graph_array_zoom['to'] = $config['time']['now']; + $graph_array_zoom['id'] = $drive['diskio_id']; + $graph_array_zoom['type'] = 'diskio_ops'; + $graph_array_zoom['width'] = '400'; + $graph_array_zoom['height'] = '125'; + $graph_array_zoom['from'] = $config['time']['twoday']; + $graph_array_zoom['to'] = $config['time']['now']; - echo(""); + echo "'; - $types = array("diskio_bits", "diskio_ops"); + $types = array( + 'diskio_bits', + 'diskio_ops', + ); - foreach ($types as $graph_type) - { - echo('"); - } + echo ''; + } - $row++; + $row++; } -echo("
    DriveUsageFree
    "); - echo(overlib_link($fs_url, $drive['diskio_descr'], generate_graph_tag($graph_array_zoom), NULL)); - echo("
    "; + echo overlib_link($fs_url, $drive['diskio_descr'], generate_graph_tag($graph_array_zoom), null); + echo '
    '); + foreach ($types as $graph_type) { + echo '
    '; - $graph_array = array(); - $graph_array['id'] = $drive['diskio_id']; - $graph_array['type'] = $graph_type; + $graph_array = array(); + $graph_array['id'] = $drive['diskio_id']; + $graph_array['type'] = $graph_type; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo("
    "); - -?> +echo ''; diff --git a/html/pages/device/health/fanspeed.inc.php b/html/pages/device/health/fanspeed.inc.php index accf2d896..62c385ebf 100644 --- a/html/pages/device/health/fanspeed.inc.php +++ b/html/pages/device/health/fanspeed.inc.php @@ -1,9 +1,7 @@ +require 'sensors.inc.php'; diff --git a/html/pages/device/health/frequency.inc.php b/html/pages/device/health/frequency.inc.php index 4ad62f40d..280a76e49 100644 --- a/html/pages/device/health/frequency.inc.php +++ b/html/pages/device/health/frequency.inc.php @@ -1,9 +1,7 @@ +require 'sensors.inc.php'; diff --git a/html/pages/device/health/power.inc.php b/html/pages/device/health/power.inc.php index ab246055e..e0354e564 100644 --- a/html/pages/device/health/power.inc.php +++ b/html/pages/device/health/power.inc.php @@ -1,9 +1,7 @@ +require 'sensors.inc.php'; diff --git a/html/pages/device/health/sensors.inc.php b/html/pages/device/health/sensors.inc.php index 36f85bb59..7e38a58f9 100644 --- a/html/pages/device/health/sensors.inc.php +++ b/html/pages/device/health/sensors.inc.php @@ -1,32 +1,34 @@ "); +echo ''; $row = 1; -foreach (dbFetchRows("SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? ORDER BY `sensor_descr`", array($class, $device['device_id'])) as $sensor) -{ - if (!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } +foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? ORDER BY `sensor_descr`', array($class, $device['device_id'])) as $sensor) { + if (!is_integer($row / 2)) { + $row_colour = $list_colour_a; + } + else { + $row_colour = $list_colour_b; + } - echo(" - - - - - - \n"); - echo(" + + + + + + \n"; + echo ""); + echo ''; - $row++; + $row++; } -echo("
    " . $sensor['sensor_descr'] . "" . $sensor['sensor_type'] . "" . format_si($sensor['sensor_current']) .$unit. "" . format_si($sensor['sensor_limit']) . $unit . "" . format_si($sensor['sensor_limit_low']) . $unit ."
    "); + echo "
    ".$sensor['sensor_descr'].''.$sensor['sensor_type'].''.format_si($sensor['sensor_current']).$unit.''.format_si($sensor['sensor_limit']).$unit.''.format_si($sensor['sensor_limit_low']).$unit."
    "; - $graph_array['id'] = $sensor['sensor_id']; - $graph_array['type'] = $graph_type; + $graph_array['id'] = $sensor['sensor_id']; + $graph_array['type'] = $graph_type; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo("
    "); - -?> +echo ''; diff --git a/html/pages/device/health/temperature.inc.php b/html/pages/device/health/temperature.inc.php index dd2c8878b..b13856f47 100644 --- a/html/pages/device/health/temperature.inc.php +++ b/html/pages/device/health/temperature.inc.php @@ -1,9 +1,7 @@ +require 'sensors.inc.php'; diff --git a/html/pages/device/health/voltage.inc.php b/html/pages/device/health/voltage.inc.php index 900db5c18..6ff7cdb7b 100644 --- a/html/pages/device/health/voltage.inc.php +++ b/html/pages/device/health/voltage.inc.php @@ -1,9 +1,7 @@ +require 'sensors.inc.php'; diff --git a/html/pages/device/latency.inc.php b/html/pages/device/latency.inc.php index 72f882be6..571916fc0 100644 --- a/html/pages/device/latency.inc.php +++ b/html/pages/device/latency.inc.php @@ -2,134 +2,123 @@ print_optionbar_start(); -echo("Latency » "); +echo "Latency » "; -if(count($smokeping_files['in'][$device['hostname']])) - $menu_options['incoming'] = 'Incoming'; +if (count($smokeping_files['in'][$device['hostname']])) { + $menu_options['incoming'] = 'Incoming'; +} -if(count($smokeping_files['out'][$device['hostname']])) - $menu_options['outgoing'] = 'Outgoing'; +if (count($smokeping_files['out'][$device['hostname']])) { + $menu_options['outgoing'] = 'Outgoing'; +} -$sep = ""; -foreach ($menu_options as $option => $text) -{ - if (!$vars['view']) { $vars['view'] = $option; } - echo($sep); - if ($vars['view'] == $option) - { - echo(""); - } - echo(generate_link($text,$vars,array('view'=>$option))); - if ($vars['view'] == $option) - { - echo(""); - } - $sep = " | "; +$sep = ''; +foreach ($menu_options as $option => $text) { + if (!$vars['view']) { + $vars['view'] = $option; + } + + echo $sep; + if ($vars['view'] == $option) { + echo ""; + } + + echo generate_link($text, $vars, array('view' => $option)); + if ($vars['view'] == $option) { + echo ''; + } + + $sep = ' | '; } unset($sep); print_optionbar_end(); -echo(''); +echo '
    '; -if($vars['view'] == "incoming") -{ +if ($vars['view'] == 'incoming') { + if (count($smokeping_files['in'][$device['hostname']])) { + $graph_array['type'] = 'device_smokeping_in_all_avg'; + $graph_array['device'] = $device['device_id']; + echo ''; - include("includes/print-graphrow.inc.php"); + $graph_array['type'] = 'device_smokeping_in_all'; + $graph_array['legend'] = no; + echo ''); + include 'includes/print-graphrow.inc.php'; - $graph_array['type'] = "device_smokeping_in_all"; - $graph_array['legend'] = no; - echo(''; - include("includes/print-graphrow.inc.php"); + unset($graph_array['legend']); - echo(''); + ksort($smokeping_files['in'][$device['hostname']]); + foreach ($smokeping_files['in'][$device['hostname']] as $src => $host) { + $hostname = str_replace('.rrd', '', $host); + $host = device_by_name($src); + if (is_numeric($host['device_id'])) { + echo ''); - } - } - - } - -} elseif ($vars['view'] == "outgoing") { - - if (count($smokeping_files['out'][$device['hostname']])) - { - - $graph_array['type'] = "device_smokeping_out_all_avg"; - $graph_array['device'] = $device['device_id']; - echo(''); - - $graph_array['type'] = "device_smokeping_out_all"; - $graph_array['legend'] = no; - echo(''); - - unset($graph_array['legend']); - - asort($smokeping_files['out'][$device['hostname']]); - foreach ($smokeping_files['out'][$device['hostname']] AS $host) - { - $hostname = str_replace(".rrd", "", $host); - list($hostname) = explode("~", $hostname); - $host = device_by_name($hostname); - if (is_numeric($host['device_id'])) - { - echo(''); - } - } - - } + echo ''; + } + } + }//end if } +else if ($vars['view'] == 'outgoing') { + if (count($smokeping_files['out'][$device['hostname']])) { + $graph_array['type'] = 'device_smokeping_out_all_avg'; + $graph_array['device'] = $device['device_id']; + echo '
    '; + echo '

    Average

    '; - if (count($smokeping_files['in'][$device['hostname']])) - { + include 'includes/print-graphrow.inc.php'; - $graph_array['type'] = "device_smokeping_in_all_avg"; - $graph_array['device'] = $device['device_id']; - echo('
    '); - echo('

    Average

    '); + echo '
    '; + echo '

    Aggregate

    '; - echo('
    '); - echo('

    Aggregate

    '); + echo '
    '; + echo '

    '.generate_device_link($host).'

    '; + $graph_array['type'] = 'smokeping_in'; + $graph_array['device'] = $device['device_id']; + $graph_array['src'] = $host['device_id']; - unset($graph_array['legend']); + include 'includes/print-graphrow.inc.php'; - ksort($smokeping_files['in'][$device['hostname']]); - foreach ($smokeping_files['in'][$device['hostname']] AS $src => $host) - { - $hostname = str_replace(".rrd", "", $host); - $host = device_by_name($src); - if (is_numeric($host['device_id'])) - { - echo('
    '); - echo('

    '.generate_device_link($host).'

    '); - $graph_array['type'] = "smokeping_in"; - $graph_array['device'] = $device['device_id']; - $graph_array['src'] = $host['device_id']; - - include("includes/print-graphrow.inc.php"); - - echo('
    '); - echo('

    Aggregate

    '); - - include("includes/print-graphrow.inc.php"); - - echo('
    '); - echo('

    Aggregate

    '); - - include("includes/print-graphrow.inc.php"); - - echo('
    '); - echo('

    '.generate_device_link($host).'

    '); - $graph_array['type'] = "smokeping_out"; - $graph_array['device'] = $device['device_id']; - $graph_array['dest'] = $host['device_id']; - - include("includes/print-graphrow.inc.php"); - - echo('
    '; + echo '

    Aggregate

    '; -echo('
    '); + include 'includes/print-graphrow.inc.php'; -$pagetitle[] = "Latency"; + echo ''; -?> + $graph_array['type'] = 'device_smokeping_out_all'; + $graph_array['legend'] = no; + echo ''; + echo '

    Aggregate

    '; + + include 'includes/print-graphrow.inc.php'; + + echo ''; + + unset($graph_array['legend']); + + asort($smokeping_files['out'][$device['hostname']]); + foreach ($smokeping_files['out'][$device['hostname']] as $host) { + $hostname = str_replace('.rrd', '', $host); + list($hostname) = explode('~', $hostname); + $host = device_by_name($hostname); + if (is_numeric($host['device_id'])) { + echo ''; + echo '

    '.generate_device_link($host).'

    '; + $graph_array['type'] = 'smokeping_out'; + $graph_array['device'] = $device['device_id']; + $graph_array['dest'] = $host['device_id']; + + include 'includes/print-graphrow.inc.php'; + + echo ''; + } + } + }//end if +}//end if + +echo ''; + +$pagetitle[] = 'Latency'; diff --git a/html/pages/device/loadbalancer.inc.php b/html/pages/device/loadbalancer.inc.php index 26e96923c..ab624a873 100644 --- a/html/pages/device/loadbalancer.inc.php +++ b/html/pages/device/loadbalancer.inc.php @@ -1,70 +1,75 @@ 'device', - 'device' => $device['device_id'], - 'tab' => 'loadbalancer'); +$link_array = array( + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'loadbalancer', +); // Cisco ACE -$type_text['loadbalancer_rservers'] = "Rservers"; -$type_text['loadbalancer_vservers'] = "Serverfarms"; +$type_text['loadbalancer_rservers'] = 'Rservers'; +$type_text['loadbalancer_vservers'] = 'Serverfarms'; // Citrix Netscaler -$type_text['netscaler_vsvr'] = "VServers"; +$type_text['netscaler_vsvr'] = 'VServers'; print_optionbar_start(); -$pagetitle[] = "Load Balancer"; +$pagetitle[] = 'Load Balancer'; -echo("Load Balancer » "); +echo "Load Balancer » "; unset($sep); -foreach ($loadbalancer_tabs as $type) -{ +foreach ($loadbalancer_tabs as $type) { + if (!$vars['type']) { + $vars['type'] = $type; + } - if (!$vars['type']) { $vars['type'] = $type; } + echo $sep; - echo($sep); + if ($vars['type'] == $type) { + echo ''; + } - if ($vars['type'] == $type) - { - echo(''); - } + echo generate_link($type_text[$type].' ('.$device_loadbalancer_count[$type].')', $link_array, array('type' => $type)); + if ($vars['type'] == $type) { + echo ''; + } - echo(generate_link($type_text[$type] ." (".$device_loadbalancer_count[$type].")",$link_array,array('type'=>$type))); - if ($vars['type'] == $type) { echo(""); } - $sep = " | "; + $sep = ' | '; } print_optionbar_end(); -if (is_file("pages/device/loadbalancer/".mres($vars['type']).".inc.php")) -{ - include("pages/device/loadbalancer/".mres($vars['type']).".inc.php"); -} else { - foreach ($loadbalancer_tabs as $type) - { - if ($type != "overview") - { - if (is_file("pages/device/loadbalancer/overview/".mres($type).".inc.php")) { - - $g_i++; - if (!is_integer($g_i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - - echo('
    '); - echo('
    '.$type_text[$type].''); - - include("pages/device/loadbalancer/overview/".mres($type).".inc.php"); - - echo('
    '); - echo('
    '); - } else { - $graph_title = $type_text[$type]; - $graph_type = "device_".$type; - - include("includes/print-device-graph.php"); - } - } - } +if (is_file('pages/device/loadbalancer/'.mres($vars['type']).'.inc.php')) { + include 'pages/device/loadbalancer/'.mres($vars['type']).'.inc.php'; } +else { + foreach ($loadbalancer_tabs as $type) { + if ($type != 'overview') { + if (is_file('pages/device/loadbalancer/overview/'.mres($type).'.inc.php')) { + $g_i++; + if (!is_integer($g_i / 2)) { + $row_colour = $list_colour_a; + } + else { + $row_colour = $list_colour_b; + } -?> + echo '
    '; + echo '
    '.$type_text[$type].''; + + include 'pages/device/loadbalancer/overview/'.mres($type).'.inc.php'; + + echo '
    '; + echo '
    '; + } + else { + $graph_title = $type_text[$type]; + $graph_type = 'device_'.$type; + + include 'includes/print-device-graph.php'; + }//end if + }//end if + }//end foreach +}//end if diff --git a/html/pages/device/loadbalancer/ace_rservers.inc.php b/html/pages/device/loadbalancer/ace_rservers.inc.php index 08ee06c47..52f1773c7 100644 --- a/html/pages/device/loadbalancer/ace_rservers.inc.php +++ b/html/pages/device/loadbalancer/ace_rservers.inc.php @@ -2,90 +2,103 @@ print_optionbar_start(); -echo("Serverfarm Rservers » "); +echo "Serverfarm Rservers » "; -#$auth = TRUE; +// $auth = TRUE; +$menu_options = array('basic' => 'Basic'); -$menu_options = array('basic' => 'Basic', - ); +if (!$_GET['opta']) { + $_GET['opta'] = 'basic'; +} -if (!$_GET['opta']) { $_GET['opta'] = "basic"; } +$sep = ''; +foreach ($menu_options as $option => $text) { + if ($_GET['optd'] == $option) { + echo ""; + } -$sep = ""; -foreach ($menu_options as $option => $text) -{ - if ($_GET['optd'] == $option) { echo(""); } - echo('' . $text - . ''); - if ($_GET['optd'] == $option) { echo(""); } - echo(" | "); + echo ''.$text .''; + if ($_GET['optd'] == $option) { + echo ''; + } + + echo ' | '; } unset($sep); -echo(' Graphs: '); +echo ' Graphs: '; -#$graph_types = array("bits" => "Bits", -# "pkts" => "Packets", -# "errors" => "Errors"); +// $graph_types = array("bits" => "Bits", +// "pkts" => "Packets", +// "errors" => "Errors"); +$graph_types = array( + 'curr' => 'CurrentConns', + 'failed' => 'FailedConns', + 'total' => 'TotalConns', + ); -$graph_types = array("curr" => "CurrentConns", - "failed" => "FailedConns", - "total" => "TotalConns"); +foreach ($graph_types as $type => $descr) { + echo "$type_sep"; + if ($_GET['opte'] == $type) { + echo ""; + } -foreach ($graph_types as $type => $descr) -{ - echo("$type_sep"); - if ($_GET['opte'] == $type) { echo(""); } - echo(''.$descr.''); - if ($_GET['opte'] == $type) { echo(""); } + echo ''.$descr.''; + if ($_GET['opte'] == $type) { + echo ''; + } - $type_sep = " | "; + $type_sep = ' | '; } print_optionbar_end(); -echo("
    "); -$i = "0"; -foreach (dbFetchRows("SELECT * FROM `loadbalancer_rservers` WHERE `device_id` = ? ORDER BY `farm_id`", array($device['device_id'])) as $rserver) -{ -if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } +echo "
    "; +$i = '0'; +foreach (dbFetchRows('SELECT * FROM `loadbalancer_rservers` WHERE `device_id` = ? ORDER BY `farm_id`', array($device['device_id'])) as $rserver) { + if (is_integer($i / 2)) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } -if($rserver['StateDescr'] == "Server is now operational") { $rserver_class="green"; } else { $rserver_class="red"; } + if ($rserver['StateDescr'] == 'Server is now operational') { + $rserver_class = 'green'; + } else { + $rserver_class = 'red'; + } -echo(""); -#echo(""); -echo(""); -#echo(""); -echo(""); -echo(""); - if ($_GET['optd'] == "graphs") - { - echo(''); - echo(""; + // echo(""); + echo ''; + // echo(""); + echo "'; + echo ''; + if ($_GET['optd'] == 'graphs') { + echo ''; + echo ' - "); - } + '; + } -echo(""); -echo(""); + echo ''; + echo ''; - $i++; + $i++; } -echo("
    " . $tunnel['local_addr'] . " » " . $tunnel['peer_addr'] . "" . $rserver['farm_id'] . "" . $rserver['farm_id'] . "" . $rserver['StateDescr'] . "
    "); - $graph_type = "rserver_" . $_GET['opte']; + echo "
    " . $tunnel['local_addr'] . " » " . $tunnel['peer_addr'] . "'.$rserver['farm_id'].'" . $rserver['farm_id'] . "".$rserver['StateDescr'].'
    '; + $graph_type = 'rserver_'.$_GET['opte']; -$graph_array['height'] = "100"; -$graph_array['width'] = "215"; -$graph_array['to'] = $config['time']['now']; -$graph_array['id'] = $rserver['rserver_id']; -$graph_array['type'] = $graph_type; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $rserver['rserver_id']; + $graph_array['type'] = $graph_type; -include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; -#include("includes/print-interface-graphs.inc.php"); - - echo(" + // include("includes/print-interface-graphs.inc.php"); + echo '
    "); - -?> +echo ''; diff --git a/html/pages/device/loadbalancer/netscaler_vsvr.inc.php b/html/pages/device/loadbalancer/netscaler_vsvr.inc.php index aaaa437a8..a67d755b9 100644 --- a/html/pages/device/loadbalancer/netscaler_vsvr.inc.php +++ b/html/pages/device/loadbalancer/netscaler_vsvr.inc.php @@ -1,141 +1,164 @@ VServer » "); + // echo('All'); + // print_optionbar_end(); + $graph_types = array( + 'bits' => 'Bits', + 'pkts' => 'Packets', + 'conns' => 'Connections', + 'reqs' => 'Requests', + 'hitmiss' => 'Hit/Miss', + ); -#print_optionbar_start(); -#echo("VServer » "); -#echo('All'); -#print_optionbar_end(); + $i = 0; -$graph_types = array("bits" => "Bits", - "pkts" => "Packets", - "conns" => "Connections", - "reqs" => "Requests", - "hitmiss" => "Hit/Miss"); + echo "
    "; + foreach (dbFetchRows('SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? AND `vsvr_id` = ? ORDER BY `vsvr_name`', array($device['device_id'], $vars['vsvr'])) as $vsvr) { + if (is_integer($i / 2)) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } -$i=0; + if ($vsvr['vsvr_state'] == 'up') { + $vsvr_class = 'green'; + } + else { + $vsvr_class = 'red'; + } -echo("
    "); -foreach (dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? AND `vsvr_id` = ? ORDER BY `vsvr_name`", array($device['device_id'], $vars['vsvr'])) as $vsvr) -{ + echo ""; + echo ''; + echo ''; + echo "'; + echo (''); + echo (''); + echo ''; - if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + foreach ($graph_types as $graph_type => $graph_text) { + $i++; + echo ''; + echo '"); - echo(''); - echo(""); - echo(""); - echo(""); - echo(""); - echo(""); + include 'includes/print-graphrow.inc.php'; - foreach ($graph_types as $graph_type => $graph_text) - { - $i++; - echo(''); - echo(' - "); - } + '; + } + }//end foreach + + echo '
    '.$vsvr['vsvr_name'].''.$vsvr['vsvr_ip'].':'.$vsvr['vsvr_port'].'".$vsvr['vsvr_state'].''.format_si(($vsvr['vsvr_bps_in'] * 8)).'bps'.format_si(($vsvr['vsvr_bps_out'] * 8)).'bps
    '; + $graph_type = 'netscalervsvr_'.$graph_type; + $graph_array['height'] = '100'; + $graph_array['width'] = '213'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $vsvr['vsvr_id']; + $graph_array['type'] = $graph_type; - if ($vsvr['vsvr_state'] == "up") { $vsvr_class="green"; } else { $vsvr_class="red"; } + echo '

    '.$graph_text.'

    '; - echo("
    ' . $vsvr['vsvr_name'] . '" . $vsvr['vsvr_ip'] . ":" . $vsvr['vsvr_port'] . "" . $vsvr['vsvr_state'] . "" . format_si($vsvr['vsvr_bps_in']*8) . "bps" . format_si($vsvr['vsvr_bps_out']*8) . "bps
    '); - $graph_type = "netscalervsvr_" . $graph_type; - $graph_array['height'] = "100"; - $graph_array['width'] = "213"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $vsvr['vsvr_id']; - $graph_array['type'] = $graph_type; - - echo('

    '.$graph_text.'

    '); - - include("includes/print-graphrow.inc.php"); - - echo(" + echo '
    '; } +else { + print_optionbar_start(); -echo(""); + echo "VServers » "; -} else { + $menu_options = array('basic' => 'Basic'); -print_optionbar_start(); + if (!$vars['view']) { + $vars['view'] = 'basic'; + } -echo("VServers » "); + $sep = ''; + foreach ($menu_options as $option => $text) { + if ($vars['view'] == $option) { + echo ""; + } -$menu_options = array('basic' => 'Basic', - ); + echo ''.$text.''; + if ($vars['view'] == $option) { + echo ''; + } -if (!$vars['view']) { $vars['view'] = "basic"; } + echo ' | '; + } -$sep = ""; -foreach ($menu_options as $option => $text) -{ - if ($vars['view'] == $option) { echo(""); } - echo(''.$text.''); - if ($vars['view'] == $option) { echo(""); } - echo(" | "); -} + unset($sep); + echo ' Graphs: '; + $graph_types = array( + 'bits' => 'Bits', + 'pkts' => 'Packets', + 'conns' => 'Connections', + 'reqs' => 'Requests', + 'hitmiss' => 'Hit/Miss', + ); -unset($sep); -echo(' Graphs: '); -$graph_types = array("bits" => "Bits", - "pkts" => "Packets", - "conns" => "Connections", - "reqs" => "Requests", - "hitmiss" => "Hit/Miss"); + foreach ($graph_types as $type => $descr) { + echo "$type_sep"; + if ($vars['graph'] == $type) { + echo ""; + } -foreach ($graph_types as $type => $descr) -{ - echo("$type_sep"); - if ($vars['graph'] == $type) { echo(""); } - echo(''.$descr.''); - if ($vars['graph'] == $type) { echo(""); } - $type_sep = " | "; -} + echo ''.$descr.''; + if ($vars['graph'] == $type) { + echo ''; + } -print_optionbar_end(); + $type_sep = ' | '; + } -echo("
    "); -$i = "0"; -foreach (dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? ORDER BY `vsvr_name`", array($device['device_id'])) as $vsvr) -{ - if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + print_optionbar_end(); - if ($vsvr['vsvr_state'] == "up") { $vsvr_class="green"; } else { $vsvr_class="red"; } + echo "
    "; + $i = '0'; + foreach (dbFetchRows('SELECT * FROM `netscaler_vservers` WHERE `device_id` = ? ORDER BY `vsvr_name`', array($device['device_id'])) as $vsvr) { + if (is_integer($i / 2)) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } - echo(""); - echo(''); - echo(""); - echo(""); - echo(""); - echo(""); - echo(""); - if ($vars['view'] == "graphs") - { - echo(''); - echo('"; + echo ''; + echo ''; + echo "'; + echo (''); + echo (''); + echo ''; + if ($vars['view'] == 'graphs') { + echo ''; + echo ' - "); - } + '; + } -echo(""); -echo(""); + echo ''; + echo ''; - $i++; -} + $i++; + }//end foreach -echo("
    ' . $vsvr['vsvr_name'] . '" . $vsvr['vsvr_ip'] . ":" . $vsvr['vsvr_port'] . "" . $vsvr['vsvr_state'] . "" . format_si($vsvr['vsvr_bps_in']*8) . "bps" . format_si($vsvr['vsvr_bps_out']*8) . "bps
    '); - $graph_type = "netscalervsvr_" . $vars['graph']; - $graph_array['height'] = "100"; - $graph_array['width'] = "213"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $vsvr['vsvr_id']; - $graph_array['type'] = $graph_type; + if ($vsvr['vsvr_state'] == 'up') { + $vsvr_class = 'green'; + } + else { + $vsvr_class = 'red'; + } - include("includes/print-graphrow.inc.php"); + echo "
    '.$vsvr['vsvr_name'].''.$vsvr['vsvr_ip'].':'.$vsvr['vsvr_port'].'".$vsvr['vsvr_state'].''.format_si(($vsvr['vsvr_bps_in'] * 8)).'bps'.format_si(($vsvr['vsvr_bps_out'] * 8)).'bps
    '; + $graph_type = 'netscalervsvr_'.$vars['graph']; + $graph_array['height'] = '100'; + $graph_array['width'] = '213'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $vsvr['vsvr_id']; + $graph_array['type'] = $graph_type; - echo(" + include 'includes/print-graphrow.inc.php'; + + echo '
    "); - -} - -?> + echo ''; +}//end if diff --git a/html/pages/device/nfsen.inc.php b/html/pages/device/nfsen.inc.php index d3552efd5..53e3c1ef4 100644 --- a/html/pages/device/nfsen.inc.php +++ b/html/pages/device/nfsen.inc.php @@ -1,19 +1,16 @@ 'nfsen_flows', - 'Packets' => 'nfsen_packets', - 'Traffic' => 'nfsen_traffic' -); + 'Flows' => 'nfsen_flows', + 'Packets' => 'nfsen_packets', + 'Traffic' => 'nfsen_traffic', + ); -foreach ($datas as $name=>$type) -{ - $graph_title = $name; - $graph_type = "device_".$type; +foreach ($datas as $name => $type) { + $graph_title = $name; + $graph_type = 'device_'.$type; - include("includes/print-device-graph.php"); + include 'includes/print-device-graph.php'; } -$pagetitle[] = "Netflow"; - -?> +$pagetitle[] = 'Netflow'; diff --git a/html/pages/device/overview/sensors/dbm.inc.php b/html/pages/device/overview/sensors/dbm.inc.php index 81646d32c..dab9874c2 100644 --- a/html/pages/device/overview/sensors/dbm.inc.php +++ b/html/pages/device/overview/sensors/dbm.inc.php @@ -1,10 +1,8 @@ +require 'pages/device/overview/generic/sensor.inc.php'; diff --git a/html/pages/device/overview/sensors/fanspeeds.inc.php b/html/pages/device/overview/sensors/fanspeeds.inc.php index 5e522f4bc..f044edcbf 100644 --- a/html/pages/device/overview/sensors/fanspeeds.inc.php +++ b/html/pages/device/overview/sensors/fanspeeds.inc.php @@ -1,10 +1,8 @@ +require 'pages/device/overview/generic/sensor.inc.php'; diff --git a/html/pages/device/overview/sensors/frequencies.inc.php b/html/pages/device/overview/sensors/frequencies.inc.php index 077e51bb9..b49adbe28 100644 --- a/html/pages/device/overview/sensors/frequencies.inc.php +++ b/html/pages/device/overview/sensors/frequencies.inc.php @@ -1,10 +1,8 @@ +require 'pages/device/overview/generic/sensor.inc.php'; diff --git a/html/pages/device/overview/sensors/power.inc.php b/html/pages/device/overview/sensors/power.inc.php index 7bd262b7f..98a026d15 100644 --- a/html/pages/device/overview/sensors/power.inc.php +++ b/html/pages/device/overview/sensors/power.inc.php @@ -1,10 +1,8 @@ +require 'pages/device/overview/generic/sensor.inc.php'; diff --git a/html/pages/device/overview/sensors/temperatures.inc.php b/html/pages/device/overview/sensors/temperatures.inc.php index 111d046ab..c198f37c8 100644 --- a/html/pages/device/overview/sensors/temperatures.inc.php +++ b/html/pages/device/overview/sensors/temperatures.inc.php @@ -1,10 +1,8 @@ +require 'pages/device/overview/generic/sensor.inc.php'; diff --git a/html/pages/device/overview/sensors/voltages.inc.php b/html/pages/device/overview/sensors/voltages.inc.php index 11d40ccc3..69afcb1c6 100644 --- a/html/pages/device/overview/sensors/voltages.inc.php +++ b/html/pages/device/overview/sensors/voltages.inc.php @@ -1,10 +1,8 @@ +require 'pages/device/overview/generic/sensor.inc.php'; diff --git a/html/pages/device/packages.inc.php b/html/pages/device/packages.inc.php index db517b438..20cd7ff91 100644 --- a/html/pages/device/packages.inc.php +++ b/html/pages/device/packages.inc.php @@ -1,22 +1,25 @@ '); +echo ''; -$i=0; -foreach (dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ? ORDER BY `name`", array($device['device_id'])) as $entry) -{ - echo(''); - echo(''); - if ($build != '') { $dbuild = '-'.$entry['build']; } else { $dbuild = ''; } - echo(""); - echo(""); - echo(""); - echo(""); - echo(""); +$i = 0; +foreach (dbFetchRows('SELECT * FROM `packages` WHERE `device_id` = ? ORDER BY `name`', array($device['device_id'])) as $entry) { + echo ''; + echo ''; + if ($build != '') { + $dbuild = '-'.$entry['build']; + } + else { + $dbuild = ''; + } - $i++; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + + $i++; } -echo("
    '.$entry['name'].'".$entry['version'].$dbuild."".$entry['arch']."".$entry['manager']."".format_si($entry['size'])."
    '.$entry['name'].''.$entry['version'].$dbuild.''.$entry['arch'].''.$entry['manager'].''.format_si($entry['size']).'
    "); - -?> +echo ''; diff --git a/html/pages/device/port/adsl.inc.php b/html/pages/device/port/adsl.inc.php index 44813e685..170f2a2c5 100644 --- a/html/pages/device/port/adsl.inc.php +++ b/html/pages/device/port/adsl.inc.php @@ -1,27 +1,24 @@ ADSL Line Speed"); - $graph_type = "port_adsl_speed"; +if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-adsl.rrd')) { + $iid = $id; + echo '
    ADSL Line Speed
    '; + $graph_type = 'port_adsl_speed'; - include("includes/print-interface-graphs.inc.php"); + include 'includes/print-interface-graphs.inc.php'; - echo("
    ADSL Line Attenuation
    "); - $graph_type = "port_adsl_attenuation"; + echo '
    ADSL Line Attenuation
    '; + $graph_type = 'port_adsl_attenuation'; - include("includes/print-interface-graphs.inc.php"); + include 'includes/print-interface-graphs.inc.php'; - echo("
    ADSL Line SNR Margin
    "); - $graph_type = "port_adsl_snr"; + echo '
    ADSL Line SNR Margin
    '; + $graph_type = 'port_adsl_snr'; - include("includes/print-interface-graphs.inc.php"); + include 'includes/print-interface-graphs.inc.php'; - echo("
    ADSL Output Powers
    "); - $graph_type = "port_adsl_power"; + echo '
    ADSL Output Powers
    '; + $graph_type = 'port_adsl_power'; - include("includes/print-interface-graphs.inc.php"); + include 'includes/print-interface-graphs.inc.php'; } - -?> diff --git a/html/pages/device/port/arp.inc.php b/html/pages/device/port/arp.inc.php index f9898a363..821787543 100644 --- a/html/pages/device/port/arp.inc.php +++ b/html/pages/device/port/arp.inc.php @@ -1,29 +1,48 @@ '); -$i = "1"; +echo ''; +$i = '1'; -foreach (dbFetchRows("SELECT * FROM ipv4_mac WHERE port_id = ?", array($port['port_id'])) as $arp) -{ - if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - $arp_host = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id", array($arp['ipv4_address'])); +foreach (dbFetchRows('SELECT * FROM ipv4_mac WHERE port_id = ?', array($port['port_id'])) as $arp) { + if (!is_integer($i / 2)) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } - if ($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); } - if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); } + $arp_host = dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($arp['ipv4_address'])); - if ($arp_host['device_id'] == $device['device_id']) { $arp_name = "Localhost"; } - if ($arp_host['port_id'] == $arp['port_id']) { $arp_if = "Local Port"; } + if ($arp_host) { + $arp_name = generate_device_link($arp_host); + } + else { + unset($arp_name); + } - echo(' - + if ($arp_host) { + $arp_if = generate_port_link($arp_host); + } + else { + unset($arp_if); + } + + if ($arp_host['device_id'] == $device['device_id']) { + $arp_name = 'Localhost'; + } + + if ($arp_host['port_id'] == $arp['port_id']) { + $arp_if = 'Local Port'; + } + + echo ' + - '); - $i++; -} + '; + $i++; +}//end foreach -echo('
    '.formatmac($arp['mac_address']).' '.$arp['ipv4_address'].' '.$arp_name.' '.$arp_if.'
    '); - -?> +echo ''; diff --git a/html/pages/device/port/graphs.inc.php b/html/pages/device/port/graphs.inc.php index 8a38915f3..a323197de 100644 --- a/html/pages/device/port/graphs.inc.php +++ b/html/pages/device/port/graphs.inc.php @@ -1,35 +1,31 @@ Interface Traffic"); - $graph_type = "port_bits"; +if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'.rrd')) { + $iid = $id; + echo '
    Interface Traffic
    '; + $graph_type = 'port_bits'; - include("includes/print-interface-graphs.inc.php"); + include 'includes/print-interface-graphs.inc.php'; - echo("
    Interface Packets
    "); - $graph_type = "port_upkts"; + echo '
    Interface Packets
    '; + $graph_type = 'port_upkts'; - include("includes/print-interface-graphs.inc.php"); + include 'includes/print-interface-graphs.inc.php'; - echo("
    Interface Non Unicast
    "); - $graph_type = "port_nupkts"; + echo '
    Interface Non Unicast
    '; + $graph_type = 'port_nupkts'; - include("includes/print-interface-graphs.inc.php"); + include 'includes/print-interface-graphs.inc.php'; - echo("
    Interface Errors
    "); - $graph_type = "port_errors"; + echo '
    Interface Errors
    '; + $graph_type = 'port_errors'; - include("includes/print-interface-graphs.inc.php"); + include 'includes/print-interface-graphs.inc.php'; - if (is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . $port['ifIndex'] . "-dot3.rrd")) - { - echo("
    Ethernet Errors
    "); - $graph_type = "port_etherlike"; + if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-dot3.rrd')) { + echo '
    Ethernet Errors
    '; + $graph_type = 'port_etherlike'; - include("includes/print-interface-graphs.inc.php"); - } + include 'includes/print-interface-graphs.inc.php'; + } } - -?> diff --git a/html/pages/device/port/junose-atm-vp.inc.php b/html/pages/device/port/junose-atm-vp.inc.php index 0c57c75d6..70ea47d54 100644 --- a/html/pages/device/port/junose-atm-vp.inc.php +++ b/html/pages/device/port/junose-atm-vp.inc.php @@ -2,40 +2,54 @@ $row = 0; -if ($_GET['optc']) { $graph_type = "atmvp_".$_GET['optc']; } -if (!$graph_type) { $graph_type = "atmvp_bits"; } - -echo(''); - -foreach (dbFetchRows("SELECT * FROM juniAtmVp WHERE port_id = ?", array($interface['port_id'])) as $vp) -{ - if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - echo(''); - echo(''); - echo(''); - - $graph_array['height'] = "100"; - $graph_array['width'] = "214"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $vp['juniAtmVp_id']; - $graph_array['type'] = $graph_type; - - $periods = array('day', 'week', 'month', 'year'); - - echo(''); - - $row++; +if ($_GET['optc']) { + $graph_type = 'atmvp_'.$_GET['optc']; } -echo('
    '.$row.'. VP'.$vp['vp_id'].' '.$vp['vp_descr'].'
    '); - - foreach ($periods as $period) - { - $graph_array['from'] = $$period; - $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; - echo(overlib_link("#", generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); - } - - echo('
    '); +if (!$graph_type) { + $graph_type = 'atmvp_bits'; +} -?> +echo ''; + +foreach (dbFetchRows('SELECT * FROM juniAtmVp WHERE port_id = ?', array($interface['port_id'])) as $vp) { + if (is_integer($row / 2)) { + $row_colour = $list_colour_a; + } + else { + $row_colour = $list_colour_b; + } + + echo ''; + echo ''; + echo ''; + + $graph_array['height'] = '100'; + $graph_array['width'] = '214'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $vp['juniAtmVp_id']; + $graph_array['type'] = $graph_type; + + $periods = array( + 'day', + 'week', + 'month', + 'year', + ); + + echo ''; + + $row++; +}//end foreach + +echo '
    '.$row.'. VP'.$vp['vp_id'].' '.$vp['vp_descr'].'
    '; + + foreach ($periods as $period) { + $graph_array['from'] = $$period; + $graph_array_zoom = $graph_array; + $graph_array_zoom['height'] = '150'; + $graph_array_zoom['width'] = '400'; + echo overlib_link('#', generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), null); + } + + echo '
    '; diff --git a/html/pages/device/port/macaccounting.inc.php b/html/pages/device/port/macaccounting.inc.php index 29b4ad148..e82861c31 100644 --- a/html/pages/device/port/macaccounting.inc.php +++ b/html/pages/device/port/macaccounting.inc.php @@ -1,196 +1,218 @@ Disabled"; } -if ($port['ifAdminStatus'] == "up" && $port['ifOperStatus'] == "down") { $status = "Enabled / Disconnected"; } -if ($port['ifAdminStatus'] == "up" && $port['ifOperStatus'] == "up") { $status = "Enabled / Connected"; } +$color = 'black'; +if ($port['ifAdminStatus'] == 'down') { + $status = "Disabled"; +} -$i = 1; +if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] == 'down') { + $status = "Enabled / Disconnected"; +} + +if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] == 'up') { + $status = "Enabled / Connected"; +} + +$i = 1; $inf = fixifName($ifname); -echo("
    "); +echo "
    "; -if ($vars['subview'] == "top10") -{ +if ($vars['subview'] == 'top10') { + if (!isset($vars['sort'])) { + $vars['sort'] = 'in'; + } - if (!isset($vars['sort'])) { $vars['sort'] = "in"; } - if (!isset($vars['period'])) { $vars['period'] = "1day"; } - $from = "-" . $vars['period']; + if (!isset($vars['period'])) { + $vars['period'] = '1day'; + } - echo("
    + $from = '-'.$vars['period']; + + echo "
    - +
    -"); - unset($query); - } - else - { +"; + unset($query); +} +else { + $query = 'SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M, + `ports` AS I, `devices` AS D WHERE M.port_id = ? AND I.port_id = M.port_id AND I.device_id = D.device_id ORDER BY bps DESC'; + $param = array($port['port_id']); - $query = "SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M, - `ports` AS I, `devices` AS D WHERE M.port_id = ? AND I.port_id = M.port_id AND I.device_id = D.device_id ORDER BY bps DESC"; - $param = array($port['port_id']); + foreach (dbFetchRows($query, $param) as $acc) { + if (!is_integer($i / 2)) { + $row_colour = $list_colour_a; + } + else { + $row_colour = $list_colour_b; + } - foreach (dbFetchRows($query, $param) as $acc) - { - if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - $addy = dbFetchRow("SELECT * FROM ipv4_mac where mac_address = ?", array($acc['mac'])); - #$name = gethostbyaddr($addy['ipv4_address']); FIXME - Maybe some caching for this? - $arp_host = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id", array($addy['ipv4_address'])); - if ($arp_host) { $arp_name = generate_device_link($arp_host); $arp_name .= " ".generate_port_link($arp_host); } else { unset($arp_if); } + $addy = dbFetchRow('SELECT * FROM ipv4_mac where mac_address = ?', array($acc['mac'])); + // $name = gethostbyaddr($addy['ipv4_address']); FIXME - Maybe some caching for this? + $arp_host = dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($addy['ipv4_address'])); + if ($arp_host) { + $arp_name = generate_device_link($arp_host); + $arp_name .= ' '.generate_port_link($arp_host); + } + else { + unset($arp_if); + } - if ($name == $addy['ipv4_address']) { unset ($name); } - if (dbFetchCell("SELECT count(*) FROM bgpPeers WHERE device_id = ? AND bgpPeerIdentifier = ?", array($acc['device_id'], $addy['ipv4_address']))) - { - $peer_info = dbFetchRow("SELECT * FROM bgpPeers WHERE device_id = ? AND bgpPeerIdentifier = ?", array($acc['device_id'], $addy['ipv4_address'])); - } else { unset ($peer_info); } + if ($name == $addy['ipv4_address']) { + unset($name); + } - if ($peer_info) - { - $asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext']; - } else { - unset ($as); unset ($astext); unset($asn); - } + if (dbFetchCell('SELECT count(*) FROM bgpPeers WHERE device_id = ? AND bgpPeerIdentifier = ?', array($acc['device_id'], $addy['ipv4_address']))) { + $peer_info = dbFetchRow('SELECT * FROM bgpPeers WHERE device_id = ? AND bgpPeerIdentifier = ?', array($acc['device_id'], $addy['ipv4_address'])); + } + else { + unset($peer_info); + } - if ($vars['graph']) - { - $graph_type = "macaccounting_" . $vars['graph']; - } else { - $graph_type = "macaccounting_bits"; - } + if ($peer_info) { + $asn = 'AS'.$peer_info['bgpPeerRemoteAs']; + $astext = $peer_info['astext']; + } + else { + unset($as); + unset($astext); + unset($asn); + } - if ($vars['subview'] == "minigraphs") - { - if (!$asn) { $asn = "No Session"; } + if ($vars['graph']) { + $graph_type = 'macaccounting_'.$vars['graph']; + } + else { + $graph_type = 'macaccounting_bits'; + } - echo("
    - ".$addy['ipv4_address']." - ".$asn." + if ($vars['subview'] == 'minigraphs') { + if (!$asn) { + $asn = 'No Session'; + } + + echo "
    + ".$addy['ipv4_address'].' - '.$asn." ".$name." - ".$addy['ipv4_address']." - ".$asn."
    \ - \ +
    ".$name.' - '.$addy['ipv4_address'].' - '.$asn."
    \ + \ ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" > -
    + - ".$name." -
    "); + ".$name.' +
    '; + } + else { + echo "
    "; - } - else - { - echo("
    "); - - echo(" + echo (' - - - - - + + + + +
    ".mac_clean_to_readable($acc['mac'])."".$addy['ipv4_address']."".$name." ".$arp_name . "".formatRates($acc['cipMacHCSwitchedBytes_input_rate'] / 8)."".formatRates($acc['cipMacHCSwitchedBytes_output_rate'] / 8)."'.mac_clean_to_readable($acc['mac']).''.$addy['ipv4_address'].''.$name.' '.$arp_name.''.formatRates(($acc['cipMacHCSwitchedBytes_input_rate'] / 8)).''.formatRates(($acc['cipMacHCSwitchedBytes_output_rate'] / 8)).'
    - "); + '); - $peer_info['astext']; + $peer_info['astext']; - $graph_array['type'] = $graph_type; - $graph_array['id'] = $acc['ma_id']; - $graph_array['height'] = "100"; - $graph_array['width'] = "216"; - $graph_array['to'] = $config['time']['now']; - echo(''); + $graph_array['type'] = $graph_type; + $graph_array['id'] = $acc['ma_id']; + $graph_array['height'] = '100'; + $graph_array['width'] = '216'; + $graph_array['to'] = $config['time']['now']; + echo ''; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo(""); + echo ''; - $i++; - } - } -} - -?> + $i++; + }//end if + }//end foreach +}//end if diff --git a/html/pages/device/port/realtime.inc.php b/html/pages/device/port/realtime.inc.php index 28585faca..41311917f 100644 --- a/html/pages/device/port/realtime.inc.php +++ b/html/pages/device/port/realtime.inc.php @@ -1,26 +1,31 @@ "); } - echo(generate_link($interval."s",$link_array,array('view'=>'realtime','interval'=>$interval))); - if ($vars['interval'] == $interval) { echo(""); } - $thinger = " | "; +foreach (array(0.25, 1, 2, 5, 15, 60) as $interval) { + echo $thinger; + if ($vars['interval'] == $interval) { + echo ""; + } + + echo generate_link($interval.'s', $link_array, array('view' => 'realtime', 'interval' => $interval)); + if ($vars['interval'] == $interval) { + echo ''; + } + + $thinger = ' | '; } print_optionbar_end(); @@ -28,8 +33,8 @@ print_optionbar_end(); ?>
    - - + + Your browser does not support the type SVG! You need to either use Firefox or download the Adobe SVG plugin. diff --git a/html/pages/device/port/vlans.inc.php b/html/pages/device/port/vlans.inc.php index d96071c6a..d36139ddf 100644 --- a/html/pages/device/port/vlans.inc.php +++ b/html/pages/device/port/vlans.inc.php @@ -2,49 +2,63 @@ $vlans = dbFetchRows("SELECT * FROM `ports_vlans` AS PV, vlans AS V WHERE PV.`port_id` = '".$port['port_id']."' and PV.`device_id` = '".$device['device_id']."' AND V.`vlan_vlan` = PV.vlan AND V.device_id = PV.device_id"); -echo(''); +echo '
    '; -echo(""); +echo ''; -$row=0; -foreach ($vlans as $vlan) -{ - $row++; - if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - echo(''); +$row = 0; +foreach ($vlans as $vlan) { + $row++; + if (is_integer($row / 2)) { + $row_colour = $list_colour_a; + } + else { + $row_colour = $list_colour_b; + } - echo(""); - echo(""); + echo ''; - if ($vlan['state'] == "blocking") { $class="red"; } elseif ($vlan['state'] == "forwarding" ) { $class="green"; } else { $class = "none"; } + echo ''; + echo ''; - echo(""); + if ($vlan['state'] == 'blocking') { + $class = 'red'; + } + else if ($vlan['state'] == 'forwarding') { + $class = 'green'; + } + else { + $class = 'none'; + } - $vlan_ports = array(); - $otherports = dbFetchRows("SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.port_id = V.port_id", array($device['device_id'], $vlan['vlan'])); - foreach ($otherports as $otherport) - { - $vlan_ports[$otherport[ifIndex]] = $otherport; - } - $otherports = dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?", array($device['device_id'], $vlan['vlan'])); - foreach ($otherports as $otherport) - { - $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('untagged' => '1')); - } - ksort($vlan_ports); + echo ''; - echo(""); - echo(""); -} + $vlan_ports = array(); + $otherports = dbFetchRows('SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.port_id = V.port_id', array($device['device_id'], $vlan['vlan'])); + foreach ($otherports as $otherport) { + $vlan_ports[$otherport[ifIndex]] = $otherport; + } -echo("
    VLANDescriptionCostPriorityStateOther Ports
    VLANDescriptionCostPriorityStateOther Ports
    Vlan " . $vlan['vlan'] . "" . $vlan['vlan_descr'] . "
    Vlan '.$vlan['vlan'].''.$vlan['vlan_descr'].'".$vlan['cost']."".$vlan['priority']."".$vlan['state']."'.$vlan['cost'].''.$vlan['priority']."".$vlan['state'].'"); - $vsep=''; - foreach ($vlan_ports as $otherport) - { - echo($vsep.generate_port_link($otherport, makeshortif($otherport['ifDescr']))); - if ($otherport['untagged']) { echo("(U)"); } - $vsep=", "; - } - echo("
    "); + $otherports = dbFetchRows('SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?', array($device['device_id'], $vlan['vlan'])); + foreach ($otherports as $otherport) { + $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('untagged' => '1')); + } -?> + ksort($vlan_ports); + + echo ''; + $vsep = ''; + foreach ($vlan_ports as $otherport) { + echo $vsep.generate_port_link($otherport, makeshortif($otherport['ifDescr'])); + if ($otherport['untagged']) { + echo '(U)'; + } + + $vsep = ', '; + } + + echo ''; + echo ''; +}//end foreach + +echo ''; diff --git a/html/pages/device/ports/adsl.inc.php b/html/pages/device/ports/adsl.inc.php index cb75fa4df..ba19fae99 100644 --- a/html/pages/device/ports/adsl.inc.php +++ b/html/pages/device/ports/adsl.inc.php @@ -1,17 +1,15 @@ "); +echo "
    "; - echo(""); - $i = "0"; - $ports = dbFetchRows("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = ? AND A.port_id = P.port_id AND P.deleted = '0' ORDER BY `ifIndex` ASC", array($device['device_id'])); - foreach ($ports as $port) - { - include("includes/print-interface-adsl.inc.php"); +echo ''; +$i = '0'; +$ports = dbFetchRows("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = ? AND A.port_id = P.port_id AND P.deleted = '0' ORDER BY `ifIndex` ASC", array($device['device_id'])); - $i++; - } - echo("
    PortTrafficSync SpeedAttainable SpeedAttenuationSNR MarginOutput Powers
    PortTrafficSync SpeedAttainable SpeedAttenuationSNR MarginOutput Powers
    "); - echo("
    "); +foreach ($ports as $port) { + include 'includes/print-interface-adsl.inc.php'; + $i++; +} -?> +echo ''; +echo "
    "; diff --git a/html/pages/device/ports/arp.inc.php b/html/pages/device/ports/arp.inc.php index e4a9b19d2..20417201c 100644 --- a/html/pages/device/ports/arp.inc.php +++ b/html/pages/device/ports/arp.inc.php @@ -1,33 +1,51 @@ '); -echo('PortMAC addressIPv4 addressRemote deviceRemote port'); +echo ''; +echo ''; -$i = "1"; +$i = '1'; -foreach (dbFetchRows("SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.port_id = M.port_id AND I.device_id = ?", array($device['device_id'])) as $arp) -{ - if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } +foreach (dbFetchRows('SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.port_id = M.port_id AND I.device_id = ?', array($device['device_id'])) as $arp) { + if (!is_integer($i / 2)) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } - $arp_host = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id", array($arp['ipv4_address'])); + $arp_host = dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($arp['ipv4_address'])); - if ($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); } - if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); } + if ($arp_host) { + $arp_name = generate_device_link($arp_host); + } + else { + unset($arp_name); + } - if ($arp_host['device_id'] == $device['device_id']) { $arp_name = "Localhost"; } - if ($arp_host['port_id'] == $arp['port_id']) { $arp_if = "Local Port"; } + if ($arp_host) { + $arp_if = generate_port_link($arp_host); + } + else { + unset($arp_if); + } - echo(" + if ($arp_host['device_id'] == $device['device_id']) { + $arp_name = 'Localhost'; + } + + if ($arp_host['port_id'] == $arp['port_id']) { + $arp_if = 'Local Port'; + } + + echo " - - - + + + - "); - $i++; -} + "; + $i++; +}//end foreach -echo("
    PortMAC addressIPv4 addressRemote deviceRemote port
    ".generate_port_link(array_merge($arp, $device))."".formatmac($arp['mac_address'])."".$arp['ipv4_address']."".generate_port_link(array_merge($arp, $device)).''.formatmac($arp['mac_address']).''.$arp['ipv4_address']." $arp_name $arp_if
    "); - -?> +echo ''; diff --git a/html/pages/device/ports/neighbours.inc.php b/html/pages/device/ports/neighbours.inc.php index 02a5091dd..5e417eb99 100644 --- a/html/pages/device/ports/neighbours.inc.php +++ b/html/pages/device/ports/neighbours.inc.php @@ -1,39 +1,42 @@ '); +echo ''; -$i = "1"; +$i = '1'; -echo(' +echo ' - '); + '; -foreach (dbFetchRows("SELECT * FROM links AS L, ports AS I WHERE I.device_id = ? AND I.port_id = L.local_port_id", array($device['device_id'])) as $neighbour) +foreach (dbFetchRows('SELECT * FROM links AS L, ports AS I WHERE I.device_id = ? AND I.port_id = L.local_port_id', array($device['device_id'])) as $neighbour) { + if ($bg_colour == $list_colour_b) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } - if ($bg_colour == $list_colour_b) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + echo ''; + echo ''; - echo(''); - echo(''); + if (is_numeric($neighbour['remote_port_id']) && $neighbour['remote_port_id']) { + $remote_port = get_port_by_id($neighbour['remote_port_id']); + $remote_device = device_by_id_cache($remote_port['device_id']); + echo ''; + echo ''; + } + else { + echo ''; + echo ''; + } - if (is_numeric($neighbour['remote_port_id']) && $neighbour['remote_port_id']) - { - $remote_port = get_port_by_id($neighbour['remote_port_id']); - $remote_device = device_by_id_cache($remote_port['device_id']); - echo(""); - echo(""); - } else { - echo(""); - echo(""); - } - echo(""); - echo(""); - $i++; -} + echo ''; + echo ''; + $i++; +}//end foreach -echo("
    Local Port
    Local Port Remote Port Remote Device Protocol
    '.generate_port_link($neighbour).'
    '.$neighbour['ifAlias'].'
    '.generate_port_link($neighbour).'
    '.$neighbour['ifAlias'].'
    '.generate_port_link($remote_port).'
    '.$remote_port['ifAlias'].'
    '.generate_device_link($remote_device).'
    '.$remote_device['hardware'].'
    '.$neighbour['remote_port'].''.$neighbour['remote_hostname'].' +
    '.$neighbour['remote_platform'].'
    ".generate_port_link($remote_port)."
    ".$remote_port['ifAlias']."
    ".generate_device_link($remote_device)."
    ".$remote_device['hardware']."
    ".$neighbour['remote_port']."".$neighbour['remote_hostname']." -
    ".$neighbour['remote_platform']."
    ".strtoupper($neighbour['protocol'])."
    '.strtoupper($neighbour['protocol']).'
    "); - -?> +echo ''; diff --git a/html/pages/device/pseudowires.inc.php b/html/pages/device/pseudowires.inc.php index a981e5cc4..c134c8b66 100644 --- a/html/pages/device/pseudowires.inc.php +++ b/html/pages/device/pseudowires.inc.php @@ -1,97 +1,121 @@ 'pseudowires'); print_optionbar_start(); -echo('Pseudowires » '); +echo 'Pseudowires » '; -if ($vars['view'] == "detail") { echo(''); } -echo(generate_link("Details",$link_array,array('view'=> 'detail'))); -if ($vars['view'] == "detail") { echo(''); } +if ($vars['view'] == 'detail') { + echo ''; +} -echo(" | "); +echo generate_link('Details', $link_array, array('view' => 'detail')); +if ($vars['view'] == 'detail') { + echo ''; +} -if ($vars['view'] == "minigraphs") { echo(''); } -echo(generate_link("Mini Graphs",$link_array,array('view' => "minigraphs"))); -if ($vars['view'] == "minigraphs") { echo(''); } +echo ' | '; + +if ($vars['view'] == 'minigraphs') { + echo ''; +} + +echo generate_link('Mini Graphs', $link_array, array('view' => 'minigraphs')); +if ($vars['view'] == 'minigraphs') { + echo ''; +} print_optionbar_end(); -echo(""); +echo '
    '; -foreach (dbFetchRows("SELECT * FROM pseudowires AS P, ports AS I WHERE P.port_id = I.port_id AND I.device_id = ? ORDER BY I.ifDescr", array($device['device_id'])) as $pw_a) -{ - $i = 0; - while ($i < count($linkdone)) - { - $thislink = $pw_a['device_id'] . $pw_a['port_id']; - if ($linkdone[$i] == $thislink) { $skip = "yes"; } - $i++; - } - - $pw_b = dbFetchRow("SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = ? AND D.device_id = I.device_id - AND P.cpwVcID = ? AND P.port_id = I.port_id", array($pw_a['peer_device_id'], $pw_a['cpwVcID'])); - - if (!port_permitted($pw_a['port_id'])) { $skip = "yes"; } - if (!port_permitted($pw_b['port_id'])) { $skip = "yes"; } - - if ($skip) - { - unset($skip); - } else { - if ($bg == "ffffff") { $bg = "e5e5e5"; } else { $bg="ffffff"; } - echo(" - - "); - echo(""); - - if ($vars['view'] == "minigraphs") - { - echo(""); + $i++; } - $linkdone[] = $pw_b['device_id'] . $pw_b['port_id']; - } + $pw_b = dbFetchRow( + 'SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = ? AND D.device_id = I.device_id + AND P.cpwVcID = ? AND P.port_id = I.port_id', array( $pw_a['peer_device_id'], $pw_a['cpwVcID'],)); + + if (!port_permitted($pw_a['port_id'])) { + $skip = 'yes'; + } + + if (!port_permitted($pw_b['port_id'])) { + $skip = 'yes'; + } + + if ($skip) { + unset($skip); + } + else { + if ($bg == 'ffffff') { + $bg = 'e5e5e5'; + } + else { + $bg = 'ffffff'; + } + + echo " + + '; + echo "'; + + if ($vars['view'] == 'minigraphs') { + echo "'; + } + + $linkdone[] = $pw_b['device_id'].$pw_b['port_id']; + } } -echo("
    ".$pw_a['cpwVcID']."".generate_port_link($pw_a)." ".generate_device_link($pw_b)."".generate_port_link($pw_b)."
    ".$pw_a['ifAlias']."".$pw_b['ifAlias']."
    "); - - if ($pw_a) - { - $pw_a['width'] = "150"; - $pw_a['height'] = "30"; - $pw_a['from'] = $config['time']['day']; - $pw_a['to'] = $config['time']['now']; - $pw_a['bg'] = $bg; - $types = array('bits','upkts','errors'); - foreach ($types as $graph_type) - { - $pw_a['graph_type'] = "port_".$graph_type; - print_port_thumbnail($pw_a); +foreach (dbFetchRows('SELECT * FROM pseudowires AS P, ports AS I WHERE P.port_id = I.port_id AND I.device_id = ? ORDER BY I.ifDescr', array($device['device_id'])) as $pw_a) { + $i = 0; + while ($i < count($linkdone)) { + $thislink = $pw_a['device_id'].$pw_a['port_id']; + if ($linkdone[$i] == $thislink) { + $skip = 'yes'; } - } - echo(""); - if ($pw_b) - { - $pw_b['width'] = "150"; - $pw_b['height'] = "30"; - $pw_b['from'] = $config['time']['day']; - $pw_b['to'] = $config['time']['now']; - $pw_b['bg'] = $bg; - $types = array('bits','upkts','errors'); - foreach ($types as $graph_type) - { - $pw_b['graph_type'] = "port_".$graph_type; - print_port_thumbnail($pw_b); - } - } - - echo("
    ".$pw_a['cpwVcID'].''.generate_port_link($pw_a)." ".generate_device_link($pw_b).''.generate_port_link($pw_b).'
    ".$pw_a['ifAlias'].''.$pw_b['ifAlias'].'
    "; + + if ($pw_a) { + $pw_a['width'] = '150'; + $pw_a['height'] = '30'; + $pw_a['from'] = $config['time']['day']; + $pw_a['to'] = $config['time']['now']; + $pw_a['bg'] = $bg; + $types = array( + 'bits', + 'upkts', + 'errors', + ); + foreach ($types as $graph_type) + { + $pw_a['graph_type'] = 'port_'.$graph_type; + print_port_thumbnail($pw_a); + } + } + + echo ''; + + if ($pw_b) { + $pw_b['width'] = '150'; + $pw_b['height'] = '30'; + $pw_b['from'] = $config['time']['day']; + $pw_b['to'] = $config['time']['now']; + $pw_b['bg'] = $bg; + $types = array('bits', 'upkts', 'errors'); + foreach ($types as $graph_type) { + $pw_b['graph_type'] = 'port_'.$graph_type; + print_port_thumbnail($pw_b); + } + } + + echo '
    "); - -?> +echo ''; diff --git a/html/pages/device/routing.inc.php b/html/pages/device/routing.inc.php index ebd8c62a7..e4be54617 100644 --- a/html/pages/device/routing.inc.php +++ b/html/pages/device/routing.inc.php @@ -1,78 +1,83 @@ 'device', - 'device' => $device['device_id'], - 'tab' => 'routing'); +$link_array = array( + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'routing', +); -#$type_text['overview'] = "Overview"; -$type_text['ipsec_tunnels'] = "IPSEC Tunnels"; +// $type_text['overview'] = "Overview"; +$type_text['ipsec_tunnels'] = 'IPSEC Tunnels'; // Cisco ACE -$type_text['loadbalancer_rservers'] = "Rservers"; -$type_text['loadbalancer_vservers'] = "Serverfarms"; +$type_text['loadbalancer_rservers'] = 'Rservers'; +$type_text['loadbalancer_vservers'] = 'Serverfarms'; // Citrix Netscaler -$type_text['netscaler_vsvr'] = "VServers"; +$type_text['netscaler_vsvr'] = 'VServers'; -$type_text['bgp'] = "BGP"; -$type_text['cef'] = "CEF"; -$type_text['ospf'] = "OSPF"; -$type_text['vrf'] = "VRFs"; +$type_text['bgp'] = 'BGP'; +$type_text['cef'] = 'CEF'; +$type_text['ospf'] = 'OSPF'; +$type_text['vrf'] = 'VRFs'; print_optionbar_start(); -$pagetitle[] = "Routing"; +$pagetitle[] = 'Routing'; -echo("Routing » "); +echo "Routing » "; unset($sep); -foreach ($routing_tabs as $type) -{ +foreach ($routing_tabs as $type) { + if (!$vars['proto']) { + $vars['proto'] = $type; + } - if (!$vars['proto']) { $vars['proto'] = $type; } + echo $sep; - echo($sep); + if ($vars['proto'] == $type) { + echo ''; + } - if ($vars['proto'] == $type) - { - echo(''); - } + echo generate_link($type_text[$type].' ('.$device_routing_count[$type].')', $link_array, array('proto' => $type)); + if ($vars['proto'] == $type) { + echo ''; + } - echo(generate_link($type_text[$type] ." (".$device_routing_count[$type].")",$link_array,array('proto'=>$type))); - if ($vars['proto'] == $type) { echo(""); } - $sep = " | "; + $sep = ' | '; } print_optionbar_end(); -if (is_file("pages/device/routing/".mres($vars['proto']).".inc.php")) -{ - include("pages/device/routing/".mres($vars['proto']).".inc.php"); -} else { - foreach ($routing_tabs as $type) - { - if ($type != "overview") - { - if (is_file("pages/device/routing/overview/".mres($type).".inc.php")) { - - $g_i++; - if (!is_integer($g_i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - - echo('
    '); - echo('
    '.$type_text[$type].''); - - include("pages/device/routing/overview/".mres($type).".inc.php"); - - echo('
    '); - echo('
    '); - } else { - $graph_title = $type_text[$type]; - $graph_type = "device_".$type; - - include("includes/print-device-graph.php"); - } - } - } +if (is_file('pages/device/routing/'.mres($vars['proto']).'.inc.php')) { + include 'pages/device/routing/'.mres($vars['proto']).'.inc.php'; } +else { + foreach ($routing_tabs as $type) { + if ($type != 'overview') { + if (is_file('pages/device/routing/overview/'.mres($type).'.inc.php')) { + $g_i++; + if (!is_integer($g_i / 2)) { + $row_colour = $list_colour_a; + } + else { + $row_colour = $list_colour_b; + } -?> + echo '
    '; + echo '
    '.$type_text[$type].''; + + include 'pages/device/routing/overview/'.mres($type).'.inc.php'; + + echo '
    '; + echo '
    '; + } + else { + $graph_title = $type_text[$type]; + $graph_type = 'device_'.$type; + + include 'includes/print-device-graph.php'; + }//end if + }//end if + }//end foreach +}//end if diff --git a/html/pages/device/routing/cef.inc.php b/html/pages/device/routing/cef.inc.php index 785b0f653..d4a31416f 100644 --- a/html/pages/device/routing/cef.inc.php +++ b/html/pages/device/routing/cef.inc.php @@ -2,107 +2,133 @@ print_optionbar_start(); -$link_array = array('page' => 'device', - 'device' => $device['device_id'], - 'tab' => 'routing', - 'proto' => 'cef'); +$link_array = array( + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'routing', + 'proto' => 'cef', +); -if(!isset($vars['view'])) { $vars['view'] = "basic"; } +if (!isset($vars['view'])) { + $vars['view'] = 'basic'; +} -echo('CEF » '); +echo 'CEF » '; -if ($vars['view'] == "basic") { echo(""); } -echo(generate_link("Basic", $link_array,array('view'=>'basic'))); -if ($vars['view'] == "basic") { echo(""); } +if ($vars['view'] == 'basic') { + echo ""; +} -echo(" | "); +echo generate_link('Basic', $link_array, array('view' => 'basic')); +if ($vars['view'] == 'basic') { + echo ''; +} -if ($vars['view'] == "graphs") { echo(""); } -echo(generate_link("Graphs", $link_array,array('view'=>'graphs'))); -if ($vars['view'] == "graphs") { echo(""); } +echo ' | '; + +if ($vars['view'] == 'graphs') { + echo ""; +} + +echo generate_link('Graphs', $link_array, array('view' => 'graphs')); +if ($vars['view'] == 'graphs') { + echo ''; +} print_optionbar_end(); -echo('
    - '); +echo '
    +
    '; -echo(' - - - - - - '); +echo ' + + + + + + '; -$i=0; +$i = 0; -foreach (dbFetchRows("SELECT * FROM `cef_switching` WHERE `device_id` = ? ORDER BY `entPhysicalIndex`, `afi`, `cef_index`", array($device['device_id'])) as $cef) -{ +foreach (dbFetchRows('SELECT * FROM `cef_switching` WHERE `device_id` = ? ORDER BY `entPhysicalIndex`, `afi`, `cef_index`', array($device['device_id'])) as $cef) { + $entity = dbFetchRow('SELECT * FROM `entPhysical` WHERE device_id = ? AND `entPhysicalIndex` = ?', array($device['device_id'], $cef['entPhysicalIndex'])); - $entity = dbFetchRow("SELECT * FROM `entPhysical` WHERE device_id = ? AND `entPhysicalIndex` = ?", array($device['device_id'], $cef['entPhysicalIndex'])); + if (!is_integer($i / 2)) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } - if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + $interval = ($cef['updated'] - $cef['updated_prev']); - $interval = $cef['updated'] - $cef['updated_prev']; + if (!$entity['entPhysicalModelName'] && $entity['entPhysicalContainedIn']) { + $parent_entity = dbFetchRow('SELECT * FROM `entPhysical` WHERE device_id = ? AND `entPhysicalIndex` = ?', array($device['device_id'], $entity['entPhysicalContainedIn'])); + $entity_descr = $entity['entPhysicalName'].' ('.$parent_entity['entPhysicalModelName'].')'; + } + else { + $entity_descr = $entity['entPhysicalName'].' ('.$entity['entPhysicalModelName'].')'; + } - if (!$entity['entPhysicalModelName'] && $entity['entPhysicalContainedIn']) - { - $parent_entity = dbFetchRow("SELECT * FROM `entPhysical` WHERE device_id = ? AND `entPhysicalIndex` = ?", array($device['device_id'], $entity['entPhysicalContainedIn'])); - $entity_descr = $entity['entPhysicalName'] . " (" . $parent_entity['entPhysicalModelName'] .")"; - } else { - $entity_descr = $entity['entPhysicalName'] . " (" . $entity['entPhysicalModelName'] .")"; - } + echo " + + - - "); - echo(""); - echo(""); - echo(""); + echo ''; + echo ' - "); + echo ''; + echo ''; + echo ''; - include("includes/print-graphrow.inc.php"); + echo ' + '; - echo(""); - } + if ($vars['view'] == 'graphs') { + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $cef['cef_switching_id']; + $graph_array['type'] = 'cefswitching_graph'; - $i++; + echo "'; + } + + $i++; } -echo("
    EntityAFIPathDropPuntPunt2Host
    EntityAFIPathDropPuntPunt2Host
    ".$entity_descr.''.$cef['afi'].''; - echo("
    ".$entity_descr."".$cef['afi'].""); + switch ($cef['cef_path']) { + case 'RP RIB': + echo 'RP RIB'; + break; + + case 'RP LES': + echo 'RP LES'; + break; + + case 'RP PAS': + echo 'RP PAS'; + break; - switch ($cef['cef_path']) { - case "RP RIB": - echo 'RP RIB'; - break; - case "RP LES": - echo 'RP LES'; - break; - case "RP PAS": - echo 'RP PAS'; - break; default: - echo $cef['cef_path']; - } + echo $cef['cef_path']; + } - echo("".format_si($cef['drop'])); - if ($cef['drop'] > $cef['drop_prev']) { echo(" (".round(($cef['drop']-$cef['drop_prev'])/$interval,2)."/sec)"); } - echo("".format_si($cef['punt'])); - if ($cef['punt'] > $cef['punt_prev']) { echo(" (".round(($cef['punt']-$cef['punt_prev'])/$interval,2)."/sec)"); } - echo("".format_si($cef['punt2host'])); - if ($cef['punt2host'] > $cef['punt2host_prev']) { echo(" (".round(($cef['punt2host']-$cef['punt2host_prev'])/$interval,2)."/sec)"); } - echo("'.format_si($cef['drop']); + if ($cef['drop'] > $cef['drop_prev']) { + echo (" (".round((($cef['drop'] - $cef['drop_prev']) / $interval), 2).'/sec)'); + } - echo("
    '.format_si($cef['punt']); + if ($cef['punt'] > $cef['punt_prev']) { + echo (" (".round((($cef['punt'] - $cef['punt_prev']) / $interval), 2).'/sec)'); + } - if ($vars['view'] == "graphs") - { - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $cef['cef_switching_id']; - $graph_array['type'] = "cefswitching_graph"; + echo ''.format_si($cef['punt2host']); + if ($cef['punt2host'] > $cef['punt2host_prev']) { + echo (" (".round((($cef['punt2host'] - $cef['punt2host_prev']) / $interval), 2).'/sec)'); + } - echo("
    "); + echo '
    "; + + include 'includes/print-graphrow.inc.php'; + + echo '
    "); - -?> +echo ''; diff --git a/html/pages/device/routing/ipsec_tunnels.inc.php b/html/pages/device/routing/ipsec_tunnels.inc.php index 2cde88559..5a360169a 100644 --- a/html/pages/device/routing/ipsec_tunnels.inc.php +++ b/html/pages/device/routing/ipsec_tunnels.inc.php @@ -1,93 +1,114 @@ 'device', - 'device' => $device['device_id'], - 'tab' => 'routing', - 'proto' => 'ipsec_tunnels'); +$link_array = array( + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'routing', + 'proto' => 'ipsec_tunnels', + ); print_optionbar_start(); -echo("IPSEC Tunnels » "); +echo "IPSEC Tunnels » "; -$menu_options = array('basic' => 'Basic', - ); +$menu_options = array('basic' => 'Basic'); -if(!isset($vars['view'])) { $vars['view'] = "basic"; } - -echo("VRFs » "); - -$menu_options = array('basic' => 'Basic', -# 'detail' => 'Detail', - ); - -if (!$_GET['opta']) { $_GET['opta'] = "basic"; } - -$sep = ""; -foreach ($menu_options as $option => $text) -{ - if ($vars['view'] == $option) { echo(""); } - echo(generate_link($text, $link_array,array('view'=>$option))); - if ($vars['view'] == $option) { echo(""); } - echo(" | "); +if (!isset($vars['view'])) { + $vars['view'] = 'basic'; } -echo(' Graphs: '); +echo "VRFs » "; -$graph_types = array("bits" => "Bits", - "pkts" => "Packets"); +$menu_options = array('basic' => 'Basic', +// 'detail' => 'Detail', +); -foreach ($graph_types as $type => $descr) -{ - echo("$type_sep"); - if ($vars['graph'] == $type) { echo(""); } - echo(generate_link($descr, $link_array,array('view'=>'graphs','graph'=>$type))); - if ($vars['graph'] == $type) { echo(""); } +if (!$_GET['opta']) { + $_GET['opta'] = 'basic'; +} - $type_sep = " | "; +$sep = ''; +foreach ($menu_options as $option => $text) { + if ($vars['view'] == $option) { + echo ""; + } + + echo generate_link($text, $link_array, array('view' => $option)); + if ($vars['view'] == $option) { + echo ''; + } + + echo ' | '; +} + +echo ' Graphs: '; + +$graph_types = array( + 'bits' => 'Bits', + 'pkts' => 'Packets', + ); + +foreach ($graph_types as $type => $descr) { + echo "$type_sep"; + if ($vars['graph'] == $type) { + echo ""; + } + + echo generate_link($descr, $link_array, array('view' => 'graphs', 'graph' => $type)); + if ($vars['graph'] == $type) { + echo ''; + } + + $type_sep = ' | '; } print_optionbar_end(); -echo("
    "); -$i = "0"; -foreach (dbFetchRows("SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ? ORDER BY `peer_addr`", array($device['device_id'])) as $tunnel) -{ +echo "
    "; +$i = '0'; +foreach (dbFetchRows('SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ? ORDER BY `peer_addr`', array($device['device_id'])) as $tunnel) { + if (is_integer($i / 2)) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } -if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + if ($tunnel['tunnel_status'] == 'active') { + $tunnel_class = 'green'; + } + else { + $tunnel_class = 'red'; + } -if($tunnel['tunnel_status'] == "active") { $tunnel_class="green"; } else { $tunnel_class="red"; } + echo ""; + echo ''; + echo ''; + echo "'; + echo ''; + if (isset($vars['graph'])) { + echo ''; + echo '"); -echo(""); -echo(""); -echo(""); -echo(""); - if (isset($vars['graph'])) - { - echo(''); - echo(" - "); - } + '; + } -echo(""); -echo(""); + echo ''; + echo ''; - $i++; -} + $i++; +}//end foreach -echo("
    '.$tunnel['local_addr'].' » '.$tunnel['peer_addr'].''.$tunnel['tunnel_name'].'".$tunnel['tunnel_status'].'
    '; + $graph_type = 'ipsectunnel_'.$vars['graph']; -echo("
    " . $tunnel['local_addr'] . " » " . $tunnel['peer_addr'] . "" . $tunnel['tunnel_name'] . "" . $tunnel['tunnel_status'] . "
    "); - $graph_type = "ipsectunnel_" . $vars['graph']; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $tunnel['tunnel_id']; + $graph_array['type'] = $graph_type; - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $tunnel['tunnel_id']; - $graph_array['type'] = $graph_type; + include 'includes/print-graphrow.inc.php'; - include("includes/print-graphrow.inc.php"); - - echo(" + echo '
    "); - -?> +echo ''; diff --git a/html/pages/device/routing/ospf.inc.php b/html/pages/device/routing/ospf.inc.php index 8b17078e3..ed126a7fe 100644 --- a/html/pages/device/routing/ospf.inc.php +++ b/html/pages/device/routing/ospf.inc.php @@ -1,148 +1,193 @@ '); +echo ''; // Loop Instances - -foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `device_id` = ?", array($device['device_id'])) as $instance) -{ - if (!is_integer($i_i/2)) { $instance_bg = $list_colour_a; } else { $instance_bg = $list_colour_b; } - - $area_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = ?", array($device['device_id'])); - $port_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ?", array($device['device_id'])); - $port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ?", array($device['device_id'])); - $nbr_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = ?", array($device['device_id'])); - - $query = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE "; - $query .= "(A.ipv4_address = ? AND I.port_id = A.port_id)"; - $query .= " AND I.device_id = ?"; - $ipv4_host = dbFetchRow($query, array($peer['bgpPeerIdentifier'], $device['device_id'])); - - if ($instance['ospfAdminStat'] == "enabled") { $enabled = 'enabled'; } else { $enabled = 'disabled'; } - if ($instance['ospfAreaBdrRtrStatus'] == "true") { $abr = 'yes'; } else { $abr = 'no'; } - if ($instance['ospfASBdrRtrStatus'] == "true") { $asbr = 'yes'; } else { $asbr = 'no'; } - - echo(''); - echo(''); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(''); - - echo(''); - echo(''); - echo(''); + echo ''; + echo ''; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ''; - $i_i++; -} // End loop instances + echo ''; + echo ''; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ''; + + echo ''; + echo ''; + echo ''; + + $i_a++; + } //end foreach + + echo ''; + + // Loop Neigbours + $i_n = 1; + foreach (dbFetchRows('SELECT * FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id'])) as $nbr) { + if (!is_integer($i_n / 2)) { + $nbr_bg = $list_colour_b_a; + } + else { + $nbr_bg = $list_colour_b_b; + } + + $host = @dbFetchRow( + 'SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? + AND I.port_id = A.port_id AND D.device_id = I.device_id', + array($nbr['ospfNbrRtrId']) + ); + + if (is_array($host)) { + $rtr_id = generate_device_link($host); + } + else { + $rtr_id = 'unknown'; + } + + echo ''; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ''; + + $i_n++; + }//end foreach + + echo '
    Router IdStatusABRASBRAreasPortsNeighbours
    '.$instance['ospfRouterId'] . '' . $enabled . '' . $abr . '' . $asbr . '' . $area_count . '' . $port_count . '('.$port_count_enabled.')' . $nbr_count . '
    '); - echo(''); - echo(''); - - ///# Loop Areas - $i_a = 0; - foreach (dbFetchRows("SELECT * FROM `ospf_areas` WHERE `device_id` = ?", array($device['device_id'])) as $area) - { - if (!is_integer($i_a/2)) { $area_bg = $list_colour_b_a; } else { $area_bg = $list_colour_b_b; } - - $area_port_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ? AND `ospfIfAreaId` = ?", array($device['device_id'], $area['ospfAreaId'])); - $area_port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ? AND `ospfIfAreaId` = ?", array($device['device_id'], $area['ospfAreaId'])); - - echo(''); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(''); - - echo(''); - echo(''); - echo(''); + $area_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = ?', array($device['device_id'])); + $port_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ?', array($device['device_id'])); + $port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ?", array($device['device_id'])); + $nbr_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id'])); - $i_a++; - } // End loop areas + $query = 'SELECT * FROM ipv4_addresses AS A, ports AS I WHERE '; + $query .= '(A.ipv4_address = ? AND I.port_id = A.port_id)'; + $query .= ' AND I.device_id = ?'; + $ipv4_host = dbFetchRow($query, array($peer['bgpPeerIdentifier'], $device['device_id'])); - echo(''); - - // Loop Neigbours - $i_n = 1; - foreach (dbFetchRows("SELECT * FROM `ospf_nbrs` WHERE `device_id` = ?", array($device['device_id'])) as $nbr) - { - if (!is_integer($i_n/2)) { $nbr_bg = $list_colour_b_a; } else { $nbr_bg = $list_colour_b_b; } - - $host = @dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? - AND I.port_id = A.port_id AND D.device_id = I.device_id", array($nbr['ospfNbrRtrId'])); - - if (is_array($host)) { $rtr_id = generate_device_link($host); } else { $rtr_id = "unknown"; } - - echo(''); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(''); - $i_n++; + if ($instance['ospfAreaBdrRtrStatus'] == 'true') { + $abr = 'yes'; + } + else { + $abr = 'no'; + } - } + if ($instance['ospfASBdrRtrStatus'] == 'true') { + $asbr = 'yes'; + } + else { + $asbr = 'no'; + } - echo('
    Area IdStatusPorts
    '.$area['ospfAreaId'] . '' . $enabled . '' . $area_port_count . '('.$area_port_count_enabled.')
    '); - echo(''); - echo(''); - - ///# Loop Ports - $i_p = $i_a + 1; - $p_sql = "SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = ? AND O.`ospfIfAreaId` = ? AND P.port_id = O.port_id"; - foreach (dbFetchRows($p_sql, array($device['device_id'], $area['ospfAreaId'])) as $ospfport) - { - if (!is_integer($i_a/2)) - { - if (!is_integer($i_p/2)) { $port_bg = $list_colour_b_b; } else { $port_bg = $list_colour_b_a; } - } else { - if (!is_integer($i_p/2)) { $port_bg = $list_colour_a_b; } else { $port_bg = $list_colour_a_a; } - } - - if ($ospfport['ospfIfAdminStat'] == "enabled") - { - $port_enabled = 'enabled'; - } else { - $port_enabled = 'disabled'; - } - - echo(''); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(''); - - $i_p++; +foreach (dbFetchRows('SELECT * FROM `ospf_instances` WHERE `device_id` = ?', array($device['device_id'])) as $instance) { + if (!is_integer($i_i / 2)) { + $instance_bg = $list_colour_a; + } + else { + $instance_bg = $list_colour_b; } - echo('
    PortStatusPort TypePort State
    '. generate_port_link($ospfport) . '' . $port_enabled . '' . $ospfport['ospfIfType'] . '' . $ospfport['ospfIfState'] . '
    '); - echo('
    Router IdDeviceIP AddressStatus
    ' . $nbr['ospfNbrRtrId'] . '' . $rtr_id . '' . $nbr['ospfNbrIpAddr'] . ''); - switch ($nbr['ospfNbrState']) - { - case 'full': - echo(''.$nbr['ospfNbrState'].''); - break; - case 'down': - echo(''.$nbr['ospfNbrState'].''); - break; - default: - echo(''.$nbr['ospfNbrState'].''); - break; + if ($instance['ospfAdminStat'] == 'enabled') { + $enabled = 'enabled'; + } + else { + $enabled = 'disabled'; } - echo('
    '); - echo('
    Router IdStatusABRASBRAreasPortsNeighbours
    '.$instance['ospfRouterId'].''.$enabled.''.$abr.''.$asbr.''.$area_count.''.$port_count.'('.$port_count_enabled.')'.$nbr_count.'
    '; + echo ''; + echo ''; -echo('
    Area IdStatusPorts
    '); + // # Loop Areas + $i_a = 0; + foreach (dbFetchRows('SELECT * FROM `ospf_areas` WHERE `device_id` = ?', array($device['device_id'])) as $area) { + if (!is_integer($i_a / 2)) { + $area_bg = $list_colour_b_a; + } + else { + $area_bg = $list_colour_b_b; + } -?> + $area_port_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ? AND `ospfIfAreaId` = ?', array($device['device_id'], $area['ospfAreaId'])); + $area_port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ? AND `ospfIfAreaId` = ?", array($device['device_id'], $area['ospfAreaId'])); + + echo '
    '.$area['ospfAreaId'].''.$enabled.''.$area_port_count.'('.$area_port_count_enabled.')
    '; + echo ''; + echo ''; + + // # Loop Ports + $i_p = ($i_a + 1); + $p_sql = "SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = ? AND O.`ospfIfAreaId` = ? AND P.port_id = O.port_id"; + foreach (dbFetchRows($p_sql, array($device['device_id'], $area['ospfAreaId'])) as $ospfport) + { + if (!is_integer($i_a / 2)) { + if (!is_integer($i_p / 2)) { + $port_bg = $list_colour_b_b; + } + else { + $port_bg = $list_colour_b_a; + } + } + else { + if (!is_integer($i_p / 2)) { + $port_bg = $list_colour_a_b; + } + else { + $port_bg = $list_colour_a_a; + } + } + + if ($ospfport['ospfIfAdminStat'] == 'enabled') { + $port_enabled = 'enabled'; + } + else { + $port_enabled = 'disabled'; + } + + echo ''; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ''; + + $i_p++; + }//end foreach + + echo '
    PortStatusPort TypePort State
    '.generate_port_link($ospfport).''.$port_enabled.''.$ospfport['ospfIfType'].''.$ospfport['ospfIfState'].'
    '; + echo '
    Router IdDeviceIP AddressStatus
    '.$nbr['ospfNbrRtrId'].''.$rtr_id.''.$nbr['ospfNbrIpAddr'].''; + switch ($nbr['ospfNbrState']) { + case 'full': + echo ''.$nbr['ospfNbrState'].''; + break; + + case 'down': + echo ''.$nbr['ospfNbrState'].''; + break; + + default: + echo ''.$nbr['ospfNbrState'].''; + break; + } + + echo '
    '; + echo ''; + echo ''; + + $i_i++; +} //end foreach + +echo ''; diff --git a/html/pages/device/routing/vrf.inc.php b/html/pages/device/routing/vrf.inc.php index ae52da8e6..59bfc6648 100644 --- a/html/pages/device/routing/vrf.inc.php +++ b/html/pages/device/routing/vrf.inc.php @@ -1,64 +1,77 @@ 'device', - 'device' => $device['device_id'], - 'tab' => 'routing', - 'proto' => 'vrf'); +$link_array = array( + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'routing', + 'proto' => 'vrf', + ); -#echo(generate_link("Basic", $link_array,array('view'=>'basic'))); - -if(!isset($vars['view'])) { $vars['view'] = "basic"; } +// echo(generate_link("Basic", $link_array,array('view'=>'basic'))); +if (!isset($vars['view'])) { + $vars['view'] = 'basic'; +} print_optionbar_start(); -echo("VRFs » "); +echo "VRFs » "; $menu_options = array('basic' => 'Basic', -# 'detail' => 'Detail', - ); +// 'detail' => 'Detail', + ); -if (!$_GET['opta']) { $_GET['opta'] = "basic"; } +if (!$_GET['opta']) { + $_GET['opta'] = 'basic'; +} -$sep = ""; -foreach ($menu_options as $option => $text) -{ - if ($vars['view'] == $option) { echo(""); } - echo(generate_link($text, $link_array,array('view'=>$option))); - if ($vars['view'] == $option) { echo(""); } - echo(" | "); +$sep = ''; +foreach ($menu_options as $option => $text) { + if ($vars['view'] == $option) { + echo ""; + } + + echo generate_link($text, $link_array, array('view' => $option)); + if ($vars['view'] == $option) { + echo ''; + } + + echo ' | '; } unset($sep); -echo(' Graphs: '); +echo ' Graphs: '; -$graph_types = array("bits" => "Bits", - "upkts" => "Unicast Packets", - "nupkts" => "Non-Unicast Packets", - "errors" => "Errors", - "etherlike" => "Etherlike"); +$graph_types = array( + 'bits' => 'Bits', + 'upkts' => 'Unicast Packets', + 'nupkts' => 'Non-Unicast Packets', + 'errors' => 'Errors', + 'etherlike' => 'Etherlike', + ); -foreach ($graph_types as $type => $descr) -{ - echo("$type_sep"); - if ($vars['graph'] == $type) { echo(""); } - echo(generate_link($descr, $link_array,array('view'=>'graphs','graph'=>$type))); - if ($vars['graph'] == $type) { echo(""); } +foreach ($graph_types as $type => $descr) { + echo "$type_sep"; + if ($vars['graph'] == $type) { + echo ""; + } - $type_sep = " | "; + echo generate_link($descr, $link_array, array('view' => 'graphs', 'graph' => $type)); + if ($vars['graph'] == $type) { + echo ''; + } + + $type_sep = ' | '; } print_optionbar_end(); -echo("
    "); -$i = "0"; -foreach (dbFetchRows("SELECT * FROM `vrfs` WHERE `device_id` = ? ORDER BY `vrf_name`", array($device['device_id'])) as $vrf) -{ - include("includes/print-vrf.inc.php"); +echo "
    "; +$i = '0'; +foreach (dbFetchRows('SELECT * FROM `vrfs` WHERE `device_id` = ? ORDER BY `vrf_name`', array($device['device_id'])) as $vrf) { + include 'includes/print-vrf.inc.php'; - $i++; + $i++; } -echo("
    "); - -?> +echo ''; diff --git a/html/pages/device/services.inc.php b/html/pages/device/services.inc.php index d4bb3b1da..300043928 100644 --- a/html/pages/device/services.inc.php +++ b/html/pages/device/services.inc.php @@ -1,59 +1,71 @@ Services » "); +echo "Services » "; -$menu_options = array('basic' => 'Basic', - 'details' => 'Details'); +$menu_options = array( + 'basic' => 'Basic', + 'details' => 'Details', +); -if (!$vars['view']) { $vars['view'] = "basic"; } +if (!$vars['view']) { + $vars['view'] = 'basic'; +} -$sep = ""; -foreach ($menu_options as $option => $text) -{ - if (empty($vars['view'])) { $vars['view'] = $option; } - echo($sep); - if ($vars['view'] == $option) { echo(""); } - echo(generate_link($text, $vars, array('view'=>$option))); - if ($vars['view'] == $option) { echo(""); } - $sep = " | "; +$sep = ''; +foreach ($menu_options as $option => $text) { + if (empty($vars['view'])) { + $vars['view'] = $option; + } + + echo $sep; + if ($vars['view'] == $option) { + echo ""; + } + + echo generate_link($text, $vars, array('view' => $option)); + if ($vars['view'] == $option) { + echo ''; + } + + $sep = ' | '; } unset($sep); print_optionbar_end(); -if (dbFetchCell("SELECT COUNT(service_id) FROM `services` WHERE device_id = ?", array($device['device_id'])) > '0') -{ - echo("
    "); - $i = "1"; - foreach (dbFetchRows("SELECT * FROM `services` WHERE `device_id` = ? ORDER BY `service_type`", array($device['device_id'])) as $service) - { - include("includes/print-service.inc.php"); +if (dbFetchCell('SELECT COUNT(service_id) FROM `services` WHERE device_id = ?', array($device['device_id'])) > '0') { + echo "
    "; + $i = '1'; + foreach (dbFetchRows('SELECT * FROM `services` WHERE `device_id` = ? ORDER BY `service_type`', array($device['device_id'])) as $service) { + include 'includes/print-service.inc.php'; - if ($vars['view'] == "details") - { - $graph_array['height'] = "100"; - $graph_array['width'] = "210"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $service['service_id']; - $graph_array['type'] = "service_availability"; + if ($vars['view'] == 'details') { + $graph_array['height'] = '100'; + $graph_array['width'] = '210'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $service['service_id']; + $graph_array['type'] = 'service_availability'; - $periods = array('day', 'week', 'month', 'year'); + $periods = array( + 'day', + 'week', + 'month', + 'year', + ); - echo('"); - } - } - echo("
    '); + echo '
    '; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo("
    "); + echo ''; + } + } + + echo ''; } -else -{ - echo("No Services"); +else { + echo 'No Services'; } -$pagetitle[] = "Services"; - -?> +$pagetitle[] = 'Services'; diff --git a/html/pages/device/slas.inc.php b/html/pages/device/slas.inc.php index aec523110..3cc6cbf11 100644 --- a/html/pages/device/slas.inc.php +++ b/html/pages/device/slas.inc.php @@ -2,76 +2,78 @@ print_optionbar_start(); -echo("SLA » "); +echo "SLA » "; -$slas = dbFetchRows("SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` = 0 ORDER BY `sla_nr`", array($device['device_id'])); +$slas = dbFetchRows('SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` = 0 ORDER BY `sla_nr`', array($device['device_id'])); // Collect types $sla_types = array('all' => 'All'); -foreach ($slas as $sla) -{ - $sla_type = $sla['rtt_type']; +foreach ($slas as $sla) { + $sla_type = $sla['rtt_type']; - if (!in_array($sla_type, $sla_types)) - if (isset($config['sla_type_labels'][$sla_type])) - { - $text = $config['sla_type_labels'][$sla_type]; + if (!in_array($sla_type, $sla_types)) { + if (isset($config['sla_type_labels'][$sla_type])) { + $text = $config['sla_type_labels'][$sla_type]; + } } - else - { - $text = ucfirst($sla_type); + else { + $text = ucfirst($sla_type); } $sla_types[$sla_type] = $text; } + asort($sla_types); -$sep = ""; -foreach ($sla_types as $sla_type => $text) -{ - if (!$vars['view']) { $vars['view'] = $sla_type; } +$sep = ''; +foreach ($sla_types as $sla_type => $text) { + if (!$vars['view']) { + $vars['view'] = $sla_type; + } - echo($sep); - if ($vars['view'] == $sla_type) - { - echo(""); - } - echo(generate_link($text,$vars,array('view'=>$sla_type))); - if ($vars['view'] == $sla_type) - { - echo(""); - } - $sep = " | "; + echo $sep; + if ($vars['view'] == $sla_type) { + echo ""; + } + + echo generate_link($text, $vars, array('view' => $sla_type)); + if ($vars['view'] == $sla_type) { + echo ''; + } + + $sep = ' | '; } + unset($sep); print_optionbar_end(); -echo(''); +echo '
    '; -foreach ($slas as $sla) -{ - if ($vars['view'] != 'all' && $vars['view'] != $sla['rtt_type']) - continue; +foreach ($slas as $sla) { + if ($vars['view'] != 'all' && $vars['view'] != $sla['rtt_type']) { + continue; + } - $name = "SLA #". $sla['sla_nr'] ." - ". $sla_types[$sla['rtt_type']]; - if ($sla['tag']) - $name .= ": ".$sla['tag']; - if ($sla['owner']) - $name .= " (Owner: ". $sla['owner'] .")"; + $name = 'SLA #'.$sla['sla_nr'].' - '.$sla_types[$sla['rtt_type']]; + if ($sla['tag']) { + $name .= ': '.$sla['tag']; + } - $graph_array['type'] = "device_sla"; - $graph_array['id'] = $sla['sla_id']; - echo(''); + include 'includes/print-graphrow.inc.php'; + + echo ''; } -echo('
    '); - echo('

    '.htmlentities($name).'

    '); + if ($sla['owner']) { + $name .= ' (Owner: '.$sla['owner'].')'; + } - include("includes/print-graphrow.inc.php"); + $graph_array['type'] = 'device_sla'; + $graph_array['id'] = $sla['sla_id']; + echo '
    '; + echo '

    '.htmlentities($name).'

    '; - echo('
    '); +echo ''; -$pagetitle[] = "SLAs"; - -?> +$pagetitle[] = 'SLAs'; diff --git a/html/pages/device/toner.inc.php b/html/pages/device/toner.inc.php index 130b84d0b..7fe35144f 100644 --- a/html/pages/device/toner.inc.php +++ b/html/pages/device/toner.inc.php @@ -1,11 +1,8 @@ +require 'includes/print-device-graph.php'; +$pagetitle[] = 'Toner'; diff --git a/html/pages/device/vlans.inc.php b/html/pages/device/vlans.inc.php index 13d7f4c35..9adca0834 100644 --- a/html/pages/device/vlans.inc.php +++ b/html/pages/device/vlans.inc.php @@ -1,74 +1,89 @@ 'device', - 'device' => $device['device_id'], - 'tab' => 'vlans'); +$link_array = array( + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'vlans', + ); print_optionbar_start(); -echo("VLANs » "); +echo "VLANs » "; -if ($vars['view'] == 'graphs' || $vars['view'] == 'minigraphs') -{ - if (isset($vars['graph'])) { $graph_type = "port_" . $vars['graph']; } else { $graph_type = "port_bits"; } +if ($vars['view'] == 'graphs' || $vars['view'] == 'minigraphs') { + if (isset($vars['graph'])) { + $graph_type = 'port_'.$vars['graph']; + } + else { + $graph_type = 'port_bits'; + } } -if (!$vars['view']) { $vars['view'] = "basic"; } +if (!$vars['view']) { + $vars['view'] = 'basic'; +} -$menu_options['basic'] = 'Basic'; -#$menu_options['details'] = 'Details'; +$menu_options['basic'] = 'Basic'; +// $menu_options['details'] = 'Details'; +$sep = ''; +foreach ($menu_options as $option => $text) { + echo $sep; + if ($vars['view'] == $option) { + echo ""; + } -$sep = ""; -foreach ($menu_options as $option => $text) -{ - echo($sep); - if ($vars['view'] == $option) { echo(""); } - echo(generate_link($text,$link_array,array('view'=>$option))); - if ($vars['view'] == $option) { echo(""); } - $sep = " | "; + echo generate_link($text, $link_array, array('view' => $option)); + if ($vars['view'] == $option) { + echo ''; + } + + $sep = ' | '; } unset($sep); -echo(' | Graphs: '); +echo ' | Graphs: '; -$graph_types = array("bits" => "Bits", - "upkts" => "Unicast Packets", - "nupkts" => "Non-Unicast Packets", - "errors" => "Errors"); +$graph_types = array( + 'bits' => 'Bits', + 'upkts' => 'Unicast Packets', + 'nupkts' => 'Non-Unicast Packets', + 'errors' => 'Errors', + ); -foreach ($graph_types as $type => $descr) -{ - echo("$type_sep"); - if ($vars['graph'] == $type && $vars['view'] == "graphs") { echo(""); } - echo(generate_link($descr,$link_array,array('view'=>'graphs','graph'=>$type))); - if ($vars['graph'] == $type && $vars['view'] == "graphs") { echo(""); } +foreach ($graph_types as $type => $descr) { + echo "$type_sep"; + if ($vars['graph'] == $type && $vars['view'] == 'graphs') { + echo ""; + } -/* - echo(' ('); - if ($vars['graph'] == $type && $vars['type'] == "minigraphs") { echo(""); } - echo(generate_link('Mini',$link_array,array('type'=>'minigraphs','graph'=>$type))); - if ($vars['graph'] == $type && $vars['type'] == "minigraphs") { echo(""); } - echo(')'); -*/ - $type_sep = " | "; + echo generate_link($descr, $link_array, array('view' => 'graphs', 'graph' => $type)); + if ($vars['graph'] == $type && $vars['view'] == 'graphs') { + echo ''; + } + + /* + echo(' ('); + if ($vars['graph'] == $type && $vars['type'] == "minigraphs") { echo(""); } + echo(generate_link('Mini',$link_array,array('type'=>'minigraphs','graph'=>$type))); + if ($vars['graph'] == $type && $vars['type'] == "minigraphs") { echo(""); } + echo(')'); + */ + $type_sep = ' | '; } print_optionbar_end(); -echo(''); +echo '
    '; -$i = "1"; +$i = '1'; -foreach (dbFetchRows("SELECT * FROM `vlans` WHERE `device_id` = ? ORDER BY 'vlan_vlan'", array($device['device_id'])) as $vlan) -{ - include("includes/print-vlan.inc.php"); +foreach (dbFetchRows("SELECT * FROM `vlans` WHERE `device_id` = ? ORDER BY 'vlan_vlan'", array($device['device_id'])) as $vlan) { + include 'includes/print-vlan.inc.php'; - $i++; + $i++; } -echo("
    "); +echo ''; -$pagetitle[] = "VLANs"; - -?> +$pagetitle[] = 'VLANs'; diff --git a/html/pages/device/vm.inc.php b/html/pages/device/vm.inc.php index f85c55319..5dee674a5 100644 --- a/html/pages/device/vm.inc.php +++ b/html/pages/device/vm.inc.php @@ -1,18 +1,15 @@ Server NamePower StatusOperating SystemMemoryCPU'); +echo ''; -$i = "1"; +$i = '1'; -foreach (dbFetchRows("SELECT * FROM vminfo WHERE device_id = ? ORDER BY vmwVmDisplayName", array($device['device_id'])) as $vm) -{ - include("includes/print-vm.inc.php"); +foreach (dbFetchRows('SELECT * FROM vminfo WHERE device_id = ? ORDER BY vmwVmDisplayName', array($device['device_id'])) as $vm) { + include 'includes/print-vm.inc.php'; - $i++; + $i++; } -echo("
    Server NamePower StatusOperating SystemMemoryCPU
    "); +echo ''; -$pagetitle[] = "Virtual Machines"; - -?> +$pagetitle[] = 'Virtual Machines'; diff --git a/html/pages/health/current.inc.php b/html/pages/health/current.inc.php index 074afecfe..28de0a214 100644 --- a/html/pages/health/current.inc.php +++ b/html/pages/health/current.inc.php @@ -1,9 +1,7 @@ +require 'pages/health/sensors.inc.php'; diff --git a/html/pages/health/dbm.inc.php b/html/pages/health/dbm.inc.php index 9d7f49c83..57da8ced5 100644 --- a/html/pages/health/dbm.inc.php +++ b/html/pages/health/dbm.inc.php @@ -1,9 +1,7 @@ +require 'pages/health/sensors.inc.php'; diff --git a/html/pages/health/fanspeed.inc.php b/html/pages/health/fanspeed.inc.php index f8aae0665..cbb3d5632 100644 --- a/html/pages/health/fanspeed.inc.php +++ b/html/pages/health/fanspeed.inc.php @@ -1,9 +1,7 @@ +require 'pages/health/sensors.inc.php'; diff --git a/html/pages/health/frequency.inc.php b/html/pages/health/frequency.inc.php index 4e52297a0..45a66986b 100644 --- a/html/pages/health/frequency.inc.php +++ b/html/pages/health/frequency.inc.php @@ -1,9 +1,7 @@ +require 'pages/health/sensors.inc.php'; diff --git a/html/pages/health/humidity.inc.php b/html/pages/health/humidity.inc.php index 68fcbec3b..e59efb5a9 100644 --- a/html/pages/health/humidity.inc.php +++ b/html/pages/health/humidity.inc.php @@ -1,9 +1,7 @@ +require 'pages/health/sensors.inc.php'; diff --git a/html/pages/health/power.inc.php b/html/pages/health/power.inc.php index 6256158b4..ca7c95b35 100644 --- a/html/pages/health/power.inc.php +++ b/html/pages/health/power.inc.php @@ -1,9 +1,7 @@ +require 'pages/health/sensors.inc.php'; diff --git a/html/pages/health/temperature.inc.php b/html/pages/health/temperature.inc.php index f6cd40cfd..06f784380 100644 --- a/html/pages/health/temperature.inc.php +++ b/html/pages/health/temperature.inc.php @@ -1,9 +1,7 @@ +require 'pages/health/sensors.inc.php'; diff --git a/html/pages/health/toner.inc.php b/html/pages/health/toner.inc.php index 4008fbee2..f9907b6f7 100644 --- a/html/pages/health/toner.inc.php +++ b/html/pages/health/toner.inc.php @@ -1,62 +1,57 @@ - "); +echo "
    +
    "; -echo(" +echo ' - "); + '; -foreach (dbFetchRows("SELECT * FROM `toner` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.toner_descr") as $toner) -{ - if (device_permitted($toner['device_id'])) - { - $total = $toner['toner_capacity']; - $perc = $toner['toner_current']; +foreach (dbFetchRows('SELECT * FROM `toner` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.toner_descr') as $toner) { + if (device_permitted($toner['device_id'])) { + $total = $toner['toner_capacity']; + $perc = $toner['toner_current']; - $graph_array['type'] = $graph_type; - $graph_array['id'] = $toner['toner_id']; - $graph_array['from'] = $config['time']['day']; - $graph_array['to'] = $config['time']['now']; - $graph_array['height'] = "20"; - $graph_array['width'] = "80"; - $graph_array_zoom = $graph_array; - $graph_array_zoom['height'] = "150"; - $graph_array_zoom['width'] = "400"; - $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/"; - $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); + $graph_array['type'] = $graph_type; + $graph_array['id'] = $toner['toner_id']; + $graph_array['from'] = $config['time']['day']; + $graph_array['to'] = $config['time']['now']; + $graph_array['height'] = '20'; + $graph_array['width'] = '80'; + $graph_array_zoom = $graph_array; + $graph_array_zoom['height'] = '150'; + $graph_array_zoom['width'] = '400'; + $link = 'graphs/id='.$graph_array['id'].'/type='.$graph_array['type'].'/from='.$graph_array['from'].'/to='.$graph_array['to'].'/'; + $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), null); - $background = get_percentage_colours(100 - $perc); + $background = get_percentage_colours(100 - $perc); - echo(" + echo ""); + ".print_percentage_bar(400, 20, $perc, "$perc%", 'ffffff', $background['left'], $free, 'ffffff', $background['right'])." + '; - if ($vars['view'] == "graphs") - { - echo(""); - } # endif graphs - } + echo ''; + } + } } -echo("
    Device Toner Usage Used
    " . generate_device_link($toner) . "" . $toner['toner_descr'] . "
    ".generate_device_link($toner).''.$toner['toner_descr']." $mini_graph - ".print_percentage_bar (400, 20, $perc, "$perc%", "ffffff", $background['left'], $free, "ffffff", $background['right'])." - $perc"."%
    $perc".'%
    "); + if ($vars['view'] == 'graphs') { + echo "
    "; - $graph_array['height'] = "100"; - $graph_array['width'] = "216"; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $toner['toner_id']; - $graph_array['type'] = $graph_type; + $graph_array['height'] = '100'; + $graph_array['width'] = '216'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $toner['toner_id']; + $graph_array['type'] = $graph_type; - include("includes/print-graphrow.inc.php"); + include 'includes/print-graphrow.inc.php'; - echo("
    "); - -?> +echo ''; diff --git a/html/pages/health/voltage.inc.php b/html/pages/health/voltage.inc.php index 57d8a6886..cca91aa3c 100644 --- a/html/pages/health/voltage.inc.php +++ b/html/pages/health/voltage.inc.php @@ -1,9 +1,7 @@ +require 'pages/health/sensors.inc.php'; diff --git a/html/pages/packages.inc.php b/html/pages/packages.inc.php index dccddf75f..c3e79c8cf 100644 --- a/html/pages/packages.inc.php +++ b/html/pages/packages.inc.php @@ -1,62 +1,61 @@ $value) -{ - if ($value != "") - { - switch ($var) - { - case 'name': - $where .= " AND `$var` = ?"; - $param[] = $value; - break; +foreach ($vars as $var => $value) { + if ($value != '') { + switch ($var) + { + case 'name': + $where .= " AND `$var` = ?"; + $param[] = $value; + break; + } } - } } -echo(''); +echo '
    '; -foreach (dbFetchRows("SELECT * FROM `packages` WHERE 1 $where GROUP BY `name`", $param) as $entry) -{ - echo(''); - echo(''); +foreach (dbFetchRows("SELECT * FROM `packages` WHERE 1 $where GROUP BY `name`", $param) as $entry) { + echo ''; + echo ''; - echo(""); -} + foreach ($entry['blah'] as $version => $bleu) { + $content = '
    '; -echo("
    '.$entry['name'].'
    '.$entry['name'].'"); - foreach (dbFetchRows("SELECT * FROM `packages` WHERE `name` = ? ORDER BY version, build", array($entry['name'])) as $entry_v) - { - $entry['blah'][$entry_v['version']][$entry_v['build']][$entry_v['device_id']] = 1; - } - - foreach ($entry['blah'] as $version => $bleu) - { - - $content = '
    '; - - foreach ($bleu as $build => $bloo) - { - if ($build) { $dbuild = '-' . $build; } else { $dbuild = ''; } - $content .= '
    '.$version.$dbuild.''; - foreach ($bloo as $device_id => $no) - { - $this_device = device_by_id_cache($device_id); - $content .= ''.$this_device['hostname'].' '; - - } - $content .= "
    "; + echo '
    '; + foreach (dbFetchRows('SELECT * FROM `packages` WHERE `name` = ? ORDER BY version, build', array($entry['name'])) as $entry_v) { + $entry['blah'][$entry_v['version']][$entry_v['build']][$entry_v['device_id']] = 1; } - $content .= ""; - if (empty($vars['name'])) - { - echo("".overlib_link("", $version, $content, NULL).""); - } else { - echo("$version $content"); - } - } - echo(""); - echo("
    "); + foreach ($bleu as $build => $bloo) + { + if ($build) { + $dbuild = '-'.$build; + } + else { + $dbuild = ''; + } -?> + $content .= '
    '.$version.$dbuild.''; + foreach ($bloo as $device_id => $no) + { + $this_device = device_by_id_cache($device_id); + $content .= ''.$this_device['hostname'].' '; + } + + $content .= '
    '; + } + + $content .= ''; + if (empty($vars['name'])) { + echo "".overlib_link('', $version, $content, null).''; + } + else { + echo "$version $content"; + } + }//end foreach + + echo ''; + echo ''; +}//end foreach + +echo ''; diff --git a/html/pages/ports/graph.inc.php b/html/pages/ports/graph.inc.php index 90455b2d1..c582a3209 100644 --- a/html/pages/ports/graph.inc.php +++ b/html/pages/ports/graph.inc.php @@ -1,59 +1,75 @@ 0 || $port['out_errors'] > 0) - { - $error_img = generate_port_link($port,"Interface Errors",errors); - } else { $error_img = ""; } + if ($port['in_errors'] > 0 || $port['out_errors'] > 0) { + $error_img = generate_port_link($port, "Interface Errors", errors); + } + else { + $error_img = ''; + } - if (port_permitted($port['port_id'], $port['device_id'])) - { - $port = ifLabel($port, $device); + if (port_permitted($port['port_id'], $port['device_id'])) { + $port = ifLabel($port, $device); - $graph_type = "port_" . $subformat; + $graph_type = 'port_'.$subformat; - if ($_SESSION['widescreen']) { $width=357; } else { $width=315; } - if ($_SESSION['widescreen']) { $width_div=438; } else { $width_div=393; } + if ($_SESSION['widescreen']) { + $width = 357; + } + else { + $width = 315; + } - $graph_array = array(); - $graph_array['height'] = 100; - $graph_array['width'] = 210; - $graph_array['to'] = $config['time']['now']; - $graph_array['id'] = $port['port_id']; - $graph_array['type'] = $graph_type; - $graph_array['from'] = $config['time']['day']; - $graph_array['legend'] = "no"; + if ($_SESSION['widescreen']) { + $width_div = 438; + } + else { + $width_div = 393; + } - $link_array = $graph_array; - $link_array['page'] = "graphs"; - unset($link_array['height'], $link_array['width'], $link_array['legend']); - $link = generate_url($link_array); - $overlib_content = generate_overlib_content($graph_array, $port['hostname'] . " - " . $port['label']); - $graph_array['title'] = "yes"; - $graph_array['width'] = $width; $graph_array['height'] = 119; - $graph = generate_graph_tag($graph_array); + $graph_array = array(); + $graph_array['height'] = 100; + $graph_array['width'] = 210; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $port['port_id']; + $graph_array['type'] = $graph_type; + $graph_array['from'] = $config['time']['day']; + $graph_array['legend'] = 'no'; - echo("
    "); - echo(overlib_link($link, $graph, $overlib_content)); - echo("
    "); + $link_array = $graph_array; + $link_array['page'] = 'graphs'; + unset($link_array['height'], $link_array['width'], $link_array['legend']); + $link = generate_url($link_array); + $overlib_content = generate_overlib_content($graph_array, $port['hostname'].' - '.$port['label']); + $graph_array['title'] = 'yes'; + $graph_array['width'] = $width; + $graph_array['height'] = 119; + $graph = generate_graph_tag($graph_array); -# echo("\ -# \ -# ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". -# " -# -# "); - } -} -?> + echo "
    "; + echo overlib_link($link, $graph, $overlib_content); + echo '
    '; + + // echo("\ + // \ + // ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". + // " + // + // "); + }//end if +}//end foreach diff --git a/html/pages/pseudowires.inc.php b/html/pages/pseudowires.inc.php index 275d472d5..5dd77f468 100644 --- a/html/pages/pseudowires.inc.php +++ b/html/pages/pseudowires.inc.php @@ -1,97 +1,122 @@ 'pseudowires'); print_optionbar_start(); -echo('Pseudowires » '); +echo 'Pseudowires » '; -if ($vars['view'] == "detail") { echo(''); } -echo(generate_link("Details",$link_array,array('view'=> 'detail'))); -if ($vars['view'] == "detail") { echo(''); } +if ($vars['view'] == 'detail') { + echo ''; +} -echo(" | "); +echo generate_link('Details', $link_array, array('view' => 'detail')); +if ($vars['view'] == 'detail') { + echo ''; +} -if ($vars['view'] == "minigraphs") { echo(''); } -echo(generate_link("Mini Graphs",$link_array,array('view' => "minigraphs"))); -if ($vars['view'] == "minigraphs") { echo(''); } +echo ' | '; + +if ($vars['view'] == 'minigraphs') { + echo ''; +} + +echo generate_link('Mini Graphs', $link_array, array('view' => 'minigraphs')); +if ($vars['view'] == 'minigraphs') { + echo ''; +} print_optionbar_end(); -echo(""); +echo '
    '; -foreach (dbFetchRows("SELECT * FROM pseudowires AS P, ports AS I, devices AS D WHERE P.port_id = I.port_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr") as $pw_a) -{ - $i = 0; - while ($i < count($linkdone)) - { - $thislink = $pw_a['device_id'] . $pw_a['port_id']; - if ($linkdone[$i] == $thislink) { $skip = "yes"; } - $i++; - } - - $pw_b = dbFetchRow("SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = ? AND D.device_id = I.device_id - AND P.cpwVcID = ? AND P.port_id = I.port_id", array($pw_a['peer_device_id'], $pw_a['cpwVcID'])); - - if (!port_permitted($pw_a['port_id'])) { $skip = "yes"; } - if (!port_permitted($pw_b['port_id'])) { $skip = "yes"; } - - if ($skip) - { - unset($skip); - } else { - if ($bg == "ffffff") { $bg = "e5e5e5"; } else { $bg="ffffff"; } - echo(" - - "); - echo(""); - - if ($vars['view'] == "minigraphs") - { - echo(""); + $i++; } - $linkdone[] = $pw_b['device_id'] . $pw_b['port_id']; - } -} + $pw_b = dbFetchRow( + 'SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = ? AND D.device_id = I.device_id + AND P.cpwVcID = ? AND P.port_id = I.port_id', + array( + $pw_a['peer_device_id'], + $pw_a['cpwVcID'], + ) + ); -echo("
    ".$pw_a['cpwVcID']."".generate_device_link($pw_a)."".generate_port_link($pw_a)." ".generate_device_link($pw_b)."".generate_port_link($pw_b)."
    ".$pw_a['ifAlias']."".$pw_b['ifAlias']."
    "); - - if ($pw_a) - { - $pw_a['width'] = "150"; - $pw_a['height'] = "30"; - $pw_a['from'] = $config['time']['day']; - $pw_a['to'] = $config['time']['now']; - $pw_a['bg'] = $bg; - $types = array('bits','upkts','errors'); - foreach ($types as $graph_type) - { - $pw_a['graph_type'] = "port_".$graph_type; - print_port_thumbnail($pw_a); +foreach (dbFetchRows('SELECT * FROM pseudowires AS P, ports AS I, devices AS D WHERE P.port_id = I.port_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr') as $pw_a) { + $i = 0; + while ($i < count($linkdone)) { + $thislink = $pw_a['device_id'].$pw_a['port_id']; + if ($linkdone[$i] == $thislink) { + $skip = 'yes'; } - } - echo(""); - if ($pw_b) - { - $pw_b['width'] = "150"; - $pw_b['height'] = "30"; - $pw_b['from'] = $config['time']['day']; - $pw_b['to'] = $config['time']['now']; - $pw_b['bg'] = $bg; - $types = array('bits','upkts','errors'); - foreach ($types as $graph_type) - { - $pw_b['graph_type'] = "port_".$graph_type; - print_port_thumbnail($pw_b); - } - } - - echo("
    "); + if (!port_permitted($pw_a['port_id'])) { + $skip = 'yes'; + } -?> + if (!port_permitted($pw_b['port_id'])) { + $skip = 'yes'; + } + + if ($skip) { + unset($skip); + } + else { + if ($bg == 'ffffff') { + $bg = 'e5e5e5'; + } + else { + $bg = 'ffffff'; + } + + echo "".$pw_a['cpwVcID'].''.generate_device_link($pw_a).''.generate_port_link($pw_a)." + + ".generate_device_link($pw_b).''.generate_port_link($pw_b).''; + echo "".$pw_a['ifAlias'].''.$pw_b['ifAlias'].''; + + if ($vars['view'] == 'minigraphs') { + echo ""; + + if ($pw_a) { + $pw_a['width'] = '150'; + $pw_a['height'] = '30'; + $pw_a['from'] = $config['time']['day']; + $pw_a['to'] = $config['time']['now']; + $pw_a['bg'] = $bg; + $types = array('bits', 'upkts', 'errors'); + foreach ($types as $graph_type) + { + $pw_a['graph_type'] = 'port_'.$graph_type; + print_port_thumbnail($pw_a); + } + } + + echo ''; + + if ($pw_b) { + $pw_b['width'] = '150'; + $pw_b['height'] = '30'; + $pw_b['from'] = $config['time']['day']; + $pw_b['to'] = $config['time']['now']; + $pw_b['bg'] = $bg; + $types = array('bits', 'upkts', 'errors'); + foreach ($types as $graph_type) { + $pw_b['graph_type'] = 'port_'.$graph_type; + print_port_thumbnail($pw_b); + } + } + + echo ''; + }//end if + + $linkdone[] = $pw_b['device_id'].$pw_b['port_id']; + }//end if +}//end foreach + +echo ''; diff --git a/html/pages/purgeports.inc.php b/html/pages/purgeports.inc.php index 3bd98e20e..0b3d3639e 100644 --- a/html/pages/purgeports.inc.php +++ b/html/pages/purgeports.inc.php @@ -1,10 +1,7 @@ Deleting port " . $port['port_id'] . " - " . $port['ifDescr']); - delete_port($port['port_id']); - echo(""); +foreach (dbFetchRows("SELECT * FROM `ports` WHERE `deleted` = '1'") as $port) { + echo "
    Deleting port ".$port['port_id'].' - '.$port['ifDescr']; + delete_port($port['port_id']); + echo '
    '; } - -?> diff --git a/html/pages/routing.inc.php b/html/pages/routing.inc.php index 9c0bfb272..0a7fcb335 100644 --- a/html/pages/routing.inc.php +++ b/html/pages/routing.inc.php @@ -1,59 +1,62 @@ Routing » "); +// if (!$vars['protocol']) { $vars['protocol'] = "overview"; } +echo "Routing » "; unset($sep); -foreach ($routing_count as $type => $value) -{ - if (!$vars['protocol']) { $vars['protocol'] = $type; } +foreach ($routing_count as $type => $value) { + if (!$vars['protocol']) { + $vars['protocol'] = $type; + } - echo($sep); unset($sep); + echo $sep; + unset($sep); - if ($vars['protocol'] == $type) - { - echo(''); - } - if ($routing_count[$type]) - { - echo(generate_link($type_text[$type] ." (".$routing_count[$type].")",array('page'=> 'routing', 'protocol' => $type))); - $sep = " | "; - } + if ($vars['protocol'] == $type) { + echo ''; + } - if ($vars['protocol'] == $type) { echo(""); } -} + if ($routing_count[$type]) { + echo generate_link($type_text[$type].' ('.$routing_count[$type].')', array('page' => 'routing', 'protocol' => $type)); + $sep = ' | '; + } + + if ($vars['protocol'] == $type) { + echo ''; + } +}//end foreach print_optionbar_end(); -switch ($vars['protocol']) -{ - case 'overview': - case 'bgp': - case 'vrf': - case 'cef': - case 'ospf': - include('pages/routing/'.$vars['protocol'].'.inc.php'); +switch ($vars['protocol']) { + case 'overview': + case 'bgp': + case 'vrf': + case 'cef': + case 'ospf': + include 'pages/routing/'.$vars['protocol'].'.inc.php'; break; - default: - echo(report_this('Unknown protocol '.$vars['protocol'])); + + default: + echo report_this('Unknown protocol '.$vars['protocol']); break; } - -?> diff --git a/html/pages/routing/ospf.inc.php b/html/pages/routing/ospf.inc.php index f60312704..e3d779bfe 100644 --- a/html/pages/routing/ospf.inc.php +++ b/html/pages/routing/ospf.inc.php @@ -1,47 +1,65 @@ '); -echo('DeviceRouter IdStatusABRASBRAreasPortsNeighbours'); +echo ''; +echo ''; // Loop Instances +foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'") as $instance) { + if (!is_integer($i_i / 2)) { + $instance_bg = $list_colour_a; + } + else { + $instance_bg = $list_colour_b; + } -foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'") as $instance) -{ - if (!is_integer($i_i/2)) { $instance_bg = $list_colour_a; } else { $instance_bg = $list_colour_b; } + $device = device_by_id_cache($instance['device_id']); - $device = device_by_id_cache($instance['device_id']); + $area_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'"); + $port_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."'"); + $port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = '".$device['device_id']."'"); + $neighbour_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = '".$device['device_id']."'"); - $area_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'"); - $port_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."'"); - $port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = '".$device['device_id']."'"); - $neighbour_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = '".$device['device_id']."'"); + $ip_query = 'SELECT * FROM ipv4_addresses AS A, ports AS I WHERE '; + $ip_query .= '(A.ipv4_address = ? AND I.port_id = A.port_id)'; + $ip_query .= ' AND I.device_id = ?'; - $ip_query = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE "; - $ip_query .= "(A.ipv4_address = ? AND I.port_id = A.port_id)"; - $ip_query .= " AND I.device_id = ?"; + $ipv4_host = dbFetchRow($ip_query, array($peer['bgpPeerIdentifier'], $device['device_id'])); - $ipv4_host = dbFetchRow($ip_query, array($peer['bgpPeerIdentifier'], $device['device_id'])); + if ($instance['ospfAdminStat'] == 'enabled') { + $enabled = 'enabled'; + } + else { + $enabled = 'disabled'; + } - if ($instance['ospfAdminStat'] == "enabled") { $enabled = 'enabled'; } else { $enabled = 'disabled'; } - if ($instance['ospfAreaBdrRtrStatus'] == "true") { $abr = 'yes'; } else { $abr = 'no'; } - if ($instance['ospfASBdrRtrStatus'] == "true") { $asbr = 'yes'; } else { $asbr = 'no'; } + if ($instance['ospfAreaBdrRtrStatus'] == 'true') { + $abr = 'yes'; + } + else { + $abr = 'no'; + } - echo(''); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(' '); - echo(''); + if ($instance['ospfASBdrRtrStatus'] == 'true') { + $asbr = 'yes'; + } + else { + $asbr = 'no'; + } - $i_i++; -} // End loop instances + echo ''; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ''; -echo('
    DeviceRouter IdStatusABRASBRAreasPortsNeighbours
    '.generate_device_link($device, 0, array('tab' => 'routing', 'proto' => 'ospf')). ''.$instance['ospfRouterId'] . '' . $enabled . '' . $abr . '' . $asbr . '' . $area_count . '' . $port_count . '('.$port_count_enabled.')' . $neighbour_count . '
    '.generate_device_link($device, 0, array('tab' => 'routing', 'proto' => 'ospf')).''.$instance['ospfRouterId'].''.$enabled.''.$abr.''.$asbr.''.$area_count.''.$port_count.'('.$port_count_enabled.')'.$neighbour_count.'
    '); + $i_i++; +} //end foreach -?> +echo ''; diff --git a/html/pages/routing/overview.inc.php b/html/pages/routing/overview.inc.php index ff49c70ff..bd9a9e63e 100644 --- a/html/pages/routing/overview.inc.php +++ b/html/pages/routing/overview.inc.php @@ -1,28 +1,29 @@ '; + echo '
    '.$type_text[$type].''; - echo('
    '); - echo('
    '.$type_text[$type].''); + include 'pages/routing/overview/'.mres($type).'.inc.php'; - include("pages/routing/overview/".mres($type).".inc.php"); + echo '
    '; + echo '
    '; + } + else { + $graph_title = $type_text[$type]; + $graph_type = 'device_'.$type; - echo('
    '); - echo(''); - } else { - $graph_title = $type_text[$type]; - $graph_type = "device_".$type; - - include("includes/print-device-graph.php"); - } + include 'includes/print-device-graph.php'; + } } - } - -?> +} diff --git a/html/pages/routing/vrf.inc.php b/html/pages/routing/vrf.inc.php index 530c6b7f2..4d428cb1c 100644 --- a/html/pages/routing/vrf.inc.php +++ b/html/pages/routing/vrf.inc.php @@ -1,182 +1,257 @@ = '5') { - - if (!isset($_GET['optb'])) { $_GET['optb'] = "all"; } - if (!isset($_GET['optc'])) { $_GET['optc'] = "basic"; } - - print_optionbar_start(); - - echo('VRF » '); - - if ($_GET['opta'] == "vrf" && $_GET['optb'] == "all") { echo(""); } - echo('All'); - if ($_GET['opta'] == "vrf" && $_GET['optb'] == "all") { echo(""); } - echo(' | '); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "basic") { echo(""); } - echo('Basic'); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "basic") { echo(""); } - echo(" | "); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "details") { echo(""); } - echo('Details'); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "details") { echo(""); } - echo(" | Graphs: ( "); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "bits") { echo(""); } - echo('Bits'); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "bits") { echo(""); } - echo(" | "); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "upkts") { echo(""); } - echo('Packets'); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "upkts") { echo(""); } - echo(" | "); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "nupkts") { echo(""); } - echo('NU Packets'); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "nupkts") { echo(""); } - echo(" | "); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "errors") { echo(""); } - echo('Errors'); - if ($_GET['opta'] == "vrf" && $_GET['optc'] == "errors") { echo(""); } - - echo(" )"); - - print_optionbar_end(); - -if($_GET['optb'] == "all" ) { - - // Pre-Cache in arrays - // That's heavier on RAM, but much faster on CPU (1:40) - - // Specifying the fields reduces a lot the RAM used (1:4) . - $vrf_fields = "vrf_id, mplsVpnVrfRouteDistinguisher, mplsVpnVrfDescription, vrf_name"; - $dev_fields = "D.device_id as device_id, hostname, os, hardware, version, features, location, status, `ignore`, disabled"; - $port_fields = "port_id, ifvrf, device_id, ifDescr, ifAlias, ifName"; - - foreach (dbFetchRows("SELECT $vrf_fields, $dev_fields FROM `vrfs` AS V, `devices` AS D WHERE D.device_id = V.device_id") as $vrf_device) - { - if (empty($vrf_devices[$vrf_device['mplsVpnVrfRouteDistinguisher']])) { $vrf_devices[$vrf_device['mplsVpnVrfRouteDistinguisher']][0] = $vrf_device; } - else { array_push ($vrf_devices[$vrf_device['mplsVpnVrfRouteDistinguisher']], $vrf_device); } - } - - foreach (dbFetchRows("SELECT $port_fields FROM `ports` WHERE ifVrf<>0") as $port) - { - if (empty($ports[$port['ifvrf']][$port['device_id']])) { $ports[$port['ifvrf']][$port['device_id']][0] = $port; } - else { array_push ($ports[$port['ifvrf']][$port['device_id']], $port); } - } - - echo("
    "); - $i = "1"; - foreach (dbFetchRows("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`") as $vrf) - { - if ($i % 2) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - echo(""); - echo(""); - echo(""); - #echo(""); - echo(""); - - $i++; - } - echo("
    " . $vrf['vrf_name'] . "
    " . $vrf['mplsVpnVrfDescription'] . "
    " . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . ""); - $x=1; - foreach ($vrf_devices[$vrf['mplsVpnVrfRouteDistinguisher']] as $device) - { - if ($i % 2) - { - if ($x % 2) { $dev_colour = $list_colour_a_a; } else { $dev_colour = $list_colour_a_b; } - } else { - if ($x % 2) { $dev_colour = $list_colour_b_b; } else { $dev_colour = $list_colour_b_a; } - } - echo(""); - $x++; - } // End While - - echo("
    ".generate_device_link($device, shorthost($device['hostname']))); - - if ($device['vrf_name'] != $vrf['vrf_name']) { echo("Configured : ".$device['vrf_name']."', CAPTION, 'VRF Inconsistency' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> "); } - echo(""); - unset($seperator); - - foreach ($ports[$device['vrf_id']][$device['device_id']] as $port) - { - $port = array_merge ($device, $port); - - switch ($_GET['optc']) - { - case 'bits': - case 'upkts': - case 'nupkts': - case 'errors': - $port['width'] = "130"; - $port['height'] = "30"; - $port['from'] = $config['time']['day']; - $port['to'] = $config['time']['now']; - $port['bg'] = "#".$bg; - $port['graph_type'] = "port_".$_GET['optc']; - echo("
    -
    ".makeshortif($port['ifDescr'])."
    "); - print_port_thumbnail($port); - echo("
    ".truncate(short_port_descr($port['ifAlias']), 22, '')."
    -
    "); - break; - - default: - echo($seperator.generate_port_link($port,makeshortif($port['ifDescr']))); - $seperator = ", "; - break; - } - } - echo("
    "); - -} else { - - echo("
    "); - $vrf = dbFetchRow("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = ?", array($_GET['optb'])); - echo(""); - echo(""); - echo(""); - echo(""); - echo("
    " . $vrf['vrf_name'] . "" . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . "
    "); - - $x=0; - - $devices = dbFetchRows("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = ? AND D.device_id = V.device_id", array($vrf['mplsVpnVrfRouteDistinguisher'])); - foreach ($devices as $device) - { - $hostname = $device['hostname']; - if ($x % 2) { $device_colour = $list_colour_a; } else { $device_colour = $list_colour_b; } - echo(""); - - include("includes/device-header.inc.php"); - - echo("
    "); - unset($seperator); - echo('
    '); - $i=1; - foreach (dbFetchRows("SELECT * FROM `ports` WHERE `ifVrf` = ? AND `device_id` = ?", array($device['vrf_id'], $device['device_id'])) as $interface) - { - if ($x % 2) - { - if ($i % 2 === 0) { $int_colour = $list_colour_a_b; } else { $int_colour = $list_colour_a_a; } - } else { - if ($i % 2 === 0) { $int_colour = $list_colour_b_a; } else { $int_colour = $list_colour_b_b; } - } - - include("includes/print-interface.inc.php"); - - $i++; + if (!isset($_GET['optb'])) { + $_GET['optb'] = 'all'; } - $x++; - echo("
    "); - echo("
    "); - } + if (!isset($_GET['optc'])) { + $_GET['optc'] = 'basic'; + } + + print_optionbar_start(); + + echo 'VRF » '; + + if ($_GET['opta'] == 'vrf' && $_GET['optb'] == 'all') { + echo ""; + } + + echo 'All'; + if ($_GET['opta'] == 'vrf' && $_GET['optb'] == 'all') { + echo ''; + } + + echo ' | '; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'basic') { + echo ""; + } + + echo 'Basic'; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'basic') { + echo ''; + } + + echo ' | '; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'details') { + echo ""; + } + + echo 'Details'; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'details') { + echo ''; + } + + echo ' | Graphs: ( '; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'bits') { + echo ""; + } + + echo 'Bits'; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'bits') { + echo ''; + } + + echo ' | '; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'upkts') { + echo ""; + } + + echo 'Packets'; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'upkts') { + echo ''; + } + + echo ' | '; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'nupkts') { + echo ""; + } + + echo 'NU Packets'; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'nupkts') { + echo ''; + } + + echo ' | '; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'errors') { + echo ""; + } + + echo 'Errors'; + if ($_GET['opta'] == 'vrf' && $_GET['optc'] == 'errors') { + echo ''; + } + + echo ' )'; + + print_optionbar_end(); + + if ($_GET['optb'] == 'all') { + // Pre-Cache in arrays + // That's heavier on RAM, but much faster on CPU (1:40) + // Specifying the fields reduces a lot the RAM used (1:4) . + $vrf_fields = 'vrf_id, mplsVpnVrfRouteDistinguisher, mplsVpnVrfDescription, vrf_name'; + $dev_fields = 'D.device_id as device_id, hostname, os, hardware, version, features, location, status, `ignore`, disabled'; + $port_fields = 'port_id, ifvrf, device_id, ifDescr, ifAlias, ifName'; + + foreach (dbFetchRows("SELECT $vrf_fields, $dev_fields FROM `vrfs` AS V, `devices` AS D WHERE D.device_id = V.device_id") as $vrf_device) { + if (empty($vrf_devices[$vrf_device['mplsVpnVrfRouteDistinguisher']])) { + $vrf_devices[$vrf_device['mplsVpnVrfRouteDistinguisher']][0] = $vrf_device; + } + else { + array_push($vrf_devices[$vrf_device['mplsVpnVrfRouteDistinguisher']], $vrf_device); + } + } + + foreach (dbFetchRows("SELECT $port_fields FROM `ports` WHERE ifVrf<>0") as $port) { + if (empty($ports[$port['ifvrf']][$port['device_id']])) { + $ports[$port['ifvrf']][$port['device_id']][0] = $port; + } + else { + array_push($ports[$port['ifvrf']][$port['device_id']], $port); + } + } + + echo "
    "; + $i = '1'; + foreach (dbFetchRows('SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`') as $vrf) { + if (($i % 2)) { + $bg_colour = $list_colour_a; + } + else { + $bg_colour = $list_colour_b; + } + + echo ""; + echo "'; + echo ''; + // echo(""); + echo ''; + $i++; + }//end foreach + + echo '
    ".$vrf['vrf_name'].'
    '.$vrf['mplsVpnVrfDescription'].'
    '.$vrf['mplsVpnVrfRouteDistinguisher'].'" . $vrf['mplsVpnVrfDescription'] . "'; + $x = 1; + foreach ($vrf_devices[$vrf['mplsVpnVrfRouteDistinguisher']] as $device) { + if (($i % 2)) { + if (($x % 2)) { + $dev_colour = $list_colour_a_a; + } + else { + $dev_colour = $list_colour_a_b; + } + } + else { + if (($x % 2)) { + $dev_colour = $list_colour_b_b; + } + else { + $dev_colour = $list_colour_b_a; + } + } + + echo "'; + $x++; + } //end foreach + + echo '
    ".generate_device_link($device, shorthost($device['hostname'])); + + if ($device['vrf_name'] != $vrf['vrf_name']) { + echo "Configured : '.$device['vrf_name']."', CAPTION, 'VRF Inconsistency' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> "; + } + + echo ''; + unset($seperator); + + foreach ($ports[$device['vrf_id']][$device['device_id']] as $port) { + $port = array_merge($device, $port); + + switch ($_GET['optc']) { + case 'bits': + case 'upkts': + case 'nupkts': + case 'errors': + $port['width'] = '130'; + $port['height'] = '30'; + $port['from'] = $config['time']['day']; + $port['to'] = $config['time']['now']; + $port['bg'] = '#'.$bg; + $port['graph_type'] = 'port_'.$_GET['optc']; + echo "
    +
    ".makeshortif($port['ifDescr']).'
    '; + print_port_thumbnail($port); + echo "
    ".truncate(short_port_descr($port['ifAlias']), 22, '').'
    +
    '; + break; + + default: + echo $seperator.generate_port_link($port, makeshortif($port['ifDescr'])); + $seperator = ', '; + break; + }//end switch + }//end foreach + + echo '
    '; + } + else { + echo "
    "; + $vrf = dbFetchRow('SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = ?', array($_GET['optb'])); + echo ""; + echo "'; + echo ''; + echo ''; + echo '
    ".$vrf['vrf_name'].''.$vrf['mplsVpnVrfRouteDistinguisher'].''.$vrf['mplsVpnVrfDescription'].'
    '; + + $x = 0; + + $devices = dbFetchRows('SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = ? AND D.device_id = V.device_id', array($vrf['mplsVpnVrfRouteDistinguisher'])); + foreach ($devices as $device) { + $hostname = $device['hostname']; + if (($x % 2)) { + $device_colour = $list_colour_a; + } + else { + $device_colour = $list_colour_b; + } + + echo ''; + + include 'includes/device-header.inc.php'; + + echo '
    '; + unset($seperator); + echo '
    '; + $i = 1; + foreach (dbFetchRows('SELECT * FROM `ports` WHERE `ifVrf` = ? AND `device_id` = ?', array($device['vrf_id'], $device['device_id'])) as $interface) { + if (($x % 2)) { + if (($i % 2) === 0) { + $int_colour = $list_colour_a_b; + } + else { + $int_colour = $list_colour_a_a; + } + } + else { + if (($i % 2) === 0) { + $int_colour = $list_colour_b_a; + } + else { + $int_colour = $list_colour_b_b; + } + } + + include 'includes/print-interface.inc.php'; + + $i++; + }//end foreach + + $x++; + echo '
    '; + echo "
    "; + }//end foreach + }//end if } - -} else { - - include("includes/error-no-perm.inc.php"); - -} // End Permission if - -?> +else { + include 'includes/error-no-perm.inc.php'; +} //end if diff --git a/includes/discovery/cisco-entity-sensor.inc.php b/includes/discovery/cisco-entity-sensor.inc.php index 804c8189c..2fecd796c 100644 --- a/includes/discovery/cisco-entity-sensor.inc.php +++ b/includes/discovery/cisco-entity-sensor.inc.php @@ -1,152 +1,176 @@ $entry) - { - #echo("[" . $entry['entSensorType'] . "|" . $entry['entSensorValue']. "|" . $index . "]"); - - if ($entitysensor[$entry['entSensorType']] && is_numeric($entry['entSensorValue']) && is_numeric($index)) - { - $entPhysicalIndex = $index; - if ($entity_array[$index]['entPhysicalName'] || $device['os'] == "iosxr") - { - $descr = rewrite_entity_descr($entity_array[$index]['entPhysicalName']) . " - " . rewrite_entity_descr($entity_array[$index]['entPhysicalDescr']); - } else { - $descr = $entity_array[$index]['entPhysicalDescr']; - $descr = rewrite_entity_descr($descr); - } - - // Set description based on measured entity if it exists - if (is_numeric($entry['entSensorMeasuredEntity']) && $entry['entSensorMeasuredEntity']) - { - $measured_descr = $entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalName']; - if (!$measured_descr) - { - $measured_descr = $entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalDescr']; - } - - $descr = $measured_descr . " - " . $descr; - } - - // Bit dirty also, clean later - $descr = str_replace("Temp: ", "", $descr); - $descr = str_ireplace("temperature ", "", $descr); - - $oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.".$index; - $current = $entry['entSensorValue']; - $type = $entitysensor[$entry['entSensorType']]; - - #echo("$index : ".$entry['entSensorScale']."|"); - - // FIXME this stuff is foul - if ($entry['entSensorScale'] == "nano") { $divisor = "1000000000"; $multiplier = "1"; } - if ($entry['entSensorScale'] == "micro") { $divisor = "1000000"; $multiplier = "1"; } - if ($entry['entSensorScale'] == "milli") { $divisor = "1000"; $multiplier = "1"; } - if ($entry['entSensorScale'] == "units") { $divisor = "1"; $multiplier = "1"; } - if ($entry['entSensorScale'] == "kilo") { $divisor = "1"; $multiplier = "1000"; } - if ($entry['entSensorScale'] == "mega") { $divisor = "1"; $multiplier = "1000000"; } - if ($entry['entSensorScale'] == "giga") { $divisor = "1"; $multiplier = "1000000000"; } - if (is_numeric($entry['entSensorPrecision']) && $entry['entSensorPrecision'] > "0") { $divisor = $divisor . str_pad('', $entry['entSensorPrecision'], "0"); } - $current = $current * $multiplier / $divisor; - - // Set thresholds to null - $limit = NULL; $low_limit = NULL; $warn_limit = NULL; $warn_limit_low = NULL; - - // Check thresholds for this entry (bit dirty, but it works!) - if (is_array($t_oids[$index])) - { - foreach ($t_oids[$index] as $t_index => $entry) - { - // Critical Limit - if ($entry['entSensorThresholdSeverity'] == "major" && $entry['entSensorThresholdRelation'] == "greaterOrEqual") - { - $limit = $entry['entSensorThresholdValue'] * $multiplier / $divisor; - } - - if ($entry['entSensorThresholdSeverity'] == "major" && $entry['entSensorThresholdRelation'] == "lessOrEqual") - { - $limit_low = $entry['entSensorThresholdValue'] * $multiplier / $divisor; - } - - // Warning Limit - if ($entry['entSensorThresholdSeverity'] == "minor" && $entry['entSensorThresholdRelation'] == "greaterOrEqual") - { - $warn_limit = $entry['entSensorThresholdValue'] * $multiplier / $divisor; - } - - if ($entry['entSensorThresholdSeverity'] == "minor" && $entry['entSensorThresholdRelation'] == "lessOrEqual") - { - $warn_limit_low = $entry['entSensorThresholdValue'] * $multiplier / $divisor; - } - } - } - // End Threshold code - - $ok = TRUE; - - if ($current == "-127") { $ok = FALSE; } // False reading -# if ($type == "temperature" && $current < 1) { $ok = FALSE; } // False reading. Temperature <1 :) - if ($descr == "") { $ok = FALSE; } // Invalid description. Lots of these on Nexus - - if ($ok) { -# echo("\n".$valid['sensor'].", $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current"); - discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity']); - } - $cisco_entity_temperature = 1; - unset($limit, $limit_low, $warn_limit, $warn_limit_low); - - } + if (!is_array($entity_array)) { + $entity_array = array(); + echo ' entPhysicalDescr'; + $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalDescr', $entity_array, 'CISCO-ENTITY-SENSOR-MIB'); + echo ' entPhysicalName'; + $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalName', $entity_array, 'CISCO-ENTITY-SENSOR-MIB'); } - } -} -?> + echo ' entSensorType'; + $oids = snmpwalk_cache_multi_oid($device, 'entSensorType', $oids, 'CISCO-ENTITY-SENSOR-MIB'); + echo ' entSensorScale'; + $oids = snmpwalk_cache_multi_oid($device, 'entSensorScale', $oids, 'CISCO-ENTITY-SENSOR-MIB'); + echo ' entSensorValue'; + $oids = snmpwalk_cache_multi_oid($device, 'entSensorValue', $oids, 'CISCO-ENTITY-SENSOR-MIB'); + echo ' entSensorMeasuredEntity'; + $oids = snmpwalk_cache_multi_oid($device, 'entSensorMeasuredEntity', $oids, 'CISCO-ENTITY-SENSOR-MIB'); + echo ' entSensorPrecision'; + $oids = snmpwalk_cache_multi_oid($device, 'entSensorPrecision', $oids, 'CISCO-ENTITY-SENSOR-MIB'); + + $t_oids = array(); + echo ' entSensorThresholdSeverity'; + $t_oids = snmpwalk_cache_twopart_oid($device, 'entSensorThresholdSeverity', $t_oids, 'CISCO-ENTITY-SENSOR-MIB'); + echo ' entSensorThresholdRelation'; + $t_oids = snmpwalk_cache_twopart_oid($device, 'entSensorThresholdRelation', $t_oids, 'CISCO-ENTITY-SENSOR-MIB'); + echo ' entSensorThresholdValue'; + $t_oids = snmpwalk_cache_twopart_oid($device, 'entSensorThresholdValue', $t_oids, 'CISCO-ENTITY-SENSOR-MIB'); + + if ($debug) { + print_r($oids); + } + + $entitysensor['voltsDC'] = 'voltage'; + $entitysensor['voltsAC'] = 'voltage'; + $entitysensor['amperes'] = 'current'; + $entitysensor['watt'] = 'power'; + $entitysensor['hertz'] = 'freq'; + $entitysensor['percentRH'] = 'humidity'; + $entitysensor['rpm'] = 'fanspeed'; + $entitysensor['celsius'] = 'temperature'; + $entitysensor['watts'] = 'power'; + $entitysensor['dBm'] = 'dbm'; + + if (is_array($oids)) { + foreach ($oids as $index => $entry) + { + // echo("[" . $entry['entSensorType'] . "|" . $entry['entSensorValue']. "|" . $index . "]"); + if ($entitysensor[$entry['entSensorType']] && is_numeric($entry['entSensorValue']) && is_numeric($index)) { + $entPhysicalIndex = $index; + if ($entity_array[$index]['entPhysicalName'] || $device['os'] == 'iosxr') { + $descr = rewrite_entity_descr($entity_array[$index]['entPhysicalName']).' - '.rewrite_entity_descr($entity_array[$index]['entPhysicalDescr']); + } + else { + $descr = $entity_array[$index]['entPhysicalDescr']; + $descr = rewrite_entity_descr($descr); + } + + // Set description based on measured entity if it exists + if (is_numeric($entry['entSensorMeasuredEntity']) && $entry['entSensorMeasuredEntity']) { + $measured_descr = $entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalName']; + if (!$measured_descr) { + $measured_descr = $entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalDescr']; + } + + $descr = $measured_descr.' - '.$descr; + } + + // Bit dirty also, clean later + $descr = str_replace('Temp: ', '', $descr); + $descr = str_ireplace('temperature ', '', $descr); + + $oid = '.1.3.6.1.4.1.9.9.91.1.1.1.1.4.'.$index; + $current = $entry['entSensorValue']; + $type = $entitysensor[$entry['entSensorType']]; + + // echo("$index : ".$entry['entSensorScale']."|"); + // FIXME this stuff is foul + if ($entry['entSensorScale'] == 'nano') { + $divisor = '1000000000'; + $multiplier = '1'; + } + + if ($entry['entSensorScale'] == 'micro') { + $divisor = '1000000'; + $multiplier = '1'; + } + + if ($entry['entSensorScale'] == 'milli') { + $divisor = '1000'; + $multiplier = '1'; + } + + if ($entry['entSensorScale'] == 'units') { + $divisor = '1'; + $multiplier = '1'; + } + + if ($entry['entSensorScale'] == 'kilo') { + $divisor = '1'; + $multiplier = '1000'; + } + + if ($entry['entSensorScale'] == 'mega') { + $divisor = '1'; + $multiplier = '1000000'; + } + + if ($entry['entSensorScale'] == 'giga') { + $divisor = '1'; + $multiplier = '1000000000'; + } + + if (is_numeric($entry['entSensorPrecision']) && $entry['entSensorPrecision'] > '0') { + $divisor = $divisor.str_pad('', $entry['entSensorPrecision'], '0'); + } + + $current = ($current * $multiplier / $divisor); + + // Set thresholds to null + $limit = null; + $low_limit = null; + $warn_limit = null; + $warn_limit_low = null; + + // Check thresholds for this entry (bit dirty, but it works!) + if (is_array($t_oids[$index])) { + foreach ($t_oids[$index] as $t_index => $entry) { + // Critical Limit + if ($entry['entSensorThresholdSeverity'] == 'major' && $entry['entSensorThresholdRelation'] == 'greaterOrEqual') { + $limit = ($entry['entSensorThresholdValue'] * $multiplier / $divisor); + } + + if ($entry['entSensorThresholdSeverity'] == 'major' && $entry['entSensorThresholdRelation'] == 'lessOrEqual') { + $limit_low = ($entry['entSensorThresholdValue'] * $multiplier / $divisor); + } + + // Warning Limit + if ($entry['entSensorThresholdSeverity'] == 'minor' && $entry['entSensorThresholdRelation'] == 'greaterOrEqual') { + $warn_limit = ($entry['entSensorThresholdValue'] * $multiplier / $divisor); + } + + if ($entry['entSensorThresholdSeverity'] == 'minor' && $entry['entSensorThresholdRelation'] == 'lessOrEqual') { + $warn_limit_low = ($entry['entSensorThresholdValue'] * $multiplier / $divisor); + } + }//end foreach + }//end if + + // End Threshold code + $ok = true; + + if ($current == '-127') { + $ok = false; + } //end if + // if ($type == "temperature" && $current < 1) { $ok = FALSE; } // False reading. Temperature <1 :) + if ($descr == '') { + $ok = false; + } //end if + + if ($ok) { + // echo("\n".$valid['sensor'].", $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current"); + discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity']); + } + + $cisco_entity_temperature = 1; + unset($limit, $limit_low, $warn_limit, $warn_limit_low); + }//end if + }//end foreach + }//end if +}//end if diff --git a/includes/discovery/cisco-sla.inc.php b/includes/discovery/cisco-sla.inc.php index f844a5f1f..f8af98725 100644 --- a/includes/discovery/cisco-sla.inc.php +++ b/includes/discovery/cisco-sla.inc.php @@ -1,107 +1,98 @@ $device['device_id'])); - // Get existing SLAs - $existing_slas = dbFetchColumn("SELECT `sla_id` FROM `slas` WHERE `device_id` = :device_id AND `deleted` = 0", array('device_id' => $device['device_id'])); - - foreach ($sla_table as $sla_nr => $sla_config) - { + foreach ($sla_table as $sla_nr => $sla_config) { $query_data = array( - 'device_id' => $device['device_id'], - 'sla_nr' => $sla_nr, - ); - $sla_id = dbFetchCell("SELECT `sla_id` FROM `slas` WHERE `device_id` = :device_id AND `sla_nr` = :sla_nr", $query_data); + 'device_id' => $device['device_id'], + 'sla_nr' => $sla_nr, + ); + $sla_id = dbFetchCell('SELECT `sla_id` FROM `slas` WHERE `device_id` = :device_id AND `sla_nr` = :sla_nr', $query_data); - $data = array( - 'device_id' => $device['device_id'], - 'sla_nr' => $sla_nr, - 'owner' => $sla_config['rttMonCtrlAdminOwner'], - 'tag' => $sla_config['rttMonCtrlAdminTag'], - 'rtt_type' => $sla_config['rttMonCtrlAdminRttType'], - 'status' => ($sla_config['rttMonCtrlAdminStatus'] == 'active') ? 1 : 0, - 'deleted' => 0, - ); + $data = array( + 'device_id' => $device['device_id'], + 'sla_nr' => $sla_nr, + 'owner' => $sla_config['rttMonCtrlAdminOwner'], + 'tag' => $sla_config['rttMonCtrlAdminTag'], + 'rtt_type' => $sla_config['rttMonCtrlAdminRttType'], + 'status' => ($sla_config['rttMonCtrlAdminStatus'] == 'active') ? 1 : 0, + 'deleted' => 0, + ); - // Some fallbacks for when the tag is empty - if (!$data['tag']) - { - switch ($data['rtt_type']) - { - case 'http': - $data['tag'] = $sla_config['rttMonEchoAdminURL']; - break; + // Some fallbacks for when the tag is empty + if (!$data['tag']) { + switch ($data['rtt_type']) + { + case 'http': + $data['tag'] = $sla_config['rttMonEchoAdminURL']; + break; - case 'dns': - $data['tag'] = $sla_config['rttMonEchoAdminTargetAddressString']; - break; + case 'dns': + $data['tag'] = $sla_config['rttMonEchoAdminTargetAddressString']; + break; - case 'echo': - $parts = explode(" ", $sla_config['rttMonEchoAdminTargetAddress']); - if (count($parts) == 4) - { - // IPv4 - $data['tag'] = implode(".", array_map('hexdec', $parts)); - } - elseif (count($parts) == 16) - { - // IPv6 - $data['tag'] = $parts[0].$parts[1].':'.$parts[2].$parts[3].':'.$parts[4].$parts[5].':'.$parts[6].$parts[7].':'.$parts[8].$parts[9].':'.$parts[10].$parts[11].':'.$parts[12].$parts[13].':'.$parts[14].$parts[15]; - $data['tag'] = preg_replace('/:0*([0-9])/', ':$1', $data['tag']); - } - break; - } + case 'echo': + $parts = explode(' ', $sla_config['rttMonEchoAdminTargetAddress']); + if (count($parts) == 4) { + // IPv4 + $data['tag'] = implode('.', array_map('hexdec', $parts)); + } + else if (count($parts) == 16) { + // IPv6 + $data['tag'] = $parts[0].$parts[1].':'.$parts[2].$parts[3].':'.$parts[4].$parts[5].':'.$parts[6].$parts[7].':'.$parts[8].$parts[9].':'.$parts[10].$parts[11].':'.$parts[12].$parts[13].':'.$parts[14].$parts[15]; + $data['tag'] = preg_replace('/:0*([0-9])/', ':$1', $data['tag']); + } + break; + }//end switch + }//end if + + if (!$sla_id) { + $sla_id = dbInsert($data, 'slas'); + echo '+'; + } + else { + // Remove from the list + $existing_slas = array_diff($existing_slas, array($sla_id)); + + dbUpdate($data, 'slas', '`sla_id` = :sla_id', array('sla_id' => $sla_id)); + echo '.'; + } + }//end foreach + + // Mark all remaining SLAs as deleted + foreach ($existing_slas as $existing_sla) { + dbUpdate(array('deleted' => 1), 'slas', '`sla_id` = :sla_id', array('sla_id' => $existing_sla)); + echo '-'; } - if (!$sla_id) - { - $sla_id = dbInsert($data, 'slas'); - echo "+"; - } - else - { - // Remove from the list - $existing_slas = array_diff($existing_slas, array($sla_id)); - - dbUpdate($data, 'slas', "`sla_id` = :sla_id", array('sla_id' => $sla_id)); - echo "."; - } - } - - // Mark all remaining SLAs as deleted - foreach ($existing_slas as $existing_sla) - { - dbUpdate(array('deleted' => 1), 'slas', "`sla_id` = :sla_id", array('sla_id' => $existing_sla)); - echo "-"; - } - - echo("\n"); -} # enable_sla && cisco - -?> + echo "\n"; +} diff --git a/includes/discovery/current.inc.php b/includes/discovery/current.inc.php index ef60dbfb9..c28644184 100644 --- a/includes/discovery/current.inc.php +++ b/includes/discovery/current.inc.php @@ -1,15 +1,14 @@ +echo "\n"; diff --git a/includes/discovery/current/gamatronicups.inc.php b/includes/discovery/current/gamatronicups.inc.php index 03dad6c25..be019523b 100644 --- a/includes/discovery/current/gamatronicups.inc.php +++ b/includes/discovery/current/gamatronicups.inc.php @@ -1,36 +1,37 @@ \ No newline at end of file diff --git a/includes/discovery/current/ipoman.inc.php b/includes/discovery/current/ipoman.inc.php index 8b29980b6..92524dbaa 100644 --- a/includes/discovery/current/ipoman.inc.php +++ b/includes/discovery/current/ipoman.inc.php @@ -1,60 +1,54 @@ $entry) - { - $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.3.' . $index; - $divisor = 1000; - $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index"); - $current = $entry['inletStatusCurrent'] / $divisor; - $high_limit = $entry['inletConfigCurrentHigh'] / 10; - - discover_sensor($valid['sensor'], 'current', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, $high_limit, $current); - // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? + if (!is_array($cache['ipoman'])) { + echo 'outletConfigDesc '; + $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigDesc', $cache['ipoman']['out'], 'IPOMANII-MIB'); + echo 'outletConfigLocation '; + $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigLocation', $cache['ipoman']['out'], 'IPOMANII-MIB'); + echo 'inletConfigDesc '; + $cache['ipoman']['in'] = snmpwalk_cache_multi_oid($device, 'inletConfigDesc', $cache['ipoman'], 'IPOMANII-MIB'); } - } - if (is_array($oids_out)) - { - foreach ($oids_out as $index => $entry) - { - $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.3.' . $index; - $divisor = 1000; - $descr = (trim($cache['ipoman']['out'][$index]['outletConfigDesc'],'"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'],'"') : "Output $index"); - $current = $entry['outletStatusCurrent'] / $divisor; - $high_limit = $entry['outletConfigCurrentHigh'] / 10; + $oids_in = array(); + $oids_out = array(); - discover_sensor($valid['sensor'], 'current', $device, $cur_oid, '2.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, $high_limit, $current); + echo 'inletConfigCurrentHigh '; + $oids_in = snmpwalk_cache_multi_oid($device, 'inletConfigCurrentHigh', $oids_in, 'IPOMANII-MIB'); + echo 'inletStatusCurrent '; + $oids_in = snmpwalk_cache_multi_oid($device, 'inletStatusCurrent', $oids_in, 'IPOMANII-MIB'); + echo 'outletConfigCurrentHigh '; + $oids_out = snmpwalk_cache_multi_oid($device, 'outletConfigCurrentHigh', $oids_out, 'IPOMANII-MIB'); + echo 'outletStatusCurrent '; + $oids_out = snmpwalk_cache_multi_oid($device, 'outletStatusCurrent', $oids_out, 'IPOMANII-MIB'); + + if (is_array($oids_in)) { + foreach ($oids_in as $index => $entry) + { + $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.3.'.$index; + $divisor = 1000; + $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') : "Inlet $index"); + $current = ($entry['inletStatusCurrent'] / $divisor); + $high_limit = ($entry['inletConfigCurrentHigh'] / 10); + + discover_sensor($valid['sensor'], 'current', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', null, null, null, $high_limit, $current); + // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? + } } - } -} -?> \ No newline at end of file + if (is_array($oids_out)) { + foreach ($oids_out as $index => $entry) + { + $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.3.'.$index; + $divisor = 1000; + $descr = (trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') : "Output $index"); + $current = ($entry['outletStatusCurrent'] / $divisor); + $high_limit = ($entry['outletConfigCurrentHigh'] / 10); + + discover_sensor($valid['sensor'], 'current', $device, $cur_oid, '2.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', null, null, null, $high_limit, $current); + } + } +}//end if diff --git a/includes/discovery/current/mgeups.inc.php b/includes/discovery/current/mgeups.inc.php index 0f161a4a6..c2a7b77a7 100644 --- a/includes/discovery/current/mgeups.inc.php +++ b/includes/discovery/current/mgeups.inc.php @@ -1,60 +1,69 @@ 1) $descr .= " Phase $i"; - $current = snmp_get($device, $current_oid, "-Oqv"); - if (!$current) - { - $current_oid .= ".0"; - $current = snmp_get($device, $current_oid, "-Oqv"); +if ($device['os'] == 'mgeups') { + echo 'MGE '; + $oids = trim(snmp_walk($device, '1.3.6.1.4.1.705.1.7.1', '-OsqnU')); + if ($debug) { + echo $oids."\n"; } - $current /= 10; - $type = "mge-ups"; - $precision = 10; - $index = $i; - $warnlimit = NULL; - $lowlimit = 0; - $limit = NULL; - $lowwarnlimit = NULL; - discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current); - } - - $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU")); - if ($debug) { echo($oids."\n"); } - $numPhase = count(explode("\n",$oids)); - for($i = 1; $i <= $numPhase;$i++) - { + $numPhase = count(explode("\n", $oids)); + for ($i = 1; $i <= $numPhase; $i++) { unset($current); - $current_oid = ".1.3.6.1.4.1.705.1.6.2.1.6.$i"; - $descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i"; - $current = snmp_get($device, $current_oid, "-Oqv"); - if (!$current) - { - $current_oid .= ".0"; - $current = snmp_get($device, $current_oid, "-Oqv"); + $current_oid = ".1.3.6.1.4.1.705.1.7.2.1.5.$i"; + $descr = 'Output'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $current = snmp_get($device, $current_oid, '-Oqv'); + if (!$current) { + $current_oid .= '.0'; + $current = snmp_get($device, $current_oid, '-Oqv'); + } + + $current /= 10; + $type = 'mge-ups'; + $precision = 10; + $index = $i; + $warnlimit = null; + $lowlimit = 0; + $limit = null; + $lowwarnlimit = null; + + discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current); + }//end for + + $oids = trim(snmp_walk($device, '1.3.6.1.4.1.705.1.6.1', '-OsqnU')); + if ($debug) { + echo $oids."\n"; } - $current /= 10; - $type = "mge-ups"; - $precision = 10; - $index = 100+$i; - $warnlimit = NULL; - $lowlimit = 0; - $limit = NULL; - $lowwarnlimit = NULL; - discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current); - } -} + $numPhase = count(explode("\n", $oids)); + for ($i = 1; $i <= $numPhase; $i++) { + unset($current); + $current_oid = ".1.3.6.1.4.1.705.1.6.2.1.6.$i"; + $descr = 'Input'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } -?> \ No newline at end of file + $current = snmp_get($device, $current_oid, '-Oqv'); + if (!$current) { + $current_oid .= '.0'; + $current = snmp_get($device, $current_oid, '-Oqv'); + } + + $current /= 10; + $type = 'mge-ups'; + $precision = 10; + $index = (100 + $i); + $warnlimit = null; + $lowlimit = 0; + $limit = null; + $lowwarnlimit = null; + + discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current); + }//end for +}//end if diff --git a/includes/discovery/current/netvision.inc.php b/includes/discovery/current/netvision.inc.php index 1d55a7b7c..21acb200c 100644 --- a/includes/discovery/current/netvision.inc.php +++ b/includes/discovery/current/netvision.inc.php @@ -1,36 +1,37 @@ diff --git a/includes/discovery/current/sentry3.inc.php b/includes/discovery/current/sentry3.inc.php index b07e12536..0146abb39 100644 --- a/includes/discovery/current/sentry3.inc.php +++ b/includes/discovery/current/sentry3.inc.php @@ -1,113 +1,111 @@ 1 "tower" accessible via a single management interface - $tower_count = snmp_get($device,"systemTowerCount.0", "-Ovq", "Sentry3-MIB"); - $towers=1; - while ($towers <= $tower_count) { - - ///////////////////////////////// - # Check for Infeeds - $infeed_oids = snmp_walk($device, "infeedID.$towers.1", "-Osqn", "Sentry3-MIB"); - if ($debug) { echo($infeed_oids."\n"); } - $infeed_oids = trim($infeed_oids); - - if ($infeed_oids) echo("ServerTech Sentry Infeed "); - foreach (explode("\n", $infeed_oids) as $infeed_data) - { - $infeed_data = trim($infeed_data); - if ($infeed_data) - { - list($infeed_oid,$descr) = explode(" ", $infeed_data,2); - $split_oid = explode('.',$infeed_oid); - $infeed_index = $split_oid[count($split_oid)-1]; - - #infeedLoadValue - $infeed_oid = "1.3.6.1.4.1.1718.3.2.2.1.7." . $towers . ".1"; - - $descr_string = snmp_get($device,"infeedID.$towers.$infeed_index", "-Ovq", "Sentry3-MIB"); - $descr = "Infeed $descr_string"; - $low_warn_limit = NULL; - $low_limit = NULL; - $high_warn_limit = snmp_get($device,"infeedLoadHighThresh.$towers.$infeed_index", "-Ovq", "Sentry3-MIB"); - $high_limit = snmp_get($device,"infeedCapacity.$towers.$infeed_index", "-Ovq", "Sentry3-MIB"); - $current = snmp_get($device,"$infeed_oid", "-Ovq", "Sentry3-MIB") / $divisor; - - if ($current >= 0) { - discover_sensor($valid['sensor'], 'current', $device, $infeed_oid, $towers, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + // These PDUs may have > 1 "tower" accessible via a single management interface + $tower_count = snmp_get($device, 'systemTowerCount.0', '-Ovq', 'Sentry3-MIB'); + $towers = 1; + while ($towers <= $tower_count) { + // + // Check for Infeeds + $infeed_oids = snmp_walk($device, "infeedID.$towers.1", '-Osqn', 'Sentry3-MIB'); + if ($debug) { + echo $infeed_oids."\n"; } - ///////////////////////////////// - # Check for per-outlet polling - #$outlet_oids = snmp_walk($device, "outletLoadValue.$towers.$infeed_index", "-Osqn", "Sentry3-MIB"); - $outlet_oids = snmp_walk($device, "outletLoadValue.$towers.1", "-Osqn", "Sentry3-MIB"); - $outlet_oids = trim($outlet_oids); + $infeed_oids = trim($infeed_oids); - if ($outlet_oids) echo("ServerTech Sentry Outlet "); - foreach (explode("\n", $outlet_oids) as $outlet_data) - { - $outlet_data = trim($outlet_data); - if ($outlet_data) - { - list($outlet_oid,$outlet_descr) = explode(" ", $outlet_data,2); - $outlet_split_oid = explode('.',$outlet_oid); - $outlet_index = $outlet_split_oid[count($outlet_split_oid)-1]; + if ($infeed_oids) { + echo 'ServerTech Sentry Infeed '; + } - $outletsuffix = "$towers.$infeed_index.$outlet_index"; - $outlet_insert_index=$towers . $outlet_index; + foreach (explode("\n", $infeed_oids) as $infeed_data) { + $infeed_data = trim($infeed_data); + if ($infeed_data) { + list($infeed_oid,$descr) = explode(' ', $infeed_data, 2); + $split_oid = explode('.', $infeed_oid); + $infeed_index = $split_oid[(count($split_oid) - 1)]; - #outletLoadValue: "A non-negative value indicates the measured load in hundredths of Amps" - $outlet_oid = "1.3.6.1.4.1.1718.3.2.3.1.7.$outletsuffix"; - $outlet_descr_string = snmp_get($device,"outletID.$outletsuffix", "-Ovq", "Sentry3-MIB"); - $outlet_descr = "Outlet $outlet_descr_string"; - $outlet_low_warn_limit = NULL; - $outlet_low_limit = NULL; - $outlet_high_warn_limit = NULL; - # Should be "outletCapacity" but is always -1. According to MIB: "A negative value indicates that the capacity was not available." - $outlet_high_limit = snmp_get($device,"outletLoadHighThresh.$outletsuffix", "-Ovq", "Sentry3-MIB"); - $outlet_current = snmp_get($device,"$outlet_oid", "-Ovq", "Sentry3-MIB") / $outlet_divisor; + // infeedLoadValue + $infeed_oid = '1.3.6.1.4.1.1718.3.2.2.1.7.'.$towers.'.1'; - if ($outlet_current >= 0) { - discover_sensor($valid['sensor'], 'current', $device, $outlet_oid, $outlet_insert_index, 'sentry3', $outlet_descr, $outlet_divisor, $multiplier, $outlet_low_limit, $outlet_low_warn_limit, $outlet_high_warn_limit, $outlet_high_limit, $outlet_current); - } - } // if ($outlet_data) + $descr_string = snmp_get($device, "infeedID.$towers.$infeed_index", '-Ovq', 'Sentry3-MIB'); + $descr = "Infeed $descr_string"; + $low_warn_limit = null; + $low_limit = null; + $high_warn_limit = snmp_get($device, "infeedLoadHighThresh.$towers.$infeed_index", '-Ovq', 'Sentry3-MIB'); + $high_limit = snmp_get($device, "infeedCapacity.$towers.$infeed_index", '-Ovq', 'Sentry3-MIB'); + $current = (snmp_get($device, "$infeed_oid", '-Ovq', 'Sentry3-MIB') / $divisor); - unset($outlet_data); - unset($outlet_oids); - unset($outlet_oid); - unset($outlet_descr_string); - unset($outlet_descr); - unset($outlet_low_warn_limit); - unset($outlet_low_limit); - unset($outlet_high_warn_limit); - unset($outlet_high_limit); - unset($outlet_current); + if ($current >= 0) { + discover_sensor($valid['sensor'], 'current', $device, $infeed_oid, $towers, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + } - } // foreach (explode("\n", $outlet_oids) as $outlet_data) + // + // Check for per-outlet polling + // $outlet_oids = snmp_walk($device, "outletLoadValue.$towers.$infeed_index", "-Osqn", "Sentry3-MIB"); + $outlet_oids = snmp_walk($device, "outletLoadValue.$towers.1", '-Osqn', 'Sentry3-MIB'); + $outlet_oids = trim($outlet_oids); - } //if($infeed_data) - unset($infeed_data); - unset($infeed_oids); - unset($descr_string); - unset($descr); - unset($low_warn_limit); - unset($low_limit); - unset($high_warn_limit); - unset($high_limit); - unset($current); + if ($outlet_oids) { + echo 'ServerTech Sentry Outlet '; + } - } //foreach (explode("\n", $infeed_oids) as $infeed_data) + foreach (explode("\n", $outlet_oids) as $outlet_data) + { + $outlet_data = trim($outlet_data); + if ($outlet_data) { + list($outlet_oid,$outlet_descr) = explode(' ', $outlet_data, 2); + $outlet_split_oid = explode('.', $outlet_oid); + $outlet_index = $outlet_split_oid[(count($outlet_split_oid) - 1)]; - $towers++; + $outletsuffix = "$towers.$infeed_index.$outlet_index"; + $outlet_insert_index = $towers.$outlet_index; - } // while ($towers <= $tower_count) + // outletLoadValue: "A non-negative value indicates the measured load in hundredths of Amps" + $outlet_oid = "1.3.6.1.4.1.1718.3.2.3.1.7.$outletsuffix"; + $outlet_descr_string = snmp_get($device, "outletID.$outletsuffix", '-Ovq', 'Sentry3-MIB'); + $outlet_descr = "Outlet $outlet_descr_string"; + $outlet_low_warn_limit = null; + $outlet_low_limit = null; + $outlet_high_warn_limit = null; + // Should be "outletCapacity" but is always -1. According to MIB: "A negative value indicates that the capacity was not available." + $outlet_high_limit = snmp_get($device, "outletLoadHighThresh.$outletsuffix", '-Ovq', 'Sentry3-MIB'); + $outlet_current = (snmp_get($device, "$outlet_oid", '-Ovq', 'Sentry3-MIB') / $outlet_divisor); - unset($towers); -} + if ($outlet_current >= 0) { + discover_sensor($valid['sensor'], 'current', $device, $outlet_oid, $outlet_insert_index, 'sentry3', $outlet_descr, $outlet_divisor, $multiplier, $outlet_low_limit, $outlet_low_warn_limit, $outlet_high_warn_limit, $outlet_high_limit, $outlet_current); + } + } //end if -?> + unset($outlet_data); + unset($outlet_oids); + unset($outlet_oid); + unset($outlet_descr_string); + unset($outlet_descr); + unset($outlet_low_warn_limit); + unset($outlet_low_limit); + unset($outlet_high_warn_limit); + unset($outlet_high_limit); + unset($outlet_current); + } //end foreach + } //end if + unset($infeed_data); + unset($infeed_oids); + unset($descr_string); + unset($descr); + unset($low_warn_limit); + unset($low_limit); + unset($high_warn_limit); + unset($high_limit); + unset($current); + } //end foreach + + $towers++; + } //end while + + unset($towers); +}//end if diff --git a/includes/discovery/current/xups.inc.php b/includes/discovery/current/xups.inc.php index 374696348..2e1a50da6 100644 --- a/includes/discovery/current/xups.inc.php +++ b/includes/discovery/current/xups.inc.php @@ -1,61 +1,72 @@ 1) $descr .= " Phase $i"; - $current = snmp_get($device, $current_oid, "-Oqv"); - $type = "xups"; - $divisor = 1; - $index = "4.4.1.3.".$i; + $oids = trim($oids); + foreach (explode("\n", $oids) as $data) + { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $current_id = $split_oid[(count($split_oid) - 1)]; + $current_oid = "1.3.6.1.4.1.534.1.2.3.$current_id"; + $divisor = 1; + $current = snmp_get($device, $current_oid, '-O vq'); + $descr = 'Battery'.(count(explode("\n", $oids)) == 1 ? '' : ' '.($current_id + 1)); + $type = 'xups'; + $index = '1.2.3.'.$current_id; - discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + } - $oids = trim(snmp_walk($device, "xupsInputCurrent", "-OsqnU", "XUPS-MIB")); - if ($debug) { echo($oids."\n"); } - list($unused,$numPhase) = explode(' ',$oids); - for($i = 1; $i <= $numPhase;$i++) - { - $current_oid = "1.3.6.1.4.1.534.1.3.4.1.3.$i"; - $descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i"; - $current = snmp_get($device, $current_oid, "-Oqv"); - $type = "xups"; - $divisor = 1; - $index = "3.4.1.3.".$i; + $oids = trim(snmp_walk($device, 'xupsOutputCurrent', '-OsqnU', 'XUPS-MIB')); + if ($debug) { + echo $oids."\n"; + } - discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } -} + list($unused,$numPhase) = explode(' ', $oids); + for ($i = 1; $i <= $numPhase; $i++) { + $current_oid = "1.3.6.1.4.1.534.1.4.4.1.3.$i"; + $descr = 'Output'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } -?> \ No newline at end of file + $current = snmp_get($device, $current_oid, '-Oqv'); + $type = 'xups'; + $divisor = 1; + $index = '4.4.1.3.'.$i; + + discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + + $oids = trim(snmp_walk($device, 'xupsInputCurrent', '-OsqnU', 'XUPS-MIB')); + if ($debug) { + echo $oids."\n"; + } + + list($unused,$numPhase) = explode(' ', $oids); + for ($i = 1; $i <= $numPhase; $i++) { + $current_oid = "1.3.6.1.4.1.534.1.3.4.1.3.$i"; + $descr = 'Input'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $current = snmp_get($device, $current_oid, '-Oqv'); + $type = 'xups'; + $divisor = 1; + $index = '3.4.1.3.'.$i; + + discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } +}//end if diff --git a/includes/discovery/fanspeeds.inc.php b/includes/discovery/fanspeeds.inc.php index eca0c9eb3..6ad629549 100644 --- a/includes/discovery/fanspeeds.inc.php +++ b/includes/discovery/fanspeeds.inc.php @@ -1,16 +1,15 @@ +echo "\n"; diff --git a/includes/discovery/fanspeeds/areca.inc.php b/includes/discovery/fanspeeds/areca.inc.php index 477ad1eac..831cd78a5 100644 --- a/includes/discovery/fanspeeds/areca.inc.php +++ b/includes/discovery/fanspeeds/areca.inc.php @@ -1,25 +1,26 @@ \ No newline at end of file + if ($oids) { + echo 'Areca '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + $oid = '1.3.6.1.4.1.18928.1.2.2.1.9.1.3.'.$index; + $current = snmp_get($device, $oid, '-Oqv', ''); + + discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'areca', trim($descr, '"'), '1', '1', null, null, null, null, $current); + } + } +}//end if diff --git a/includes/discovery/fanspeeds/lmsensors.inc.php b/includes/discovery/fanspeeds/lmsensors.inc.php index 21a310e18..a4aa7c6ca 100644 --- a/includes/discovery/fanspeeds/lmsensors.inc.php +++ b/includes/discovery/fanspeeds/lmsensors.inc.php @@ -1,29 +1,29 @@ '0') - { - discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'lmsensors', $descr, '1', '1', NULL, NULL, NULL, NULL, $current); - } +if ($device['os'] == 'linux') { + $oids = snmp_walk($device, 'lmFanSensorsDevice', '-OsqnU', 'LM-SENSORS-MIB'); + if ($debug) { + echo $oids."\n"; } - } -} -?> \ No newline at end of file + $oids = trim($oids); + if ($oids) { + echo 'LM-SENSORS '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + $oid = '1.3.6.1.4.1.2021.13.16.3.1.3.'.$index; + $current = snmp_get($device, $oid, '-Oqv', 'LM-SENSORS-MIB'); + $descr = trim(str_ireplace('fan-', '', $descr)); + if ($current > '0') { + discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'lmsensors', $descr, '1', '1', null, null, null, null, $current); + } + } + } +}//end if diff --git a/includes/discovery/fanspeeds/supermicro.inc.php b/includes/discovery/fanspeeds/supermicro.inc.php index e2b00f149..be56aec02 100644 --- a/includes/discovery/fanspeeds/supermicro.inc.php +++ b/includes/discovery/fanspeeds/supermicro.inc.php @@ -1,43 +1,42 @@ \ No newline at end of file + $oids = trim($oids); + if ($oids) { + echo 'Supermicro '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$kind) = explode(' ', $data); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + if ($kind == 0) { + $fan_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.4.$index"; + $descr_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.2.$index"; + $limit_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.6.$index"; + $divisor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.9.$index"; + $monitor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.10.$index"; + $descr = snmp_get($device, $descr_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + $current = snmp_get($device, $fan_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + $low_limit = snmp_get($device, $limit_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + // $divisor = snmp_get($device, $divisor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB"); + // ^ This returns an incorrect precision. At least using the raw value... I think. -TL + $divisor = '1'; + $monitor = snmp_get($device, $monitor_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + $descr = str_replace(' Fan Speed', '', $descr); + $descr = str_replace(' Speed', '', $descr); + if ($monitor == 'true') { + discover_sensor($valid['sensor'], 'fanspeed', $device, $fan_oid, $index, 'supermicro', $descr, $divisor, '1', $low_limit, null, null, null, $current); + } + } + }//end if + }//end foreach +}//end if diff --git a/includes/discovery/frequencies.inc.php b/includes/discovery/frequencies.inc.php index ca476d8ea..23b30b092 100644 --- a/includes/discovery/frequencies.inc.php +++ b/includes/discovery/frequencies.inc.php @@ -1,16 +1,15 @@ +echo "\n"; diff --git a/includes/discovery/frequencies/apc.inc.php b/includes/discovery/frequencies/apc.inc.php index 5c354661b..cfb4d08ef 100644 --- a/includes/discovery/frequencies/apc.inc.php +++ b/includes/discovery/frequencies/apc.inc.php @@ -1,71 +1,84 @@ 1) { $descr .= " $index"; } - discover_sensor($valid['sensor'], 'frequency', $device, $oid, "4.2.1.4.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); + if ($oids) { + echo 'APC In '; } - } - $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.3.2.4.0", "-OsqnU", ""); - if ($debug) { echo($oids."\n"); } - if ($oids) - { - echo(" APC In "); - list($oid,$current) = explode(" ",$oids); $divisor = 1; - $type = "apc"; - $index = "3.2.4.0"; - $descr = "Input"; - discover_sensor($valid['sensor'], 'frequency', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + $type = 'apc'; + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$current) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + $oid = '1.3.6.1.4.1.318.1.1.8.5.3.2.1.4.'.$index; + $descr = 'Input Feed '.chr(64 + $index); + discover_sensor($valid['sensor'], 'frequency', $device, $oid, "3.2.1.4.$index", $type, $descr, $divisor, '1', null, null, null, null, $current); + } + } + + $oids = snmp_walk($device, '1.3.6.1.4.1.318.1.1.8.5.4.2.1.4', '-OsqnU', ''); + if ($debug) { + echo $oids."\n"; + } + + if ($oids) { + echo ' APC Out '; + } - $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.4.2.2.0", "-OsqnU", ""); - if ($debug) { echo($oids."\n"); } - if ($oids) - { - echo(" APC Out "); - list($oid,$current) = explode(" ",$oids); $divisor = 1; - $type = "apc"; - $index = "4.2.2.0"; - $descr = "Output"; - discover_sensor($valid['sensor'], 'frequency', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } -} + $type = 'apc'; + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$current) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 3)]; + $oid = '1.3.6.1.4.1.318.1.1.8.5.4.2.1.4.'.$index; + $descr = 'Output Feed'; + if (count(explode("\n", $oids)) > 1) { + $descr .= " $index"; + } -?> \ No newline at end of file + discover_sensor($valid['sensor'], 'frequency', $device, $oid, "4.2.1.4.$index", $type, $descr, $divisor, '1', null, null, null, null, $current); + } + } + + $oids = snmp_get($device, '1.3.6.1.4.1.318.1.1.1.3.2.4.0', '-OsqnU', ''); + if ($debug) { + echo $oids."\n"; + } + + if ($oids) { + echo ' APC In '; + list($oid,$current) = explode(' ', $oids); + $divisor = 1; + $type = 'apc'; + $index = '3.2.4.0'; + $descr = 'Input'; + discover_sensor($valid['sensor'], 'frequency', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + + $oids = snmp_get($device, '1.3.6.1.4.1.318.1.1.1.4.2.2.0', '-OsqnU', ''); + if ($debug) { + echo $oids."\n"; + } + + if ($oids) { + echo ' APC Out '; + list($oid,$current) = explode(' ', $oids); + $divisor = 1; + $type = 'apc'; + $index = '4.2.2.0'; + $descr = 'Output'; + discover_sensor($valid['sensor'], 'frequency', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } +}//end if diff --git a/includes/discovery/frequencies/ipoman.inc.php b/includes/discovery/frequencies/ipoman.inc.php index 34c459480..a64f0d426 100644 --- a/includes/discovery/frequencies/ipoman.inc.php +++ b/includes/discovery/frequencies/ipoman.inc.php @@ -1,43 +1,38 @@ $entry) - { - $freq_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.4.' . $index; - $divisor = 10; - $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index"); - $current = $entry['inletStatusFrequency'] / 10; - $low_limit = $entry['inletConfigFrequencyLow']; - $high_limit = $entry['inletConfigFrequencyHigh']; - discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, NULL, NULL, $high_limit, $current); - // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? + if (!is_array($cache['ipoman'])) { + echo 'outletConfigDesc '; + $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigDesc', $cache['ipoman']['out'], 'IPOMANII-MIB'); + echo 'outletConfigLocation '; + $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigLocation', $cache['ipoman']['out'], 'IPOMANII-MIB'); + echo 'inletConfigDesc '; + $cache['ipoman']['in'] = snmpwalk_cache_multi_oid($device, 'inletConfigDesc', $cache['ipoman']['in'], 'IPOMANII-MIB'); } - } -} -?> \ No newline at end of file + $oids = array(); + + echo 'inletConfigFrequencyHigh '; + $oids = snmpwalk_cache_multi_oid($device, 'inletConfigFrequencyHigh', $oids, 'IPOMANII-MIB'); + echo 'inletConfigFrequencyLow '; + $oids = snmpwalk_cache_multi_oid($device, 'inletConfigFrequencyLow', $oids, 'IPOMANII-MIB'); + echo 'inletStatusFrequency '; + $oids = snmpwalk_cache_multi_oid($device, 'inletStatusFrequency', $oids, 'IPOMANII-MIB'); + + if (is_array($oids)) { + foreach ($oids as $index => $entry) + { + $freq_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.4.'.$index; + $divisor = 10; + $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') : "Inlet $index"); + $current = ($entry['inletStatusFrequency'] / 10); + $low_limit = $entry['inletConfigFrequencyLow']; + $high_limit = $entry['inletConfigFrequencyHigh']; + discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, null, null, $high_limit, $current); + // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? + } + } +}//end if diff --git a/includes/discovery/frequencies/mgeups.inc.php b/includes/discovery/frequencies/mgeups.inc.php index 034ec2e66..67a31218c 100644 --- a/includes/discovery/frequencies/mgeups.inc.php +++ b/includes/discovery/frequencies/mgeups.inc.php @@ -1,47 +1,57 @@ 1) $descr .= " Phase $i"; - $current = snmp_get($device, $freq_oid, "-Oqv"); - if (!$current) - { - $freq_oid .= ".0"; - $current = snmp_get($device, $freq_oid, "-Oqv"); +if ($device['os'] == 'mgeups') { + echo 'MGE '; + $oids = trim(snmp_walk($device, '1.3.6.1.4.1.705.1.7.1', '-OsqnU')); + if ($debug) { + echo $oids."\n"; } - $current /= 10; - $type = "mge-ups"; - $divisor = 10; - $index = $i; - discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } - $oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU")); - if ($debug) { echo($oids."\n"); } - $numPhase = count(explode("\n",$oids)); - for($i = 1; $i <= $numPhase;$i++) - { - $freq_oid = ".1.3.6.1.4.1.705.1.6.2.1.3.$i"; - $descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i"; - $current = snmp_get($device, $freq_oid, "-Oqv"); - if (!$current) - { - $freq_oid .= ".0"; - $current = snmp_get($device, $freq_oid, "-Oqv"); - } - $current /= 10; - $type = "mge-ups"; - $divisor = 10; - $index = 100+$i; - discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } -} -?> \ No newline at end of file + $numPhase = count(explode("\n", $oids)); + for ($i = 1; $i <= $numPhase; $i++) { + $freq_oid = ".1.3.6.1.4.1.705.1.7.2.1.3.$i"; + $descr = 'Output'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $current = snmp_get($device, $freq_oid, '-Oqv'); + if (!$current) { + $freq_oid .= '.0'; + $current = snmp_get($device, $freq_oid, '-Oqv'); + } + + $current /= 10; + $type = 'mge-ups'; + $divisor = 10; + $index = $i; + discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + + $oids = trim(snmp_walk($device, '1.3.6.1.4.1.705.1.6.1', '-OsqnU')); + if ($debug) { + echo $oids."\n"; + } + + $numPhase = count(explode("\n", $oids)); + for ($i = 1; $i <= $numPhase; $i++) { + $freq_oid = ".1.3.6.1.4.1.705.1.6.2.1.3.$i"; + $descr = 'Input'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $current = snmp_get($device, $freq_oid, '-Oqv'); + if (!$current) { + $freq_oid .= '.0'; + $current = snmp_get($device, $freq_oid, '-Oqv'); + } + + $current /= 10; + $type = 'mge-ups'; + $divisor = 10; + $index = (100 + $i); + discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } +}//end if diff --git a/includes/discovery/frequencies/netvision.inc.php b/includes/discovery/frequencies/netvision.inc.php index 6b80ff388..e26fef8c6 100644 --- a/includes/discovery/frequencies/netvision.inc.php +++ b/includes/discovery/frequencies/netvision.inc.php @@ -1,22 +1,23 @@ \ No newline at end of file diff --git a/includes/discovery/frequencies/xups.inc.php b/includes/discovery/frequencies/xups.inc.php index 3c7dbeb6b..911824a87 100644 --- a/includes/discovery/frequencies/xups.inc.php +++ b/includes/discovery/frequencies/xups.inc.php @@ -1,43 +1,38 @@ \ No newline at end of file + // XUPS-MIB::xupsBypassFrequency.0 = INTEGER: 500 + $freq_oid = '1.3.6.1.4.1.534.1.5.1.0'; + $descr = 'Bypass'; + $divisor = 10; + $current = snmp_get($device, $freq_oid, '-Oqv'); + if ($current != '') { + // Bypass is not always available in SNMP + $current /= $divisor; + $type = 'xups'; + $index = '5.1.0'; + discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } +}//end if diff --git a/includes/discovery/humidity/akcp.inc.php b/includes/discovery/humidity/akcp.inc.php index e4ca767d1..07dc0864c 100644 --- a/includes/discovery/humidity/akcp.inc.php +++ b/includes/discovery/humidity/akcp.inc.php @@ -1,39 +1,42 @@ \ No newline at end of file + $oids = trim($oids); + if ($oids) { + echo 'AKCP '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$status) = explode(' ', $data, 2); + if ($status == 2) { + // 2 = normal, 0 = not connected + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + $descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.1.$index"; + $oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.3.$index"; + $warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.7.$index"; + $limit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.8.$index"; + $warnlowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.9.$index"; + $lowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.10.$index"; + + $descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"'); + $humidity = snmp_get($device, $oid, '-Oqv', ''); + $warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', ''); + $limit = snmp_get($device, $limit_oid, '-Oqv', ''); + $lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', ''); + $warnlowlimit = snmp_get($device, $warnlowlimit_oid, '-Oqv', ''); + + discover_sensor($valid['sensor'], 'humidity', $device, + $oid, $index, 'akcp', + $descr, '1', '1', $lowlimit, $warnlowlimit, $limit, $warnlimit, $humidity); + } + } + } +} diff --git a/includes/discovery/humidity/apc.inc.php b/includes/discovery/humidity/apc.inc.php index c68aefd78..fdad576fa 100644 --- a/includes/discovery/humidity/apc.inc.php +++ b/includes/discovery/humidity/apc.inc.php @@ -1,29 +1,25 @@ Sensor not available - discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit , $current); - } - } -} + $descr = $apc_env_data[$index]['iemStatusProbeName']; + $current = $apc_env_data[$index]['iemStatusProbeCurrentHumid']; + $sensorType = 'apc'; + $oid = '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.6.'.$index; + $low_limit = ($apc_env_data[$index]['iemConfigProbeMinHumidEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeMinHumidThreshold'] : null); + $low_warn_limit = ($apc_env_data[$index]['iemConfigProbeLowHumidEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeLowHumidThreshold'] : null); + $high_warn_limit = ($apc_env_data[$index]['iemConfigProbeHighHumidEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeHighHumidThreshold'] : null); + $high_limit = ($apc_env_data[$index]['iemConfigProbeMaxHumidEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeMaxHumidThreshold'] : null); -?> + if ($current != 0) { + // Humidity = 0 -> Sensor not available + discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + } + } +}//end if diff --git a/includes/discovery/humidity/ipoman.inc.php b/includes/discovery/humidity/ipoman.inc.php index 473ed64bb..4a3059b7b 100644 --- a/includes/discovery/humidity/ipoman.inc.php +++ b/includes/discovery/humidity/ipoman.inc.php @@ -2,27 +2,21 @@ // FIXME: EMD "stack" support // FIXME: What to do with IPOMANII-MIB::ipmEnvEmdConfigHumiOffset.0 ? +if ($device['os'] == 'ipoman') { + echo ' IPOMANII-MIB '; + $emd_installed = snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdStatusEmdType.0', ' -Oqv'); -if ($device['os'] == "ipoman") -{ - echo(" IPOMANII-MIB "); - $emd_installed = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdStatusEmdType.0"," -Oqv"); + if ($emd_installed == 'eMD-HT') { + $descr = snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdConfigHumiName.0', '-Oqv'); + $current = (snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdStatusHumidity.0', '-Oqv') / 10); + $high_limit = snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdConfigHumiHighSetPoint.0', '-Oqv'); + $low_limit = snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdConfigHumiLowSetPoint.0', '-Oqv'); - if ($emd_installed == 'eMD-HT') - { - $descr = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigHumiName.0", "-Oqv"); - $current = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdStatusHumidity.0", "-Oqv") / 10; - $high_limit = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigHumiHighSetPoint.0", "-Oqv"); - $low_limit = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigHumiLowSetPoint.0", "-Oqv"); + if ($descr != '' && is_numeric($current) && $current > '0') { + $current_oid = '.1.3.6.1.4.1.2468.1.4.2.1.5.1.1.3.0'; + $descr = trim(str_replace('"', '', $descr)); - if ($descr != "" && is_numeric($current) && $current > "0") - { - $current_oid = ".1.3.6.1.4.1.2468.1.4.2.1.5.1.1.3.0"; - $descr = trim(str_replace("\"", "", $descr)); - - discover_sensor($valid['sensor'], 'humidity', $device, $current_oid, "1", 'ipoman', $descr, '10', '1', $low_limit, NULL, NULL, $high_limit, $current); + discover_sensor($valid['sensor'], 'humidity', $device, $current_oid, '1', 'ipoman', $descr, '10', '1', $low_limit, null, null, $high_limit, $current); + } } - } } - -?> \ No newline at end of file diff --git a/includes/discovery/humidity/mgeups.inc.php b/includes/discovery/humidity/mgeups.inc.php index aa085889d..3cd77e9eb 100644 --- a/includes/discovery/humidity/mgeups.inc.php +++ b/includes/discovery/humidity/mgeups.inc.php @@ -2,68 +2,65 @@ global $debug; -if ($device['os'] == "mgeups") -{ - # blatently copyied from APC +if ($device['os'] == 'mgeups') { + // blatently copyied from APC + echo 'MGE UPS External '; - echo("MGE UPS External "); + // Environmental monitoring on UPSes etc + // FIXME upsmgConfigEnvironmentTable and upsmgEnvironmentSensorTable are used but there are others ... + $mge_env_data = snmpwalk_cache_oid($device, 'upsmgConfigEnvironmentTable', array(), 'MG-SNMP-UPS-MIB'); + $mge_env_data = snmpwalk_cache_oid($device, 'upsmgEnvironmentSensorTable', $mge_env_data, 'MG-SNMP-UPS-MIB'); - # Environmental monitoring on UPSes etc - // FIXME upsmgConfigEnvironmentTable and upsmgEnvironmentSensorTable are used but there are others ... - $mge_env_data = snmpwalk_cache_oid($device, "upsmgConfigEnvironmentTable", array(), "MG-SNMP-UPS-MIB"); - $mge_env_data = snmpwalk_cache_oid($device, "upsmgEnvironmentSensorTable", $mge_env_data, "MG-SNMP-UPS-MIB"); + /* + upsmgConfigSensorIndex.1 = 1 + upsmgConfigSensorName.1 = "Environment sensor" + upsmgConfigTemperatureLow.1 = 5 + upsmgConfigTemperatureHigh.1 = 40 + upsmgConfigTemperatureHysteresis.1 = 2 + upsmgConfigHumidityLow.1 = 5 + upsmgConfigHumidityHigh.1 = 90 + upsmgConfigHumidityHysteresis.1 = 5 + upsmgConfigInput1Name.1 = "Input #1" + upsmgConfigInput1ClosedLabel.1 = "closed" + upsmgConfigInput1OpenLabel.1 = "open" + upsmgConfigInput2Name.1 = "Input #2" + upsmgConfigInput2ClosedLabel.1 = "closed" + upsmgConfigInput2OpenLabel.1 = "open" -/* -upsmgConfigSensorIndex.1 = 1 -upsmgConfigSensorName.1 = "Environment sensor" -upsmgConfigTemperatureLow.1 = 5 -upsmgConfigTemperatureHigh.1 = 40 -upsmgConfigTemperatureHysteresis.1 = 2 -upsmgConfigHumidityLow.1 = 5 -upsmgConfigHumidityHigh.1 = 90 -upsmgConfigHumidityHysteresis.1 = 5 -upsmgConfigInput1Name.1 = "Input #1" -upsmgConfigInput1ClosedLabel.1 = "closed" -upsmgConfigInput1OpenLabel.1 = "open" -upsmgConfigInput2Name.1 = "Input #2" -upsmgConfigInput2ClosedLabel.1 = "closed" -upsmgConfigInput2OpenLabel.1 = "open" + upsmgEnvironmentIndex.1 = 1 + upsmgEnvironmentComFailure.1 = no + upsmgEnvironmentTemperature.1 = 287 + upsmgEnvironmentTemperatureLow.1 = no + upsmgEnvironmentTemperatureHigh.1 = no + upsmgEnvironmentHumidity.1 = 17 + upsmgEnvironmentHumidityLow.1 = no + upsmgEnvironmentHumidityHigh.1 = no + upsmgEnvironmentInput1State.1 = open + upsmgEnvironmentInput2State.1 = open + */ -upsmgEnvironmentIndex.1 = 1 -upsmgEnvironmentComFailure.1 = no -upsmgEnvironmentTemperature.1 = 287 -upsmgEnvironmentTemperatureLow.1 = no -upsmgEnvironmentTemperatureHigh.1 = no -upsmgEnvironmentHumidity.1 = 17 -upsmgEnvironmentHumidityLow.1 = no -upsmgEnvironmentHumidityHigh.1 = no -upsmgEnvironmentInput1State.1 = open -upsmgEnvironmentInput2State.1 = open -*/ - - foreach (array_keys($mge_env_data) as $index) - { - $descr = $mge_env_data[$index]['upsmgConfigSensorName']; - $current = $mge_env_data[$index]['upsmgEnvironmentHumidity']; - $sensorType = 'mge'; - $oid = '.1.3.6.1.4.1.705.1.8.7.1.6.' . $index; - $low_limit = $mge_env_data[$index]['upsmgConfigHumidityLow']; - $high_limit = $mge_env_data[$index]['upsmgConfigHumidityHigh']; - $hysteresis = $mge_env_data[$index]['upsmgConfigHumidityHysteresis']; - - // FIXME warninglevels might need some other calculation in stead of hysteresis - $low_warn_limit = $low_limit + $hysteresis; - $high_warn_limit = $high_limit - $hysteresis; - - if ($debug) { echo("low_limit : $low_limit\nlow_warn_limit : $low_warn_limit\nhigh_warn_limit : $high_warn_limit\nhigh_limit : $high_limit\n"); } - - if ($current != 0) + foreach (array_keys($mge_env_data) as $index) { - # Humidity = 0 -> Sensor not available - // FIXME true for MGE as wel as APC? - discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit , $current); - } - } -} + $descr = $mge_env_data[$index]['upsmgConfigSensorName']; + $current = $mge_env_data[$index]['upsmgEnvironmentHumidity']; + $sensorType = 'mge'; + $oid = '.1.3.6.1.4.1.705.1.8.7.1.6.'.$index; + $low_limit = $mge_env_data[$index]['upsmgConfigHumidityLow']; + $high_limit = $mge_env_data[$index]['upsmgConfigHumidityHigh']; + $hysteresis = $mge_env_data[$index]['upsmgConfigHumidityHysteresis']; -?> + // FIXME warninglevels might need some other calculation in stead of hysteresis + $low_warn_limit = ($low_limit + $hysteresis); + $high_warn_limit = ($high_limit - $hysteresis); + + if ($debug) { + echo "low_limit : $low_limit\nlow_warn_limit : $low_warn_limit\nhigh_warn_limit : $high_warn_limit\nhigh_limit : $high_limit\n"; + } + + if ($current != 0) { + // Humidity = 0 -> Sensor not available + // FIXME true for MGE as wel as APC? + discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + } + }//end foreach +}//end if diff --git a/includes/discovery/humidity/netbotz.inc.php b/includes/discovery/humidity/netbotz.inc.php index 938386327..2ed4172ec 100644 --- a/includes/discovery/humidity/netbotz.inc.php +++ b/includes/discovery/humidity/netbotz.inc.php @@ -1,30 +1,33 @@ = 0) { - discover_sensor($valid['sensor'], 'humidity', $device, $humidity_oid, $humidity_id, 'netbotz', $descr, '1', '1', NULL, NULL, NULL, NULL, $humidity); - } +if ($device['os'] == 'netbotz') { + $oids = snmp_walk($device, '.1.3.6.1.4.1.5528.100.4.1.2.1.4', '-Osqn', ''); + if ($debug) { + echo $oids."\n"; } - unset($data); - } - unset($oids); -} -?> + $oids = trim($oids); + if ($oids) { + echo 'Netbotz '; + foreach (explode("\n", $oids) as $data) + { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $humidity_id = $split_oid[(count($split_oid) - 1)]; + // tempHumidSensorHumidValue + $humidity_oid = '.1.3.6.1.4.1.5528.100.4.1.2.1.8.'.$humidity_id; + $humidity = snmp_get($device, "$humidity_oid", '-Ovq', ''); + $descr = str_replace('"', '', $descr); + $descr = trim($descr); + if ($humidity >= 0) { + discover_sensor($valid['sensor'], 'humidity', $device, + $humidity_oid, $humidity_id, 'netbotz', + $descr, '1', '1', null, null, null, null, $humidity); + } + } + + unset($data); + } + + unset($oids); +} diff --git a/includes/discovery/humidity/pcoweb.inc.php b/includes/discovery/humidity/pcoweb.inc.php index b64d90e31..4a975e4ef 100644 --- a/includes/discovery/humidity/pcoweb.inc.php +++ b/includes/discovery/humidity/pcoweb.inc.php @@ -1,40 +1,59 @@ "CAREL-ug40cdz-MIB::roomRH.0", "descr" => "Room Relative Humidity", "oid" => ".1.3.6.1.4.1.9839.2.1.2.6.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::dehumPband.0", "descr" => "Dehumidification Prop. Band", "oid" => ".1.3.6.1.4.1.9839.2.1.3.12.0", "precision" => "1"), - array("mib" => "CAREL-ug40cdz-MIB::humidPband.0", "descr" => "Humidification Prop. Band", "oid" => ".1.3.6.1.4.1.9839.2.1.3.13.0", "precision" => "1"), - array("mib" => "CAREL-ug40cdz-MIB::dehumSetp.0", "descr" => "Dehumidification Set Point", "oid" => ".1.3.6.1.4.1.9839.2.1.3.16.0", "precision" => "1"), - array("mib" => "CAREL-ug40cdz-MIB::humidSetp.0", "descr" => "Humidification Set Point", "oid" => ".1.3.6.1.4.1.9839.2.1.3.17.0", "precision" => "1"), - ); + $humidities = array( + array( + 'mib' => 'CAREL-ug40cdz-MIB::roomRH.0', + 'descr' => 'Room Relative Humidity', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.6.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::dehumPband.0', + 'descr' => 'Dehumidification Prop. Band', + 'oid' => '.1.3.6.1.4.1.9839.2.1.3.12.0', + 'precision' => '1', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::humidPband.0', + 'descr' => 'Humidification Prop. Band', + 'oid' => '.1.3.6.1.4.1.9839.2.1.3.13.0', + 'precision' => '1', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::dehumSetp.0', + 'descr' => 'Dehumidification Set Point', + 'oid' => '.1.3.6.1.4.1.9839.2.1.3.16.0', + 'precision' => '1', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::humidSetp.0', + 'descr' => 'Humidification Set Point', + 'oid' => '.1.3.6.1.4.1.9839.2.1.3.17.0', + 'precision' => '1', + ), + ); - foreach ($humidities as $humidity) - { - $current = snmp_get($device, $humidity['mib'], "-OqvU") / $humidity['precision']; + foreach ($humidities as $humidity) { + $current = (snmp_get($device, $humidity['mib'], '-OqvU') / $humidity['precision']); - $high_limit = NULL; - $low_limit = NULL; + $high_limit = null; + $low_limit = null; - if (is_numeric($current) && $current != 0) - { - $index = implode(".",array_slice(explode(".",$humidity['oid']),-5)); - discover_sensor($valid['sensor'], 'humidity', $device, $humidity['oid'], $index, 'pcoweb', $humidity['descr'], $humidity['precision'], '1', $low_limit, NULL, NULL, $high_limit, $current); + if (is_numeric($current) && $current != 0) { + $index = implode('.', array_slice(explode('.', $humidity['oid']), -5)); + discover_sensor($valid['sensor'], 'humidity', $device, $humidity['oid'], $index, 'pcoweb', $humidity['descr'], $humidity['precision'], '1', $low_limit, null, null, $high_limit, $current); + } } - } -/* -FIXME - -hhAlarmThrsh.0 = INTEGER: 80 rH% -lhAlarmThrsh.0 = INTEGER: 30 rH% -smDehumSetp.0 = INTEGER: 75 rH% -smHumidSetp.0 = INTEGER: 35 rH% -*/ + /* + FIXME + hhAlarmThrsh.0 = INTEGER: 80 rH% + lhAlarmThrsh.0 = INTEGER: 30 rH% + smDehumSetp.0 = INTEGER: 75 rH% + smHumidSetp.0 = INTEGER: 35 rH% + */ } - -?> diff --git a/includes/discovery/humidity/sentry3.inc.php b/includes/discovery/humidity/sentry3.inc.php index 1f74805af..c3e4ff440 100644 --- a/includes/discovery/humidity/sentry3.inc.php +++ b/includes/discovery/humidity/sentry3.inc.php @@ -1,38 +1,44 @@ = 0) { - discover_sensor($valid['sensor'], 'humidity', $device, $humidity_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); - } +if ($device['os'] == 'sentry3') { + $oids = snmp_walk($device, 'tempHumidSensorHumidValue', '-Osqn', 'Sentry3-MIB'); + $divisor = '1'; + $multiplier = '1'; + if ($debug) { + echo $oids."\n"; } - unset($data); - } - unset($oids); -} -?> + $oids = trim($oids); + if ($oids) { + echo 'ServerTech Sentry '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + + // tempHumidSensorHumidValue + $humidity_oid = '1.3.6.1.4.1.1718.3.2.5.1.10.1.'.$index; + $descr = 'Removable Sensor '.$index; + $low_warn_limit = '0'; + $low_limit = snmp_get($device, "tempHumidSensorHumidLowThresh.1.$index", '-Ovq', 'Sentry3-MIB'); + $high_warn_limit = '0'; + $high_limit = snmp_get($device, "tempHumidSensorHumidHighThresh.1.$index", '-Ovq', 'Sentry3-MIB'); + $current = snmp_get($device, "$humidity_oid", '-Ovq', 'Sentry3-MIB'); + + if ($current >= 0) { + discover_sensor($valid['sensor'], 'humidity', $device, + $humidity_oid, $index, 'sentry3', + $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, + $high_warn_limit, $high_limit, $current); + } + } + + unset($data); + } + + unset($oids); +} diff --git a/includes/discovery/mempools/avaya-ers.inc.php b/includes/discovery/mempools/avaya-ers.inc.php index 271d25bea..f43dc28ab 100644 --- a/includes/discovery/mempools/avaya-ers.inc.php +++ b/includes/discovery/mempools/avaya-ers.inc.php @@ -1,29 +1,26 @@ = 6.1) { - $mem = snmp_walk($device, $OID, "-Osqn"); + // Temperature info only known to be present in firmware 6.1 or higher + if ($fw_major_version >= 6.1) { + $mem = snmp_walk($device, $OID, '-Osqn'); - echo "$mem\n"; + echo "$mem\n"; - foreach (explode("\n", $mem) as $i => $t) { - $t = explode(" ",$t); - $oid = str_replace($OID, "", $t[0]); - discover_mempool($valid_mempool, $device, $oid, "avaya-ers", "Unit " . ($i+1) . " memory", "1", NULL, NULL); - } + foreach (explode("\n", $mem) as $i => $t) { + $t = explode(' ', $t); + $oid = str_replace($OID, '', $t[0]); + discover_mempool($valid_mempool, $device, $oid, 'avaya-ers', 'Unit '.($i + 1).' memory', '1', null, null); + } + } } - } } - -?> diff --git a/includes/discovery/mempools/fortigate.inc.php b/includes/discovery/mempools/fortigate.inc.php index ac68990b2..f8fe041a1 100644 --- a/includes/discovery/mempools/fortigate.inc.php +++ b/includes/discovery/mempools/fortigate.inc.php @@ -1,8 +1,6 @@ diff --git a/includes/discovery/mempools/netscaler.inc.php b/includes/discovery/mempools/netscaler.inc.php index 1d8459314..cdade351f 100644 --- a/includes/discovery/mempools/netscaler.inc.php +++ b/includes/discovery/mempools/netscaler.inc.php @@ -1,13 +1,7 @@ diff --git a/includes/discovery/mempools/vrp.inc.php b/includes/discovery/mempools/vrp.inc.php index 4960713e3..8b8237733 100644 --- a/includes/discovery/mempools/vrp.inc.php +++ b/includes/discovery/mempools/vrp.inc.php @@ -1,33 +1,32 @@ $entry) - { - if ($entry['hwEntityMemSize'] != 0 ) - { - if ($debug) { echo($index . " " . $entry['hwEntityBomEnDesc'] . " -> " . $entry['hwEntityMemUsage'] . " -> " . $entry['hwEntityMemSize'] . "\n"); } - $usage_oid = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.7." . $index; - $descr = $entry['hwEntityBomEnDesc']; - $usage = $entry['hwEntityMemUsage']; - if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) + if (is_array($mempools_array)) { + foreach ($mempools_array as $index => $entry) { - discover_mempool($valid_mempool, $device, $index, "vrp", $descr, "1", NULL, NULL); - } - } // End if checks - } // End Foreach - } // End if array -} // End VRP mempools + if ($entry['hwEntityMemSize'] != 0) { + if ($debug) { + echo $index.' '.$entry['hwEntityBomEnDesc'].' -> '.$entry['hwEntityMemUsage'].' -> '.$entry['hwEntityMemSize']."\n"; + } -unset ($mempools_array); + $usage_oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.1.1.7.'.$index; + $descr = $entry['hwEntityBomEnDesc']; + $usage = $entry['hwEntityMemUsage']; + if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') { + discover_mempool($valid_mempool, $device, $index, 'vrp', $descr, '1', null, null); + } + } //end if + } //end foreach + } //end if +} //end if -?> +unset($mempools_array); diff --git a/includes/discovery/os/acsw.inc.php b/includes/discovery/os/acsw.inc.php index 9d08cf4cc..f662254b9 100644 --- a/includes/discovery/os/acsw.inc.php +++ b/includes/discovery/os/acsw.inc.php @@ -1,16 +1,19 @@ diff --git a/includes/discovery/os/airport.inc.php b/includes/discovery/os/airport.inc.php index e20f256ce..bdf403e21 100644 --- a/includes/discovery/os/airport.inc.php +++ b/includes/discovery/os/airport.inc.php @@ -1,10 +1,13 @@ \ No newline at end of file diff --git a/includes/discovery/os/akcp.inc.php b/includes/discovery/os/akcp.inc.php index 1fa39310e..dd9b7ff50 100644 --- a/includes/discovery/os/akcp.inc.php +++ b/includes/discovery/os/akcp.inc.php @@ -1,9 +1,11 @@ \ No newline at end of file + if (preg_match('/SensorProbe/i', $sysDescr)) { + $os = 'akcp'; + } +} diff --git a/includes/discovery/os/apc.inc.php b/includes/discovery/os/apc.inc.php index 0c2ab869e..cb276dac8 100644 --- a/includes/discovery/os/apc.inc.php +++ b/includes/discovery/os/apc.inc.php @@ -1,11 +1,16 @@ \ No newline at end of file diff --git a/includes/discovery/os/arubaos.inc.php b/includes/discovery/os/arubaos.inc.php index f453e2a47..7364e5d19 100644 --- a/includes/discovery/os/arubaos.inc.php +++ b/includes/discovery/os/arubaos.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/avocent.inc.php b/includes/discovery/os/avocent.inc.php index d22f39b5d..7c7dea245 100644 --- a/includes/discovery/os/avocent.inc.php +++ b/includes/discovery/os/avocent.inc.php @@ -1,9 +1,11 @@ \ No newline at end of file + if (preg_match('/^AlterPath/', $sysDescr)) { + $os = 'avocent'; + } +} diff --git a/includes/discovery/os/axiscam.inc.php b/includes/discovery/os/axiscam.inc.php index 792e00836..2060365f8 100644 --- a/includes/discovery/os/axiscam.inc.php +++ b/includes/discovery/os/axiscam.inc.php @@ -1,9 +1,11 @@ \ No newline at end of file + if (preg_match('/AXIS .* Video Server/', $sysDescr)) { + $os = 'axiscam'; + } +} diff --git a/includes/discovery/os/axisdocserver.inc.php b/includes/discovery/os/axisdocserver.inc.php index f6b25b84e..f4b865991 100644 --- a/includes/discovery/os/axisdocserver.inc.php +++ b/includes/discovery/os/axisdocserver.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/bcm963.inc.php b/includes/discovery/os/bcm963.inc.php index e0c721170..4113d29e0 100644 --- a/includes/discovery/os/bcm963.inc.php +++ b/includes/discovery/os/bcm963.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/bnt.inc.php b/includes/discovery/os/bnt.inc.php index 8f610d95e..37e0a8b17 100644 --- a/includes/discovery/os/bnt.inc.php +++ b/includes/discovery/os/bnt.inc.php @@ -1,9 +1,11 @@ \ No newline at end of file + if (preg_match('/^BNT /', $sysDescr)) { + $os = 'bnt'; + } +} diff --git a/includes/discovery/os/brother.inc.php b/includes/discovery/os/brother.inc.php index be6a4a6be..b56634a0b 100644 --- a/includes/discovery/os/brother.inc.php +++ b/includes/discovery/os/brother.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/cometsystem.inc.php b/includes/discovery/os/cometsystem.inc.php index 86cb86af1..6eedee41f 100644 --- a/includes/discovery/os/cometsystem.inc.php +++ b/includes/discovery/os/cometsystem.inc.php @@ -1,14 +1,9 @@ \ No newline at end of file diff --git a/includes/discovery/os/dell-laser.inc.php b/includes/discovery/os/dell-laser.inc.php index daa90da14..030ae8a94 100644 --- a/includes/discovery/os/dell-laser.inc.php +++ b/includes/discovery/os/dell-laser.inc.php @@ -1,10 +1,13 @@ \ No newline at end of file diff --git a/includes/discovery/os/deltaups.inc.php b/includes/discovery/os/deltaups.inc.php index c52aa4741..0df9ffb7d 100644 --- a/includes/discovery/os/deltaups.inc.php +++ b/includes/discovery/os/deltaups.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/dlink.inc.php b/includes/discovery/os/dlink.inc.php index 26e9c78de..313158ee1 100644 --- a/includes/discovery/os/dlink.inc.php +++ b/includes/discovery/os/dlink.inc.php @@ -1,11 +1,16 @@ \ No newline at end of file diff --git a/includes/discovery/os/dlinkap.inc.php b/includes/discovery/os/dlinkap.inc.php index 4add24995..3cd1d7179 100644 --- a/includes/discovery/os/dlinkap.inc.php +++ b/includes/discovery/os/dlinkap.inc.php @@ -1,10 +1,13 @@ \ No newline at end of file diff --git a/includes/discovery/os/epson.inc.php b/includes/discovery/os/epson.inc.php index 1369bdbf8..52467ca2f 100644 --- a/includes/discovery/os/epson.inc.php +++ b/includes/discovery/os/epson.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/gamatronicups.inc.php b/includes/discovery/os/gamatronicups.inc.php index 06e442c64..8ddc691a3 100644 --- a/includes/discovery/os/gamatronicups.inc.php +++ b/includes/discovery/os/gamatronicups.inc.php @@ -1,14 +1,9 @@ \ No newline at end of file diff --git a/includes/discovery/os/ies.inc.php b/includes/discovery/os/ies.inc.php index 1125cc186..62b2e49a6 100644 --- a/includes/discovery/os/ies.inc.php +++ b/includes/discovery/os/ies.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/ipoman.inc.php b/includes/discovery/os/ipoman.inc.php index 8a7300278..97c753b91 100644 --- a/includes/discovery/os/ipoman.inc.php +++ b/includes/discovery/os/ipoman.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/jetdirect.inc.php b/includes/discovery/os/jetdirect.inc.php index e0a6502c0..090a867f2 100644 --- a/includes/discovery/os/jetdirect.inc.php +++ b/includes/discovery/os/jetdirect.inc.php @@ -1,10 +1,13 @@ \ No newline at end of file diff --git a/includes/discovery/os/konica.inc.php b/includes/discovery/os/konica.inc.php index 911d78c32..90798bf9e 100644 --- a/includes/discovery/os/konica.inc.php +++ b/includes/discovery/os/konica.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/kyocera.inc.php b/includes/discovery/os/kyocera.inc.php index e0d5c56f9..7e7242572 100644 --- a/includes/discovery/os/kyocera.inc.php +++ b/includes/discovery/os/kyocera.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/liebert.inc.php b/includes/discovery/os/liebert.inc.php index f13b39e2d..2a7bfa324 100644 --- a/includes/discovery/os/liebert.inc.php +++ b/includes/discovery/os/liebert.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/mgepdu.inc.php b/includes/discovery/os/mgepdu.inc.php index 718367cec..3b5c80a79 100644 --- a/includes/discovery/os/mgepdu.inc.php +++ b/includes/discovery/os/mgepdu.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/mgeups.inc.php b/includes/discovery/os/mgeups.inc.php index 9d94bce4a..6da303921 100644 --- a/includes/discovery/os/mgeups.inc.php +++ b/includes/discovery/os/mgeups.inc.php @@ -1,11 +1,16 @@ \ No newline at end of file diff --git a/includes/discovery/os/mrvld.inc.php b/includes/discovery/os/mrvld.inc.php index 738d5915f..2f8e5bff3 100644 --- a/includes/discovery/os/mrvld.inc.php +++ b/includes/discovery/os/mrvld.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/netopia.inc.php b/includes/discovery/os/netopia.inc.php index 541503ce0..8bafc5a64 100644 --- a/includes/discovery/os/netopia.inc.php +++ b/includes/discovery/os/netopia.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/netvision.inc.php b/includes/discovery/os/netvision.inc.php index ec3c36096..8dc07c870 100644 --- a/includes/discovery/os/netvision.inc.php +++ b/includes/discovery/os/netvision.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/netware.inc.php b/includes/discovery/os/netware.inc.php index 42f85b340..6e5ea3f46 100644 --- a/includes/discovery/os/netware.inc.php +++ b/includes/discovery/os/netware.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/nrg.inc.php b/includes/discovery/os/nrg.inc.php index 11bebecc1..9e9210421 100644 --- a/includes/discovery/os/nrg.inc.php +++ b/includes/discovery/os/nrg.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/okilan.inc.php b/includes/discovery/os/okilan.inc.php index 70f396281..3403a2cf6 100644 --- a/includes/discovery/os/okilan.inc.php +++ b/includes/discovery/os/okilan.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/packetshaper.inc.php b/includes/discovery/os/packetshaper.inc.php index 849eae3cb..a36ed88aa 100644 --- a/includes/discovery/os/packetshaper.inc.php +++ b/includes/discovery/os/packetshaper.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/panos.inc.php b/includes/discovery/os/panos.inc.php index b0c9159ca..276b57906 100644 --- a/includes/discovery/os/panos.inc.php +++ b/includes/discovery/os/panos.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/poweralert.inc.php b/includes/discovery/os/poweralert.inc.php index a2fbff009..fd4a4e1bc 100644 --- a/includes/discovery/os/poweralert.inc.php +++ b/includes/discovery/os/poweralert.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/powervault.inc.php b/includes/discovery/os/powervault.inc.php index e2cb5f9c0..730e8f79f 100644 --- a/includes/discovery/os/powervault.inc.php +++ b/includes/discovery/os/powervault.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/powerware.inc.php b/includes/discovery/os/powerware.inc.php index 5d5b7ea6d..8e18f7742 100644 --- a/includes/discovery/os/powerware.inc.php +++ b/includes/discovery/os/powerware.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/prestige.inc.php b/includes/discovery/os/prestige.inc.php index c2240fc2f..c817d6e85 100644 --- a/includes/discovery/os/prestige.inc.php +++ b/includes/discovery/os/prestige.inc.php @@ -1,9 +1,10 @@ \ No newline at end of file diff --git a/includes/discovery/os/redback.inc.php b/includes/discovery/os/redback.inc.php index e53ff830d..4905b1f3d 100644 --- a/includes/discovery/os/redback.inc.php +++ b/includes/discovery/os/redback.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/ricoh.inc.php b/includes/discovery/os/ricoh.inc.php index 419d6dfd3..436ffe55e 100644 --- a/includes/discovery/os/ricoh.inc.php +++ b/includes/discovery/os/ricoh.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/routeros.inc.php b/includes/discovery/os/routeros.inc.php index 7a65b364d..323cc6257 100644 --- a/includes/discovery/os/routeros.inc.php +++ b/includes/discovery/os/routeros.inc.php @@ -1,19 +1,17 @@ = 5 - # sysDescr.0 = STRING: RouterOS RB493AH - if (preg_match("/^RouterOS/", $sysDescr)) { $os = "routeros"; } -} -?> + // Routeros >= 5 + // sysDescr.0 = STRING: RouterOS RB493AH + if (preg_match('/^RouterOS/', $sysDescr)) { + $os = 'routeros'; + } +} diff --git a/includes/discovery/os/sonicwall.inc.php b/includes/discovery/os/sonicwall.inc.php index 3a642f632..42a0f8640 100644 --- a/includes/discovery/os/sonicwall.inc.php +++ b/includes/discovery/os/sonicwall.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/supermicro-switch.inc.php b/includes/discovery/os/supermicro-switch.inc.php index f70783f52..fd8c9a507 100644 --- a/includes/discovery/os/supermicro-switch.inc.php +++ b/includes/discovery/os/supermicro-switch.inc.php @@ -1,10 +1,13 @@ diff --git a/includes/discovery/os/symbol.inc.php b/includes/discovery/os/symbol.inc.php index e90c95a67..cfee2ca17 100644 --- a/includes/discovery/os/symbol.inc.php +++ b/includes/discovery/os/symbol.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/tranzeo.inc.php b/includes/discovery/os/tranzeo.inc.php index 6bd6d8535..55d0d73e3 100644 --- a/includes/discovery/os/tranzeo.inc.php +++ b/includes/discovery/os/tranzeo.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/vrp.inc.php b/includes/discovery/os/vrp.inc.php index 3855fb903..6c49cf862 100644 --- a/includes/discovery/os/vrp.inc.php +++ b/includes/discovery/os/vrp.inc.php @@ -1,11 +1,15 @@ \ No newline at end of file diff --git a/includes/discovery/os/windows.inc.php b/includes/discovery/os/windows.inc.php index 608298e56..671db0740 100644 --- a/includes/discovery/os/windows.inc.php +++ b/includes/discovery/os/windows.inc.php @@ -1,9 +1,11 @@ + if (preg_match('/Windows/', $sysDescr)) { + $os = 'windows'; + } +} diff --git a/includes/discovery/os/wxgoos.inc.php b/includes/discovery/os/wxgoos.inc.php index a8ee4e8e6..551d0e80a 100644 --- a/includes/discovery/os/wxgoos.inc.php +++ b/includes/discovery/os/wxgoos.inc.php @@ -1,12 +1,13 @@ \ No newline at end of file + if (strstr($sysObjectId, '.1.3.6.1.4.1.17373')) { + $os = 'wxgoos'; + } +} diff --git a/includes/discovery/os/xerox.inc.php b/includes/discovery/os/xerox.inc.php index 5fec318c2..f3972ebcd 100644 --- a/includes/discovery/os/xerox.inc.php +++ b/includes/discovery/os/xerox.inc.php @@ -1,9 +1,10 @@ \ No newline at end of file diff --git a/includes/discovery/os/zxr10.inc.php b/includes/discovery/os/zxr10.inc.php index dea79552e..352ed293b 100644 --- a/includes/discovery/os/zxr10.inc.php +++ b/includes/discovery/os/zxr10.inc.php @@ -1,8 +1,7 @@ diff --git a/includes/discovery/os/zywall.inc.php b/includes/discovery/os/zywall.inc.php index 5d46c7df7..0b3b25056 100644 --- a/includes/discovery/os/zywall.inc.php +++ b/includes/discovery/os/zywall.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/zyxeles.inc.php b/includes/discovery/os/zyxeles.inc.php index d539826ac..22b18dc58 100644 --- a/includes/discovery/os/zyxeles.inc.php +++ b/includes/discovery/os/zyxeles.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/os/zyxelnwa.inc.php b/includes/discovery/os/zyxelnwa.inc.php index e483cc1ca..e616b78ac 100644 --- a/includes/discovery/os/zyxelnwa.inc.php +++ b/includes/discovery/os/zyxelnwa.inc.php @@ -1,8 +1,7 @@ \ No newline at end of file diff --git a/includes/discovery/power.inc.php b/includes/discovery/power.inc.php index 838853de2..2161e5ec2 100644 --- a/includes/discovery/power.inc.php +++ b/includes/discovery/power.inc.php @@ -1,16 +1,15 @@ +echo "\n"; diff --git a/includes/discovery/power/ipoman.inc.php b/includes/discovery/power/ipoman.inc.php index acd51cebd..eba11ac4e 100644 --- a/includes/discovery/power/ipoman.inc.php +++ b/includes/discovery/power/ipoman.inc.php @@ -1,56 +1,49 @@ $entry) -# { -# $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.5.' . $index; -# $divisor = 10; -# $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index"); -# $power = $entry['inletStatusWH'] / $divisor; -# -# discover_sensor($valid['sensor'], 'power', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $power); -# // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? -# } -# } - - if (is_array($oids_out)) - { - foreach ($oids_out as $index => $entry) - { - $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.5.' . $index; - $divisor = 10; - $descr = (trim($cache['ipoman']['out'][$index]['outletConfigDesc'],'"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'],'"') : "Output $index"); - $power = $entry['outletStatusWH'] / $divisor; - - discover_sensor($valid['sensor'], 'power', $device, $cur_oid, '2.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $power); + // Inlet Disabled due to the fact thats it's Kwh instead of just Watt + if (!is_array($cache['ipoman'])) { + echo 'outletConfigDesc '; + $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigDesc', $cache['ipoman']['out'], 'IPOMANII-MIB'); + echo 'outletConfigLocation '; + $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigLocation', $cache['ipoman']['out'], 'IPOMANII-MIB'); + // echo("inletConfigDesc "); + // $cache['ipoman']['in'] = snmpwalk_cache_multi_oid($device, "inletConfigDesc", $cache['ipoman'], "IPOMANII-MIB"); } - } -} -?> + // $oids_in = array(); + $oids_out = array(); + + // echo("inletStatusWH "); + // $oids_in = snmpwalk_cache_multi_oid($device, "inletStatusWH", $oids_in, "IPOMANII-MIB"); + echo 'outletStatusWH '; + $oids_out = snmpwalk_cache_multi_oid($device, 'outletStatusWH', $oids_out, 'IPOMANII-MIB'); + + // if (is_array($oids_in)) + // { + // foreach ($oids_in as $index => $entry) + // { + // $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.5.' . $index; + // $divisor = 10; + // $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index"); + // $power = $entry['inletStatusWH'] / $divisor; + // + // discover_sensor($valid['sensor'], 'power', $device, $cur_oid, '1.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $power); + // // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? + // } + // } + if (is_array($oids_out)) { + foreach ($oids_out as $index => $entry) + { + $cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.5.'.$index; + $divisor = 10; + $descr = (trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') != '' ? trim($cache['ipoman']['out'][$index]['outletConfigDesc'], '"') : "Output $index"); + $power = ($entry['outletStatusWH'] / $divisor); + + discover_sensor($valid['sensor'], 'power', $device, $cur_oid, '2.3.1.3.'.$index, 'ipoman', $descr, $divisor, '1', null, null, null, null, $power); + } + } +}//end if diff --git a/includes/discovery/processors/avaya-ers.inc.php b/includes/discovery/processors/avaya-ers.inc.php index 1e1092cf1..b11f76ef4 100644 --- a/includes/discovery/processors/avaya-ers.inc.php +++ b/includes/discovery/processors/avaya-ers.inc.php @@ -1,18 +1,15 @@ $t) { - $t = explode(" ",$t); - $oid = $t[0]; - $val = $t[1]; - discover_processor($valid['processor'], $device, $oid, zeropad($i+1), "avaya-ers", "Unit " . ($i+1) . " processor", "1", $val, $i, NULL); + foreach (explode("\n", $procs) as $i => $t) { + $t = explode(' ', $t); + $oid = $t[0]; + $val = $t[1]; + discover_processor($valid['processor'], $device, $oid, zeropad($i + 1), 'avaya-ers', 'Unit '.($i + 1).' processor', '1', $val, $i, null); + } } - } } - -?> diff --git a/includes/discovery/processors/fortigate.inc.php b/includes/discovery/processors/fortigate.inc.php index 22ea6a516..d7c6060ab 100644 --- a/includes/discovery/processors/fortigate.inc.php +++ b/includes/discovery/processors/fortigate.inc.php @@ -1,23 +1,18 @@ +unset($processors_array); diff --git a/includes/discovery/processors/netscaler.inc.php b/includes/discovery/processors/netscaler.inc.php index a96ba62d8..0e08938f3 100644 --- a/includes/discovery/processors/netscaler.inc.php +++ b/includes/discovery/processors/netscaler.inc.php @@ -1,36 +1,27 @@ $data) { + $current = $data['nsCPUusage']; - foreach ($nsarray as $descr => $data) - { + $oid = '.1.3.6.1.4.1.5951.4.1.1.41.6.1.2.'.string_to_oid($descr); + $descr = $data['nsCPUname']; - $current = $data['nsCPUusage']; + discover_processor($valid['processor'], $device, $oid, $descr, 'netscaler', $descr, '1', $current, null, null); + } - $oid = ".1.3.6.1.4.1.5951.4.1.1.41.6.1.2." . string_to_oid($descr); - $descr = $data['nsCPUname']; - - discover_processor($valid['processor'], $device, $oid, $descr, "netscaler", $descr, "1", $current, NULL, NULL); - - } - - unset($nsarray, $oid, $descr, $current); - -} - -?> + unset($nsarray, $oid, $descr, $current); +}//end if diff --git a/includes/discovery/processors/radlan.inc.php b/includes/discovery/processors/radlan.inc.php index a5115b2b9..5032576e3 100644 --- a/includes/discovery/processors/radlan.inc.php +++ b/includes/discovery/processors/radlan.inc.php @@ -1,22 +1,17 @@ +unset($processors_array); diff --git a/includes/discovery/processors/vrp.inc.php b/includes/discovery/processors/vrp.inc.php index 68b95307e..e4e583904 100644 --- a/includes/discovery/processors/vrp.inc.php +++ b/includes/discovery/processors/vrp.inc.php @@ -1,33 +1,32 @@ $entry) - { - if ($entry['hwEntityMemSize'] != 0) - { - if ($debug) { echo($index . " " . $entry['hwEntityBomEnDesc'] . " -> " . $entry['hwEntityCpuUsage'] . " -> " . $entry['hwEntityMemSize']. "\n"); } - $usage_oid = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.5." . $index; - $descr = $entry['hwEntityBomEnDesc']; - $usage = $entry['hwEntityCpuUsage']; - if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) + if (is_array($processors_array)) { + foreach ($processors_array as $index => $entry) { - discover_processor($valid['processor'], $device, $usage_oid, $index, "vrp", $descr, "1", $usage, NULL, NULL); - } - } // End if checks - } // End Foreach - } // End if array -} // End VRP Processors + if ($entry['hwEntityMemSize'] != 0) { + if ($debug) { + echo $index.' '.$entry['hwEntityBomEnDesc'].' -> '.$entry['hwEntityCpuUsage'].' -> '.$entry['hwEntityMemSize']."\n"; + } -unset ($processors_array); + $usage_oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.1.1.5.'.$index; + $descr = $entry['hwEntityBomEnDesc']; + $usage = $entry['hwEntityCpuUsage']; + if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') { + discover_processor($valid['processor'], $device, $usage_oid, $index, 'vrp', $descr, '1', $usage, null, null); + } + } //end if + } //end foreach + } //end if +} //end if -?> +unset($processors_array); diff --git a/includes/discovery/processors/watchguard.inc.php b/includes/discovery/processors/watchguard.inc.php index aba03cc61..65d1c1b61 100644 --- a/includes/discovery/processors/watchguard.inc.php +++ b/includes/discovery/processors/watchguard.inc.php @@ -1,23 +1,18 @@ +unset($processors_array); diff --git a/includes/discovery/sensors-netscaler.inc.php b/includes/discovery/sensors-netscaler.inc.php index c7705b250..8470bb2a9 100644 --- a/includes/discovery/sensors-netscaler.inc.php +++ b/includes/discovery/sensors-netscaler.inc.php @@ -1,34 +1,48 @@ $data) -{ +foreach ($ns_sensor_array as $descr => $data) { + $current = $data['sysHealthCounterValue']; - $current = $data['sysHealthCounterValue']; + $oid = '.1.3.6.1.4.1.5951.4.1.1.41.7.1.2.'.string_to_oid($descr); - $oid = ".1.3.6.1.4.1.5951.4.1.1.41.7.1.2." . string_to_oid($descr); + if (strpos($descr, 'Temp') !== false) { + $divisor = 0; + $multiplier = 0; + $type = 'temperature'; + } + else if (strpos($descr, 'Fan') !== false) { + $divisor = 0; + $multiplier = 0; + $type = 'fanspeed'; + } + else if (strpos($descr, 'Volt') !== false) { + $divisor = 1000; + $multiplier = 0; + $type = 'voltage'; + } + else if (strpos($descr, 'Vtt') !== false) { + $divisor = 1000; + $multiplier = 0; + $type = 'voltage'; + } - if (strpos($descr, "Temp") !== FALSE) { $divisor = 0; $multiplier = 0; $type = "temperature"; } - elseif (strpos($descr, "Fan") !== FALSE) { $divisor = 0; $multiplier = 0; $type = "fanspeed"; } - elseif (strpos($descr, "Volt") !== FALSE) { $divisor = 1000; $multiplier = 0; $type = "voltage"; } - elseif (strpos($descr, "Vtt") !== FALSE) { $divisor = 1000; $multiplier = 0; $type = "voltage"; } - - if ($divisor) { $current = $current / $divisor; }; - - discover_sensor($valid['sensor'], $type, $device, $oid, $descr, 'netscaler-health', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current); + if ($divisor) { + $current = ($current / $divisor); + }; + discover_sensor($valid['sensor'], $type, $device, + $oid, $descr, 'netscaler-health', + $descr, $divisor, $multiplier, null, null, null, null, $current); } unset($ns_sensor_array); - -?> diff --git a/includes/discovery/services.inc.php b/includes/discovery/services.inc.php index a9d41bf81..3f3e3c988 100644 --- a/includes/discovery/services.inc.php +++ b/includes/discovery/services.inc.php @@ -1,37 +1,35 @@ "ssh", 25 => "smtp", 53 => "dns", 80 => "http", - 110 => "pop", 143 => "imap"); + // FIXME: use /etc/services? + $known_services = array( + 22 => 'ssh', + 25 => 'smtp', + 53 => 'dns', + 80 => 'http', + 110 => 'pop', + 143 => 'imap', + ); - # Services - if ($device['type'] == "server") - { - $oids = trim(snmp_walk($device, ".1.3.6.1.2.1.6.13.1.1.0.0.0.0", "-Osqn")); - foreach (explode("\n", $oids) as $data) - { - $data = trim($data); - if ($data) - { - list($oid, $tcpstatus) = explode(" ", $data); - if (trim($tcpstatus) == "listen") - { - $split_oid = explode('.',$oid); - $tcp_port = $split_oid[count($split_oid)-6]; - if ($known_services[$tcp_port]) - { - discover_service($device,$known_services[$tcp_port]); - } + // Services + if ($device['type'] == 'server') { + $oids = trim(snmp_walk($device, '.1.3.6.1.2.1.6.13.1.1.0.0.0.0', '-Osqn')); + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid, $tcpstatus) = explode(' ', $data); + if (trim($tcpstatus) == 'listen') { + $split_oid = explode('.', $oid); + $tcp_port = $split_oid[(count($split_oid) - 6)]; + if ($known_services[$tcp_port]) { + discover_service($device, $known_services[$tcp_port]); + } + } + } } - } } - } # End Services - echo("\n"); + echo "\n"; } - -?> \ No newline at end of file diff --git a/includes/discovery/temperatures/akcp.inc.php b/includes/discovery/temperatures/akcp.inc.php index e2c8c9b15..76602e418 100644 --- a/includes/discovery/temperatures/akcp.inc.php +++ b/includes/discovery/temperatures/akcp.inc.php @@ -1,39 +1,40 @@ + $oids = trim($oids); + if ($oids) { + echo 'AKCP '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$status) = explode(' ', $data, 2); + if ($status == 2) { + // 2 = normal, 0 = not connected + $split_oid = explode('.', $oid); + $temperature_id = $split_oid[(count($split_oid) - 1)]; + $descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.1.$temperature_id"; + $temperature_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.3.$temperature_id"; + $warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.7.$temperature_id"; + $limit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.8.$temperature_id"; + $lowwarnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.9.$temperature_id"; + $lowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.10.$temperature_id"; + + $descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"'); + $temperature = snmp_get($device, $temperature_oid, '-Oqv', ''); + $lowwarnlimit = snmp_get($device, $lowwarnlimit_oid, '-Oqv', ''); + $warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', ''); + $limit = snmp_get($device, $limit_oid, '-Oqv', ''); + $lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', ''); + + discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'akcp', $descr, '1', '1', $lowlimit, $low_warn_limit, $warnlimit, $limit, $temperature); + } + } + } +} diff --git a/includes/discovery/temperatures/aos-device.inc.php b/includes/discovery/temperatures/aos-device.inc.php index 1ffc52078..b386c0823 100644 --- a/includes/discovery/temperatures/aos-device.inc.php +++ b/includes/discovery/temperatures/aos-device.inc.php @@ -1,17 +1,15 @@ "0") - { - $temperature_oid = ".1.3.6.1.4.1.18248.1.1.1.0"; - discover_sensor($valid['sensor'], 'temperature', $device, ".1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.17.0", "1", 'alcatel-device', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature); - } + if ($descr != '' && is_numeric($temperature) && $temperature > '0') { + $temperature_oid = '.1.3.6.1.4.1.18248.1.1.1.0'; + discover_sensor($valid['sensor'], 'temperature', $device, + '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.17.0', '1', 'alcatel-device', + $descr, '1', '1', null, null, null, null, $temperature); + } } - -?> diff --git a/includes/discovery/temperatures/areca.inc.php b/includes/discovery/temperatures/areca.inc.php index ac25df88f..beffb9dd4 100644 --- a/includes/discovery/temperatures/areca.inc.php +++ b/includes/discovery/temperatures/areca.inc.php @@ -1,48 +1,56 @@ diff --git a/includes/discovery/temperatures/avaya-ers.inc.php b/includes/discovery/temperatures/avaya-ers.inc.php index 2d4e7bd63..9e066f01d 100644 --- a/includes/discovery/temperatures/avaya-ers.inc.php +++ b/includes/discovery/temperatures/avaya-ers.inc.php @@ -1,25 +1,24 @@ = 6.1) { - $temps = snmp_walk($device, "1.3.6.1.4.1.45.1.6.3.7.1.1.5.5", "-Osqn"); + // Temperature info only known to be present in firmware 6.1 or higher + if ($fw_major_version >= 6.1) { + $temps = snmp_walk($device, '1.3.6.1.4.1.45.1.6.3.7.1.1.5.5', '-Osqn'); - foreach (explode("\n", $temps) as $i => $t) { - $t = explode(" ",$t); - $oid = $t[0]; - $val = $t[1]; - # Sensors are reported as 2 * value - $val = trim($val) / 2; - discover_sensor($valid['sensor'], 'temperature', $device, $oid, zeropad($i+1), 'avaya-ers', "Unit " . ($i+1) . " temperature", '2', '1', NULL, NULL, NULL, NULL, $val); + foreach (explode("\n", $temps) as $i => $t) { + $t = explode(' ', $t); + $oid = $t[0]; + $val = $t[1]; + // Sensors are reported as 2 * value + $val = (trim($val) / 2); + discover_sensor($valid['sensor'], 'temperature', $device, + $oid, zeropad($i + 1), 'avaya-ers', + 'Unit '.($i + 1).' temperature', '2', '1', null, null, null, null, $val); + } } - } } - -?> diff --git a/includes/discovery/temperatures/cometsystem-p85xx.inc.php b/includes/discovery/temperatures/cometsystem-p85xx.inc.php index e9a82cc6f..cefae39dd 100644 --- a/includes/discovery/temperatures/cometsystem-p85xx.inc.php +++ b/includes/discovery/temperatures/cometsystem-p85xx.inc.php @@ -1,8 +1,7 @@ \d+) \. @@ -14,50 +13,43 @@ if ($device['os'] == "cometsystem-p85xx") ) /x'; - $oids = snmp_walk($device, ".1.3.6.1.4.1.22626.1.5.2", "-OsqnU", ""); - #if ($debug) { echo($oids."\n"); } - if ($oids) - { - $out = array(); - foreach (explode("\n", $oids) as $line) - { - preg_match($regexp, $line, $match); - if ($match['name']) - { - $out[$match['id']]['name'] = $match['name']; - } + $oids = snmp_walk($device, '.1.3.6.1.4.1.22626.1.5.2', '-OsqnU', ''); + // if ($debug) { echo($oids."\n"); } + if ($oids) { + $out = array(); + foreach (explode("\n", $oids) as $line) + { + preg_match($regexp, $line, $match); + if ($match['name']) { + $out[$match['id']]['name'] = $match['name']; + } - if ($match['temp_intval']) - { - $out[$match['id']]['temp_intval'] = $match['temp_intval']; - } + if ($match['temp_intval']) { + $out[$match['id']]['temp_intval'] = $match['temp_intval']; + } - if ($match['limit_high']) - { - $out[$match['id']]['limit_high'] = $match['limit_high']; - } + if ($match['limit_high']) { + $out[$match['id']]['limit_high'] = $match['limit_high']; + } - if ($match['limit_low']) - { - $out[$match['id']]['limit_low'] = $match['limit_low']; - } + if ($match['limit_low']) { + $out[$match['id']]['limit_low'] = $match['limit_low']; + } + } + + foreach ($out as $sensor_id => $sensor) { + if ($sensor['temp_intval'] != 9999) { + $temperature_oid = '.1.3.6.1.4.1.22626.1.5.2.'.$sensor_id.'.3.0'; + $temperature_id = $sensor_id; + $descr = trim($sensor['name'], ' "'); + $lowlimit = trim($sensor['limit_low'], ' "'); + $limit = trim($sensor['limit_high'], ' "'); + $temperature = $sensor['temp_intval']; + + discover_sensor($valid['sensor'], 'temperature', $device, + $temperature_oid, $temperature_id, 'cometsystem-p85xx', + $descr, '10', '1', $lowlimit, null, null, $limit, $temperature); + } + } } - - foreach ($out as $sensor_id=>$sensor) - { - if ($sensor['temp_intval'] != 9999) - { - $temperature_oid = '.1.3.6.1.4.1.22626.1.5.2.' . $sensor_id . '.3.0'; - $temperature_id = $sensor_id; - $descr = trim($sensor['name'], ' "'); - $lowlimit = trim($sensor['limit_low'], ' "'); - $limit = trim($sensor['limit_high'], ' "'); - $temperature = $sensor['temp_intval']; - - discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'cometsystem-p85xx', $descr, '10', '1', $lowlimit, NULL, NULL, $limit, $temperature); - } - } - } } - -?> diff --git a/includes/discovery/temperatures/dell.inc.php b/includes/discovery/temperatures/dell.inc.php index af93f3dee..73544ce6a 100644 --- a/includes/discovery/temperatures/dell.inc.php +++ b/includes/discovery/temperatures/dell.inc.php @@ -1,67 +1,69 @@ - * @copyright (C) 2006 - 2012 Adam Armstrong - * + * @author Squiz Pty Ltd + * @copyright 2015 Squiz Pty Ltd (ABN 77 084 670 600) */ -# MIB-Dell-10892::temperatureProbechassisIndex.1.1 = INTEGER: 1 -# MIB-Dell-10892::temperatureProbeIndex.1.1 = INTEGER: 1 -# MIB-Dell-10892::temperatureProbeStateCapabilities.1.1 = INTEGER: 0 -# MIB-Dell-10892::temperatureProbeStateSettings.1.1 = INTEGER: enabled(2) -# MIB-Dell-10892::temperatureProbeStatus.1.1 = INTEGER: ok(3) -# MIB-Dell-10892::temperatureProbeReading.1.1 = INTEGER: 320 -# MIB-Dell-10892::temperatureProbeType.1.1 = INTEGER: temperatureProbeTypeIsAmbientESM(3) -# MIB-Dell-10892::temperatureProbeLocationName.1.1 = STRING: "BMC Planar Temp" -# MIB-Dell-10892::temperatureProbeUpperCriticalThreshold.1.1 = INTEGER: 530 -# MIB-Dell-10892::temperatureProbeUpperNonCriticalThreshold.1.1 = INTEGER: 480 -# MIB-Dell-10892::temperatureProbeLowerNonCriticalThreshold.1.1 = INTEGER: 70 -# MIB-Dell-10892::temperatureProbeLowerCriticalThreshold.1.1 = INTEGER: 30 -# MIB-Dell-10892::temperatureProbeProbeCapabilities.1.1 = INTEGER: 0 - -if (strstr($device['hardware'], "Dell")) -{ - // stuff partially copied from akcp sensor - $oids = snmp_walk($device, "temperatureProbeStatus", "-Osqn", "MIB-Dell-10892"); - if ($debug) { echo($oids."\n"); } - $oids = trim($oids); - if ($oids) echo("Dell OMSA "); - foreach (explode("\n", $oids) as $data) - { - $data = trim($data); - if ($data) - { - list($oid,$status) = explode(" ", $data, 2); - if ($debug) { echo("status : ".$status."\n"); } - if ($status == "ok") # 2 = normal, 0 = not connected - { - $split_oid = explode('.',$oid); - $temperature_id = $split_oid[count($split_oid)-2].".".$split_oid[count($split_oid)-1]; - $descr_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.8.$temperature_id"; - $temperature_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.6.$temperature_id"; - $limit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.10.$temperature_id"; - $warnlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.11.$temperature_id"; - $lowwarnlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.12.$temperature_id"; - $lowlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.13.$temperature_id"; - - $descr = trim(snmp_get($device, $descr_oid, "-Oqv", "MIB-Dell-10892"),'"'); - $temperature = snmp_get($device, $temperature_oid, "-Oqv", "MIB-Dell-10892"); - $lowwarnlimit = snmp_get($device, $lowwarnlimit_oid, "-Oqv", "MIB-Dell-10892"); - $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", "MIB-Dell-10892"); - $limit = snmp_get($device, $limit_oid, "-Oqv", "MIB-Dell-10892"); - $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "MIB-Dell-10892"); - - discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'dell', $descr, '10', '1', $lowlimit/10, $low_warn_limit/10, $warnlimit/10, $limit/10, $temperature/10); - } +// MIB-Dell-10892::temperatureProbechassisIndex.1.1 = INTEGER: 1 +// MIB-Dell-10892::temperatureProbeIndex.1.1 = INTEGER: 1 +// MIB-Dell-10892::temperatureProbeStateCapabilities.1.1 = INTEGER: 0 +// MIB-Dell-10892::temperatureProbeStateSettings.1.1 = INTEGER: enabled(2) +// MIB-Dell-10892::temperatureProbeStatus.1.1 = INTEGER: ok(3) +// MIB-Dell-10892::temperatureProbeReading.1.1 = INTEGER: 320 +// MIB-Dell-10892::temperatureProbeType.1.1 = INTEGER: temperatureProbeTypeIsAmbientESM(3) +// MIB-Dell-10892::temperatureProbeLocationName.1.1 = STRING: "BMC Planar Temp" +// MIB-Dell-10892::temperatureProbeUpperCriticalThreshold.1.1 = INTEGER: 530 +// MIB-Dell-10892::temperatureProbeUpperNonCriticalThreshold.1.1 = INTEGER: 480 +// MIB-Dell-10892::temperatureProbeLowerNonCriticalThreshold.1.1 = INTEGER: 70 +// MIB-Dell-10892::temperatureProbeLowerCriticalThreshold.1.1 = INTEGER: 30 +// MIB-Dell-10892::temperatureProbeProbeCapabilities.1.1 = INTEGER: 0 +if (strstr($device['hardware'], 'Dell')) { + // stuff partially copied from akcp sensor + $oids = snmp_walk($device, 'temperatureProbeStatus', '-Osqn', 'MIB-Dell-10892'); + if ($debug) { + echo $oids."\n"; } - } -} -?> + $oids = trim($oids); + if ($oids) { + echo 'Dell OMSA '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$status) = explode(' ', $data, 2); + if ($debug) { + echo 'status : '.$status."\n"; + } + + if ($status == 'ok') { + // 2 = normal, 0 = not connected + $split_oid = explode('.', $oid); + $temperature_id = $split_oid[(count($split_oid) - 2)].'.'.$split_oid[(count($split_oid) - 1)]; + $descr_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.8.$temperature_id"; + $temperature_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.6.$temperature_id"; + $limit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.10.$temperature_id"; + $warnlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.11.$temperature_id"; + $lowwarnlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.12.$temperature_id"; + $lowlimit_oid = ".1.3.6.1.4.1.674.10892.1.700.20.1.13.$temperature_id"; + + $descr = trim(snmp_get($device, $descr_oid, '-Oqv', 'MIB-Dell-10892'), '"'); + $temperature = snmp_get($device, $temperature_oid, '-Oqv', 'MIB-Dell-10892'); + $lowwarnlimit = snmp_get($device, $lowwarnlimit_oid, '-Oqv', 'MIB-Dell-10892'); + $warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', 'MIB-Dell-10892'); + $limit = snmp_get($device, $limit_oid, '-Oqv', 'MIB-Dell-10892'); + $lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', 'MIB-Dell-10892'); + + discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'dell', $descr, '10', '1', ($lowlimit / 10), ($low_warn_limit / 10), ($warnlimit / 10), ($limit / 10), ($temperature / 10)); + } + }//end if + }//end foreach +}//end if diff --git a/includes/discovery/temperatures/ftos-c-series.inc.php b/includes/discovery/temperatures/ftos-c-series.inc.php index 045675dc3..bc4af9dc5 100644 --- a/includes/discovery/temperatures/ftos-c-series.inc.php +++ b/includes/discovery/temperatures/ftos-c-series.inc.php @@ -1,26 +1,20 @@ $entry) - { - $entry['descr'] = "Slot ".$index; - $entry['oid'] = ".1.3.6.1.4.1.6027.3.8.1.2.1.1.5.".$index; - $entry['current'] = $entry['chSysCardTemp']; - discover_sensor($valid['sensor'], 'temperature', $device, $entry['oid'], $index, 'ftos-cseries', $entry['descr'], '1', '1', NULL, NULL, NULL, NULL, $entry['current']); +// F10-C-SERIES-CHASSIS-MIB::chSysCardType.1 = INTEGER: lc4802E48TB(1024) +// F10-C-SERIES-CHASSIS-MIB::chSysCardType.2 = INTEGER: lc0810EX8PB(2049) +// F10-C-SERIES-CHASSIS-MIB::chSysCardTemp.1 = Gauge32: 25 +// F10-C-SERIES-CHASSIS-MIB::chSysCardTemp.2 = Gauge32: 26 +if ($device['os'] == 'ftos' || $device['os_group'] == 'ftos') { + echo 'FTOS C-Series '; + $oids = snmpwalk_cache_oid($device, 'chSysCardTemp', array(), 'F10-C-SERIES-CHASSIS-MIB', $config['mib_dir'].':'.$config['mib_dir'].'/ftos'); + if (is_array($oids)) { + foreach ($oids as $index => $entry) + { + $entry['descr'] = 'Slot '.$index; + $entry['oid'] = '.1.3.6.1.4.1.6027.3.8.1.2.1.1.5.'.$index; + $entry['current'] = $entry['chSysCardTemp']; + discover_sensor($valid['sensor'], 'temperature', $device, $entry['oid'], $index, 'ftos-cseries', $entry['descr'], '1', '1', null, null, null, null, $entry['current']); + } } - } } - -?> diff --git a/includes/discovery/temperatures/ftos-e-series.inc.php b/includes/discovery/temperatures/ftos-e-series.inc.php index c06afc46d..62df5f73a 100644 --- a/includes/discovery/temperatures/ftos-e-series.inc.php +++ b/includes/discovery/temperatures/ftos-e-series.inc.php @@ -1,31 +1,25 @@ $entry) + { + $descr = 'Slot '.$index; + $oid = '.1.3.6.1.4.1.6027.3.1.1.2.3.1.8.'.$index; + $current = $entry['chSysCardUpperTemp']; - $oids = snmpwalk_cache_oid($device, "chSysCardUpperTemp", array(), "F10-CHASSIS-MIB", $config['mib_dir'].":".$config['mib_dir']."/ftos" ); - - if (is_array($oids)) - { - foreach ($oids as $index => $entry) - { - $descr = "Slot ".$index; - $oid = ".1.3.6.1.4.1.6027.3.1.1.2.3.1.8.".$index; - $current = $entry['chSysCardUpperTemp']; - - discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'ftos-eseries', $descr, '1', '1', NULL, NULL, NULL, NULL, $current); + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'ftos-eseries', $descr, '1', '1', null, null, null, null, $current); + } } - } } - -?> diff --git a/includes/discovery/temperatures/ftos-s-series.inc.php b/includes/discovery/temperatures/ftos-s-series.inc.php index 09b043ad9..e16472c08 100644 --- a/includes/discovery/temperatures/ftos-s-series.inc.php +++ b/includes/discovery/temperatures/ftos-s-series.inc.php @@ -1,27 +1,21 @@ $entry) - { - $descr = "Unit ".$index . " " . $entry['chStackUnitSysType']; - $oid = ".1.3.6.1.4.1.6027.3.10.1.2.2.1.14.".$index; - $current = $entry['chStackUnitTemp']; - discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'ftos-sseries', $descr, '1', '1', NULL, NULL, NULL, NULL, $current); + if (is_array($oids)) { + foreach ($oids as $index => $entry) + { + $descr = 'Unit '.$index.' '.$entry['chStackUnitSysType']; + $oid = '.1.3.6.1.4.1.6027.3.10.1.2.2.1.14.'.$index; + $current = $entry['chStackUnitTemp']; + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'ftos-sseries', $descr, '1', '1', null, null, null, null, $current); + } } - } } - -?> diff --git a/includes/discovery/temperatures/ipoman.inc.php b/includes/discovery/temperatures/ipoman.inc.php index 793297005..1de3afad0 100644 --- a/includes/discovery/temperatures/ipoman.inc.php +++ b/includes/discovery/temperatures/ipoman.inc.php @@ -2,27 +2,21 @@ // FIXME: EMD "stack" support? // FIXME: What to do with IPOMANII-MIB::ipmEnvEmdConfigTempOffset.0 ? +if ($device['os'] == 'ipoman') { + echo ' IPOMANII-MIB '; + $emd_installed = snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdStatusEmdType.0', ' -Oqv'); -if ($device['os'] == "ipoman") -{ - echo(" IPOMANII-MIB "); - $emd_installed = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdStatusEmdType.0"," -Oqv"); + if ($emd_installed != 'disabled') { + $descr = snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdConfigTempName.0', '-Oqv'); + $current = (snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdStatusTemperature.0', '-Oqv') / 10); + $high_limit = snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdConfigTempHighSetPoint.0', '-Oqv'); + $low_limit = snmp_get($device, 'IPOMANII-MIB::ipmEnvEmdConfigTempLowSetPoint.0', '-Oqv'); - if ($emd_installed != 'disabled') - { - $descr = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigTempName.0", "-Oqv"); - $current = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdStatusTemperature.0", "-Oqv") / 10; - $high_limit = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigTempHighSetPoint.0", "-Oqv"); - $low_limit = snmp_get($device, "IPOMANII-MIB::ipmEnvEmdConfigTempLowSetPoint.0", "-Oqv"); + if ($descr != '' && is_numeric($current) && $current > '0') { + $current_oid = '.1.3.6.1.4.1.2468.1.4.2.1.5.1.1.2.0'; + $descr = trim(str_replace('"', '', $descr)); - if ($descr != "" && is_numeric($current) && $current > "0") - { - $current_oid = ".1.3.6.1.4.1.2468.1.4.2.1.5.1.1.2.0"; - $descr = trim(str_replace("\"", "", $descr)); - - discover_sensor($valid['sensor'], 'temperature', $device, $current_oid, "1", 'ipoman', $descr, '10', '1', $low_limit, NULL, NULL, $high_limit, $current); + discover_sensor($valid['sensor'], 'temperature', $device, $current_oid, '1', 'ipoman', $descr, '10', '1', $low_limit, null, null, $high_limit, $current); + } } - } } - -?> diff --git a/includes/discovery/temperatures/ironware.inc.php b/includes/discovery/temperatures/ironware.inc.php index 591453bd1..ffc03f9c6 100644 --- a/includes/discovery/temperatures/ironware.inc.php +++ b/includes/discovery/temperatures/ironware.inc.php @@ -1,39 +1,35 @@ diff --git a/includes/discovery/temperatures/junos.inc.php b/includes/discovery/temperatures/junos.inc.php index 04987509c..3f0a87943 100644 --- a/includes/discovery/temperatures/junos.inc.php +++ b/includes/discovery/temperatures/junos.inc.php @@ -1,33 +1,29 @@ diff --git a/includes/discovery/temperatures/junose.inc.php b/includes/discovery/temperatures/junose.inc.php index 96eb310fd..63e4cdb05 100644 --- a/includes/discovery/temperatures/junose.inc.php +++ b/includes/discovery/temperatures/junose.inc.php @@ -1,28 +1,23 @@ $entry) + { + if (is_numeric($entry['juniSystemTempValue']) && is_numeric($index) && $entry['juniSystemTempValue'] > '0') { + $entPhysicalIndex = snmp_get($device, 'juniSystemTempPhysicalIndex.'.$index, '-Oqv', 'Juniper-System-MIB', '+'.$config['install_dir'].'/mibs/junose'); + $descr = snmp_get($device, 'entPhysicalDescr.'.$entPhysicalIndex, '-Oqv', 'ENTITY-MIB'); + $descr = preg_replace('/^Juniper\ [0-9a-zA-Z\-]+/', '', $descr); + // Wipe out ugly Juniper crap. Why put vendor and model in here? Idiots! + $descr = str_replace('temperature sensor on', '', trim($descr)); + $oid = '.1.3.6.1.4.1.4874.2.2.2.1.9.4.1.3.'.$index; + $current = $entry['juniSystemTempValue']; -if ($device['os'] == "junose") -{ - echo("JunOSe: "); - $oids = snmpwalk_cache_multi_oid($device, "juniSystemTempValue", array(), "Juniper-System-MIB", $config['install_dir']."/mibs/junose"); - if (is_array($oids)) - { - foreach ($oids as $index => $entry) - { - if (is_numeric($entry['juniSystemTempValue']) && is_numeric($index) && $entry['juniSystemTempValue'] > "0") - { - $entPhysicalIndex = snmp_get($device, "juniSystemTempPhysicalIndex.".$index, "-Oqv", "Juniper-System-MIB", "+".$config['install_dir']."/mibs/junose"); - $descr = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB"); - $descr = preg_replace("/^Juniper\ [0-9a-zA-Z\-]+/", "", $descr); // Wipe out ugly Juniper crap. Why put vendor and model in here? Idiots! - $descr = str_replace("temperature sensor on", "", trim($descr)); - $oid = ".1.3.6.1.4.1.4874.2.2.2.1.9.4.1.3.".$index; - $current = $entry['juniSystemTempValue']; - - discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'junose', $descr, '1', '1', NULL, NULL, NULL, NULL, $current); - } + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'junose', $descr, '1', '1', null, null, null, null, $current); + } + } } - } -} - -?> +}//end if diff --git a/includes/discovery/temperatures/lm-sensors.inc.php b/includes/discovery/temperatures/lm-sensors.inc.php index cb4357780..1df73f023 100644 --- a/includes/discovery/temperatures/lm-sensors.inc.php +++ b/includes/discovery/temperatures/lm-sensors.inc.php @@ -1,30 +1,32 @@ + $oids = trim($oids); + if ($oids) { + echo 'LM-SENSORS-MIB: '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $temperature_id = $split_oid[(count($split_oid) - 1)]; + $temperature_oid = "1.3.6.1.4.1.2021.13.16.2.1.3.$temperature_id"; + $temperature = (snmp_get($device, $temperature_oid, '-Ovq') / 1000); + $descr = str_ireplace('temperature-', '', $descr); + $descr = str_ireplace('temp-', '', $descr); + $descr = trim($descr); + if ($temperature != '0' && $temperature <= '1000') { + discover_sensor($valid['sensor'], 'temperature', $device, + $temperature_oid, $temperature_id, 'lmsensors', + $descr, '1000', '1', null, null, null, null, $temperature); + } + } + } +} diff --git a/includes/discovery/temperatures/mgeups.inc.php b/includes/discovery/temperatures/mgeups.inc.php index 1c8045738..4b2ff3a32 100644 --- a/includes/discovery/temperatures/mgeups.inc.php +++ b/includes/discovery/temperatures/mgeups.inc.php @@ -2,63 +2,61 @@ global $debug; -if ($device['os'] == "mgeups") -{ - # blatently copyied from APC +if ($device['os'] == 'mgeups') { + // blatently copyied from APC + echo 'MGE UPS External '; - echo("MGE UPS External "); + // Environmental monitoring on UPSes etc + // FIXME upsmgConfigEnvironmentTable and upsmgEnvironmentSensorTable are used but there are others ... + $mge_env_data = snmpwalk_cache_oid($device, 'upsmgConfigEnvironmentTable', array(), 'MG-SNMP-UPS-MIB'); + $mge_env_data = snmpwalk_cache_oid($device, 'upsmgEnvironmentSensorTable', $mge_env_data, 'MG-SNMP-UPS-MIB'); - # Environmental monitoring on UPSes etc - // FIXME upsmgConfigEnvironmentTable and upsmgEnvironmentSensorTable are used but there are others ... - $mge_env_data = snmpwalk_cache_oid($device, "upsmgConfigEnvironmentTable", array(), "MG-SNMP-UPS-MIB"); - $mge_env_data = snmpwalk_cache_oid($device, "upsmgEnvironmentSensorTable", $mge_env_data, "MG-SNMP-UPS-MIB"); + /* + upsmgConfigSensorIndex.1 = 1 + upsmgConfigSensorName.1 = "Environment sensor" + upsmgConfigTemperatureLow.1 = 5 + upsmgConfigTemperatureHigh.1 = 40 + upsmgConfigTemperatureHysteresis.1 = 2 + upsmgConfigHumidityLow.1 = 5 + upsmgConfigHumidityHigh.1 = 90 + upsmgConfigHumidityHysteresis.1 = 5 + upsmgConfigInput1Name.1 = "Input #1" + upsmgConfigInput1ClosedLabel.1 = "closed" + upsmgConfigInput1OpenLabel.1 = "open" + upsmgConfigInput2Name.1 = "Input #2" + upsmgConfigInput2ClosedLabel.1 = "closed" + upsmgConfigInput2OpenLabel.1 = "open" -/* -upsmgConfigSensorIndex.1 = 1 -upsmgConfigSensorName.1 = "Environment sensor" -upsmgConfigTemperatureLow.1 = 5 -upsmgConfigTemperatureHigh.1 = 40 -upsmgConfigTemperatureHysteresis.1 = 2 -upsmgConfigHumidityLow.1 = 5 -upsmgConfigHumidityHigh.1 = 90 -upsmgConfigHumidityHysteresis.1 = 5 -upsmgConfigInput1Name.1 = "Input #1" -upsmgConfigInput1ClosedLabel.1 = "closed" -upsmgConfigInput1OpenLabel.1 = "open" -upsmgConfigInput2Name.1 = "Input #2" -upsmgConfigInput2ClosedLabel.1 = "closed" -upsmgConfigInput2OpenLabel.1 = "open" + upsmgEnvironmentIndex.1 = 1 + upsmgEnvironmentComFailure.1 = no + upsmgEnvironmentTemperature.1 = 287 + upsmgEnvironmentTemperatureLow.1 = no + upsmgEnvironmentTemperatureHigh.1 = no + upsmgEnvironmentHumidity.1 = 17 + upsmgEnvironmentHumidityLow.1 = no + upsmgEnvironmentHumidityHigh.1 = no + upsmgEnvironmentInput1State.1 = open + upsmgEnvironmentInput2State.1 = open + */ -upsmgEnvironmentIndex.1 = 1 -upsmgEnvironmentComFailure.1 = no -upsmgEnvironmentTemperature.1 = 287 -upsmgEnvironmentTemperatureLow.1 = no -upsmgEnvironmentTemperatureHigh.1 = no -upsmgEnvironmentHumidity.1 = 17 -upsmgEnvironmentHumidityLow.1 = no -upsmgEnvironmentHumidityHigh.1 = no -upsmgEnvironmentInput1State.1 = open -upsmgEnvironmentInput2State.1 = open -*/ + foreach (array_keys($mge_env_data) as $index) + { + $descr = $mge_env_data[$index]['upsmgConfigSensorName']; + $current = $mge_env_data[$index]['upsmgEnvironmentTemperature']; + $sensorType = 'mge'; + $oid = '.1.3.6.1.4.1.705.1.8.7.1.3.'.$index; + $low_limit = $mge_env_data[$index]['upsmgConfigTemperatureLow']; + $high_limit = $mge_env_data[$index]['upsmgConfigTemperatureHigh']; + $hysteresis = $mge_env_data[$index]['upsmgConfigTemperatureHysteresis']; - foreach (array_keys($mge_env_data) as $index) - { - $descr = $mge_env_data[$index]['upsmgConfigSensorName']; - $current = $mge_env_data[$index]['upsmgEnvironmentTemperature']; - $sensorType = 'mge'; - $oid = '.1.3.6.1.4.1.705.1.8.7.1.3.' . $index; - $low_limit = $mge_env_data[$index]['upsmgConfigTemperatureLow']; - $high_limit = $mge_env_data[$index]['upsmgConfigTemperatureHigh']; - $hysteresis = $mge_env_data[$index]['upsmgConfigTemperatureHysteresis']; + // FIXME warninglevels might need some other calculation in stead of hysteresis + $low_warn_limit = ($low_limit + $hysteresis); + $high_warn_limit = ($high_limit - $hysteresis); - // FIXME warninglevels might need some other calculation in stead of hysteresis - $low_warn_limit = $low_limit + $hysteresis; - $high_warn_limit = $high_limit - $hysteresis; + if ($debug) { + echo "low_limit : $low_limit\nlow_warn_limit : $low_warn_limit\nhigh_warn_limit : $high_warn_limit\nhigh_limit : $high_limit\n"; + } - if ($debug) { echo("low_limit : $low_limit\nlow_warn_limit : $low_warn_limit\nhigh_warn_limit : $high_warn_limit\nhigh_limit : $high_limit\n"); } - - discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '10', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit , $current/10); - } -} - -?> + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '10', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, ($current / 10)); + } +}//end if diff --git a/includes/discovery/temperatures/netbotz.inc.php b/includes/discovery/temperatures/netbotz.inc.php index 5191246f6..6f6a31905 100644 --- a/includes/discovery/temperatures/netbotz.inc.php +++ b/includes/discovery/temperatures/netbotz.inc.php @@ -1,29 +1,29 @@ + $oids = trim($oids); + if ($oids) { + echo 'NetBotz '; + foreach (explode("\n", $oids) as $data) + { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $temperature_id = $split_oid[(count($split_oid) - 1)]; + $temperature_oid = ".1.3.6.1.4.1.5528.100.4.1.1.1.8.$temperature_id"; + $temperature = snmp_get($device, $temperature_oid, '-Ovq'); + $descr = str_replace('"', '', $descr); + $descr = preg_replace('/Temperature /', '', $descr); + $descr = trim($descr); + if ($temperature != '0' && $temperature <= '1000') { + discover_sensor($valid['sensor'], 'temperature', $device, + $temperature_oid, $temperature_id, 'netbotz', + $descr, '1', '1', null, null, null, null, $temperature); + } + } + } +} diff --git a/includes/discovery/temperatures/observernms-custom.inc.php b/includes/discovery/temperatures/observernms-custom.inc.php index d64398fdc..bacb3e9a1 100644 --- a/includes/discovery/temperatures/observernms-custom.inc.php +++ b/includes/discovery/temperatures/observernms-custom.inc.php @@ -1,26 +1,27 @@ + $oids = shell_exec($cmd); + $oids = trim($oids); + if ($oids) { + echo 'Observer-Style '; + } + + foreach (explode("\n", $oids) as $oid) { + $oid = trim($oid); + if ($oid != '') { + // FIXME snmp_get + $descr_query = $config['snmpget'].' -M '.$config['mibdir'].' -m SNMPv2-SMI -Osqn '.snmp_gen_auth($device).' '.$device['transport'].':'.$device['hostname'].':'.$device['port']." .1.3.6.1.4.1.2021.7891.$oid.2.1 | sed s/.1.3.6.1.4.1.2021.7891.$oid.2.1\ //"; + $descr = trim(str_replace('"', '', shell_exec($descr_query))); + $fulloid = ".1.3.6.1.4.1.2021.7891.$oid.101.1"; + discover_sensor($valid['sensor'], 'temperature', $device, $fulloid, $oid, 'observium', $descr, '1', '1', null, null, null, null, $current); + } + } +}//end if diff --git a/includes/discovery/temperatures/papouch-tme.inc.php b/includes/discovery/temperatures/papouch-tme.inc.php index 9d7d5ddb3..0b122976c 100644 --- a/includes/discovery/temperatures/papouch-tme.inc.php +++ b/includes/discovery/temperatures/papouch-tme.inc.php @@ -1,18 +1,16 @@ "0") - { - $temperature_oid = ".1.3.6.1.4.1.18248.1.1.1.0"; - $descr = trim(str_replace("\"", "", $descr)); - discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, "1", 'papouch-tme', $descr, '10', '1', NULL, NULL, NULL, NULL, $temperature); - } + if ($descr != '' && is_numeric($temperature) && $temperature > '0') { + $temperature_oid = '.1.3.6.1.4.1.18248.1.1.1.0'; + $descr = trim(str_replace('"', '', $descr)); + discover_sensor($valid['sensor'], 'temperature', $device, + $temperature_oid, '1', 'papouch-tme', + $descr, '10', '1', null, null, null, null, $temperature); + } } - -?> diff --git a/includes/discovery/temperatures/pcoweb.inc.php b/includes/discovery/temperatures/pcoweb.inc.php index eaa1c40b9..263e1906b 100644 --- a/includes/discovery/temperatures/pcoweb.inc.php +++ b/includes/discovery/temperatures/pcoweb.inc.php @@ -1,60 +1,144 @@ "CAREL-ug40cdz-MIB::roomTemp.0", "descr" => "Room Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.1.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::outdoorTemp.0", "descr" => "Ambient Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.2.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::deliveryTemp.0", "descr" => "Delivery Air Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.3.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::cwTemp.0", "descr" => "Chilled Water Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.4.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::hwTemp.0", "descr" => "Hot Water Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.5.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::cwoTemp.0", "descr" => "Chilled Water Outlet Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.7.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::suctTemp1.0", "descr" => "Circuit 1 Suction Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.10.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::suctTemp2.0", "descr" => "Circuit 2 Suction Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.11.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::evapTemp1.0", "descr" => "Circuit 1 Evap. Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.12.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::evapTemp2.0", "descr" => "Circuit 2 Evap. Temperature", "oid" => ".1.3.6.1.4.1.9839.2.1.2.13.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::ssh1.0", "descr" => "Circuit 1 Superheat", "oid" => ".1.3.6.1.4.1.9839.2.1.2.14.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::ssh2.0", "descr" => "Circuit 2 Superheat", "oid" => ".1.3.6.1.4.1.9839.2.1.2.15.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::coolSetP.0", "descr" => "Cooling Set Point", "oid" => ".1.3.6.1.4.1.9839.2.1.2.20.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::coolDiff.0", "descr" => "Cooling Prop. Band", "oid" => ".1.3.6.1.4.1.9839.2.1.2.21.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::cool2SetP.0", "descr" => "Cooling 2nd Set Point", "oid" => ".1.3.6.1.4.1.9839.2.1.2.22.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::heatSetP.0", "descr" => "Heating Set Point", "oid" => ".1.3.6.1.4.1.9839.2.1.2.23.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::heatDiff.0", "descr" => "Heating Prop. Band", "oid" => ".1.3.6.1.4.1.9839.2.1.2.25.0", "precision" => "10"), - array("mib" => "CAREL-ug40cdz-MIB::heat2SetP.0", "descr" => "Heating 2nd Set Point", "oid" => ".1.3.6.1.4.1.9839.2.1.2.24.0", "precision" => "10"), - ); + $temperatures = array( + array( + 'mib' => 'CAREL-ug40cdz-MIB::roomTemp.0', + 'descr' => 'Room Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.1.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::outdoorTemp.0', + 'descr' => 'Ambient Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.2.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::deliveryTemp.0', + 'descr' => 'Delivery Air Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.3.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::cwTemp.0', + 'descr' => 'Chilled Water Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.4.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::hwTemp.0', + 'descr' => 'Hot Water Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.5.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::cwoTemp.0', + 'descr' => 'Chilled Water Outlet Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.7.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::suctTemp1.0', + 'descr' => 'Circuit 1 Suction Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.10.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::suctTemp2.0', + 'descr' => 'Circuit 2 Suction Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.11.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::evapTemp1.0', + 'descr' => 'Circuit 1 Evap. Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.12.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::evapTemp2.0', + 'descr' => 'Circuit 2 Evap. Temperature', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.13.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::ssh1.0', + 'descr' => 'Circuit 1 Superheat', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.14.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::ssh2.0', + 'descr' => 'Circuit 2 Superheat', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.15.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::coolSetP.0', + 'descr' => 'Cooling Set Point', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.20.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::coolDiff.0', + 'descr' => 'Cooling Prop. Band', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.21.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::cool2SetP.0', + 'descr' => 'Cooling 2nd Set Point', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.22.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::heatSetP.0', + 'descr' => 'Heating Set Point', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.23.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::heatDiff.0', + 'descr' => 'Heating Prop. Band', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.25.0', + 'precision' => '10', + ), + array( + 'mib' => 'CAREL-ug40cdz-MIB::heat2SetP.0', + 'descr' => 'Heating 2nd Set Point', + 'oid' => '.1.3.6.1.4.1.9839.2.1.2.24.0', + 'precision' => '10', + ), + ); - foreach ($temperatures as $temperature) - { - $current = snmp_get($device, $temperature['mib'], "-OqvU") / $temperature['precision']; + foreach ($temperatures as $temperature) { + $current = (snmp_get($device, $temperature['mib'], '-OqvU') / $temperature['precision']); - $high_limit = NULL; - $low_limit = NULL; + $high_limit = null; + $low_limit = null; - if (is_numeric($current) && $current != 0) - { - $index = implode(".",array_slice(explode(".",$temperature['oid']),-5)); - discover_sensor($valid['sensor'], 'temperature', $device, $temperature['oid'], $index, 'pcoweb', $temperature['descr'], $temperature['precision'], '1', $low_limit, NULL, NULL, $high_limit, $current); + if (is_numeric($current) && $current != 0) { + $index = implode('.', array_slice(explode('.', $temperature['oid']), -5)); + discover_sensor($valid['sensor'], 'temperature', $device, $temperature['oid'], $index, 'pcoweb', $temperature['descr'], $temperature['precision'], '1', $low_limit, null, null, $high_limit, $current); + } } - } -/* -FIXME - -thrsHT.0 = INTEGER: 30 degrees C x10 -thrsLT.0 = INTEGER: 10 degrees C x10 -smCoolSetp.0 = INTEGER: 280 degrees C -smHeatSetp.0 = INTEGER: 160 degrees C -cwDehumSetp.0 = INTEGER: 70 degrees C -cwHtThrsh.0 = INTEGER: 150 degrees C -cwModeSetp.0 = INTEGER: 70 degrees C -radcoolSpES.0 = INTEGER: 80 degrees C -radcoolSpDX.0 = INTEGER: 280 degrees C -delTempLimit.0 = INTEGER: 14 degrees C x10 -dtAutChgMLT.0 = INTEGER: 20 degrees C -*/ + /* + FIXME + thrsHT.0 = INTEGER: 30 degrees C x10 + thrsLT.0 = INTEGER: 10 degrees C x10 + smCoolSetp.0 = INTEGER: 280 degrees C + smHeatSetp.0 = INTEGER: 160 degrees C + cwDehumSetp.0 = INTEGER: 70 degrees C + cwHtThrsh.0 = INTEGER: 150 degrees C + cwModeSetp.0 = INTEGER: 70 degrees C + radcoolSpES.0 = INTEGER: 80 degrees C + radcoolSpDX.0 = INTEGER: 280 degrees C + delTempLimit.0 = INTEGER: 14 degrees C x10 + dtAutChgMLT.0 = INTEGER: 20 degrees C + */ } - -?> diff --git a/includes/discovery/temperatures/rfc1628.inc.php b/includes/discovery/temperatures/rfc1628.inc.php index c90fe0fb5..a010e68af 100644 --- a/includes/discovery/temperatures/rfc1628.inc.php +++ b/includes/discovery/temperatures/rfc1628.inc.php @@ -1,26 +1,27 @@ + $oids = trim($oids); + if ($oids) { + echo 'RFC1628 Battery Temperature '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $temperature_id = $split_oid[(count($split_oid) - 1)]; + $temperature_oid = "1.3.6.1.2.1.33.1.2.7.$temperature_id"; + $temperature = snmp_get($device, $temperature_oid, '-Ovq'); + $descr = 'Battery'.(count(explode("\n", $oids)) == 1 ? '' : ' '.($temperature_id + 1)); + + discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'rfc1628', $descr, '1', '1', null, null, null, null, $temperature); + } + } +}//end if diff --git a/includes/discovery/temperatures/sentry3.inc.php b/includes/discovery/temperatures/sentry3.inc.php index ce94fa362..3bd43beb0 100644 --- a/includes/discovery/temperatures/sentry3.inc.php +++ b/includes/discovery/temperatures/sentry3.inc.php @@ -1,36 +1,40 @@ = 0) { - discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); - } +if ($device['os'] == 'sentry3') { + $oids = snmp_walk($device, 'tempHumidSensorTempValue', '-Osqn', 'Sentry3-MIB'); + if ($debug) { + echo $oids."\n"; } - } -} -?> + $oids = trim($oids); + $divisor = '10'; + $multiplier = '1'; + if ($oids) { + echo 'ServerTech Sentry3 Temperature '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + + // tempHumidSensorTempValue + $temperature_oid = '1.3.6.1.4.1.1718.3.2.5.1.6.1.'.$index; + $descr = 'Removable Sensor '.$index; + $low_warn_limit = null; + $low_limit = (snmp_get($device, "tempHumidSensorTempLowThresh.1.$index", '-Ovq', 'Sentry3-MIB') / $divisor); + $high_warn_limit = null; + $high_limit = (snmp_get($device, "tempHumidSensorTempHighThresh.1.$index", '-Ovq', 'Sentry3-MIB') / $divisor); + $current = (snmp_get($device, "$temperature_oid", '-Ovq', 'Sentry3-MIB') / $divisor); + + if ($current >= 0) { + discover_sensor($valid['sensor'], 'temperature', $device, + $temperature_oid, $index, 'sentry3', + $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, + $high_warn_limit, $high_limit, $current); + } + } + } +} diff --git a/includes/discovery/temperatures/supermicro.inc.php b/includes/discovery/temperatures/supermicro.inc.php index e25e5a42e..9bb5a677e 100644 --- a/includes/discovery/temperatures/supermicro.inc.php +++ b/includes/discovery/temperatures/supermicro.inc.php @@ -1,39 +1,37 @@ + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$type) = explode(' ', $data); + $oid_ex = explode('.', $oid); + $index = $oid_ex[(count($oid_ex) - 1)]; + if ($type == 2) { + $temperature_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.4.$index"; + $descr_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.2.$index"; + $limit_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.5.$index"; + $divisor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.9.$index"; + $monitor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.10.$index"; + $descr = snmp_get($device, $descr_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + $temperature = snmp_get($device, $temperature_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + $limit = snmp_get($device, $limit_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + $divisor = snmp_get($device, $divisor_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB') || 1; + $monitor = snmp_get($device, $monitor_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + if ($monitor == 'true') { + $descr = trim(str_ireplace('temperature', '', $descr)); + discover_sensor($valid['sensor'], 'temperature', $device, + $temperature_oid, trim($index, '.'), 'supermicro', + $descr, $divisor, '1', null, null, null, $limit, $temperature); + } + } + } + } +} diff --git a/includes/discovery/temperatures/xups.inc.php b/includes/discovery/temperatures/xups.inc.php index 3c9d2ac4a..048d881ca 100644 --- a/includes/discovery/temperatures/xups.inc.php +++ b/includes/discovery/temperatures/xups.inc.php @@ -1,31 +1,34 @@ + $oids = trim($oids); + if ($oids) { + echo 'Powerware Ambient Temperature '; + } + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $temperature_id = $split_oid[(count($split_oid) - 1)]; + $temperature_oid = ".1.3.6.1.4.1.534.1.6.1.$temperature_id"; + $lowlimit = snmp_get($device, "upsEnvAmbientLowerLimit.$temperature_id", '-Ovq', 'XUPS-MIB'); + $highlimit = snmp_get($device, "upsEnvAmbientUpperLimit.$temperature_id", '-Ovq', 'XUPS-MIB'); + $temperature = snmp_get($device, $temperature_oid, '-Ovq'); + $descr = 'Ambient'.(count(explode("\n", $oids)) == 1 ? '' : ' '.($temperature_id + 1)); + + discover_sensor($valid['sensor'], 'temperature', $device, + $temperature_oid, '1.6.1.'.$temperature_id, 'powerware', + $descr, '1', '1', $lowlimit, null, null, $highlimit, $temperature); + } + } +} diff --git a/includes/discovery/temperatures/zyxel-ies.inc.php b/includes/discovery/temperatures/zyxel-ies.inc.php index 9aa9f88d0..818bfc417 100644 --- a/includes/discovery/temperatures/zyxel-ies.inc.php +++ b/includes/discovery/temperatures/zyxel-ies.inc.php @@ -1,26 +1,24 @@ $entry) - { - $entPhysicalIndex = $index; - $descr = trim(snmp_get($device, "accessSwitchSysTempDescr.".$index, "-Oqv", "ZYXEL-AS-MIB"),'"'); - $oid = ".1.3.6.1.4.1.890.1.5.1.1.6.1.2.".$index; - $current = $entry['accessSwitchSysTempCurValue']; - $divisor = '1'; - discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'zyxel-ies', $descr, '1', '1', NULL, $entry['accessSwitchSysTempHighThresh'], NULL, NULL, $current); + if (is_array($oids)) { + foreach ($oids as $index => $entry) + { + $entPhysicalIndex = $index; + $descr = trim(snmp_get($device, 'accessSwitchSysTempDescr.'.$index, '-Oqv', 'ZYXEL-AS-MIB'), '"'); + $oid = '.1.3.6.1.4.1.890.1.5.1.1.6.1.2.'.$index; + $current = $entry['accessSwitchSysTempCurValue']; + $divisor = '1'; + discover_sensor($valid['sensor'], 'temperature', $device, + $oid, $index, 'zyxel-ies', + $descr, '1', '1', null, $entry['accessSwitchSysTempHighThresh'], null, null, $current); + } } - } } - -?> diff --git a/includes/discovery/vlans/q-bridge-mib.inc.php b/includes/discovery/vlans/q-bridge-mib.inc.php index 3b55121a6..83908fbd9 100644 --- a/includes/discovery/vlans/q-bridge-mib.inc.php +++ b/includes/discovery/vlans/q-bridge-mib.inc.php @@ -1,31 +1,27 @@ $vlan) - { - echo(" $vlan_id"); - if (is_array($vlans_db[$vtpdomain_id][$vlan_id])) - { - echo("."); - } else { - dbInsert(array('device_id' => $device['device_id'], 'vlan_domain' => $vtpdomain_id, 'vlan_vlan' => $vlan_id, 'vlan_name' => $vlan['dot1qVlanStaticName'], 'vlan_type' => array('NULL')), 'vlans'); - echo("+"); + foreach ($vlans as $vlan_id => $vlan) { + echo " $vlan_id"; + if (is_array($vlans_db[$vtpdomain_id][$vlan_id])) { + echo '.'; + } + else { + dbInsert(array('device_id' => $device['device_id'], 'vlan_domain' => $vtpdomain_id, 'vlan_vlan' => $vlan_id, 'vlan_name' => $vlan['dot1qVlanStaticName'], 'vlan_type' => array('NULL')), 'vlans'); + echo '+'; } - $device['vlans'][$vtpdomain_id][$vlan_id] = $vlan_id; - } + $device['vlans'][$vtpdomain_id][$vlan_id] = $vlan_id; + } } -echo("\n"); - -?> +echo "\n"; diff --git a/includes/discovery/voltages/apc.inc.php b/includes/discovery/voltages/apc.inc.php index a69b5bc86..b309d21fb 100644 --- a/includes/discovery/voltages/apc.inc.php +++ b/includes/discovery/voltages/apc.inc.php @@ -1,106 +1,121 @@ 1) { $descr .= " $index"; } - - discover_sensor($valid['sensor'], 'voltage', $device, $oid, "4.3.1.3.$index", $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); + if ($oids) { + echo 'APC In '; } - } - $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.3.2.1.0", "-OsqnU", ""); - if ($debug) { echo($oids."\n"); } - if ($oids) - { - echo(" APC In "); - list($oid,$current) = explode(" ",$oids); $divisor = 1; - $type = "apc"; - $index = "3.2.1.0"; - $descr = "Input"; + $type = 'apc'; + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$current) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 3)]; + $oid = '1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.'.$index.'.1.1'; + $descr = 'Input Feed '.chr(64 + $index); - discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + discover_sensor($valid['sensor'], 'voltage', $device, $oid, "3.3.1.3.$index", $type, $descr, $divisor, '1', null, null, null, null, $current); + } + } + + $oids = snmp_walk($device, '1.3.6.1.4.1.318.1.1.8.5.4.3.1.3', '-OsqnU', ''); + if ($debug) { + echo $oids."\n"; + } + + if ($oids) { + echo ' APC Out '; + } - $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.4.2.1.0", "-OsqnU", ""); - if ($debug) { echo($oids."\n"); } - if ($oids) - { - echo(" APC Out "); - list($oid,$current) = explode(" ",$oids); $divisor = 1; - $type = "apc"; - $index = "4.2.1.0"; - $descr = "Output"; + $type = 'apc'; + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$current) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 3)]; + $oid = '1.3.6.1.4.1.318.1.1.8.5.4.3.1.3.'.$index.'.1.1'; + $descr = 'Output Feed'; + if (count(explode("\n", $oids)) > 1) { + $descr .= " $index"; + } - discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + discover_sensor($valid['sensor'], 'voltage', $device, $oid, "4.3.1.3.$index", $type, $descr, $divisor, '1', null, null, null, null, $current); + } + } - #PDU - #$oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.15.0", "-OsqnU", ""); - $oids = snmp_walk($device, "rPDUIdentDeviceLinetoLineVoltage.0", "-OsqnU", "PowerNet-MIB"); - if ($debug) { echo($oids."\n"); } - if ($oids) - { - echo(" Voltage In "); - list($oid,$current) = explode(" ",$oids); - $divisor = 1; - $type = "apc"; - $index = "1"; - $descr = "Input"; + $oids = snmp_get($device, '1.3.6.1.4.1.318.1.1.1.3.2.1.0', '-OsqnU', ''); + if ($debug) { + echo $oids."\n"; + } - discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + if ($oids) { + echo ' APC In '; + list($oid,$current) = explode(' ', $oids); + $divisor = 1; + $type = 'apc'; + $index = '3.2.1.0'; + $descr = 'Input'; - $oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.26.6.3.1.6", "-OsqnU", "PowerNet-MIB"); - if ($debug) { echo($oids."\n"); } - if ($oids) - { - echo(" Voltage In "); - list($oid,$current) = explode(" ",$oids); - $divisor = 1; - $type = "apc"; - $index = "1"; - $descr = "Input"; + discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } - discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + $oids = snmp_get($device, '1.3.6.1.4.1.318.1.1.1.4.2.1.0', '-OsqnU', ''); + if ($debug) { + echo $oids."\n"; + } -} + if ($oids) { + echo ' APC Out '; + list($oid,$current) = explode(' ', $oids); + $divisor = 1; + $type = 'apc'; + $index = '4.2.1.0'; + $descr = 'Output'; -?> + discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + + // PDU + // $oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.15.0", "-OsqnU", ""); + $oids = snmp_walk($device, 'rPDUIdentDeviceLinetoLineVoltage.0', '-OsqnU', 'PowerNet-MIB'); + if ($debug) { + echo $oids."\n"; + } + + if ($oids) { + echo ' Voltage In '; + list($oid,$current) = explode(' ', $oids); + $divisor = 1; + $type = 'apc'; + $index = '1'; + $descr = 'Input'; + + discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + + $oids = snmp_walk($device, '1.3.6.1.4.1.318.1.1.26.6.3.1.6', '-OsqnU', 'PowerNet-MIB'); + if ($debug) { + echo $oids."\n"; + } + + if ($oids) { + echo ' Voltage In '; + list($oid,$current) = explode(' ', $oids); + $divisor = 1; + $type = 'apc'; + $index = '1'; + $descr = 'Input'; + + discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } +}//end if diff --git a/includes/discovery/voltages/areca.inc.php b/includes/discovery/voltages/areca.inc.php index 7c91923de..258203a80 100644 --- a/includes/discovery/voltages/areca.inc.php +++ b/includes/discovery/voltages/areca.inc.php @@ -1,29 +1,30 @@ \ No newline at end of file + if ($oids) { + echo 'Areca '; + } + + $divisor = 1000; + $type = 'areca'; + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + $oid = '1.3.6.1.4.1.18928.1.2.2.1.8.1.3.'.$index; + $current = (snmp_get($device, $oid, '-Oqv', '') / $divisor); + if (trim($descr, '"') != 'Battery Status') { + // Battery Status is charge percentage, or 255 when no BBU + discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, trim($descr, '"'), $divisor, '1', null, null, null, null, $current); + } + } + } +}//end if diff --git a/includes/discovery/voltages/gamatronicups.inc.php b/includes/discovery/voltages/gamatronicups.inc.php index 477f42bc9..2fe1dbec4 100644 --- a/includes/discovery/voltages/gamatronicups.inc.php +++ b/includes/discovery/voltages/gamatronicups.inc.php @@ -1,34 +1,34 @@ \ No newline at end of file diff --git a/includes/discovery/voltages/ipoman.inc.php b/includes/discovery/voltages/ipoman.inc.php index dfebcea5a..a98282acb 100644 --- a/includes/discovery/voltages/ipoman.inc.php +++ b/includes/discovery/voltages/ipoman.inc.php @@ -1,44 +1,39 @@ $entry) - { - $volt_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.2.' . $index; - $divisor = 10; - $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'],'"') : "Inlet $index"); - $current = $entry['inletStatusVoltage'] / 10; - $low_limit = $entry['inletConfigVoltageLow']; - $high_limit = $entry['inletConfigVoltageHigh']; - - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, NULL, NULL, $high_limit, $current); - // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? + if (!is_array($cache['ipoman'])) { + echo 'outletConfigDesc '; + $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigDesc', $cache['ipoman']['out'], 'IPOMANII-MIB'); + echo 'outletConfigLocation '; + $cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, 'outletConfigLocation', $cache['ipoman']['out'], 'IPOMANII-MIB'); + echo 'inletConfigDesc '; + $cache['ipoman']['in'] = snmpwalk_cache_multi_oid($device, 'inletConfigDesc', $cache['ipoman']['in'], 'IPOMANII-MIB'); } - } -} -?> \ No newline at end of file + $oids = array(); + + echo 'inletConfigVoltageHigh '; + $oids = snmpwalk_cache_multi_oid($device, 'inletConfigVoltageHigh', $oids, 'IPOMANII-MIB'); + echo 'inletConfigVoltageLow '; + $oids = snmpwalk_cache_multi_oid($device, 'inletConfigVoltageLow', $oids, 'IPOMANII-MIB'); + echo 'inletStatusVoltage '; + $oids = snmpwalk_cache_multi_oid($device, 'inletStatusVoltage', $oids, 'IPOMANII-MIB'); + + if (is_array($oids)) { + foreach ($oids as $index => $entry) + { + $volt_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.2.'.$index; + $divisor = 10; + $descr = (trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') != '' ? trim($cache['ipoman']['in'][$index]['inletConfigDesc'], '"') : "Inlet $index"); + $current = ($entry['inletStatusVoltage'] / 10); + $low_limit = $entry['inletConfigVoltageLow']; + $high_limit = $entry['inletConfigVoltageHigh']; + + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, 'ipoman', $descr, $divisor, '1', $low_limit, null, null, $high_limit, $current); + // FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf? + } + } +}//end if diff --git a/includes/discovery/voltages/linux.inc.php b/includes/discovery/voltages/linux.inc.php index 410d02595..f599f02ee 100644 --- a/includes/discovery/voltages/linux.inc.php +++ b/includes/discovery/voltages/linux.inc.php @@ -1,28 +1,29 @@ + if ($oids) { + echo 'LM-SENSORS '; + } + + $divisor = 1000; + $type = 'lmsensors'; + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + $oid = '1.3.6.1.4.1.2021.13.16.4.1.3.'.$index; + $current = (snmp_get($device, $oid, '-Oqv', 'LM-SENSORS-MIB') / $divisor); + + discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + } +}//end if diff --git a/includes/discovery/voltages/mgeups.inc.php b/includes/discovery/voltages/mgeups.inc.php index 412e2dde5..6e715b995 100644 --- a/includes/discovery/voltages/mgeups.inc.php +++ b/includes/discovery/voltages/mgeups.inc.php @@ -1,50 +1,59 @@ 1) $descr .= " Phase $i"; - $current = snmp_get($device, $volt_oid, "-Oqv"); - if (!$current) - { - $volt_oid .= ".0"; - $current = snmp_get($device, $volt_oid, "-Oqv"); +if ($device['os'] == 'mgeups') { + echo 'MGE '; + $oids = trim(snmp_walk($device, 'mgoutputVoltage', '-OsqnU', 'MG-SNMP-UPS-MIB')); + if ($debug) { + echo $oids."\n"; } - $current /= 10; - $type = "mge-ups"; - $divisor = 10; - $index = $i; - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + $numPhase = count(explode("\n", $oids)); + for ($i = 1; $i <= $numPhase; $i++) { + $volt_oid = ".1.3.6.1.4.1.705.1.7.2.1.2.$i"; + $descr = 'Output'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } - $oids = trim(snmp_walk($device, "mgeinputVoltage", "-OsqnU", "MG-SNMP-UPS-MIB")); - if ($debug) { echo($oids."\n"); } - $numPhase = count(explode("\n",$oids)); - for($i = 1; $i <= $numPhase;$i++) - { - $volt_oid = ".1.3.6.1.4.1.705.1.6.2.1.2.$i"; - $descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i"; - $current = snmp_get($device, $volt_oid, "-Oqv"); - if (!$current) - { - $volt_oid .= ".0"; - $current = snmp_get($device, $volt_oid, "-Oqv"); + $current = snmp_get($device, $volt_oid, '-Oqv'); + if (!$current) { + $volt_oid .= '.0'; + $current = snmp_get($device, $volt_oid, '-Oqv'); + } + + $current /= 10; + $type = 'mge-ups'; + $divisor = 10; + $index = $i; + + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); } - $current /= 10; - $type = "mge-ups"; - $divisor = 10; - $index = 100+$i; - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } -} + $oids = trim(snmp_walk($device, 'mgeinputVoltage', '-OsqnU', 'MG-SNMP-UPS-MIB')); + if ($debug) { + echo $oids."\n"; + } -?> \ No newline at end of file + $numPhase = count(explode("\n", $oids)); + for ($i = 1; $i <= $numPhase; $i++) { + $volt_oid = ".1.3.6.1.4.1.705.1.6.2.1.2.$i"; + $descr = 'Input'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $current = snmp_get($device, $volt_oid, '-Oqv'); + if (!$current) { + $volt_oid .= '.0'; + $current = snmp_get($device, $volt_oid, '-Oqv'); + } + + $current /= 10; + $type = 'mge-ups'; + $divisor = 10; + $index = (100 + $i); + + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } +}//end if diff --git a/includes/discovery/voltages/netvision.inc.php b/includes/discovery/voltages/netvision.inc.php index 54a9fc751..42c6d6453 100644 --- a/includes/discovery/voltages/netvision.inc.php +++ b/includes/discovery/voltages/netvision.inc.php @@ -1,47 +1,49 @@ diff --git a/includes/discovery/voltages/rfc1628.inc.php b/includes/discovery/voltages/rfc1628.inc.php index 09438d8eb..42cdd90e4 100644 --- a/includes/discovery/voltages/rfc1628.inc.php +++ b/includes/discovery/voltages/rfc1628.inc.php @@ -1,79 +1,105 @@ 1) $descr .= " Phase $i"; - $type = "rfc1628"; - $divisor = 10; if ($device['os'] == "netmanplus") { $divisor = 1; }; - $current = snmp_get($device, $volt_oid, "-Oqv") / $divisor; - $index = $i; + $oids = trim($oids); + foreach (explode("\n", $oids) as $data) + { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $volt_id = $split_oid[(count($split_oid) - 1)]; + $volt_oid = "1.3.6.1.2.1.33.1.2.5.$volt_id"; + $divisor = 10; + if ($device['os'] == 'poweralert') { + $divisor = 1; + }; + $volt = (snmp_get($device, $volt_oid, '-O vq') / $divisor); + $descr = 'Battery'.(count(explode("\n", $oids)) == 1 ? '' : ' '.($volt_id + 1)); + $type = 'rfc1628'; + $index = '1.2.5.'.$volt_id; - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $volt); + } + } - $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.3.2.0", "-OsqnU")); - if ($debug) { echo($oids."\n"); } - list($unused,$numPhase) = explode(' ',$oids); - for($i = 1; $i <= $numPhase;$i++) - { - $volt_oid = "1.3.6.1.2.1.33.1.3.3.1.3.$i"; - $descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i"; - $type = "rfc1628"; - $divisor = 10; - if ($device['os'] == "netmanplus" || $device['os'] == "poweralert") { $divisor = 1; }; - $current = snmp_get($device, $volt_oid, "-Oqv") / $divisor; - $index = 100+$i; + $oids = trim(snmp_walk($device, '1.3.6.1.2.1.33.1.4.3.0', '-OsqnU')); + if ($debug) { + echo $oids."\n"; + } - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + list($unused,$numPhase) = explode(' ', $oids); + for ($i = 1; $i <= $numPhase; $i++) { + $volt_oid = ".1.3.6.1.2.1.33.1.4.4.1.2.$i"; + $descr = 'Output'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } - $oids = trim(snmp_walk($device, "1.3.6.1.2.1.33.1.5.2.0", "-OsqnU")); - if ($debug) { echo($oids."\n"); } - list($unused,$numPhase) = explode(' ',$oids); - for($i = 1; $i <= $numPhase;$i++) - { - $volt_oid = "1.3.6.1.2.1.33.1.5.3.1.2.$i"; - $descr = "Bypass"; if ($numPhase > 1) $descr .= " Phase $i"; - $type = "rfc1628"; - $divisor = 10; - if ($device['os'] == "netmanplus" || $device['os'] == "poweralert") { $divisor = 1; }; - $current = snmp_get($device, $volt_oid, "-Oqv") / $divisor; - $index = 200+$i; + $type = 'rfc1628'; + $divisor = 10; + if ($device['os'] == 'netmanplus') { + $divisor = 1; + }; + $current = (snmp_get($device, $volt_oid, '-Oqv') / $divisor); + $index = $i; - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } -} + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } -?> + $oids = trim(snmp_walk($device, '1.3.6.1.2.1.33.1.3.2.0', '-OsqnU')); + if ($debug) { + echo $oids."\n"; + } + + list($unused,$numPhase) = explode(' ', $oids); + for ($i = 1; $i <= $numPhase; $i++) { + $volt_oid = "1.3.6.1.2.1.33.1.3.3.1.3.$i"; + $descr = 'Input'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $type = 'rfc1628'; + $divisor = 10; + if ($device['os'] == 'netmanplus' || $device['os'] == 'poweralert') { + $divisor = 1; + }; + $current = (snmp_get($device, $volt_oid, '-Oqv') / $divisor); + $index = (100 + $i); + + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + + $oids = trim(snmp_walk($device, '1.3.6.1.2.1.33.1.5.2.0', '-OsqnU')); + if ($debug) { + echo $oids."\n"; + } + + list($unused,$numPhase) = explode(' ', $oids); + for ($i = 1; $i <= $numPhase; $i++) { + $volt_oid = "1.3.6.1.2.1.33.1.5.3.1.2.$i"; + $descr = 'Bypass'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $type = 'rfc1628'; + $divisor = 10; + if ($device['os'] == 'netmanplus' || $device['os'] == 'poweralert') { + $divisor = 1; + }; + $current = (snmp_get($device, $volt_oid, '-Oqv') / $divisor); + $index = (200 + $i); + + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } +}//end if diff --git a/includes/discovery/voltages/sentry3.inc.php b/includes/discovery/voltages/sentry3.inc.php index e77b69432..e2d704322 100644 --- a/includes/discovery/voltages/sentry3.inc.php +++ b/includes/discovery/voltages/sentry3.inc.php @@ -1,28 +1,31 @@ + if ($oids) { + echo 'Sentry3-MIB '; + } + + $divisor = 10; + $type = 'sentry3'; + + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $descr = 'Tower '.$index; + $index = $split_oid[(count($split_oid) - 1)]; + $oid = '1.3.6.1.4.1.1718.3.2.2.1.11.1.'.$index; + $current = (snmp_get($device, $oid, '-Oqv') / $divisor); + + discover_sensor($valid['sensor'], 'voltage', $device, + $oid, $index, $type, + $descr, $divisor, '1', null, null, null, null, $current); + } + } +}//end if diff --git a/includes/discovery/voltages/supermicro.inc.php b/includes/discovery/voltages/supermicro.inc.php index e4580e9cd..690d34747 100644 --- a/includes/discovery/voltages/supermicro.inc.php +++ b/includes/discovery/voltages/supermicro.inc.php @@ -1,44 +1,43 @@ \ No newline at end of file + $oids = trim($oids); + if ($oids) { + echo 'Supermicro '; + } + + $type = 'supermicro'; + $divisor = '1000'; + foreach (explode("\n", $oids) as $data) { + $data = trim($data); + if ($data) { + list($oid,$kind) = explode(' ', $data); + $split_oid = explode('.', $oid); + $index = $split_oid[(count($split_oid) - 1)]; + if ($kind == 1) { + $volt_oid = '1.3.6.1.4.1.10876.2.1.1.1.1.4.'.$index; + $descr_oid = '1.3.6.1.4.1.10876.2.1.1.1.1.2.'.$index; + $monitor_oid = '1.3.6.1.4.1.10876.2.1.1.1.1.10.'.$index; + $limit_oid = '1.3.6.1.4.1.10876.2.1.1.1.1.5.'.$index; + $lowlimit_oid = '1.3.6.1.4.1.10876.2.1.1.1.1.6.'.$index; + + $descr = snmp_get($device, $descr_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + $current = (snmp_get($device, $volt_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB') / $divisor); + $limit = (snmp_get($device, $limit_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB') / $divisor); + $lowlimit = (snmp_get($device, $lowlimit_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB') / $divisor); + $monitor = snmp_get($device, $monitor_oid, '-Oqv', 'SUPERMICRO-HEALTH-MIB'); + $descr = trim(str_ireplace('Voltage', '', $descr)); + + if ($monitor == 'true') { + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', $lowlimit, null, null, $limit, $current); + } + } + }//end if + }//end foreach +}//end if diff --git a/includes/discovery/voltages/xups.inc.php b/includes/discovery/voltages/xups.inc.php index 8bb859be2..378f7737e 100644 --- a/includes/discovery/voltages/xups.inc.php +++ b/includes/discovery/voltages/xups.inc.php @@ -1,82 +1,99 @@ 1) $descr .= " Phase $i"; - $type = "xups"; - $divisor = 1; - $current = snmp_get($device, $volt_oid, "-Oqv") / $divisor; - $index = '3.4.1.2.'.$i; + $oids = trim($oids); + foreach (explode("\n", $oids) as $data) + { + $data = trim($data); + if ($data) { + list($oid,$descr) = explode(' ', $data, 2); + $split_oid = explode('.', $oid); + $volt_id = $split_oid[(count($split_oid) - 1)]; + $volt_oid = ".1.3.6.1.4.1.534.1.2.2.$volt_id"; + $divisor = 1; + $volt = (snmp_get($device, $volt_oid, '-O vq') / $divisor); + $descr = 'Battery'.(count(explode("\n", $oids)) == 1 ? '' : ' '.($volt_id + 1)); + $type = 'xups'; + $index = '1.2.5.'.$volt_id; - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $volt); + } + } - # XUPS-MIB::xupsOutputNumPhases.0 = INTEGER: 1 - $oids = trim(snmp_walk($device, "xupsOutputNumPhases", "-OsqnU")); - if ($debug) { echo($oids."\n"); } - list($unused,$numPhase) = explode(' ',$oids); - for($i = 1; $i <= $numPhase;$i++) - { - # XUPS-MIB::xupsOutputVoltage.1 = INTEGER: 228 - $volt_oid = ".1.3.6.1.4.1.534.1.4.4.1.2.$i"; - $descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i"; - $type = "xups"; - $divisor = 1; - $current = snmp_get($device, $volt_oid, "-Oqv") / $divisor; - $index = '4.4.1.2.'.$i; + // XUPS-MIB::xupsInputNumPhases.0 = INTEGER: 1 + $oids = trim(snmp_walk($device, 'xupsInputNumPhases', '-OsqnU', 'XUPS-MIB')); + if ($debug) { + echo $oids."\n"; + } - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } + list($unused,$numPhase) = explode(' ', $oids); + for ($i = 1; $i <= $numPhase; $i++) { + // XUPS-MIB::xupsInputVoltage.1 = INTEGER: 228 + $volt_oid = ".1.3.6.1.4.1.534.1.3.4.1.2.$i"; + $descr = 'Output'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } - # XUPS-MIB::xupsBypassNumPhases.0 = INTEGER: 1 - $oids = trim(snmp_walk($device, "xupsBypassNumPhases", "-OsqnU")); - if ($debug) { echo($oids."\n"); } - list($unused,$numPhase) = explode(' ',$oids); - for($i = 1; $i <= $numPhase;$i++) - { - $volt_oid = ".1.3.6.1.4.1.534.1.5.3.1.2.$i"; - $descr = "Bypass"; if ($numPhase > 1) $descr .= " Phase $i"; - $type = "xups"; - $divisor = 1; - $current = snmp_get($device, $volt_oid, "-Oqv") / $divisor; - $index = '5.3.1.2.'.$i; + $type = 'xups'; + $divisor = 1; + $current = (snmp_get($device, $volt_oid, '-Oqv') / $divisor); + $index = '3.4.1.2.'.$i; - discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); - } -} + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } -?> \ No newline at end of file + // XUPS-MIB::xupsOutputNumPhases.0 = INTEGER: 1 + $oids = trim(snmp_walk($device, 'xupsOutputNumPhases', '-OsqnU')); + if ($debug) { + echo $oids."\n"; + } + + list($unused,$numPhase) = explode(' ', $oids); + for ($i = 1; $i <= $numPhase; $i++) { + // XUPS-MIB::xupsOutputVoltage.1 = INTEGER: 228 + $volt_oid = ".1.3.6.1.4.1.534.1.4.4.1.2.$i"; + $descr = 'Output'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $type = 'xups'; + $divisor = 1; + $current = (snmp_get($device, $volt_oid, '-Oqv') / $divisor); + $index = '4.4.1.2.'.$i; + + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } + + // XUPS-MIB::xupsBypassNumPhases.0 = INTEGER: 1 + $oids = trim(snmp_walk($device, 'xupsBypassNumPhases', '-OsqnU')); + if ($debug) { + echo $oids."\n"; + } + + list($unused,$numPhase) = explode(' ', $oids); + for ($i = 1; $i <= $numPhase; $i++) { + $volt_oid = ".1.3.6.1.4.1.534.1.5.3.1.2.$i"; + $descr = 'Bypass'; + if ($numPhase > 1) { + $descr .= " Phase $i"; + } + + $type = 'xups'; + $divisor = 1; + $current = (snmp_get($device, $volt_oid, '-Oqv') / $divisor); + $index = '5.3.1.2.'.$i; + + discover_sensor($valid['sensor'], 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); + } +}//end if diff --git a/includes/include-dir.inc.php b/includes/include-dir.inc.php index 49155614b..d5c0a7eab 100644 --- a/includes/include-dir.inc.php +++ b/includes/include-dir.inc.php @@ -1,26 +1,22 @@ +unset($include_dir_regexp, $include_dir); diff --git a/includes/polling/applications.inc.php b/includes/polling/applications.inc.php index 32c6c4057..a32dce5e6 100644 --- a/includes/polling/applications.inc.php +++ b/includes/polling/applications.inc.php @@ -1,26 +1,24 @@ +$app_rows = dbFetchRows('SELECT * FROM `applications` WHERE `device_id` = ?', array($device['device_id'])); + +if (count($app_rows)) { + echo 'Applications: '; + foreach ($app_rows as $app) + { + $app_include = $config['install_dir'].'/includes/polling/applications/'.$app['app_type'].'.inc.php'; + if (is_file($app_include)) { + include $app_include; + } + else { + echo $app['app_type'].' include missing! '; + } + } + + echo "\n"; +} diff --git a/includes/polling/applications/apache.inc.php b/includes/polling/applications/apache.inc.php index 4e496b07d..1f8614c88 100644 --- a/includes/polling/applications/apache.inc.php +++ b/includes/polling/applications/apache.inc.php @@ -1,26 +1,28 @@ +rrdtool_update($rrd_filename, "N:$total_access:$total_kbyte:$cpuload:$uptime:$reqpersec:$bytespersec:$bytesperreq:$busyworkers:$idleworkers:$score_wait:$score_start:$score_reading:$score_writing:$score_keepalive:$score_dns:$score_closing:$score_logging:$score_graceful:$score_idle:$score_open"); diff --git a/includes/polling/applications/drbd.inc.php b/includes/polling/applications/drbd.inc.php index bb1841d44..c399478cb 100644 --- a/includes/polling/applications/drbd.inc.php +++ b/includes/polling/applications/drbd.inc.php @@ -1,18 +1,18 @@ +unset($drbd) diff --git a/includes/polling/applications/mailscanner.inc.php b/includes/polling/applications/mailscanner.inc.php index 72eb7f914..a1b29bf47 100644 --- a/includes/polling/applications/mailscanner.inc.php +++ b/includes/polling/applications/mailscanner.inc.php @@ -1,29 +1,28 @@ +rrdtool_update($rrd_filename, "N:$msg_recv:$msg_rejected:$msg_relay:$msg_sent:$msg_waiting:$spam:$virus"); diff --git a/includes/polling/applications/memcached.inc.php b/includes/polling/applications/memcached.inc.php index 2c41ff208..f3bc0daa5 100644 --- a/includes/polling/applications/memcached.inc.php +++ b/includes/polling/applications/memcached.inc.php @@ -2,12 +2,14 @@ $data = $agent_data['app']['memcached'][$app['app_instance']]; -$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-memcached-".$app['app_id'].".rrd"; +$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-memcached-'.$app['app_id'].'.rrd'; -echo("memcached(".$app['app_instance'].") "); +echo 'memcached('.$app['app_instance'].') '; - if (!is_file($rrd_filename)) { - rrdtool_create ($rrd_filename, "--step 300 \ +if (!is_file($rrd_filename)) { + rrdtool_create( + $rrd_filename, + '--step 300 \ DS:uptime:GAUGE:600:0:125000000000 \ DS:threads:GAUGE:600:0:125000000000 \ DS:rusage_user_ms:DERIVE:600:0:125000000000 \ @@ -26,18 +28,34 @@ echo("memcached(".$app['app_instance'].") "); DS:evictions:DERIVE:600:0:125000000000 \ DS:bytes_read:DERIVE:600:0:125000000000 \ DS:bytes_written:DERIVE:600:0:125000000000 \ - ".$config['rrd_rra']); - } + '.$config['rrd_rra'] + ); +} - $dslist = array('uptime', 'threads', 'rusage_user_microseconds','rusage_system_microseconds','curr_items','total_items','limit_maxbytes','curr_connections','total_connections', - 'connection_structures','bytes','cmd_get','cmd_set','get_hits','get_misses','evictions','bytes_read','bytes_written'); +$dslist = array( + 'uptime', + 'threads', + 'rusage_user_microseconds', + 'rusage_system_microseconds', + 'curr_items', + 'total_items', + 'limit_maxbytes', + 'curr_connections', + 'total_connections', + 'connection_structures', + 'bytes', + 'cmd_get', + 'cmd_set', + 'get_hits', + 'get_misses', + 'evictions', + 'bytes_read', + 'bytes_written', +); - $values = array(); - foreach ($dslist as $ds) - { - $values[] = isset($data[$ds]) ? $data[$ds] : -1; - } +$values = array(); +foreach ($dslist as $ds) { + $values[] = isset($data[$ds]) ? $data[$ds] : (-1); +} - rrdtool_update($rrd_filename, "N:".implode(":", $values)); - -?> +rrdtool_update($rrd_filename, 'N:'.implode(':', $values)); diff --git a/includes/polling/applications/mysql.inc.php b/includes/polling/applications/mysql.inc.php index 15fe00935..13a362021 100644 --- a/includes/polling/applications/mysql.inc.php +++ b/includes/polling/applications/mysql.inc.php @@ -1,125 +1,124 @@ 'cr', - 'IBLFh' => 'ct', - 'IBLWn' => 'cu', - 'IBLWn' => 'cu', - 'SRows' => 'ck', - 'SRange' => 'cj', - 'SMPs' => 'ci', - 'SScan' => 'cl', - 'IBIRd' => 'ai', - 'IBIWr' => 'aj', - 'IBILg' => 'ak', - 'IBIFSc' => 'ah', - 'IDBRDd' => 'b2', - 'IDBRId' => 'b0', - 'IDBRRd' => 'b3', - 'IDBRUd' => 'b1', - 'IBRd' => 'ae', - 'IBCd' => 'af', - 'IBWr' => 'ag', - 'TLIe' => 'b5', - 'TLWd' => 'b4', - 'IBPse' => 'aa', - 'IBPDBp' => 'ac', - 'IBPFe' => 'ab', - 'IBPMps' => 'ad', - 'TOC' => 'bc', - 'OFs' => 'b7', - 'OTs' => 'b8', - 'OdTs' => 'b9', - 'IBSRs' => 'ay', - 'IBSWs' => 'ax', - 'IBOWs' => 'az', - 'QCs' => 'c1', - 'QCeFy' => 'bu', - 'MaCs' => 'bl', - 'MUCs' => 'bf', - 'ACs' => 'bd', - 'AdCs' => 'be', - 'TCd' => 'bi', - 'Cs' => 'bn', - 'IBTNx' => 'a5', - 'KRRs' => 'a0', - 'KRs' => 'a1', - 'KWR' => 'a2', - 'KWs' => 'a3', - 'QCQICe' => 'bz', - 'QCHs' => 'bv', - 'QCIs' => 'bw', - 'QCNCd' => 'by', - 'QCLMPs' => 'bx', - 'CTMPDTs' => 'cn', - 'CTMPTs' => 'cm', - 'CTMPFs' => 'co', - 'IBIIs' => 'au', - 'IBIMRd' => 'av', - 'IBIMs' => 'aw', - 'IBILog' => 'al', - 'IBISc' => 'am', - 'IBIFLg' => 'an', - 'IBFBl' => 'aq', - 'IBIIAo' => 'ap', - 'IBIAd' => 'as', - 'IBIAe' => 'at', - 'SFJn' => 'cd', - 'SFRJn' => 'ce', - 'SRe' => 'cf', - 'SRCk' => 'cg', - 'SSn' => 'ch', - 'SQs' => 'b6', - 'BRd' => 'cq', - 'BSt' => 'cp', - 'CDe' => 'c6', - 'CIt' => 'c4', - 'CISt' => 'ca', - 'CLd' => 'c8', - 'CRe' => 'c7', - 'CRSt' => 'cc', - 'CSt' => 'c5', - 'CUe' => 'c3', - 'CUMi' => 'c9', + 'IDBLBSe' => 'cr', + 'IBLFh' => 'ct', + 'IBLWn' => 'cu', + 'IBLWn' => 'cu', + 'SRows' => 'ck', + 'SRange' => 'cj', + 'SMPs' => 'ci', + 'SScan' => 'cl', + 'IBIRd' => 'ai', + 'IBIWr' => 'aj', + 'IBILg' => 'ak', + 'IBIFSc' => 'ah', + 'IDBRDd' => 'b2', + 'IDBRId' => 'b0', + 'IDBRRd' => 'b3', + 'IDBRUd' => 'b1', + 'IBRd' => 'ae', + 'IBCd' => 'af', + 'IBWr' => 'ag', + 'TLIe' => 'b5', + 'TLWd' => 'b4', + 'IBPse' => 'aa', + 'IBPDBp' => 'ac', + 'IBPFe' => 'ab', + 'IBPMps' => 'ad', + 'TOC' => 'bc', + 'OFs' => 'b7', + 'OTs' => 'b8', + 'OdTs' => 'b9', + 'IBSRs' => 'ay', + 'IBSWs' => 'ax', + 'IBOWs' => 'az', + 'QCs' => 'c1', + 'QCeFy' => 'bu', + 'MaCs' => 'bl', + 'MUCs' => 'bf', + 'ACs' => 'bd', + 'AdCs' => 'be', + 'TCd' => 'bi', + 'Cs' => 'bn', + 'IBTNx' => 'a5', + 'KRRs' => 'a0', + 'KRs' => 'a1', + 'KWR' => 'a2', + 'KWs' => 'a3', + 'QCQICe' => 'bz', + 'QCHs' => 'bv', + 'QCIs' => 'bw', + 'QCNCd' => 'by', + 'QCLMPs' => 'bx', + 'CTMPDTs' => 'cn', + 'CTMPTs' => 'cm', + 'CTMPFs' => 'co', + 'IBIIs' => 'au', + 'IBIMRd' => 'av', + 'IBIMs' => 'aw', + 'IBILog' => 'al', + 'IBISc' => 'am', + 'IBIFLg' => 'an', + 'IBFBl' => 'aq', + 'IBIIAo' => 'ap', + 'IBIAd' => 'as', + 'IBIAe' => 'at', + 'SFJn' => 'cd', + 'SFRJn' => 'ce', + 'SRe' => 'cf', + 'SRCk' => 'cg', + 'SSn' => 'ch', + 'SQs' => 'b6', + 'BRd' => 'cq', + 'BSt' => 'cp', + 'CDe' => 'c6', + 'CIt' => 'c4', + 'CISt' => 'ca', + 'CLd' => 'c8', + 'CRe' => 'c7', + 'CRSt' => 'cc', + 'CSt' => 'c5', + 'CUe' => 'c3', + 'CUMi' => 'c9', ); $values = array(); -foreach ($mapping as $key) -{ - $values[] = isset($map[$key]) ? $map[$key] : -1; +foreach ($mapping as $key) { + $values[] = isset($map[$key]) ? $map[$key] : (-1); } + $string = implode(':', $values); -if (!is_file($mysql_rrd)) -{ - rrdtool_create ($mysql_rrd, "--step 300 \ +if (!is_file($mysql_rrd)) { + rrdtool_create( + $mysql_rrd, + '--step 300 \ DS:IDBLBSe:GAUGE:600:0:125000000000 \ DS:IBLFh:DERIVE:600:0:125000000000 \ DS:IBLWn:DERIVE:600:0:125000000000 \ @@ -198,47 +197,45 @@ if (!is_file($mysql_rrd)) DS:CRSt:DERIVE:600:0:125000000000 \ DS:CSt:DERIVE:600:0:125000000000 \ DS:CUe:DERIVE:600:0:125000000000 \ - DS:CUMi:DERIVE:600:0:125000000000 ".$config['rrd_rra']); -} + DS:CUMi:DERIVE:600:0:125000000000 '.$config['rrd_rra'] + ); +}//end if rrdtool_update($mysql_rrd, "N:$string"); // Process state statistics - -$mysql_status_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-mysql-".$app['app_id']."-status.rrd"; +$mysql_status_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/app-mysql-'.$app['app_id'].'-status.rrd'; $mapping_status = array( - 'State_closing_tables' => 'd2', - 'State_copying_to_tmp_table' => 'd3', - 'State_end' => 'd4', - 'State_freeing_items' => 'd5', - 'State_init' => 'd6', - 'State_locked' => 'd7', - 'State_login' => 'd8', - 'State_preparing' => 'd9', - 'State_reading_from_net' => 'da', - 'State_sending_data' => 'db', - 'State_sorting_result' => 'dc', - 'State_statistics' => 'dd', - 'State_updating' => 'de', - 'State_writing_to_net' => 'df', - 'State_none' => 'dg', - 'State_other' => 'dh' + 'State_closing_tables' => 'd2', + 'State_copying_to_tmp_table' => 'd3', + 'State_end' => 'd4', + 'State_freeing_items' => 'd5', + 'State_init' => 'd6', + 'State_locked' => 'd7', + 'State_login' => 'd8', + 'State_preparing' => 'd9', + 'State_reading_from_net' => 'da', + 'State_sending_data' => 'db', + 'State_sorting_result' => 'dc', + 'State_statistics' => 'dd', + 'State_updating' => 'de', + 'State_writing_to_net' => 'df', + 'State_none' => 'dg', + 'State_other' => 'dh', ); -$values = array(); $rrd_create = ""; -foreach ($mapping_status as $desc => $id) -{ - $values[] = isset($map[$id]) ? $map[$id] : -1; - $rrd_create .= " DS:".$id.":GAUGE:600:0:125000000000"; +$values = array(); +$rrd_create = ''; +foreach ($mapping_status as $desc => $id) { + $values[] = isset($map[$id]) ? $map[$id] : (-1); + $rrd_create .= ' DS:'.$id.':GAUGE:600:0:125000000000'; } + $string = implode(':', $values); -if (!is_file($mysql_status_rrd)) -{ - rrdtool_create ($mysql_status_rrd, "--step 300 ".$rrd_create." ".$config['rrd_rra']); +if (!is_file($mysql_status_rrd)) { + rrdtool_create($mysql_status_rrd, '--step 300 '.$rrd_create.' '.$config['rrd_rra']); } rrdtool_update($mysql_status_rrd, "N:$string"); - -?> diff --git a/includes/polling/applications/nginx.inc.php b/includes/polling/applications/nginx.inc.php index 72defc804..cace17bce 100644 --- a/includes/polling/applications/nginx.inc.php +++ b/includes/polling/applications/nginx.inc.php @@ -1,38 +1,37 @@ diff --git a/includes/polling/applications/ntp-client.inc.php b/includes/polling/applications/ntp-client.inc.php index 904be6ac1..ad5ecb9a4 100644 --- a/includes/polling/applications/ntp-client.inc.php +++ b/includes/polling/applications/ntp-client.inc.php @@ -1,27 +1,26 @@ +rrdtool_update($rrd_filename, "N:$offset:$frequency:$jitter:$noise:$stability"); diff --git a/includes/polling/applications/ntpd-server.inc.php b/includes/polling/applications/ntpd-server.inc.php index 80c7441f9..1b419d45e 100644 --- a/includes/polling/applications/ntpd-server.inc.php +++ b/includes/polling/applications/ntpd-server.inc.php @@ -1,20 +1,22 @@ +rrdtool_update($rrd_filename, "N:$stratum:$offset:$frequency:$jitter:$noise:$stability:$uptime:$buffer_recv:$buffer_free:$buffer_used:$packets_drop:$packets_ignore:$packets_recv:$packets_sent"); diff --git a/includes/polling/applications/powerdns.inc.php b/includes/polling/applications/powerdns.inc.php index 7a60a966c..586ec5e48 100644 --- a/includes/polling/applications/powerdns.inc.php +++ b/includes/polling/applications/powerdns.inc.php @@ -1,22 +1,24 @@ +rrdtool_update($rrd_filename, "N:$corrupt:$def_cacheInserts:$def_cacheLookup:$latency:$pc_hit:$pc_miss:$pc_size:$qsize:$qc_hit:$qc_miss:$rec_answers:$rec_questions:$servfail:$tcp_answers:$tcp_queries:$timedout:$udp_answers:$udp_queries:$udp4_answers:$udp4_queries:$udp6_answers:$udp6_queries"); diff --git a/includes/polling/applications/shoutcast.inc.php b/includes/polling/applications/shoutcast.inc.php index 192707a25..b06431ae8 100644 --- a/includes/polling/applications/shoutcast.inc.php +++ b/includes/polling/applications/shoutcast.inc.php @@ -1,37 +1,35 @@ $server) -{ - $server = trim($server); +foreach ($servers as $item => $server) { + $server = trim($server); - if (!empty($server)) - { - $data = explode(";", $server); - list($host, $port) = split(":", $data['0'], 2); - $bitrate = $data['1']; - $traf_in = $data['2']; - $traf_out = $data['3']; - $current = $data['4']; - $status = $data['5']; - $peak = $data['6']; - $max = $data['7']; - $unique = $data['8']; - $rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-shoutcast-".$app['app_id']."-".$host."_".$port.".rrd"; + if (!empty($server)) { + $data = explode(';', $server); + list($host, $port) = split(':', $data['0'], 2); + $bitrate = $data['1']; + $traf_in = $data['2']; + $traf_out = $data['3']; + $current = $data['4']; + $status = $data['5']; + $peak = $data['6']; + $max = $data['7']; + $unique = $data['8']; + $rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/app-shoutcast-'.$app['app_id'].'-'.$host.'_'.$port.'.rrd'; - if (!is_file($rrdfile)) - { - rrdtool_create($rrdfile, "--step 300 \ + if (!is_file($rrdfile)) { + rrdtool_create( + $rrdfile, + '--step 300 \ DS:bitrate:GAUGE:600:0:125000000000 \ DS:traf_in:GAUGE:600:0:125000000000 \ DS:traf_out:GAUGE:600:0:125000000000 \ @@ -39,11 +37,10 @@ foreach ($servers as $item=>$server) DS:status:GAUGE:600:0:125000000000 \ DS:peak:GAUGE:600:0:125000000000 \ DS:max:GAUGE:600:0:125000000000 \ - DS:unique:GAUGE:600:0:125000000000 ".$config['rrd_rra']); - } + DS:unique:GAUGE:600:0:125000000000 '.$config['rrd_rra'] + ); + } - rrdtool_update($rrdfile, "N:$bitrate:$traf_in:$traf_out:$current:$status:$peak:$max:$unique"); - } -} - -?> + rrdtool_update($rrdfile, "N:$bitrate:$traf_in:$traf_out:$current:$status:$peak:$max:$unique"); + }//end if +}//end foreach diff --git a/includes/polling/cisco-ace-loadbalancer.inc.php b/includes/polling/cisco-ace-loadbalancer.inc.php index 37019e06a..54df903ef 100644 --- a/includes/polling/cisco-ace-loadbalancer.inc.php +++ b/includes/polling/cisco-ace-loadbalancer.inc.php @@ -1,65 +1,67 @@ $serverfarm) { + $clean_index = preg_replace('@\d+\."(.*?)"\.\d+@', '\\1', $index); - $clean_index = preg_replace('@\d+\."(.*?)"\.\d+@', '\\1', $index); + $oids = array( + 'cesServerFarmRserverTotalConns', + 'cesServerFarmRserverCurrentConns', + 'cesServerFarmRserverFailedConns', + ); - $oids = array ( - "cesServerFarmRserverTotalConns", - "cesServerFarmRserverCurrentConns", - "cesServerFarmRserverFailedConns"); + $db_oids = array( + $clean_index => 'farm_id', + 'cesServerFarmRserverStateDescr' => 'StateDescr', + ); - $db_oids = array($clean_index => 'farm_id', "cesServerFarmRserverStateDescr" => "StateDescr"); + if (!is_array($serverfarms[$clean_index])) { + $rserver_id = dbInsert(array('device_id' => $device['device_id'], 'farm_id' => $clean_index, 'StateDescr' => $serverfarm['cesServerFarmRserverStateDescr']), 'loadbalancer_rservers'); + } + else { + foreach ($db_oids as $db_oid => $db_value) { + $db_update[$db_value] = $serverfarm[$db_oid]; + } - if (!is_array( $serverfarms[$clean_index])) - { - $rserver_id = dbInsert(array('device_id' => $device['device_id'], 'farm_id' => $clean_index, 'StateDescr' => $serverfarm['cesServerFarmRserverStateDescr']), 'loadbalancer_rservers'); - } else { - foreach ($db_oids as $db_oid => $db_value) { - $db_update[$db_value] = $serverfarm[$db_oid]; + $updated = dbUpdate($db_update, 'loadbalancer_rservers', '`rserver_id` = ?', $serverfarm['cesServerFarmRserverFailedConns']['farm_id']); } - $updated = dbUpdate($db_update, 'loadbalancer_rservers', '`rserver_id` = ?', $serverfarm['cesServerFarmRserverFailedConns']['farm_id']); - } + $rrd_file = $config['rrd_dir'].'/'.$device['hostname'].'/rserver-'.$serverfarms[$clean_index]['rserver_id'].'.rrd'; - $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/rserver-".$serverfarms[$clean_index]['rserver_id'].".rrd"; - - foreach ($oids as $oid) - { - $oid_ds = truncate(str_replace("cesServerFarm", "", $oid), 19, ''); - $rrd_create .= " DS:$oid_ds:GAUGE:600:-1:100000000"; - } - - $rrdupdate = "N"; - - foreach ($oids as $oid) - { - if (is_numeric($serverfarm[$oid])) - { - $value = $serverfarm[$oid]; - } else { - $value = "0"; + foreach ($oids as $oid) { + $oid_ds = truncate(str_replace('cesServerFarm', '', $oid), 19, ''); + $rrd_create .= " DS:$oid_ds:GAUGE:600:-1:100000000"; } - $rrdupdate .= ":$value"; - } - $rrd_create .= " ".$config['rrd_rra']; + $rrdupdate = 'N'; - if (isset($serverfarms[$clean_index])) - { - if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } - rrdtool_update($rrd_file, $rrdupdate); - } + foreach ($oids as $oid) { + if (is_numeric($serverfarm[$oid])) { + $value = $serverfarm[$oid]; + } + else { + $value = '0'; + } -} + $rrdupdate .= ":$value"; + } + + $rrd_create .= ' '.$config['rrd_rra']; + + if (isset($serverfarms[$clean_index])) { + if (!file_exists($rrd_file)) { + rrdtool_create($rrd_file, $rrd_create); + } + + rrdtool_update($rrd_file, $rrdupdate); + } +}//end foreach unset($oids, $oid, $serverfarm); - -?> - diff --git a/includes/polling/cisco-ace-serverfarms.inc.php b/includes/polling/cisco-ace-serverfarms.inc.php index e8d5c722d..421e8cf81 100644 --- a/includes/polling/cisco-ace-serverfarms.inc.php +++ b/includes/polling/cisco-ace-serverfarms.inc.php @@ -1,67 +1,71 @@ $vserver) { + $classmap = str_replace('class-map-', '', $vserver['slbVServerClassMap']); + $classmap_id = str_replace('9.', '', $index); - $classmap = str_replace("class-map-", "", $vserver['slbVServerClassMap']); - $classmap_id = str_replace("9.", "" , $index); + $oids = array( + 'slbVServerNumberOfConnections', + 'slbVServerDroppedConnections', + 'slbVServerClientPacketCounts', + 'slbVServerClientByteCounts', + 'slbVServerPacketCounts', + 'slbVServerByteCounts', + ); - $oids = array ( - "slbVServerNumberOfConnections", - "slbVServerDroppedConnections", - "slbVServerClientPacketCounts", - "slbVServerClientByteCounts", - "slbVServerPacketCounts", - "slbVServerByteCounts"); + $db_oids = array( + $classmap_id => 'classmap_id', + $classmap => 'classmap', + 'slbVServerState' => 'serverstate', + ); - $db_oids = array($classmap_id => 'classmap_id', $classmap => 'classmap', "slbVServerState" => "serverstate"); + if (!is_array($classmaps[$classmap])) { + $classmap_in = dbInsert(array('device_id' => $device['device_id'], 'classmap_id' => $classmap_id, 'classmap' => $classmap, 'serverstate' => $vserver['slbVServerState']), 'loadbalancer_vservers'); + } + else { + foreach ($db_oids as $db_oid => $db_value) { + $db_update[$db_value] = $vserver[$db_oid]; + } - if (!is_array( $classmaps[$classmap])) - { - $classmap_in = dbInsert(array('device_id' => $device['device_id'], 'classmap_id' => $classmap_id, 'classmap' => $classmap, 'serverstate' => $vserver['slbVServerState']), 'loadbalancer_vservers'); - } else { - foreach ($db_oids as $db_oid => $db_value) - { - $db_update[$db_value] = $vserver[$db_oid]; + $updated = dbUpdate($db_update, 'loadbalancer_vservers', '`classmap_id` = ?', $vserver['slbVServerState']['classmap']); } - $updated = dbUpdate($db_update, 'loadbalancer_vservers', '`classmap_id` = ?', $vserver['slbVServerState']['classmap']); - } + $rrd_file = $config['rrd_dir'].'/'.$device['hostname'].'/vserver-'.$classmap_id.'.rrd'; + $rrd_create = $config['rrd_rra']; - $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/vserver-".$classmap_id.".rrd"; - $rrd_create = $config['rrd_rra']; - - foreach ($oids as $oid) - { - $oid_ds = truncate(str_replace("slbVServer", "", $oid), 19, ''); - $rrd_create .= " DS:$oid_ds:COUNTER:600:U:1000000000"; - } - - $rrdupdate = "N"; - - foreach ($oids as $oid) - { - if (is_numeric($vserver[$oid])) - { - $value = $vserver[$oid]; - } else { - $value = "0"; + foreach ($oids as $oid) { + $oid_ds = truncate(str_replace('slbVServer', '', $oid), 19, ''); + $rrd_create .= " DS:$oid_ds:COUNTER:600:U:1000000000"; } - $rrdupdate .= ":$value"; - } - if (isset($classmaps[$classmap])) - { - if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } - rrdtool_update($rrd_file, $rrdupdate); - } -} + $rrdupdate = 'N'; + + foreach ($oids as $oid) { + if (is_numeric($vserver[$oid])) { + $value = $vserver[$oid]; + } + else { + $value = '0'; + } + + $rrdupdate .= ":$value"; + } + + if (isset($classmaps[$classmap])) { + if (!file_exists($rrd_file)) { + rrdtool_create($rrd_file, $rrd_create); + } + + rrdtool_update($rrd_file, $rrdupdate); + } +}//end foreach unset($oids, $oid, $vserver); - -?> diff --git a/includes/polling/cisco-sla.inc.php b/includes/polling/cisco-sla.inc.php index 2dcb6cd05..a54936073 100644 --- a/includes/polling/cisco-sla.inc.php +++ b/includes/polling/cisco-sla.inc.php @@ -1,64 +1,64 @@ + rrdtool_update($slarrd, $ts.':'.$val); + echo "\n"; +}//end foreach diff --git a/includes/polling/entity-physical.inc.php b/includes/polling/entity-physical.inc.php index 0b04e9b31..43aba44ca 100644 --- a/includes/polling/entity-physical.inc.php +++ b/includes/polling/entity-physical.inc.php @@ -1,96 +1,96 @@ $entry) + { + $group = 'c6kxbar'; + foreach ($entry as $key => $value) { + $subindex = null; + $entPhysical_state[$index][$subindex][$group][$key] = $value; + } + } - foreach ($mod_stats as $index => $entry) - { - $group = 'c6kxbar'; - foreach ($entry as $key => $value) - { - $subindex = NULL; - $entPhysical_state[$index][$subindex][$group][$key] = $value; - } - } + foreach ($chan_stats as $index => $entry) + { + list($index,$subindex) = explode('.', $index, 2); + $group = 'c6kxbar'; + foreach ($entry as $key => $value) { + $entPhysical_state[$index][$subindex][$group][$key] = $value; + } - foreach ($chan_stats as $index => $entry) - { - list($index,$subindex) = explode(".", $index, 2); - $group = 'c6kxbar'; - foreach ($entry as $key => $value) - { - $entPhysical_state[$index][$subindex][$group][$key] = $value; - } + $chan_update = $entry['cc6kxbarStatisticsInUtil']; + $chan_update .= ':'.$entry['cc6kxbarStatisticsOutUtil']; + $chan_update .= ':'.$entry['cc6kxbarStatisticsOutDropped']; + $chan_update .= ':'.$entry['cc6kxbarStatisticsOutErrors']; + $chan_update .= ':'.$entry['cc6kxbarStatisticsInErrors']; - $chan_update = $entry['cc6kxbarStatisticsInUtil']; - $chan_update .= ":".$entry['cc6kxbarStatisticsOutUtil']; - $chan_update .= ":".$entry['cc6kxbarStatisticsOutDropped']; - $chan_update .= ":".$entry['cc6kxbarStatisticsOutErrors']; - $chan_update .= ":".$entry['cc6kxbarStatisticsInErrors']; + $rrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('c6kxbar-'.$index.'-'.$subindex.'.rrd'); - $rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("c6kxbar-".$index."-".$subindex.".rrd"); + if ($debug) { + echo "$rrd "; + } - if ($debug) { echo("$rrd "); } - - if (!is_file($rrd)) - { - rrdtool_create ($rrd, "--step 300 \ + if (!is_file($rrd)) { + rrdtool_create( + $rrd, + '--step 300 \ DS:inutil:GAUGE:600:0:100 \ DS:oututil:GAUGE:600:0:100 \ DS:outdropped:DERIVE:600:0:125000000000 \ DS:outerrors:DERIVE:600:0:125000000000 \ - DS:inerrors:DERIVE:600:0:125000000000 ".$config['rrd_rra']); - } + DS:inerrors:DERIVE:600:0:125000000000 '.$config['rrd_rra'] + ); + } - rrdtool_update($rrd,"N:$chan_update"); + rrdtool_update($rrd, "N:$chan_update"); + }//end foreach - } - -#print_r($entPhysical_state); - -} + // print_r($entPhysical_state); +}//end if // Set Entity state -foreach (dbFetch("SELECT * FROM `entPhysical_state` WHERE `device_id` = ?", array($device['device_id'])) as $entity) -{ - if (!isset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']])) - { - dbDelete('entPhysical_state', "`device_id` = ? AND `entPhysicalIndex` = ? AND `subindex` = ? AND `group` = ? AND `key` = ?", - array($device['device_id'], $entity['entPhysicalIndex'], $entity['subindex'], $entity['group'], $entity['key'])); - } else { - if ($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] != $entity['value']) - { - echo("no match!"); +foreach (dbFetch('SELECT * FROM `entPhysical_state` WHERE `device_id` = ?', array($device['device_id'])) as $entity) { + if (!isset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']])) { + dbDelete( + 'entPhysical_state', + '`device_id` = ? AND `entPhysicalIndex` = ? AND `subindex` = ? AND `group` = ? AND `key` = ?', + array( + $device['device_id'], + $entity['entPhysicalIndex'], + $entity['subindex'], + $entity['group'], + $entity['key'], + ) + ); } - unset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']]); - } -} + else { + if ($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] != $entity['value']) { + echo 'no match!'; + } + + unset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']]); + } +}//end foreach + // End Set Entity Attrivs - // Delete Entity state -foreach ($entPhysical_state as $epi => $entity) -{ - foreach ($entity as $subindex => $si) - { - foreach ($si as $group => $ti) - { - foreach ($ti as $key => $value) - { - dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $epi, 'subindex' => $subindex, 'group' => $group, 'key' => $key, 'value' => $value), 'entPhysical_state'); - } +foreach ($entPhysical_state as $epi => $entity) { + foreach ($entity as $subindex => $si) { + foreach ($si as $group => $ti) { + foreach ($ti as $key => $value) { + dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $epi, 'subindex' => $subindex, 'group' => $group, 'key' => $key, 'value' => $value), 'entPhysical_state'); + } + } } - } } + // End Delete Entity state - -echo("\n"); - -?> +echo "\n"; diff --git a/includes/polling/mempools/avaya-ers.inc.php b/includes/polling/mempools/avaya-ers.inc.php index 219779938..6d40b5214 100644 --- a/includes/polling/mempools/avaya-ers.inc.php +++ b/includes/polling/mempools/avaya-ers.inc.php @@ -1,19 +1,15 @@ diff --git a/includes/polling/mempools/fortigate.inc.php b/includes/polling/mempools/fortigate.inc.php index 0b2a9323b..0001b40f8 100644 --- a/includes/polling/mempools/fortigate.inc.php +++ b/includes/polling/mempools/fortigate.inc.php @@ -2,14 +2,11 @@ // Simple hard-coded poller for Fortinet Fortigate // Yes, it really can be this simple. +echo 'Fortigate MemPool'; -echo "Fortigate MemPool"; +$mempool['perc'] = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysMemUsage.0', '-OvQ'); +$mempool['total'] = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysMemCapacity.0', '-OvQ'); +$mempool['used'] = ($mempool['total'] * ($mempool['perc'] / 100)); +$mempool['free'] = ($mempool['total'] - $mempool['used']); -$mempool['perc'] = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemUsage.0", "-OvQ"); -$mempool['total'] = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemCapacity.0", "-OvQ"); -$mempool['used'] = $mempool['total'] * ($mempool['perc']/100); -$mempool['free'] = $mempool['total'] - $mempool['used']; - -echo "(U: ".$mempool['used']." T: ".$mempool['total']." F: ".$mempool['free'].") "; - -?> \ No newline at end of file +echo '(U: '.$mempool['used'].' T: '.$mempool['total'].' F: '.$mempool['free'].') '; diff --git a/includes/polling/mempools/hpLocal.inc.php b/includes/polling/mempools/hpLocal.inc.php index 40647e895..c503cbe11 100644 --- a/includes/polling/mempools/hpLocal.inc.php +++ b/includes/polling/mempools/hpLocal.inc.php @@ -1,28 +1,27 @@ \ No newline at end of file diff --git a/includes/polling/mempools/netscaler.inc.php b/includes/polling/mempools/netscaler.inc.php index bcf681515..ffa8ec0e2 100644 --- a/includes/polling/mempools/netscaler.inc.php +++ b/includes/polling/mempools/netscaler.inc.php @@ -1,16 +1,12 @@ +$mempool['total'] = (snmp_get($device, '.1.3.6.1.4.1.5951.4.1.1.41.4.0', '-OvQ') * 1047552); +$mempool['perc'] = snmp_get($device, '.1.3.6.1.4.1.5951.4.1.1.41.2.0', '-OvQ'); +$mempool['used'] = ($mempool['total'] / 100 * $mempool['perc']); +$mempool['free'] = ($mempool['total'] - $mempool['used']); diff --git a/includes/polling/mempools/vrp.inc.php b/includes/polling/mempools/vrp.inc.php index 64f1611f1..5345e3a73 100644 --- a/includes/polling/mempools/vrp.inc.php +++ b/includes/polling/mempools/vrp.inc.php @@ -2,25 +2,30 @@ $oid = $mempool['mempool_index']; -if($debug) {echo("Huawei VRP Mempool");} +if ($debug) { + echo 'Huawei VRP Mempool'; +} -if(!is_array($mempool_cache['vrp'])) { - if ($debug) {echo("caching");} - $mempool_cache['vrp'] = array(); - $mempool_cache['vrp'] = snmpwalk_cache_multi_oid($device, "hwEntityMemSize", $mempool_cache['vrp'], "HUAWEI-ENTITY-EXTENT-MIB" , $config['install_dir']."/mibs"); - $mempool_cache['vrp'] = snmpwalk_cache_multi_oid($device, "hwEntityMemUsage", $mempool_cache['vrp'], "HUAWEI-ENTITY-EXTENT-MIB" , $config['install_dir']."/mibs"); - if ($debug) {print_r($mempool_cache);} +if (!is_array($mempool_cache['vrp'])) { + if ($debug) { + echo 'caching'; + } + + $mempool_cache['vrp'] = array(); + $mempool_cache['vrp'] = snmpwalk_cache_multi_oid($device, 'hwEntityMemSize', $mempool_cache['vrp'], 'HUAWEI-ENTITY-EXTENT-MIB', $config['install_dir'].'/mibs'); + $mempool_cache['vrp'] = snmpwalk_cache_multi_oid($device, 'hwEntityMemUsage', $mempool_cache['vrp'], 'HUAWEI-ENTITY-EXTENT-MIB', $config['install_dir'].'/mibs'); + if ($debug) { + print_r($mempool_cache); + } } $entry = $mempool_cache['vrp'][$mempool[mempool_index]]; -if ( $entry['hwEntityMemSize'] < 0 ) { -$entry['hwEntityMemSize'] = $entry['hwEntityMemSize'] * -1; +if ($entry['hwEntityMemSize'] < 0) { + $entry['hwEntityMemSize'] = ($entry['hwEntityMemSize'] * -1); } -$perc = $entry['hwEntityMemUsage']; +$perc = $entry['hwEntityMemUsage']; $mempool['total'] = $entry['hwEntityMemSize']; -$mempool['used'] = $entry['hwEntityMemSize'] / 100 * $perc; -$mempool['free'] = $entry['hwEntityMemSize'] - $mempool['used']; - -?> +$mempool['used'] = ($entry['hwEntityMemSize'] / 100 * $perc); +$mempool['free'] = ($entry['hwEntityMemSize'] - $mempool['used']); diff --git a/includes/polling/netscaler-stats.inc.php b/includes/polling/netscaler-stats.inc.php index eccad01a4..5db1724b8 100644 --- a/includes/polling/netscaler-stats.inc.php +++ b/includes/polling/netscaler-stats.inc.php @@ -1,69 +1,136 @@ diff --git a/includes/polling/netscaler-vsvr.inc.php b/includes/polling/netscaler-vsvr.inc.php index cc2cd99c9..f6a462f21 100644 --- a/includes/polling/netscaler-vsvr.inc.php +++ b/includes/polling/netscaler-vsvr.inc.php @@ -1,120 +1,142 @@ $vsvr) - { - if (isset($vsvr['vsvrName'])) - { - $vsvr_exist[$vsvr['vsvrName']] = 1; - $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netscaler-vsvr-".safename($vsvr['vsvrName']).".rrd"; - $rrdupdate = "N"; + foreach ($vsvr_array as $index => $vsvr) { + if (isset($vsvr['vsvrName'])) { + $vsvr_exist[$vsvr['vsvrName']] = 1; + $rrd_file = $config['rrd_dir'].'/'.$device['hostname'].'/netscaler-vsvr-'.safename($vsvr['vsvrName']).'.rrd'; + $rrdupdate = 'N'; - foreach ($oids as $oid) - { - if (is_numeric($vsvr[$oid])) - { - $rrdupdate .= ":".$vsvr[$oid]; - } else { - $rrdupdate .= ":U"; + foreach ($oids as $oid) { + if (is_numeric($vsvr[$oid])) { + $rrdupdate .= ':'.$vsvr[$oid]; + } + else { + $rrdupdate .= ':U'; + } + } + + echo str_pad($vsvr['vsvrName'], 25).' | '.str_pad($vsvr['vsvrType'], 5).' | '.str_pad($vsvr['vsvrState'], 6).' | '.str_pad($vsvr['vsvrIpAddress'], 16).' | '.str_pad($vsvr['vsvrPort'], 5); + echo ' | '.str_pad($vsvr['vsvrRequestRate'], 8).' | '.str_pad($vsvr['vsvrRxBytesRate'].'B/s', 8).' | '.str_pad($vsvr['vsvrTxBytesRate'].'B/s', 8); + + $db_update = array( + 'vsvr_ip' => $vsvr['vsvrIpAddress'], + 'vsvr_port' => $vsvr['vsvrPort'], + 'vsvr_state' => $vsvr['vsvrState'], + 'vsvr_type' => $vsvr['vsvrType'], + 'vsvr_req_rate' => $vsvr['RequestRate'], + 'vsvr_bps_in' => $vsvr['vsvrRxBytesRate'], + 'vsvr_bps_out' => $vsvr['vsvrTxBytesRate'], + ); + + if (!is_array($vsvrs[$vsvr['vsvrName']])) { + $db_insert = array_merge(array('device_id' => $device['device_id'], 'vsvr_name' => $vsvr['vsvrName']), $db_update); + $vsvr_id = dbInsert($db_insert, 'netscaler_vservers'); + echo ' +'; + } + else { + $updated = dbUpdate($db_update, 'netscaler_vservers', '`vsvr_id` = ?', array($vsvrs[$vsvr['vsvrName']]['vsvr_id'])); + echo ' U'; + } + + if (!file_exists($rrd_file)) { + rrdtool_create($rrd_file, $rrd_create); + } + + rrdtool_update($rrd_file, $rrdupdate); + + echo "\n"; + }//end if + }//end foreach + + if ($debug) { + print_r($vsvr_exist); + } + + foreach ($vsvrs as $db_name => $db_id) { + if (!$vsvr_exist[$db_name]) { + echo '-'.$db_name; + dbDelete('netscaler_vservers', '`vsvr_id` = ?', array($db_id)); } - } - - echo(str_pad($vsvr['vsvrName'], 25) . " | " . str_pad($vsvr['vsvrType'],5) . " | " . str_pad($vsvr['vsvrState'],6) ." | ". str_pad($vsvr['vsvrIpAddress'],16) ." | ". str_pad($vsvr['vsvrPort'],5)); - echo(" | " . str_pad($vsvr['vsvrRequestRate'],8) . " | " . str_pad($vsvr['vsvrRxBytesRate']."B/s", 8)." | ". str_pad($vsvr['vsvrTxBytesRate']."B/s", 8)); - - $db_update = array('vsvr_ip' => $vsvr['vsvrIpAddress'], 'vsvr_port' => $vsvr['vsvrPort'], 'vsvr_state' => $vsvr['vsvrState'], 'vsvr_type' => $vsvr['vsvrType'], - 'vsvr_req_rate' => $vsvr['RequestRate'], 'vsvr_bps_in' => $vsvr['vsvrRxBytesRate'], 'vsvr_bps_out' => $vsvr['vsvrTxBytesRate']); - - if (!is_array($vsvrs[$vsvr['vsvrName']])) - { - $db_insert = array_merge(array('device_id' => $device['device_id'], 'vsvr_name' => $vsvr['vsvrName']), $db_update); - $vsvr_id = dbInsert($db_insert, 'netscaler_vservers'); echo(" +"); - } else { - $updated = dbUpdate($db_update, 'netscaler_vservers', '`vsvr_id` = ?', array($vsvrs[$vsvr['vsvrName']]['vsvr_id'])); - echo(" U"); - } - - if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } - rrdtool_update($rrd_file, $rrdupdate); - - echo("\n"); } - - } - - if ($debug) { print_r($vsvr_exist); } - - foreach ($vsvrs as $db_name => $db_id) - { - if (!$vsvr_exist[$db_name]) - { - echo("-".$db_name); - dbDelete('netscaler_vservers', "`vsvr_id` = ?", array($db_id)); - } - } -} - -?> +}//end if diff --git a/includes/polling/os.inc.php b/includes/polling/os.inc.php index cd3da2861..fcbf24a65 100644 --- a/includes/polling/os.inc.php +++ b/includes/polling/os.inc.php @@ -1,50 +1,40 @@ ".$version, $device, 'system'); +if ($version && $device['version'] != $version) { + $update_array['version'] = $version; + log_event('OS Version -> '.$version, $device, 'system'); } -if ($features != $device['features']) -{ - $update_array['features'] = $features; - log_event("OS Features -> ".$features, $device, 'system'); +if ($features != $device['features']) { + $update_array['features'] = $features; + log_event('OS Features -> '.$features, $device, 'system'); } -if ($hardware && $hardware != $device['hardware']) -{ - $update_array['hardware'] = $hardware; - log_event("Hardware -> ".$hardware, $device, 'system'); +if ($hardware && $hardware != $device['hardware']) { + $update_array['hardware'] = $hardware; + log_event('Hardware -> '.$hardware, $device, 'system'); } -if ($serial && $serial != $device['serial']) -{ - $update_array['serial'] = $serial; - log_event("Serial -> ".$serial, $device, 'system'); +if ($serial && $serial != $device['serial']) { + $update_array['serial'] = $serial; + log_event('Serial -> '.$serial, $device, 'system'); } -if ($icon && $icon != $device['icon']) -{ - $update_array['icon'] = $icon; - log_event("Icon -> ".$icon, $device, 'system'); +if ($icon && $icon != $device['icon']) { + $update_array['icon'] = $icon; + log_event('Icon -> '.$icon, $device, 'system'); } -echo("\nHardware: ".$hardware." Version: ".$version." Features: ".$features." Serial: ".$serial."\n"); - -?> +echo "\nHardware: ".$hardware.' Version: '.$version.' Features: '.$features.' Serial: '.$serial."\n"; diff --git a/includes/polling/os/acsw.inc.php b/includes/polling/os/acsw.inc.php index ecd1daf24..a3a6f2a13 100644 --- a/includes/polling/os/acsw.inc.php +++ b/includes/polling/os/acsw.inc.php @@ -1,54 +1,50 @@ +// if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; } +if (strpos($poll_device['sysDescr'], 'IOS XR')) { + list(,$version) = explode(',', $poll_device['sysDescr']); + $version = trim($version); + list(,$version) = explode(' ', $version); + list($version) = explode("\n", $version); + trim($version); +} diff --git a/includes/polling/os/airport.inc.php b/includes/polling/os/airport.inc.php index 365d25483..0f8fd2bfc 100644 --- a/includes/polling/os/airport.inc.php +++ b/includes/polling/os/airport.inc.php @@ -1,5 +1,3 @@ \ No newline at end of file +$version = snmp_get($device, 'sysConfFirmwareVersion.0', '-Ovq', 'AIRPORT-BASESTATION-3-MIB'); diff --git a/includes/polling/os/allied.inc.php b/includes/polling/os/allied.inc.php index 506cb1063..e83282078 100644 --- a/includes/polling/os/allied.inc.php +++ b/includes/polling/os/allied.inc.php @@ -1,52 +1,41 @@ \ No newline at end of file +$version = str_replace('"', '', $version); +$features = str_replace('"', '', $features); +$hardware = str_replace('"', '', $hardware); diff --git a/includes/polling/os/areca.inc.php b/includes/polling/os/areca.inc.php index 3f6664165..e1442a2de 100644 --- a/includes/polling/os/areca.inc.php +++ b/includes/polling/os/areca.inc.php @@ -1,18 +1,21 @@ \ No newline at end of file +$version = trim(snmp_get($device, '1.3.6.1.4.1.18928.1.1.1.4.0', '-OQv', '', ''), '"'); +if (!$version) { + $version = trim(snmp_get($device, '1.3.6.1.4.1.18928.1.2.1.4.0', '-OQv', '', ''), '"'); +} + +$serial = trim(snmp_get($device, '1.3.6.1.4.1.18928.1.1.1.3.0', '-OQv', '', ''), '"'); +if (!$serial) { + $serial = trim(snmp_get($device, '1.3.6.1.4.1.18928.1.2.1.3.0', '-OQv', '', ''), '"'); +} + +if (isHexString($serial)) { + // Sometimes firmware outputs serial as hex-string + $serial = snmp_hexstring($serial); +} diff --git a/includes/polling/os/arubaos.inc.php b/includes/polling/os/arubaos.inc.php index b3c85a863..784ed7ee0 100644 --- a/includes/polling/os/arubaos.inc.php +++ b/includes/polling/os/arubaos.inc.php @@ -1,22 +1,26 @@ +echo "\n"; + +if ($aruba_info[0]['wlsxSwitchRole'] == 'master') { + $features = 'Master Controller'; +} +else { + $features = 'Local Controller for '.$aruba_info[0]['wlsxSwitchMasterIp']; +} diff --git a/includes/polling/os/avaya-ers.inc.php b/includes/polling/os/avaya-ers.inc.php index af2e9ae4a..163c82c18 100644 --- a/includes/polling/os/avaya-ers.inc.php +++ b/includes/polling/os/avaya-ers.inc.php @@ -1,42 +1,40 @@ 1) { - $features = "Stack of $stack_size units"; + $features = "Stack of $stack_size units"; } -$version = str_replace("\"","", $version); -$features = str_replace("\"","", $features); -$hardware = str_replace("\"","", $hardware); - -?> +$version = str_replace('"', '', $version); +$features = str_replace('"', '', $features); +$hardware = str_replace('"', '', $hardware); diff --git a/includes/polling/os/avocent.inc.php b/includes/polling/os/avocent.inc.php index 23f480b30..2646c66ec 100644 --- a/includes/polling/os/avocent.inc.php +++ b/includes/polling/os/avocent.inc.php @@ -1,11 +1,8 @@ diff --git a/includes/polling/os/bnt.inc.php b/includes/polling/os/bnt.inc.php index 943cdf017..89e0d8ea7 100644 --- a/includes/polling/os/bnt.inc.php +++ b/includes/polling/os/bnt.inc.php @@ -2,9 +2,6 @@ preg_match('/Blade Network Technologies (.*)$/', $poll_device['sysDescr'], $store); -if (isset($store[1])) -{ - $hardware = $store[1]; +if (isset($store[1])) { + $hardware = $store[1]; } - -?> \ No newline at end of file diff --git a/includes/polling/os/brother.inc.php b/includes/polling/os/brother.inc.php index 98f0eab75..442fe1e36 100644 --- a/includes/polling/os/brother.inc.php +++ b/includes/polling/os/brother.inc.php @@ -1,45 +1,41 @@ \ No newline at end of file +// Strip off useless brand fields +$hardware = str_replace('Brother ', '', $hardware); +$hardware = str_ireplace(' series', '', $hardware); + +if (isHexString($serial)) { + // Sometimes firmware outputs serial as hex-string + $serial = snmp_hexstring($serial); +} diff --git a/includes/polling/os/dell-laser.inc.php b/includes/polling/os/dell-laser.inc.php index e3ba6f013..05be449b8 100644 --- a/includes/polling/os/dell-laser.inc.php +++ b/includes/polling/os/dell-laser.inc.php @@ -1,37 +1,30 @@ \ No newline at end of file diff --git a/includes/polling/os/drac.inc.php b/includes/polling/os/drac.inc.php index f99269d4e..8974a44e3 100644 --- a/includes/polling/os/drac.inc.php +++ b/includes/polling/os/drac.inc.php @@ -1,7 +1,5 @@ \ No newline at end of file +$version = trim(snmp_get($device, '.1.3.6.1.4.1.674.10892.2.1.2.1.0', '-OQv'), '"'); +$hardware = trim(snmp_get($device, '.1.3.6.1.4.1.674.10892.2.1.1.2.0', '-OQv'), '"'); +$serial = trim(snmp_get($device, '.1.3.6.1.4.1.674.10892.2.1.1.11.0', '-OQv'), '"'); diff --git a/includes/polling/os/extremeware.inc.php b/includes/polling/os/extremeware.inc.php index 00d92c2d5..94509495a 100644 --- a/includes/polling/os/extremeware.inc.php +++ b/includes/polling/os/extremeware.inc.php @@ -1,46 +1,40 @@ +$version = str_replace('"', '', $version); +$features = str_replace('"', '', $features); +$hardware = str_replace('"', '', $hardware); diff --git a/includes/polling/os/fabos.inc.php b/includes/polling/os/fabos.inc.php index 90c08e986..b4feb9abb 100644 --- a/includes/polling/os/fabos.inc.php +++ b/includes/polling/os/fabos.inc.php @@ -1,6 +1,4 @@ +$version = trim(snmp_get($device, '1.3.6.1.4.1.1588.2.1.1.1.1.6.0', '-Ovq'), '"'); +$hardware = trim(snmp_get($device, 'ENTITY-MIB::entPhysicalDescr.1', '-Ovq'), '"'); diff --git a/includes/polling/os/firebox.inc.php b/includes/polling/os/firebox.inc.php index 72a3adebc..dbe5d7f79 100644 --- a/includes/polling/os/firebox.inc.php +++ b/includes/polling/os/firebox.inc.php @@ -1,10 +1,8 @@ \ No newline at end of file +$version = (isset($matches[1]) ? $matches[1] : ''); +// $hardware = "Still need to figger hardware out!"; +// $serial = "Still need to figger serial out!"; +// $features = "Still need to figger features out!"; diff --git a/includes/polling/os/ftos.inc.php b/includes/polling/os/ftos.inc.php index 3e7e5ca49..f24e264d8 100644 --- a/includes/polling/os/ftos.inc.php +++ b/includes/polling/os/ftos.inc.php @@ -1,55 +1,44 @@ +$version = str_replace('"', '', $version); +$features = str_replace('"', '', $features); +$hardware = str_replace('"', '', $hardware); diff --git a/includes/polling/os/ies.inc.php b/includes/polling/os/ies.inc.php index f63a822bc..da679f4a4 100644 --- a/includes/polling/os/ies.inc.php +++ b/includes/polling/os/ies.inc.php @@ -1,8 +1,6 @@ \ No newline at end of file diff --git a/includes/polling/os/ipoman.inc.php b/includes/polling/os/ipoman.inc.php index 294db2c46..2e72f13d5 100644 --- a/includes/polling/os/ipoman.inc.php +++ b/includes/polling/os/ipoman.inc.php @@ -1,10 +1,13 @@ \ No newline at end of file +if ($matches[2]) { + $serial = $matches[2]; +} diff --git a/includes/polling/os/ironware.inc.php b/includes/polling/os/ironware.inc.php index 5a59932fc..e7a2406f0 100644 --- a/includes/polling/os/ironware.inc.php +++ b/includes/polling/os/ironware.inc.php @@ -1,15 +1,19 @@ +$version = str_replace('V', '', $version); +$version = str_replace('"', '', $version); diff --git a/includes/polling/os/jetdirect.inc.php b/includes/polling/os/jetdirect.inc.php index 370ef363e..323ec81c3 100644 --- a/includes/polling/os/jetdirect.inc.php +++ b/includes/polling/os/jetdirect.inc.php @@ -1,31 +1,25 @@ \ No newline at end of file diff --git a/includes/polling/os/junos.inc.php b/includes/polling/os/junos.inc.php index 3066e25af..dc698106e 100644 --- a/includes/polling/os/junos.inc.php +++ b/includes/polling/os/junos.inc.php @@ -1,19 +1,17 @@ \ No newline at end of file +list($version) = explode(']', $jun_ver); +list(,$version) = explode('[', $version); +$features = ''; diff --git a/includes/polling/os/junose.inc.php b/includes/polling/os/junose.inc.php index f434cf02a..e51eabb3e 100644 --- a/includes/polling/os/junose.inc.php +++ b/includes/polling/os/junose.inc.php @@ -1,22 +1,18 @@ \ No newline at end of file +list($version) = explode(' ', $junose_version); +list(,$version) = explode('(', $version); +list($features) = explode(']', $junose_version); +list(,$features) = explode('[', $features); diff --git a/includes/polling/os/jwos.inc.php b/includes/polling/os/jwos.inc.php index 91b649bfd..689d03335 100644 --- a/includes/polling/os/jwos.inc.php +++ b/includes/polling/os/jwos.inc.php @@ -1,16 +1,13 @@ \ No newline at end of file +$hardware = snmp_get($device, 'jnxWxChassisType.0', '-Ovq', 'JUNIPER-WX-GLOBAL-REG'); +$hardware = strtoupper(str_replace('jnx', '', $hardware)); +$hardware .= ' '.snmp_get($device, 'jnxWxSysHwVersion.0', '-Ovq', 'JUNIPER-WX-GLOBAL-REG'); diff --git a/includes/polling/os/konica.inc.php b/includes/polling/os/konica.inc.php index fe94a8d86..2ecac249f 100644 --- a/includes/polling/os/konica.inc.php +++ b/includes/polling/os/konica.inc.php @@ -1,13 +1,11 @@ \ No newline at end of file diff --git a/includes/polling/os/kyocera.inc.php b/includes/polling/os/kyocera.inc.php index 4931342cf..3ff7a2f40 100644 --- a/includes/polling/os/kyocera.inc.php +++ b/includes/polling/os/kyocera.inc.php @@ -1,14 +1,11 @@ \ No newline at end of file +// SNMPv2-SMI::enterprises.1347.43.5.4.1.5.1.1 = STRING: "2H9_2F00.002.002" +$version = trim(snmp_get($device, '1.3.6.1.4.1.1347.43.5.4.1.5.1.1', '-OQv', '', ''), '" '); diff --git a/includes/polling/os/mgeups.inc.php b/includes/polling/os/mgeups.inc.php index 7d0bac261..f1cd43c92 100644 --- a/includes/polling/os/mgeups.inc.php +++ b/includes/polling/os/mgeups.inc.php @@ -1,14 +1,11 @@ \ No newline at end of file +$serial = trim(snmp_get($device, 'upsmgIdentSerialNumber.0', '-OQv', 'MG-SNMP-UPS-MIB'), '" '); diff --git a/includes/polling/os/minkelsrms.inc.php b/includes/polling/os/minkelsrms.inc.php index a7bc0b4c6..9922a2e16 100644 --- a/includes/polling/os/minkelsrms.inc.php +++ b/includes/polling/os/minkelsrms.inc.php @@ -1,7 +1,4 @@ \ No newline at end of file +// AKCP clone +require 'includes/polling/os/akcp.inc.php'; diff --git a/includes/polling/os/netmanplus.inc.php b/includes/polling/os/netmanplus.inc.php index 5b76ea3d4..e209c6a37 100644 --- a/includes/polling/os/netmanplus.inc.php +++ b/includes/polling/os/netmanplus.inc.php @@ -1,5 +1,3 @@ \ No newline at end of file +$version = trim(snmp_get($device, '1.3.6.1.2.1.33.1.1.3.0', '-OQv', 'UPS-MIB'), '"'); diff --git a/includes/polling/os/netscaler.inc.php b/includes/polling/os/netscaler.inc.php index 48cc359e3..d1677471e 100644 --- a/includes/polling/os/netscaler.inc.php +++ b/includes/polling/os/netscaler.inc.php @@ -1,16 +1,13 @@ +require 'includes/polling/netscaler-stats.inc.php'; diff --git a/includes/polling/os/nrg.inc.php b/includes/polling/os/nrg.inc.php index e46a27001..fdb861830 100644 --- a/includes/polling/os/nrg.inc.php +++ b/includes/polling/os/nrg.inc.php @@ -1,17 +1,14 @@ +// SNMPv2-SMI::enterprises.367.3.2.1.2.1.4.0 = STRING: "M6394300657" +// $serial = trim(snmp_get($device, "1.3.6.1.4.1.367.3.2.1.2.1.4.0", "-OQv", "", ""),'" '); diff --git a/includes/polling/os/okilan.inc.php b/includes/polling/os/okilan.inc.php index 6cf8b486a..6c71798f1 100644 --- a/includes/polling/os/okilan.inc.php +++ b/includes/polling/os/okilan.inc.php @@ -1,10 +1,7 @@ \ No newline at end of file +// Strip off useless brand fields +$hardware = str_replace('OKI ', '', $hardware); diff --git a/includes/polling/os/panos.inc.php b/includes/polling/os/panos.inc.php index a76793aad..e61a64dd8 100644 --- a/includes/polling/os/panos.inc.php +++ b/includes/polling/os/panos.inc.php @@ -1,21 +1,18 @@ diff --git a/includes/polling/os/poweralert.inc.php b/includes/polling/os/poweralert.inc.php index 8b5ad0a8e..41349cef5 100644 --- a/includes/polling/os/poweralert.inc.php +++ b/includes/polling/os/poweralert.inc.php @@ -1,17 +1,14 @@ +$sysLocation = trim(snmp_get($device, '.1.3.6.1.4.1.850.10.2.2.1.12.1', '-Ovq', 'TRIPPLITE-MIB'), '"'); +$sysName = trim(snmp_get($device, '.1.3.6.1.2.1.33.1.1.5.0', '-Ovq', 'TRIPPLITE-MIB'), '"'); +$serial = trim(snmp_get($device, '.1.3.6.1.4.1.850.100.1.1.4.0', '-Ovq', 'TRIPPLITE-MIB'), '"'); +$version = snmp_get($device, 'upsIdentAgentSoftwareVersion.0', '-Ovq', 'UPS-MIB'); diff --git a/includes/polling/os/powerconnect.inc.php b/includes/polling/os/powerconnect.inc.php index 4646e10bd..97de6124e 100644 --- a/includes/polling/os/powerconnect.inc.php +++ b/includes/polling/os/powerconnect.inc.php @@ -1,12 +1,9 @@ \ No newline at end of file diff --git a/includes/polling/os/powervault.inc.php b/includes/polling/os/powervault.inc.php index 3cb155875..fc5c7e01a 100644 --- a/includes/polling/os/powervault.inc.php +++ b/includes/polling/os/powervault.inc.php @@ -1,5 +1,3 @@ \ No newline at end of file +$version = trim(snmp_get($device, '1.3.6.1.4.1.674.10893.2.102.3.1.1.9.1', '-OQv', '', ''), '"'); diff --git a/includes/polling/os/radlan.inc.php b/includes/polling/os/radlan.inc.php index ade5a8893..aa0da3818 100644 --- a/includes/polling/os/radlan.inc.php +++ b/includes/polling/os/radlan.inc.php @@ -1,22 +1,19 @@ \ No newline at end of file +$version = str_replace('"', '', $version); +$features = str_replace('"', '', $features); +$hardware = str_replace('"', '', $hardware); diff --git a/includes/polling/os/ricoh.inc.php b/includes/polling/os/ricoh.inc.php index a72773159..10172afcb 100644 --- a/includes/polling/os/ricoh.inc.php +++ b/includes/polling/os/ricoh.inc.php @@ -1,12 +1,10 @@ \ No newline at end of file +// SNMPv2-SMI::enterprises.367.3.2.1.2.1.4.0 = STRING: "M6394300657" +$serial = trim(snmp_get($device, '1.3.6.1.4.1.367.3.2.1.2.1.4.0', '-OQv', '', ''), '" '); diff --git a/includes/polling/os/sonicwall.inc.php b/includes/polling/os/sonicwall.inc.php index 556a3fa3f..b11150cf1 100644 --- a/includes/polling/os/sonicwall.inc.php +++ b/includes/polling/os/sonicwall.inc.php @@ -1,19 +1,15 @@ +// SNMPv2-SMI::enterprises.8741.2.1.1.1.0 = STRING: "NSA 2400" +// SNMPv2-SMI::enterprises.8741.2.1.1.2.0 = STRING: "0017C599BD08" +// SNMPv2-SMI::enterprises.8741.2.1.1.3.0 = STRING: "SonicOS Enhanced 5.8.1.7-4o" +// SNMPv2-SMI::enterprises.8741.2.1.1.4.0 = STRING: "5.0.3.3" +// SNMPv2-SMI::enterprises.8741.2.1.1.1.0 = STRING: "TZ 210" +// SNMPv2-SMI::enterprises.8741.2.1.1.2.0 = STRING: "0017C568903C" +// SNMPv2-SMI::enterprises.8741.2.1.1.3.0 = STRING: "SonicOS Enhanced 5.6.0.11-61o" +// SNMPv2-SMI::enterprises.8741.2.1.1.4.0 = STRING: "5.0.2.11" +$hardware = trim(snmp_get($device, '.1.3.6.1.4.1.8741.2.1.1.1.0', '-OQv', '', ''), '" '); +$serial = trim(snmp_get($device, '.1.3.6.1.4.1.8741.2.1.1.2.0', '-OQv', '', ''), '" '); +$fwversion = trim(snmp_get($device, '.1.3.6.1.4.1.8741.2.1.1.3.0', '-OQv', '', ''), '" '); +$romversion = trim(snmp_get($device, '.1.3.6.1.4.1.8741.2.1.1.4.0', '-OQv', '', ''), '" '); +$version = "(Firmware $fwversion / ROM $romversion)"; diff --git a/includes/polling/os/speedtouch.inc.php b/includes/polling/os/speedtouch.inc.php index 1abe8c623..64851ece7 100644 --- a/includes/polling/os/speedtouch.inc.php +++ b/includes/polling/os/speedtouch.inc.php @@ -1,20 +1,15 @@ diff --git a/includes/polling/os/symbol.inc.php b/includes/polling/os/symbol.inc.php index fcfeaaac4..8062405ba 100644 --- a/includes/polling/os/symbol.inc.php +++ b/includes/polling/os/symbol.inc.php @@ -1,9 +1,8 @@ \ No newline at end of file +$fnSysVersion = snmp_get($device, '.1.3.6.1.4.1.388.11.2.2.1.3.2.0', '-Ovq'); +$serial = trim(snmp_get($device, '.1.3.6.1.4.1.388.11.2.2.1.1.0', '-Ovq'), '"'); +$version = trim(snmp_get($device, '.1.3.6.1.4.1.388.11.2.2.1.3.2.0', '-Ovq'), '"'); +// preg_match("/HW=(^\s]+)/",$sysDescr,$hardwarematches); +preg_match('/\s+[^\s]+/', $poll_device['sysDescr'], $hardwarematches); +$hardware = $hardwarematches[0]; diff --git a/includes/polling/os/tranzeo.inc.php b/includes/polling/os/tranzeo.inc.php index 4d42475dc..f2ce8aaf6 100644 --- a/includes/polling/os/tranzeo.inc.php +++ b/includes/polling/os/tranzeo.inc.php @@ -1,16 +1,13 @@ \ No newline at end of file +list(,$version) = explode(' ', $version); +list($version) = explode('(', $version); +list(,$features) = explode(' ', $features); diff --git a/includes/polling/os/vrp.inc.php b/includes/polling/os/vrp.inc.php index 4d4a12cb0..4901ad163 100644 --- a/includes/polling/os/vrp.inc.php +++ b/includes/polling/os/vrp.inc.php @@ -1,8 +1,6 @@ \ No newline at end of file +preg_match("/Version .*\n/", $poll_device['sysDescr'], $matches); +$version = trim(str_replace('Version ', '', $matches[0])); diff --git a/includes/polling/os/vyatta.inc.php b/includes/polling/os/vyatta.inc.php index d0a26bc99..39e323dbf 100644 --- a/includes/polling/os/vyatta.inc.php +++ b/includes/polling/os/vyatta.inc.php @@ -1,5 +1,3 @@ +list($features, $version) = explode('-', trim(str_replace('Vyatta', '', snmp_get($device, 'SNMPv2-MIB::sysDescr.0', '-Oqv', 'SNMPv2-MIB'))), 2); diff --git a/includes/polling/os/xerox.inc.php b/includes/polling/os/xerox.inc.php index a63bda998..5fbb733ee 100644 --- a/includes/polling/os/xerox.inc.php +++ b/includes/polling/os/xerox.inc.php @@ -1,25 +1,19 @@ \ No newline at end of file +$version = trim(snmp_get($device, '1.3.6.1.4.1.236.11.5.1.1.1.2.0', '-OQv', '', ''), '" '); diff --git a/includes/polling/os/zxr10.inc.php b/includes/polling/os/zxr10.inc.php index fab869660..a65403a19 100644 --- a/includes/polling/os/zxr10.inc.php +++ b/includes/polling/os/zxr10.inc.php @@ -5,5 +5,3 @@ list($version) = explode(',', $poll_device['sysDescr']); preg_match('/Version V(\S+) (.+) Software,/', $poll_device['sysDescr'], $matches); $hardware = $matches[2]; - -?> diff --git a/includes/polling/os/zywall.inc.php b/includes/polling/os/zywall.inc.php index 91156e604..9b67f5f78 100644 --- a/includes/polling/os/zywall.inc.php +++ b/includes/polling/os/zywall.inc.php @@ -1,5 +1,3 @@ \ No newline at end of file diff --git a/includes/polling/os/zyxelnwa.inc.php b/includes/polling/os/zyxelnwa.inc.php index 91156e604..9b67f5f78 100644 --- a/includes/polling/os/zyxelnwa.inc.php +++ b/includes/polling/os/zyxelnwa.inc.php @@ -1,5 +1,3 @@ \ No newline at end of file diff --git a/includes/polling/ospf.inc.php b/includes/polling/ospf.inc.php index a7cc83078..9f2e0c3e0 100644 --- a/includes/polling/ospf.inc.php +++ b/includes/polling/ospf.inc.php @@ -1,342 +1,381 @@ $ospf_entry) -{ - // If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array - if (!isset($ospf_instances_db[$ospf_instance_id])) - { - dbInsert(array('device_id' => $device['device_id'], 'ospf_instance_id' => $ospf_instance_id), 'ospf_instances'); - echo("+"); - $ospf_instances_db[$entry['ospf_instance_id']] = dbFetchRow("SELECT * FROM `ospf_instances` WHERE `device_id` = ? AND `ospf_instance_id` = ?", array($device['device_id'],$ospf_instance_id)); - $ospf_instances_db[$entry['ospf_instance_id']] = $entry; - } +$ospf_instances_poll = snmpwalk_cache_oid($device, 'OSPF-MIB::ospfGeneralGroup', array(), 'OSPF-MIB'); +foreach ($ospf_instances_poll as $ospf_instance_id => $ospf_entry) { + // If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array + if (!isset($ospf_instances_db[$ospf_instance_id])) { + dbInsert(array('device_id' => $device['device_id'], 'ospf_instance_id' => $ospf_instance_id), 'ospf_instances'); + echo '+'; + $ospf_instances_db[$entry['ospf_instance_id']] = dbFetchRow('SELECT * FROM `ospf_instances` WHERE `device_id` = ? AND `ospf_instance_id` = ?', array($device['device_id'], $ospf_instance_id)); + $ospf_instances_db[$entry['ospf_instance_id']] = $entry; + } } -if ($debug) -{ - echo("\nPolled: "); - print_r($ospf_instances_poll); - echo("Database: "); - print_r($ospf_instances_db); - echo("\n"); +if ($debug) { + echo "\nPolled: "; + print_r($ospf_instances_poll); + echo 'Database: '; + print_r($ospf_instances_db); + echo "\n"; } // Loop array of entries and update -if (is_array($ospf_instances_db)) -{ - foreach ($ospf_instances_db as $ospf_instance_db) - { - $ospf_instance_poll = $ospf_instances_poll[$ospf_instance_db['ospf_instance_id']]; - foreach ($ospf_oids_db as $oid) - { // Loop the OIDs - if ($ospf_instance_db[$oid] != $ospf_instance_poll[$oid]) - { // If data has changed, build a query - $ospf_instance_update[$oid] = $ospf_instance_poll[$oid]; - #log_event("$oid -> ".$this_port[$oid], $device, 'ospf', $port['port_id']); // FIXME - } - } - if ($ospf_instance_update) - { - dbUpdate($ospf_instance_update, 'ospf_instances', '`device_id` = ? AND `ospf_instance_id` = ?', array($device['device_id'], $ospf_instance_id)); - echo("U"); - unset($ospf_instance_update); - } else { - echo("."); - } +if (is_array($ospf_instances_db)) { + foreach ($ospf_instances_db as $ospf_instance_db) { + $ospf_instance_poll = $ospf_instances_poll[$ospf_instance_db['ospf_instance_id']]; + foreach ($ospf_oids_db as $oid) { + // Loop the OIDs + if ($ospf_instance_db[$oid] != $ospf_instance_poll[$oid]) { + // If data has changed, build a query + $ospf_instance_update[$oid] = $ospf_instance_poll[$oid]; + // log_event("$oid -> ".$this_port[$oid], $device, 'ospf', $port['port_id']); // FIXME + } + } - unset($ospf_instance_poll); - unset($ospf_instance_db); - $ospf_instance_count++; - } -} + if ($ospf_instance_update) { + dbUpdate($ospf_instance_update, 'ospf_instances', '`device_id` = ? AND `ospf_instance_id` = ?', array($device['device_id'], $ospf_instance_id)); + echo 'U'; + unset($ospf_instance_update); + } + else { + echo '.'; + } + + unset($ospf_instance_poll); + unset($ospf_instance_db); + $ospf_instance_count++; + }//end foreach +}//end if unset($ospf_instances_poll); unset($ospf_instances_db); -echo(" Areas: "); +echo ' Areas: '; -$ospf_area_oids = array('ospfAuthType','ospfImportAsExtern','ospfSpfRuns','ospfAreaBdrRtrCount','ospfAsBdrRtrCount','ospfAreaLsaCount','ospfAreaLsaCksumSum','ospfAreaSummary','ospfAreaStatus'); +$ospf_area_oids = array( + 'ospfAuthType', + 'ospfImportAsExtern', + 'ospfSpfRuns', + 'ospfAreaBdrRtrCount', + 'ospfAsBdrRtrCount', + 'ospfAreaLsaCount', + 'ospfAreaLsaCksumSum', + 'ospfAreaSummary', + 'ospfAreaStatus', +); // Build array of existing entries -foreach (dbFetchRows("SELECT * FROM `ospf_areas` WHERE `device_id` = ?", array($device['device_id'])) as $entry) -{ - $ospf_areas_db[$entry['ospfAreaId']] = $entry; +foreach (dbFetchRows('SELECT * FROM `ospf_areas` WHERE `device_id` = ?', array($device['device_id'])) as $entry) { + $ospf_areas_db[$entry['ospfAreaId']] = $entry; } // Pull data from device -$ospf_areas_poll = snmpwalk_cache_oid($device, "OSPF-MIB::ospfAreaEntry", array(), "OSPF-MIB"); +$ospf_areas_poll = snmpwalk_cache_oid($device, 'OSPF-MIB::ospfAreaEntry', array(), 'OSPF-MIB'); -foreach ($ospf_areas_poll as $ospf_area_id => $ospf_area) -{ - // If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array - if (!isset($ospf_areas_db[$ospf_area_id])) - { - dbInsert(array('device_id' => $device['device_id'], 'ospfAreaId' => $ospf_area_id), 'ospf_areas'); - echo("+"); - $entry = dbFetchRows("SELECT * FROM `ospf_areas` WHERE `device_id` = ? AND `ospfAreaId` = ?",array($device['device_id'], $ospf_area_id)); - $ospf_areas_db[$entry['ospf_area_id']] = $entry; - } +foreach ($ospf_areas_poll as $ospf_area_id => $ospf_area) { + // If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array + if (!isset($ospf_areas_db[$ospf_area_id])) { + dbInsert(array('device_id' => $device['device_id'], 'ospfAreaId' => $ospf_area_id), 'ospf_areas'); + echo '+'; + $entry = dbFetchRows('SELECT * FROM `ospf_areas` WHERE `device_id` = ? AND `ospfAreaId` = ?', array($device['device_id'], $ospf_area_id)); + $ospf_areas_db[$entry['ospf_area_id']] = $entry; + } } -if ($debug) -{ - echo("\nPolled: "); - print_r($ospf_areas_poll); - echo("Database: "); - print_r($ospf_areas_db); - echo("\n"); +if ($debug) { + echo "\nPolled: "; + print_r($ospf_areas_poll); + echo 'Database: '; + print_r($ospf_areas_db); + echo "\n"; } // Loop array of entries and update -if (is_array($ospf_areas_db)) -{ - foreach ($ospf_areas_db as $ospf_area_db) - { - if (is_array($ospf_ports_poll[$ospf_port_db['ospf_port_id']])) - { - $ospf_area_poll = $ospf_areas_poll[$ospf_area_db['ospfAreaId']]; - foreach ($ospf_area_oids as $oid) - { // Loop the OIDs - if ($ospf_area_db[$oid] != $ospf_area_poll[$oid]) - { // If data has changed, build a query - $ospf_area_update[$oid] = $ospf_area_poll[$oid]; - #log_event("$oid -> ".$this_port[$oid], $device, 'interface', $port['port_id']); // FIXME +if (is_array($ospf_areas_db)) { + foreach ($ospf_areas_db as $ospf_area_db) { + if (is_array($ospf_ports_poll[$ospf_port_db['ospf_port_id']])) { + $ospf_area_poll = $ospf_areas_poll[$ospf_area_db['ospfAreaId']]; + foreach ($ospf_area_oids as $oid) { + // Loop the OIDs + if ($ospf_area_db[$oid] != $ospf_area_poll[$oid]) { + // If data has changed, build a query + $ospf_area_update[$oid] = $ospf_area_poll[$oid]; + // log_event("$oid -> ".$this_port[$oid], $device, 'interface', $port['port_id']); // FIXME + } + } + + if ($ospf_area_update) { + dbUpdate($ospf_area_update, 'ospf_areas', '`device_id` = ? AND `ospfAreaId` = ?', array($device['device_id'], $ospf_area_id)); + echo 'U'; + unset($ospf_area_update); + } + else { + echo '.'; + } + + unset($ospf_area_poll); + unset($ospf_area_db); + $ospf_area_count++; } - } - if ($ospf_area_update) - { - dbUpdate($ospf_area_update, 'ospf_areas', '`device_id` = ? AND `ospfAreaId` = ?', array($device['device_id'], $ospf_area_id)); - echo("U"); - unset($ospf_area_update); - } else { - echo("."); - } - unset($ospf_area_poll); - unset($ospf_area_db); - $ospf_area_count++; - } else { - dbDelete('ospf_ports', '`device_id` = ? AND `ospfAreaId` = ?', array($device['device_id'], $ospf_area_db['ospfAreaId'])); - } - } -} + else { + dbDelete('ospf_ports', '`device_id` = ? AND `ospfAreaId` = ?', array($device['device_id'], $ospf_area_db['ospfAreaId'])); + }//end if + }//end foreach +}//end if unset($ospf_areas_db); unset($ospf_areas_poll); -#$ospf_ports = snmpwalk_cache_oid($device, "OSPF-MIB::ospfIfEntry", array(), "OSPF-MIB"); -#print_r($ospf_ports); +// $ospf_ports = snmpwalk_cache_oid($device, "OSPF-MIB::ospfIfEntry", array(), "OSPF-MIB"); +// print_r($ospf_ports); +echo ' Ports: '; -echo(" Ports: "); - -$ospf_port_oids = array('ospfIfIpAddress','port_id','ospfAddressLessIf','ospfIfAreaId','ospfIfType','ospfIfAdminStat','ospfIfRtrPriority','ospfIfTransitDelay','ospfIfRetransInterval','ospfIfHelloInterval','ospfIfRtrDeadInterval','ospfIfPollInterval','ospfIfState','ospfIfDesignatedRouter','ospfIfBackupDesignatedRouter','ospfIfEvents','ospfIfAuthKey','ospfIfStatus','ospfIfMulticastForwarding','ospfIfDemand','ospfIfAuthType'); +$ospf_port_oids = array( + 'ospfIfIpAddress', + 'port_id', + 'ospfAddressLessIf', + 'ospfIfAreaId', + 'ospfIfType', + 'ospfIfAdminStat', + 'ospfIfRtrPriority', + 'ospfIfTransitDelay', + 'ospfIfRetransInterval', + 'ospfIfHelloInterval', + 'ospfIfRtrDeadInterval', + 'ospfIfPollInterval', + 'ospfIfState', + 'ospfIfDesignatedRouter', + 'ospfIfBackupDesignatedRouter', + 'ospfIfEvents', + 'ospfIfAuthKey', + 'ospfIfStatus', + 'ospfIfMulticastForwarding', + 'ospfIfDemand', + 'ospfIfAuthType', +); // Build array of existing entries -foreach (dbFetchRows("SELECT * FROM `ospf_ports` WHERE `device_id` = ?", array($device['device_id'])) as $entry) -{ - $ospf_ports_db[$entry['ospf_port_id']] = $entry; +foreach (dbFetchRows('SELECT * FROM `ospf_ports` WHERE `device_id` = ?', array($device['device_id'])) as $entry) { + $ospf_ports_db[$entry['ospf_port_id']] = $entry; } // Pull data from device -$ospf_ports_poll = snmpwalk_cache_oid($device, "OSPF-MIB::ospfIfEntry", array(), "OSPF-MIB"); +$ospf_ports_poll = snmpwalk_cache_oid($device, 'OSPF-MIB::ospfIfEntry', array(), 'OSPF-MIB'); -foreach ($ospf_ports_poll as $ospf_port_id => $ospf_port) -{ - // If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array - if (!isset($ospf_ports_db[$ospf_port_id])) - { - dbInsert(array('device_id' => $device['device_id'], 'ospf_port_id' => $ospf_port_id), 'ospf_ports'); - echo("+"); - $ospf_ports_db[$entry['ospf_port_id']] = dbFetchRow("SELECT * FROM `ospf_ports` WHERE `device_id` = ? AND `ospf_port_id` = ?", array($device['device_id'], $ospf_port_id)); - } +foreach ($ospf_ports_poll as $ospf_port_id => $ospf_port) { + // If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array + if (!isset($ospf_ports_db[$ospf_port_id])) { + dbInsert(array('device_id' => $device['device_id'], 'ospf_port_id' => $ospf_port_id), 'ospf_ports'); + echo '+'; + $ospf_ports_db[$entry['ospf_port_id']] = dbFetchRow('SELECT * FROM `ospf_ports` WHERE `device_id` = ? AND `ospf_port_id` = ?', array($device['device_id'], $ospf_port_id)); + } } -if ($debug) -{ - echo("\nPolled: "); - print_r($ospf_ports_poll); - echo("Database: "); - print_r($ospf_ports_db); - echo("\n"); +if ($debug) { + echo "\nPolled: "; + print_r($ospf_ports_poll); + echo 'Database: '; + print_r($ospf_ports_db); + echo "\n"; } // Loop array of entries and update -if (is_array($ospf_ports_db)) -{ - foreach ($ospf_ports_db as $ospf_port_id => $ospf_port_db) - { - if (is_array($ospf_ports_poll[$ospf_port_db['ospf_port_id']])) - { - $ospf_port_poll = $ospf_ports_poll[$ospf_port_db['ospf_port_id']]; +if (is_array($ospf_ports_db)) { + foreach ($ospf_ports_db as $ospf_port_id => $ospf_port_db) { + if (is_array($ospf_ports_poll[$ospf_port_db['ospf_port_id']])) { + $ospf_port_poll = $ospf_ports_poll[$ospf_port_db['ospf_port_id']]; - if ($ospf_port_poll['ospfAddressLessIf']) - { - $ospf_port_poll['port_id'] = @dbFetchCell("SELECT `port_id` FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $ospf_port_poll['ospfAddressLessIf'])); - } else { - $ospf_port_poll['port_id'] = @dbFetchCell("SELECT A.`port_id` FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND I.device_id = ?", array($ospf_port_poll['ospfIfIpAddress'], $device['device_id'])); - } + if ($ospf_port_poll['ospfAddressLessIf']) { + $ospf_port_poll['port_id'] = @dbFetchCell('SELECT `port_id` FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $ospf_port_poll['ospfAddressLessIf'])); + } + else { + $ospf_port_poll['port_id'] = @dbFetchCell('SELECT A.`port_id` FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND I.device_id = ?', array($ospf_port_poll['ospfIfIpAddress'], $device['device_id'])); + } - foreach ($ospf_port_oids as $oid) - { // Loop the OIDs - if ($ospf_port_db[$oid] != $ospf_port_poll[$oid]) - { // If data has changed, build a query - $ospf_port_update[$oid] = $ospf_port_poll[$oid]; - #log_event("$oid -> ".$this_port[$oid], $device, 'ospf', $port['port_id']); // FIXME + foreach ($ospf_port_oids as $oid) { + // Loop the OIDs + if ($ospf_port_db[$oid] != $ospf_port_poll[$oid]) { + // If data has changed, build a query + $ospf_port_update[$oid] = $ospf_port_poll[$oid]; + // log_event("$oid -> ".$this_port[$oid], $device, 'ospf', $port['port_id']); // FIXME + } + } + + if ($ospf_port_update) { + dbUpdate($ospf_port_update, 'ospf_ports', '`device_id` = ? AND `ospf_port_id` = ?', array($device['device_id'], $ospf_port_id)); + echo 'U'; + unset($ospf_port_update); + } + else { + echo '.'; + } + + unset($ospf_port_poll); + unset($ospf_port_db); + $ospf_port_count++; } - } - if ($ospf_port_update) - { - dbUpdate($ospf_port_update, 'ospf_ports', '`device_id` = ? AND `ospf_port_id` = ?', array($device['device_id'], $ospf_port_id)); - echo("U"); - unset($ospf_port_update); - } else { - echo("."); - } - unset($ospf_port_poll); - unset($ospf_port_db); - $ospf_port_count++; - } else { - dbDelete('ospf_ports', '`device_id` = ? AND `ospf_port_id` = ?', array($device['device_id'], $ospf_port_db['ospf_port_id'])); - # "DELETE FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."' AND `ospf_port_id` = '".$ospf_port_db['ospf_port_id']."'"); - echo("-"); - } - } -} + else { + dbDelete('ospf_ports', '`device_id` = ? AND `ospf_port_id` = ?', array($device['device_id'], $ospf_port_db['ospf_port_id'])); + // "DELETE FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."' AND `ospf_port_id` = '".$ospf_port_db['ospf_port_id']."'"); + echo '-'; + }//end if + }//end foreach +}//end if -#OSPF-MIB::ospfNbrIpAddr.172.22.203.98.0 172.22.203.98 -#OSPF-MIB::ospfNbrAddressLessIndex.172.22.203.98.0 0 -#OSPF-MIB::ospfNbrRtrId.172.22.203.98.0 172.22.203.128 -#OSPF-MIB::ospfNbrOptions.172.22.203.98.0 2 -#OSPF-MIB::ospfNbrPriority.172.22.203.98.0 0 -#OSPF-MIB::ospfNbrState.172.22.203.98.0 full -#OSPF-MIB::ospfNbrEvents.172.22.203.98.0 6 -#OSPF-MIB::ospfNbrLsRetransQLen.172.22.203.98.0 1 -#OSPF-MIB::ospfNbmaNbrStatus.172.22.203.98.0 active -#OSPF-MIB::ospfNbmaNbrPermanence.172.22.203.98.0 dynamic -#OSPF-MIB::ospfNbrHelloSuppressed.172.22.203.98.0 false +// OSPF-MIB::ospfNbrIpAddr.172.22.203.98.0 172.22.203.98 +// OSPF-MIB::ospfNbrAddressLessIndex.172.22.203.98.0 0 +// OSPF-MIB::ospfNbrRtrId.172.22.203.98.0 172.22.203.128 +// OSPF-MIB::ospfNbrOptions.172.22.203.98.0 2 +// OSPF-MIB::ospfNbrPriority.172.22.203.98.0 0 +// OSPF-MIB::ospfNbrState.172.22.203.98.0 full +// OSPF-MIB::ospfNbrEvents.172.22.203.98.0 6 +// OSPF-MIB::ospfNbrLsRetransQLen.172.22.203.98.0 1 +// OSPF-MIB::ospfNbmaNbrStatus.172.22.203.98.0 active +// OSPF-MIB::ospfNbmaNbrPermanence.172.22.203.98.0 dynamic +// OSPF-MIB::ospfNbrHelloSuppressed.172.22.203.98.0 false +echo ' Neighbours: '; -echo(' Neighbours: '); - -$ospf_nbr_oids_db = array('ospfNbrIpAddr', 'ospfNbrAddressLessIndex', 'ospfNbrRtrId', 'ospfNbrOptions', 'ospfNbrPriority', 'ospfNbrState', 'ospfNbrEvents', 'ospfNbrLsRetransQLen', 'ospfNbmaNbrStatus', 'ospfNbmaNbrPermanence', 'ospfNbrHelloSuppressed'); +$ospf_nbr_oids_db = array( + 'ospfNbrIpAddr', + 'ospfNbrAddressLessIndex', + 'ospfNbrRtrId', + 'ospfNbrOptions', + 'ospfNbrPriority', + 'ospfNbrState', + 'ospfNbrEvents', + 'ospfNbrLsRetransQLen', + 'ospfNbmaNbrStatus', + 'ospfNbmaNbrPermanence', + 'ospfNbrHelloSuppressed', +); $ospf_nbr_oids_rrd = array(); -$ospf_nbr_oids = array_merge($ospf_nbr_oids_db, $ospf_nbr_oids_rrd); +$ospf_nbr_oids = array_merge($ospf_nbr_oids_db, $ospf_nbr_oids_rrd); // Build array of existing entries -foreach (dbFetchRows("SELECT * FROM `ospf_nbrs` WHERE `device_id` = ?", array($device['device_id'])) as $nbr_entry) -{ - $ospf_nbrs_db[$nbr_entry['ospf_nbr_id']] = $nbr_entry; +foreach (dbFetchRows('SELECT * FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id'])) as $nbr_entry) { + $ospf_nbrs_db[$nbr_entry['ospf_nbr_id']] = $nbr_entry; } // Pull data from device -$ospf_nbrs_poll = snmpwalk_cache_oid($device, "OSPF-MIB::ospfNbrEntry", array(), "OSPF-MIB"); +$ospf_nbrs_poll = snmpwalk_cache_oid($device, 'OSPF-MIB::ospfNbrEntry', array(), 'OSPF-MIB'); -foreach ($ospf_nbrs_poll as $ospf_nbr_id => $ospf_nbr) -{ - // If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array - if (!isset($ospf_nbrs_db[$ospf_nbr_id])) - { - dbInsert(array('device_id' => $device['device_id'], 'ospf_nbr_id' => $ospf_nbr_id), 'ospf_nbrs'); - echo("+"); - $entry = dbFetchRow("SELECT * FROM `ospf_nbrs` WHERE `device_id` = ? AND `ospf_nbr_id` = ?", array($device['device_id'], $ospf_nbr_id)); - $ospf_nbrs_db[$entry['ospf_nbr_id']] = $entry; - } +foreach ($ospf_nbrs_poll as $ospf_nbr_id => $ospf_nbr) { + // If the entry doesn't already exist in the prebuilt array, insert into the database and put into the array + if (!isset($ospf_nbrs_db[$ospf_nbr_id])) { + dbInsert(array('device_id' => $device['device_id'], 'ospf_nbr_id' => $ospf_nbr_id), 'ospf_nbrs'); + echo '+'; + $entry = dbFetchRow('SELECT * FROM `ospf_nbrs` WHERE `device_id` = ? AND `ospf_nbr_id` = ?', array($device['device_id'], $ospf_nbr_id)); + $ospf_nbrs_db[$entry['ospf_nbr_id']] = $entry; + } } -if ($debug) -{ - echo("\nPolled: "); - print_r($ospf_nbrs_poll); - echo("Database: "); - print_r($ospf_nbrs_db); - echo("\n"); +if ($debug) { + echo "\nPolled: "; + print_r($ospf_nbrs_poll); + echo 'Database: '; + print_r($ospf_nbrs_db); + echo "\n"; } // Loop array of entries and update -if (is_array($ospf_nbrs_db)) -{ - foreach ($ospf_nbrs_db as $ospf_nbr_id => $ospf_nbr_db) - { - if (is_array($ospf_nbrs_poll[$ospf_nbr_db['ospf_nbr_id']])) - { - $ospf_nbr_poll = $ospf_nbrs_poll[$ospf_nbr_db['ospf_nbr_id']]; +if (is_array($ospf_nbrs_db)) { + foreach ($ospf_nbrs_db as $ospf_nbr_id => $ospf_nbr_db) { + if (is_array($ospf_nbrs_poll[$ospf_nbr_db['ospf_nbr_id']])) { + $ospf_nbr_poll = $ospf_nbrs_poll[$ospf_nbr_db['ospf_nbr_id']]; - $ospf_nbr_poll['port_id'] = @dbFetchCell("SELECT A.`port_id` FROM ipv4_addresses AS A, nbrs AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND I.device_id = ?", array($ospf_nbr_poll['ospfNbrIpAddr'], $device['device_id'])); + $ospf_nbr_poll['port_id'] = @dbFetchCell('SELECT A.`port_id` FROM ipv4_addresses AS A, nbrs AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND I.device_id = ?', array($ospf_nbr_poll['ospfNbrIpAddr'], $device['device_id'])); - if ($ospf_nbr_db['port_id'] != $ospf_nbr_poll['port_id']) - { - if ($ospf_nbr_poll['port_id']) { - $ospf_nbr_update = array('port_id' => $ospf_nbr_poll['port_id']); - } else { - $ospf_nbr_update = array('port_id' => array('NULL')); + if ($ospf_nbr_db['port_id'] != $ospf_nbr_poll['port_id']) { + if ($ospf_nbr_poll['port_id']) { + $ospf_nbr_update = array('port_id' => $ospf_nbr_poll['port_id']); + } + else { + $ospf_nbr_update = array('port_id' => array('NULL')); + } + } + + foreach ($ospf_nbr_oids as $oid) { + // Loop the OIDs + if ($debug) { + echo $ospf_nbr_db[$oid].'|'.$ospf_nbr_poll[$oid]."\n"; + } + + if ($ospf_nbr_db[$oid] != $ospf_nbr_poll[$oid]) { + // If data has changed, build a query + $ospf_nbr_update[$oid] = $ospf_nbr_poll[$oid]; + // log_event("$oid -> ".$this_nbr[$oid], $device, 'ospf', $nbr['port_id']); // FIXME + } + } + + if ($ospf_nbr_update) { + dbUpdate($ospf_nbr_update, 'ospf_nbrs', '`device_id` = ? AND `ospf_nbr_id` = ?', array($device['device_id'], $ospf_nbr_id)); + echo 'U'; + unset($ospf_nbr_update); + } + else { + echo '.'; + } + + unset($ospf_nbr_poll); + unset($ospf_nbr_db); + $ospf_nbr_count++; } - } - - foreach ($ospf_nbr_oids as $oid) - { // Loop the OIDs - if ($debug) { echo($ospf_nbr_db[$oid]."|".$ospf_nbr_poll[$oid]."\n"); } - if ($ospf_nbr_db[$oid] != $ospf_nbr_poll[$oid]) - { // If data has changed, build a query - $ospf_nbr_update[$oid] = $ospf_nbr_poll[$oid]; - #log_event("$oid -> ".$this_nbr[$oid], $device, 'ospf', $nbr['port_id']); // FIXME - } - } - if ($ospf_nbr_update) - { - dbUpdate($ospf_nbr_update, 'ospf_nbrs', '`device_id` = ? AND `ospf_nbr_id` = ?', array($device['device_id'], $ospf_nbr_id)); - echo("U"); - unset($ospf_nbr_update); - } else { - echo("."); - } - - unset($ospf_nbr_poll); - unset($ospf_nbr_db); - $ospf_nbr_count++; - } else { - dbDelete('ospf_nbrs', '`device_id` = ? AND `ospf_nbr_id` = ?', array($device['device_id'], $ospf_nbr_db['ospf_nbr_id'])); - echo("-"); - } - } -} + else { + dbDelete('ospf_nbrs', '`device_id` = ? AND `ospf_nbr_id` = ?', array($device['device_id'], $ospf_nbr_db['ospf_nbr_id'])); + echo '-'; + }//end if + }//end foreach +}//end if // Create device-wide statistics RRD +$filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('ospf-statistics.rrd'); -$filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("ospf-statistics.rrd"); +if (!is_file($filename)) { + rrdtool_create( + $filename, + '--step 300 \ + DS:instances:GAUGE:600:0:1000000 \ + DS:areas:GAUGE:600:0:1000000 \ + DS:ports:GAUGE:600:0:1000000 \ + DS:neighbours:GAUGE:600:0:1000000 '.$config['rrd_rra'] + ); +} -if (!is_file($filename)) -{ - rrdtool_create($filename, "--step 300 \ - DS:instances:GAUGE:600:0:1000000 \ - DS:areas:GAUGE:600:0:1000000 \ - DS:ports:GAUGE:600:0:1000000 \ - DS:neighbours:GAUGE:600:0:1000000 ".$config['rrd_rra']); - } - -$rrd_update = "N:".$ospf_instance_count.":".$ospf_area_count.":".$ospf_port_count.":".$ospf_neighbour_count; -$ret = rrdtool_update("$filename", $rrd_update); +$rrd_update = 'N:'.$ospf_instance_count.':'.$ospf_area_count.':'.$ospf_port_count.':'.$ospf_neighbour_count; +$ret = rrdtool_update("$filename", $rrd_update); unset($ospf_ports_db); unset($ospf_ports_poll); -echo("\n"); - -?> +echo "\n"; diff --git a/includes/polling/processors/ucd-old.inc.php b/includes/polling/processors/ucd-old.inc.php index bca70b1ec..f37006f24 100644 --- a/includes/polling/processors/ucd-old.inc.php +++ b/includes/polling/processors/ucd-old.inc.php @@ -1,11 +1,8 @@ +$proc = (100 - $idle); diff --git a/includes/polling/ucd-diskio.inc.php b/includes/polling/ucd-diskio.inc.php index 92a3af276..36a8c3a3f 100644 --- a/includes/polling/ucd-diskio.inc.php +++ b/includes/polling/ucd-diskio.inc.php @@ -1,44 +1,47 @@ diff --git a/includes/polling/unix-agent/dmi.inc.php b/includes/polling/unix-agent/dmi.inc.php index 9f8c6d7fc..d03718d08 100644 --- a/includes/polling/unix-agent/dmi.inc.php +++ b/includes/polling/unix-agent/dmi.inc.php @@ -3,12 +3,9 @@ $dmi = $agent_data['dmi']; unset($agent_data['dmi']); -foreach (explode("\n",$dmi) as $line) -{ - list($field,$contents) = explode("=",$line,2); - $agent_data['dmi'][$field] = trim($contents); +foreach (explode("\n", $dmi) as $line) { + list($field,$contents) = explode('=', $line, 2); + $agent_data['dmi'][$field] = trim($contents); } unset($dmi); - -?> \ No newline at end of file diff --git a/includes/polling/unix-agent/hddtemp.inc.php b/includes/polling/unix-agent/hddtemp.inc.php index b4715ac0c..17078e0d0 100644 --- a/includes/polling/unix-agent/hddtemp.inc.php +++ b/includes/polling/unix-agent/hddtemp.inc.php @@ -2,25 +2,26 @@ global $agent_sensors; -include_once("includes/discovery/functions.inc.php"); +require_once 'includes/discovery/functions.inc.php'; -if ($agent_data['haddtemp'] != '|') -{ - $disks = explode('||',trim($agent_data['hddtemp'],'|')); +if ($agent_data['haddtemp'] != '|') { + $disks = explode('||', trim($agent_data['hddtemp'], '|')); - if (count($disks)) - { - echo "hddtemp: "; - foreach ($disks as $disk) - { - list($blockdevice,$descr,$temperature,$unit) = explode('|',$disk,4); - $diskcount++; - discover_sensor($valid['sensor'], 'temperature', $device, '', $diskcount, 'hddtemp', "$blockdevice: $descr", '1', '1', NULL, NULL, NULL, NULL, $temperature, 'agent'); + if (count($disks)) { + echo 'hddtemp: '; + foreach ($disks as $disk) + { + list($blockdevice,$descr,$temperature,$unit) = explode('|', $disk, 4); + $diskcount++; + discover_sensor($valid['sensor'], 'temperature', $device, '', $diskcount, 'hddtemp', "$blockdevice: $descr", '1', '1', null, null, null, null, $temperature, 'agent'); - $agent_sensors['temperature']['hddtemp'][$diskcount] = array('description' => "$blockdevice: $descr", 'current' => $temperature, 'index' => $diskcount); + $agent_sensors['temperature']['hddtemp'][$diskcount] = array( + 'description' => "$blockdevice: $descr", + 'current' => $temperature, + 'index' => $diskcount, + ); + } + + echo "\n"; } - echo "\n"; - } -} - -?> \ No newline at end of file +}//end if diff --git a/includes/port-descr-parser.inc.php b/includes/port-descr-parser.inc.php index 710d8c931..2b0f475aa 100644 --- a/includes/port-descr-parser.inc.php +++ b/includes/port-descr-parser.inc.php @@ -2,32 +2,27 @@ // Very basic parser to parse classic Observium-type schemes. // Parser should populate $port_ifAlias array with type, descr, circuit, speed and notes +unset($port_ifAlias); -unset ($port_ifAlias); +echo $this_port['ifAlias']; -echo($this_port['ifAlias']); +list($type,$descr) = preg_split('/[\:\[\]\{\}\(\)]/', $this_port['ifAlias']); +list(,$circuit) = preg_split('/[\{\}]/', $this_port['ifAlias']); +list(,$notes) = preg_split('/[\(\)]/', $this_port['ifAlias']); +list(,$speed) = preg_split('/[\[\]]/', $this_port['ifAlias']); +$descr = trim($descr); -list($type,$descr) = preg_split("/[\:\[\]\{\}\(\)]/", $this_port['ifAlias']); -list(,$circuit) = preg_split("/[\{\}]/", $this_port['ifAlias']); -list(,$notes) = preg_split("/[\(\)]/", $this_port['ifAlias']); -list(,$speed) = preg_split("/[\[\]]/", $this_port['ifAlias']); -$descr = trim($descr); +if ($type && $descr) { + $type = strtolower($type); + $port_ifAlias['type'] = $type; + $port_ifAlias['descr'] = $descr; + $port_ifAlias['circuit'] = $circuit; + $port_ifAlias['speed'] = $speed; + $port_ifAlias['notes'] = $notes; -if ($type && $descr) -{ - $type = strtolower($type); - $port_ifAlias['type'] = $type; - $port_ifAlias['descr'] = $descr; - $port_ifAlias['circuit'] = $circuit; - $port_ifAlias['speed'] = $speed; - $port_ifAlias['notes'] = $notes; - - if ($debug) - { - print_r($port_ifAlias); - } + if ($debug) { + print_r($port_ifAlias); + } } -unset ($port_type, $port_descr, $port_circuit, $port_notes, $port_speed); - -?> \ No newline at end of file +unset($port_type, $port_descr, $port_circuit, $port_notes, $port_speed); diff --git a/includes/services.inc.php b/includes/services.inc.php index eeacaa870..d94ce09c9 100644 --- a/includes/services.inc.php +++ b/includes/services.inc.php @@ -1,15 +1,14 @@ diff --git a/includes/snom-graphing.php b/includes/snom-graphing.php index 249bab1fe..c6dedfb7f 100644 --- a/includes/snom-graphing.php +++ b/includes/snom-graphing.php @@ -2,36 +2,58 @@ // FIXME not used, do we still need this? -function callsgraphSNOM ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { - global $config; - $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; - $optsa = array( "--start", $from, "--end", $to, "--width", $width, "--height", $height, "--vertical-label", $vertical ,"--alt-autoscale-max", - "-l 0", - "-E", - "--title", $title, - "DEF:call=$database:CALLS:AVERAGE", - "CDEF:calls=call,360,*", - "LINE1.25:calls#FF9900:Calls", - "GPRINT:calls:LAST:Cu\: %2.0lf/min", - "GPRINT:calls:AVERAGE:Av\: %2.0lf/min", - "GPRINT:calls:MAX:Mx\: %2.0lf/min\\n"); - if ($width <= "300") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."", - "--font", "AXIS:6:".$config['mono_font']."", - "--font-render-mode", "normal");} +function callsgraphSNOM($rrd, $graph, $from, $to, $width, $height, $title, $vertical) +{ + global $config; - $opts = array_merge($config['rrdgraph_defaults'], $optsa, $optsb); + $database = $config['rrd_dir'].'/'.$rrd; + $imgfile = 'graphs/'."$graph"; + $optsa = array( + '--start', + $from, + '--end', + $to, + '--width', + $width, + '--height', + $height, + '--vertical-label', + $vertical, + '--alt-autoscale-max', + '-l 0', + '-E', + '--title', + $title, + "DEF:call=$database:CALLS:AVERAGE", + 'CDEF:calls=call,360,*', + 'LINE1.25:calls#FF9900:Calls', + 'GPRINT:calls:LAST:Cu\: %2.0lf/min', + 'GPRINT:calls:AVERAGE:Av\: %2.0lf/min', + "GPRINT:calls:MAX:Mx\: %2.0lf/min\\n", + ); + if ($width <= '300') { + $optsb = array( + '--font', + 'LEGEND:7:'.$config['mono_font'].'', + '--font', + 'AXIS:6:'.$config['mono_font'].'', + '--font-render-mode', + 'normal', + ); + } - $ret = rrd_graph("$imgfile", $opts, count($opts)); + $opts = array_merge($config['rrdgraph_defaults'], $optsa, $optsb); - if ( !is_array($ret) ) { - $err = rrd_error(); - echo("rrd_graph() ERROR: $err\n"); - return FALSE; - } else { - return $imgfile; - } -} + $ret = rrd_graph("$imgfile", $opts, count($opts)); -?> + if (!is_array($ret)) { + $err = rrd_error(); + echo "rrd_graph() ERROR: $err\n"; + return false; + } + else { + return $imgfile; + } + +}//end callsgraphSNOM() diff --git a/includes/static-config.php b/includes/static-config.php index 46b064123..e136a1d74 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -1,5 +1,3 @@ +echo 'Please remove static-config.inc.php from the bottom of your config.php'; diff --git a/includes/vmware_guestid.inc.php b/includes/vmware_guestid.inc.php index 6ed011717..5fcc590f7 100644 --- a/includes/vmware_guestid.inc.php +++ b/includes/vmware_guestid.inc.php @@ -1,100 +1,99 @@ +$config['vmware_guestid']['winNetEnterpriseGuest'] = 'Windows Server 2003, Enterprise Edition'; +$config['vmware_guestid']['winNetStandard64Guest'] = 'Windows Server 2003, Standard Edition (64 bit)'; +$config['vmware_guestid']['winNetStandardGuest'] = 'Windows Server 2003, Standard Edition'; +$config['vmware_guestid']['winNetWebGuest'] = 'Windows Server 2003, Web Edition'; +$config['vmware_guestid']['winNTGuest'] = 'Windows NT 4'; +$config['vmware_guestid']['winVista64Guest'] = 'Windows Vista (64 bit)'; +$config['vmware_guestid']['winVistaGuest'] = 'Windows Vista'; +$config['vmware_guestid']['winXPHomeGuest'] = 'Windows XP Home Edition'; +$config['vmware_guestid']['winXPPro64Guest'] = 'Windows XP Professional Edition (64 bit)'; +$config['vmware_guestid']['winXPProGuest'] = 'Windows XP Professional'; diff --git a/renamehost.php b/renamehost.php index 1178be36a..e1a369eed 100755 --- a/renamehost.php +++ b/renamehost.php @@ -1,7 +1,7 @@ #!/usr/bin/env php * @copyright (C) 2006 - 2012 Adam Armstrong - * */ chdir(dirname($argv[0])); -include("includes/defaults.inc.php"); -include("config.php"); -include("includes/definitions.inc.php"); -include("includes/functions.php"); +require 'includes/defaults.inc.php'; +require 'config.php'; +require 'includes/definitions.inc.php'; +require 'includes/functions.php'; -# Remove a host and all related data from the system - -if ($argv[1] && $argv[2]) -{ - $host = strtolower($argv[1]); - $id = getidbyname($host); - if ($id) - { - $tohost = strtolower($argv[2]); - $toid = getidbyname($tohost); - if ($toid) - { - echo("NOT renamed. New hostname $tohost already exists.\n"); - } else { - renamehost($id, $tohost, 'console'); - echo("Renamed $host\n"); +// Remove a host and all related data from the system +if ($argv[1] && $argv[2]) { + $host = strtolower($argv[1]); + $id = getidbyname($host); + if ($id) { + $tohost = strtolower($argv[2]); + $toid = getidbyname($tohost); + if ($toid) { + echo "NOT renamed. New hostname $tohost already exists.\n"; + } + else { + renamehost($id, $tohost, 'console'); + echo "Renamed $host\n"; + } + } + else { + echo "Host doesn't exist!\n"; } - } else { - echo("Host doesn't exist!\n"); - } } -else -{ - echo("Host Rename Tool\nUsage: ./renamehost.php \n"); +else { + echo "Host Rename Tool\nUsage: ./renamehost.php \n"; } - -?> diff --git a/scripts/geshi-ios.php b/scripts/geshi-ios.php index ab587b511..fbfd63c69 100755 --- a/scripts/geshi-ios.php +++ b/scripts/geshi-ios.php @@ -1,171 +1,173 @@ 'IOS', + 'LANG_NAME' => 'IOS', 'COMMENT_SINGLE' => array(1 => '!'), - 'CASE_KEYWORDS' => GESHI_CAPS_LOWER, - 'OOLANG' => false, - 'NUMBERS' => GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX, - 'KEYWORDS' => array( + 'CASE_KEYWORDS' => GESHI_CAPS_LOWER, + 'OOLANG' => false, + 'NUMBERS' => GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX, + 'KEYWORDS' => array( 1 => array( - 'no', 'shutdown' + 'no', + 'shutdown', ), - # 2 => array( - # 'router', 'interface', 'service', 'config-register', 'upgrade', 'version', 'hostname', 'boot-start-marker', 'boot', 'boot-end-marker', 'enable', 'aaa', 'clock', 'ip', - # 'logging', 'access-list', 'route-map', 'snmp-server', 'mpls', 'speed', 'media-type', 'negotiation', 'timestamps', 'prefix-list', 'network', 'mask', 'unsuppress-map', - # 'neighbor', 'remote-as', 'ebgp-multihop', 'update-source', 'description', 'peer-group', 'policy-map', 'class-map', 'class', 'match', 'access-group', 'bandwidth', 'username', - # 'password', 'send-community', 'next-hop-self', 'route-reflector-client', 'ldp', 'discovery', 'advertise-labels', 'label', 'protocol', 'login', 'debug', 'log', 'duplex', 'router-id', - # 'authentication', 'mode', 'maximum-paths', 'address-family', 'set', 'local-preference', 'community', 'trap-source', 'location', 'host', 'tacacs-server', 'session-id', - # 'flow-export', 'destination', 'source', 'in', 'out', 'permit', 'deny', 'control-plane', 'line', 'con' ,'aux', 'vty', 'access-class', 'ntp', 'server', 'end', 'source-interface', - # 'key', 'chain', 'key-string', 'redundancy', 'match-any', 'queue-limit', 'encapsulation', 'pvc', 'vbr-nrt', 'address', 'bundle-enable', 'atm', 'sonet', 'clns', 'route-cache', - # 'default-information', 'redistribute', 'log-adjacency-changes', 'metric', 'spf-interval', 'prc-interval', 'lsp-refresh-interval', 'max-lsp-lifetime', 'set-overload-bit', - # 'on-startup', 'wait-for-bgp', 'system', 'flash', 'timezone', 'subnet-zero', 'cef', 'flow-cache', 'timeout', 'active', 'domain', 'lookup', 'dhcp', 'use', 'vrf', 'hello', 'interval', - # 'priority', 'ilmi-keepalive', 'buffered', 'debugging', 'fpd', 'secret', 'accounting', 'exec', 'group', 'local', 'recurring', 'source-route', 'call', 'rsvp-sync', 'scripting', - # 'mtu', 'passive-interface', 'area' , 'distribute-list', 'metric-style', 'is-type', 'originate', 'activate', 'both', 'auto-summary', 'synchronization', 'aggregate-address', 'le', 'ge', - # 'bgp-community', 'route', 'exit-address-family', 'standard', 'file', 'verify', 'domain-name', 'domain-lookup', 'route-target', 'export', 'import', 'map', 'rd', 'mfib', 'vtp', 'mls', - # 'hardware-switching', 'replication-mode', 'ingress', 'flow', 'error', 'action', 'slb', 'purge', 'share-global', 'routing', 'traffic-eng', 'tunnels', 'propagate-ttl', 'switchport', 'vlan', - # 'portfast', 'counters', 'max', 'age', 'ethernet', 'evc', 'uni', 'count', 'oam', 'lmi', 'gmt', 'netflow', 'pseudowire-class', 'spanning-tree', 'name', 'circuit-type' - # ), - # 3 => array( - # 'isis', 'ospf', 'eigrp', 'rip', 'igrp', 'bgp', 'ipv4', 'unicast', 'multicast', 'ipv6', 'connected', 'static', 'subnets', 'tcl' - # ), - # 4 => array( - # 'point-to-point', 'aal5snap', 'rj45', 'auto', 'full', 'half', 'precedence', 'percent', 'datetime', 'msec', 'locatime', 'summer-time', 'md5', 'wait-for-bgp', 'wide', - # 'level-1', 'level-2', 'log-neighbor-changes', 'directed-request', 'password-encryption', 'common', 'origin-as', 'bgp-nexthop', 'random-detect', 'localtime', 'sso', 'stm-1', - # 'dot1q', 'isl', 'new-model', 'always', 'summary-only', 'freeze', 'global', 'forwarded', 'access', 'trunk', 'edge', 'transparent' - # ), + // 2 => array( + // 'router', 'interface', 'service', 'config-register', 'upgrade', 'version', 'hostname', 'boot-start-marker', 'boot', 'boot-end-marker', 'enable', 'aaa', 'clock', 'ip', + // 'logging', 'access-list', 'route-map', 'snmp-server', 'mpls', 'speed', 'media-type', 'negotiation', 'timestamps', 'prefix-list', 'network', 'mask', 'unsuppress-map', + // 'neighbor', 'remote-as', 'ebgp-multihop', 'update-source', 'description', 'peer-group', 'policy-map', 'class-map', 'class', 'match', 'access-group', 'bandwidth', 'username', + // 'password', 'send-community', 'next-hop-self', 'route-reflector-client', 'ldp', 'discovery', 'advertise-labels', 'label', 'protocol', 'login', 'debug', 'log', 'duplex', 'router-id', + // 'authentication', 'mode', 'maximum-paths', 'address-family', 'set', 'local-preference', 'community', 'trap-source', 'location', 'host', 'tacacs-server', 'session-id', + // 'flow-export', 'destination', 'source', 'in', 'out', 'permit', 'deny', 'control-plane', 'line', 'con' ,'aux', 'vty', 'access-class', 'ntp', 'server', 'end', 'source-interface', + // 'key', 'chain', 'key-string', 'redundancy', 'match-any', 'queue-limit', 'encapsulation', 'pvc', 'vbr-nrt', 'address', 'bundle-enable', 'atm', 'sonet', 'clns', 'route-cache', + // 'default-information', 'redistribute', 'log-adjacency-changes', 'metric', 'spf-interval', 'prc-interval', 'lsp-refresh-interval', 'max-lsp-lifetime', 'set-overload-bit', + // 'on-startup', 'wait-for-bgp', 'system', 'flash', 'timezone', 'subnet-zero', 'cef', 'flow-cache', 'timeout', 'active', 'domain', 'lookup', 'dhcp', 'use', 'vrf', 'hello', 'interval', + // 'priority', 'ilmi-keepalive', 'buffered', 'debugging', 'fpd', 'secret', 'accounting', 'exec', 'group', 'local', 'recurring', 'source-route', 'call', 'rsvp-sync', 'scripting', + // 'mtu', 'passive-interface', 'area' , 'distribute-list', 'metric-style', 'is-type', 'originate', 'activate', 'both', 'auto-summary', 'synchronization', 'aggregate-address', 'le', 'ge', + // 'bgp-community', 'route', 'exit-address-family', 'standard', 'file', 'verify', 'domain-name', 'domain-lookup', 'route-target', 'export', 'import', 'map', 'rd', 'mfib', 'vtp', 'mls', + // 'hardware-switching', 'replication-mode', 'ingress', 'flow', 'error', 'action', 'slb', 'purge', 'share-global', 'routing', 'traffic-eng', 'tunnels', 'propagate-ttl', 'switchport', 'vlan', + // 'portfast', 'counters', 'max', 'age', 'ethernet', 'evc', 'uni', 'count', 'oam', 'lmi', 'gmt', 'netflow', 'pseudowire-class', 'spanning-tree', 'name', 'circuit-type' + // ), + // 3 => array( + // 'isis', 'ospf', 'eigrp', 'rip', 'igrp', 'bgp', 'ipv4', 'unicast', 'multicast', 'ipv6', 'connected', 'static', 'subnets', 'tcl' + // ), + // 4 => array( + // 'point-to-point', 'aal5snap', 'rj45', 'auto', 'full', 'half', 'precedence', 'percent', 'datetime', 'msec', 'locatime', 'summer-time', 'md5', 'wait-for-bgp', 'wide', + // 'level-1', 'level-2', 'log-neighbor-changes', 'directed-request', 'password-encryption', 'common', 'origin-as', 'bgp-nexthop', 'random-detect', 'localtime', 'sso', 'stm-1', + // 'dot1q', 'isl', 'new-model', 'always', 'summary-only', 'freeze', 'global', 'forwarded', 'access', 'trunk', 'edge', 'transparent' + // ), ), - 'REGEXPS' => array ( - 1 => array( - GESHI_SEARCH => '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})', + 'REGEXPS' => array( + 1 => array( + GESHI_SEARCH => '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})', GESHI_REPLACE => '\\1', - GESHI_BEFORE => '', + GESHI_BEFORE => '', ), - 2 => array( - GESHI_SEARCH => '(255\.\d{1,3}\.\d{1,3}\.\d{1,3})', + 2 => array( + GESHI_SEARCH => '(255\.\d{1,3}\.\d{1,3}\.\d{1,3})', GESHI_REPLACE => '\\1', - GESHI_BEFORE => '', + GESHI_BEFORE => '', ), - 3 => array( - GESHI_SEARCH => '(source|interface|update-source|router-id) ([A-Za-z0-9\/\:\-\.]+)', + 3 => array( + GESHI_SEARCH => '(source|interface|update-source|router-id) ([A-Za-z0-9\/\:\-\.]+)', GESHI_REPLACE => '\\2', - GESHI_BEFORE => '\\1 ', + GESHI_BEFORE => '\\1 ', ), - 4 => array( - GESHI_SEARCH => '(neighbor) ([\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}]+|[a-zA-Z0-9\-\_]+)', + 4 => array( + GESHI_SEARCH => '(neighbor) ([\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}]+|[a-zA-Z0-9\-\_]+)', GESHI_REPLACE => '\\2', - GESHI_BEFORE => '\\1 ', + GESHI_BEFORE => '\\1 ', ), - 5 => array( - GESHI_SEARCH => '(distribute-map|access-group|policy-map|class-map\ match-any|ip\ access-list\ extended|match\ community|community-list\ standard|community-list\ expanded|ip\ access-list\ standard|router\ bgp|remote-as|key\ chain|service-policy\ input|service-policy\ output|class|login\ authentication|authentication\ key-chain|username|import\ map|export\ map|domain-name|hostname|route-map|access-class|ip\ vrf\ forwarding|ip\ vrf|vtp\ domain|name|pseudowire-class|pw-class|prefix-list|vrf) ([A-Za-z0-9\-\_\.]+)', + 5 => array( + GESHI_SEARCH => '(distribute-map|access-group|policy-map|class-map\ match-any|ip\ access-list\ extended|match\ community|community-list\ standard|community-list\ expanded|ip\ access-list\ standard|router\ bgp|remote-as|key\ chain|service-policy\ input|service-policy\ output|class|login\ authentication|authentication\ key-chain|username|import\ map|export\ map|domain-name|hostname|route-map|access-class|ip\ vrf\ forwarding|ip\ vrf|vtp\ domain|name|pseudowire-class|pw-class|prefix-list|vrf) ([A-Za-z0-9\-\_\.]+)', GESHI_REPLACE => '\\2', - GESHI_BEFORE => '\\1 ', + GESHI_BEFORE => '\\1 ', ), - 6 => array( - GESHI_SEARCH => '(password|key-string|key) ([0-9]) (.+)', + 6 => array( + GESHI_SEARCH => '(password|key-string|key) ([0-9]) (.+)', GESHI_REPLACE => '\\2 \\3', - GESHI_BEFORE => '\\1 ', + GESHI_BEFORE => '\\1 ', ), - 7 => array( - GESHI_SEARCH => '(enable) ([a-z]+) ([0-9]) (.+)', + 7 => array( + GESHI_SEARCH => '(enable) ([a-z]+) ([0-9]) (.+)', GESHI_REPLACE => '\\3 \\4', - GESHI_BEFORE => '\\1 \\2 ', + GESHI_BEFORE => '\\1 \\2 ', ), - 8 => array( - GESHI_SEARCH => '(description|location|contact|remark) (.+)', + 8 => array( + GESHI_SEARCH => '(description|location|contact|remark) (.+)', GESHI_REPLACE => '\\2', - GESHI_BEFORE => '\\1 ', + GESHI_BEFORE => '\\1 ', ), - 9 => array( - GESHI_SEARCH => '([0-9\.\_\*]+\:[0-9\.\_\*]+)', + 9 => array( + GESHI_SEARCH => '([0-9\.\_\*]+\:[0-9\.\_\*]+)', GESHI_REPLACE => '\\1', ), 10 => array( - GESHI_SEARCH => '(boot) ([a-z]+) (.+)', + GESHI_SEARCH => '(boot) ([a-z]+) (.+)', GESHI_REPLACE => '\\3', - GESHI_BEFORE => '\\1 \\2 ' + GESHI_BEFORE => '\\1 \\2 ', ), 11 => array( - GESHI_SEARCH => '(net) ([0-9a-z\.]+)', + GESHI_SEARCH => '(net) ([0-9a-z\.]+)', GESHI_REPLACE => '\\2', - GESHI_BEFORE => '\\1 ' + GESHI_BEFORE => '\\1 ', ), 12 => array( - GESHI_SEARCH => '(access-list|RO|RW) ([0-9]+)', + GESHI_SEARCH => '(access-list|RO|RW) ([0-9]+)', GESHI_REPLACE => '\\2', - GESHI_BEFORE => '\\1 ' + GESHI_BEFORE => '\\1 ', ), 13 => array( - GESHI_SEARCH => '(vlan) ([0-9]+)', + GESHI_SEARCH => '(vlan) ([0-9]+)', GESHI_REPLACE => '\\2', - GESHI_BEFORE => '\\1 ' + GESHI_BEFORE => '\\1 ', ), 14 => array( - GESHI_SEARCH => '(encapsulation|speed|duplex|mtu|metric|media-type|negotiation|transport\ input|bgp-community|set\ as-path\ prepend|maximum-prefix|version|local-preference|continue|redistribute|cluster-id|vtp\ mode|label\ protocol|spanning-tree\ mode) (.+)', + GESHI_SEARCH => '(encapsulation|speed|duplex|mtu|metric|media-type|negotiation|transport\ input|bgp-community|set\ as-path\ prepend|maximum-prefix|version|local-preference|continue|redistribute|cluster-id|vtp\ mode|label\ protocol|spanning-tree\ mode) (.+)', GESHI_REPLACE => '\\2', - GESHI_BEFORE => '\\1 ' + GESHI_BEFORE => '\\1 ', ), ), 'STYLES' => array( 'REGEXPS' => array( - 0 => 'color: #ff0000;', - 1 => 'color: #0000cc;', # x.x.x.x - 2 => 'color: #000099; font-style: italic', # 255.x.x.x - 3 => 'color: #000000; font-weight: bold; font-style: italic;', # interface xxx - 4 => 'color: #ff0000;', # neighbor x.x.x.x - 5 => 'color: #000099;', # variable names - 6 => 'color: #cc0000;', - 7 => 'color: #cc0000;', # passwords - 8 => 'color: #555555;', # description - 9 => 'color: #990099;', # communities - 10 => 'color: #cc0000; font-style: italic;', # no/shut - 11 => 'color: #000099;', # net numbers - 12 => 'color: #000099;', # acls - 13 => 'color: #000099;', # acls - 14 => 'color: #990099;', # warnings + 0 => 'color: #ff0000;', + 1 => 'color: #0000cc;', + // x.x.x.x + 2 => 'color: #000099; font-style: italic', + // 255.x.x.x + 3 => 'color: #000000; font-weight: bold; font-style: italic;', + // interface xxx + 4 => 'color: #ff0000;', + // neighbor x.x.x.x + 5 => 'color: #000099;', + // variable names + 6 => 'color: #cc0000;', + 7 => 'color: #cc0000;', + // passwords + 8 => 'color: #555555;', + // description + 9 => 'color: #990099;', + // communities + 10 => 'color: #cc0000; font-style: italic;', + // no/shut + 11 => 'color: #000099;', + // net numbers + 12 => 'color: #000099;', + // acls + 13 => 'color: #000099;', + // acls + 14 => 'color: #990099;', + // warnings ), 'KEYWORDS' => array( - 1 => 'color: #cc0000; font-weight: bold;', # no/shut - 2 => 'color: #000000;', # commands - 3 => 'color: #000000; font-weight: bold;', # proto/service - 4 => 'color: #000000;', # options - 5 => 'color: #ff0000;' + 1 => 'color: #cc0000; font-weight: bold;', + // no/shut + 2 => 'color: #000000;', + // commands + 3 => 'color: #000000; font-weight: bold;', + // proto/service + 4 => 'color: #000000;', + // options + 5 => 'color: #ff0000;', ), - 'COMMENTS' => array( - 1 => 'color: #808080; font-style: italic;' - ), - 'ESCAPE_CHAR' => array( - 0 => 'color: #000099; font-weight: bold;' - ), - 'BRACKETS' => array( - 0 => 'color: #66cc66;' - ), - 'STRINGS' => array( - 0 => 'color: #ff0000;' - ), - 'NUMBERS' => array( - 0 => 'color: #cc0000;' - ), - 'METHODS' => array( - 0 => 'color: #006600;' - ), - 'SYMBOLS' => array( - 0 => 'color: #66cc66;' - ), - 'SCRIPT' => array( + 'COMMENTS' => array(1 => 'color: #808080; font-style: italic;'), + 'ESCAPE_CHAR' => array(0 => 'color: #000099; font-weight: bold;'), + 'BRACKETS' => array(0 => 'color: #66cc66;'), + 'STRINGS' => array(0 => 'color: #ff0000;'), + 'NUMBERS' => array(0 => 'color: #cc0000;'), + 'METHODS' => array(0 => 'color: #006600;'), + 'SYMBOLS' => array(0 => 'color: #66cc66;'), + 'SCRIPT' => array( 0 => '', 1 => '', 2 => '', - 3 => '' - ) + 3 => '', + ), - ) + ), ); - -?> \ No newline at end of file diff --git a/snmptrap.php b/snmptrap.php index 049da4c7c..04f6f5de6 100755 --- a/snmptrap.php +++ b/snmptrap.php @@ -10,7 +10,6 @@ * @subpackage snmptraps * @author Adam Armstrong * @copyright (C) 2006 - 2012 Adam Armstrong - * */ ini_set('display_errors', 1); @@ -18,27 +17,30 @@ ini_set('display_startup_errors', 1); ini_set('log_errors', 1); ini_set('error_reporting', E_ALL); -include("includes/defaults.inc.php"); -include("config.php"); -include("includes/definitions.inc.php"); -include("includes/functions.php"); +require 'includes/defaults.inc.php'; +require 'config.php'; +require 'includes/definitions.inc.php'; +require 'includes/functions.php'; -$entry = explode(",", $argv[1]); +$entry = explode(',', $argv[1]); logfile($argv[1]); -#print_r($entry); +// print_r($entry); +$device = @dbFetchRow('SELECT * FROM devices WHERE `hostname` = ?', array($entry['0'])); -$device = @dbFetchRow("SELECT * FROM devices WHERE `hostname` = ?", array($entry['0'])); - -if (!$device['device_id']) -{ - $device = @dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id", array($entry['0'])); +if (!$device['device_id']) { + $device = @dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id', array($entry['0'])); } -if (!$device['device_id']) { exit; } else { } +if (!$device['device_id']) { + exit; +} -$file = $config['install_dir'] . "/includes/snmptrap/".$entry['1'].".inc.php"; -if (is_file($file)) { include("$file"); } else { echo("unknown trap ($file)"); } - -?> +$file = $config['install_dir'].'/includes/snmptrap/'.$entry['1'].'.inc.php'; +if (is_file($file)) { + include "$file"; +} +else { + echo "unknown trap ($file)"; +} diff --git a/upgrade-scripts/fix-port-rrd.php b/upgrade-scripts/fix-port-rrd.php index 9862af1b8..3d95d6860 100755 --- a/upgrade-scripts/fix-port-rrd.php +++ b/upgrade-scripts/fix-port-rrd.php @@ -1,52 +1,56 @@ 1) { + echo (round((($i / $count) * 100), 2)."% \r"); + } +} + + +function getDirectoryTree($outerDir, &$files=array()) +{ + $dirs = array_diff(scandir($outerDir), array( '.', '..' )); + foreach ($dirs as $d) { + if (is_dir($outerDir.'/'.$d)) { + getDirectoryTree($outerDir.'/'.$d, $files); } + else { + if (preg_match('/^[\d]+.rrd$/', $d)) { + array_push($files, preg_replace('/\/+/', '/', $outerDir.'/'.$d)); + } + } + } - echo($count . " Files \n"); - $start = date("U"); - $i = 0; - foreach ($files as $file){ - fixRdd($file); - $i++; - if (date("U") - $start > 1) - echo(round(($i / $count) * 100, 2) . "% \r"); - } + return $files; - function getDirectoryTree( $outerDir, &$files = array()){ - - $dirs = array_diff( scandir( $outerDir ), Array( ".", ".." ) ); - foreach ( $dirs as $d ){ - if (is_dir($outerDir."/".$d) ){ - getDirectoryTree($outerDir.'/'. $d, $files); - }else{ - if (preg_match('/^[\d]+.rrd$/', $d)) - array_push($files, preg_replace('/\/+/', '/', $outerDir.'/'. $d)); - - } - } - return $files; - } +}//end getDirectoryTree() - function fixRdd($file){ - global $config; - global $rrdcached; - $fileC = shell_exec( "{$config['rrdtool']} dump $file $rrdcached" ); +function fixRdd($file) +{ + global $config; + global $rrdcached; + $fileC = shell_exec("{$config['rrdtool']} dump $file $rrdcached"); -#--------------------------------------------------------------------------------------------------------- - -$first = << INDISCARDS DERIVE @@ -54,9 +58,9 @@ $first = << 0.0000000000e+00 1.2500000000e+10 - UNKN - 0.0000000000e+00 - 0 + UNKN + 0.0000000000e+00 + 0 OUTDISCARDS @@ -65,9 +69,9 @@ $first = << 0.0000000000e+00 1.2500000000e+10 - UNKN - 0.0000000000e+00 - 0 + UNKN + 0.0000000000e+00 + 0 INUNKNOWNPROTOS @@ -128,20 +132,18 @@ $first = << FIRST; - - -$second = << - 0.0000000000e+00 - NaN - NaN - 0 + $second = << + 0.0000000000e+00 + NaN + NaN + 0 - - 0.0000000000e+00 - NaN - NaN - 0 + + 0.0000000000e+00 + NaN + NaN + 0 0.0000000000e+00 @@ -173,35 +175,28 @@ $second = << NaN 0 - + SECOND; -$third = << NaN NaN NaN NaN NaN NaN NaN THIRD; + // --------------------------------------------------------------------------------------------------------- + if (!preg_match('/DISCARDS/', $fileC)) { + $fileC = str_replace('', $first, $fileC); + $fileC = str_replace('', $second, $fileC); + $fileC = str_replace('', $third, $fileC); + $tmpfname = tempnam('/tmp', 'OBS'); + file_put_contents($tmpfname, $fileC); + @unlink($file); + $newfile = preg_replace('/(\d+)\.rrd/', 'port-\\1.rrd', $file); + @unlink($newfile); + shell_exec($config['rrdtool']." restore $tmpfname $newfile"); + unlink($tmpfname); + } + +}//end fixRdd() - -#--------------------------------------------------------------------------------------------------------- - if (!preg_match('/DISCARDS/', $fileC)){ - $fileC = str_replace('', $first, $fileC); - $fileC = str_replace('', $second, $fileC); - $fileC = str_replace('', $third, $fileC); - $tmpfname = tempnam("/tmp", "OBS"); - file_put_contents($tmpfname, $fileC); - @unlink($file); - $newfile = preg_replace("/(\d+)\.rrd/", "port-\\1.rrd", $file); - @unlink($newfile); - shell_exec($config['rrdtool'] . " restore $tmpfname $newfile"); - unlink($tmpfname); - - } - - - } - - echo("\n"); - -?> - +echo "\n"; diff --git a/upgrade-scripts/fix-sensor-rrd.php b/upgrade-scripts/fix-sensor-rrd.php index df373de71..e508dbf2d 100755 --- a/upgrade-scripts/fix-sensor-rrd.php +++ b/upgrade-scripts/fix-sensor-rrd.php @@ -1,79 +1,81 @@ 1) - echo(round(($i / $count) * 100, 2) . "% \r"); - } +echo $count." Files \n"; +$start = date('U'); +$i = 0; - function sensor_getDirectoryTree( $outerDir, &$files = array()){ - - $dirs = array_diff( scandir( $outerDir ), Array( ".", ".." ) ); - foreach ( $dirs as $d ){ - if (is_dir($outerDir."/".$d) ){ - sensor_getDirectoryTree($outerDir.'/'. $d, $files); - } else { - if ((preg_match('/^fan-.*.rrd$/', $d)) || - (preg_match('/^current-.*.rrd$/', $d)) || - (preg_match('/^freq-.*.rrd$/', $d)) || - (preg_match('/^humidity-.*.rrd$/', $d)) || - (preg_match('/^volt-.*.rrd$/', $d)) || - (preg_match('/^temp-.*.rrd$/', $d)) ) - array_push($files, preg_replace('/\/+/', '/', $outerDir.'/'. $d)); - - } - } - return $files; - } +foreach ($files as $file) { + sensor_fixRdd($file); + $i++; + if ((date('U') - $start) > 1) { + echo (round((($i / $count) * 100), 2)."% \r"); + } +} - function sensor_fixRdd($file){ - global $config; - global $rrdcached; - $fileC = shell_exec( "{$config['rrdtool']} dump $file $rrdcached"); - if (preg_match('/ fan/', $fileC)) - { - shell_exec("{$config['rrdtool']} tune $file $rrdcached -r fan:sensor"); - rename($file,str_replace('/fan-','/fanspeed-',$file)); - } - elseif (preg_match('/ volt/', $fileC)) - { - shell_exec("{$config['rrdtool']} tune $file $rrdcached -r volt:sensor"); - rename($file,str_replace('/volt-','/voltage-',$file)); - } - elseif (preg_match('/ current/', $fileC)) - { - shell_exec("{$config['rrdtool']} tune $file $rrdcached -r current:sensor"); - } - elseif (preg_match('/ freq/', $fileC)) - { - shell_exec("{$config['rrdtool']} tune $file $rrdcached -r freq:sensor"); - rename($file,str_replace('/freq-','/frequency-',$file)); - } - elseif (preg_match('/ humidity/', $fileC)) - { - shell_exec("{$config['rrdtool']} tune $file $rrdcached -r humidity:sensor"); - } - elseif (preg_match('/ temp/', $fileC)) - { - shell_exec("{$config['rrdtool']} tune $file $rrdcached -r temp:sensor"); - rename($file,str_replace('/temp-','/temperature-',$file)); - } - } +function sensor_getDirectoryTree($outerDir, &$files=array()) +{ - echo("\n"); + $dirs = array_diff(scandir($outerDir), array( '.', '..' )); + foreach ($dirs as $d) { + if (is_dir($outerDir.'/'.$d)) { + sensor_getDirectoryTree($outerDir.'/'.$d, $files); + } + else { + if ((preg_match('/^fan-.*.rrd$/', $d)) + || (preg_match('/^current-.*.rrd$/', $d)) + || (preg_match('/^freq-.*.rrd$/', $d)) + || (preg_match('/^humidity-.*.rrd$/', $d)) + || (preg_match('/^volt-.*.rrd$/', $d)) + || (preg_match('/^temp-.*.rrd$/', $d)) + ) { + array_push($files, preg_replace('/\/+/', '/', $outerDir.'/'.$d)); + } + } + } -?> + return $files; +} + + +function sensor_fixRdd($file) +{ + global $config; + global $rrdcached; + $fileC = shell_exec("{$config['rrdtool']} dump $file $rrdcached"); + if (preg_match('/ fan/', $fileC)) { + shell_exec("{$config['rrdtool']} tune $file $rrdcached -r fan:sensor"); + rename($file, str_replace('/fan-', '/fanspeed-', $file)); + } + else if (preg_match('/ volt/', $fileC)) { + shell_exec("{$config['rrdtool']} tune $file $rrdcached -r volt:sensor"); + rename($file, str_replace('/volt-', '/voltage-', $file)); + } + else if (preg_match('/ current/', $fileC)) { + shell_exec("{$config['rrdtool']} tune $file $rrdcached -r current:sensor"); + } + else if (preg_match('/ freq/', $fileC)) { + shell_exec("{$config['rrdtool']} tune $file $rrdcached -r freq:sensor"); + rename($file, str_replace('/freq-', '/frequency-', $file)); + } + else if (preg_match('/ humidity/', $fileC)) { + shell_exec("{$config['rrdtool']} tune $file $rrdcached -r humidity:sensor"); + } + else if (preg_match('/ temp/', $fileC)) { + shell_exec("{$config['rrdtool']} tune $file $rrdcached -r temp:sensor"); + rename($file, str_replace('/temp-', '/temperature-', $file)); + } + +} + + +echo "\n";