diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 1578389d8..a8b2af26e 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -69,8 +69,8 @@ function generatedevicelink($device, $text=0, $start=0, $end=0) $graphhead = $entry['text']; $contents .= '
'; $contents .= ''.$graphhead.'
'; - $contents .= ''; - $contents .= ''; + $contents .= ''; + $contents .= ''; $contents .= '
'; } $text = htmlentities($text); diff --git a/html/includes/graphs/device/auth.inc.php b/html/includes/graphs/device/auth.inc.php new file mode 100644 index 000000000..c5f258da2 --- /dev/null +++ b/html/includes/graphs/device/auth.inc.php @@ -0,0 +1,11 @@ + diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php index 3f5bcdfd9..9779538f2 100644 --- a/html/includes/graphs/graph.inc.php +++ b/html/includes/graphs/graph.inc.php @@ -18,16 +18,16 @@ if($_GET['debug']) { if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; } } - if($_GET['device']) { - $_GET['id'] = $_GET['device']; - $device_id = $_GET['device']; - } elseif($_GET['if']) { - $_GET['id'] = $_GET['if']; - } elseif($_GET['port']) { - $_GET['id'] = $_GET['port']; - } elseif($_GET['peer']) { - $_GET['id'] = $_GET['peer']; - } +# if($_GET['device']) { +# $_GET['id'] = $_GET['device']; +# $device_id = $_GET['device']; +# } elseif($_GET['if']) { +# $_GET['id'] = $_GET['if']; +# } elseif($_GET['port']) { +# $_GET['id'] = $_GET['port']; +# } elseif($_GET['peer']) { +# $_GET['id'] = $_GET['peer']; +# } preg_match('/^(?P[A-Za-z0-9]+)_(?P.+)/', mres($_GET['type']), $graphtype); diff --git a/html/includes/graphs/port/auth.inc.php b/html/includes/graphs/port/auth.inc.php new file mode 100644 index 000000000..067225874 --- /dev/null +++ b/html/includes/graphs/port/auth.inc.php @@ -0,0 +1,12 @@ + diff --git a/html/includes/print-device-graph.php b/html/includes/print-device-graph.php index f0675b983..30bdc8826 100644 --- a/html/includes/print-device-graph.php +++ b/html/includes/print-device-graph.php @@ -1,47 +1,15 @@ "); +$graph_array['type'] = $graph_type; +$graph_array['id'] = $device['device_id']; - echo('
'.$graph_title.'
'); - - $daily_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=".$config['day']."&to=".$config['now']."&width=215&height=100"; - $daily_traffic .= $args; - $daily_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=".$config['day']."&to=".$config['now']."&width=400&height=150"; - $daily_url .= $args; - - $weekly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=".$config['week']."&to=".$config['now']."&width=215&height=100"; - $weekly_traffic .= $args; - $weekly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=".$config['week']."&to=".$config['now']."&width=400&height=150"; - $weekly_url .= $args; - - $monthly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=".$config['month']."&to=".$config['now']."&width=215&height=100"; - $monthly_traffic .= $args; - $monthly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=".$config['month']."&to=".$config['now']."&width=400&height=150"; - $monthly_url .= $args; - - $yearly_traffic = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=".$config['year']."&to=".$config['now']."&width=215&height=100"; - $yearly_traffic .= $args; - $yearly_url = "graph.php?device=" . $device['device_id'] . "&type=$graph_type&from=".$config['year']."&to=".$config['now']."&width=400&height=150"; - $yearly_url .= $args; - - $graph_args = $device['device_id'] . "/" . $graph_type . "/"; - - echo("', LEFT".$config['overlib_defaults'].");\" - onmouseout=\"return nd();\"> "); - - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> - "); - - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> - "); - - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> - "); - - echo(""); +$g_i++; +if(!is_integer($g_i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } +echo('
'); +echo('
'.$graph_title.'
'); +include("includes/print-quadgraphs.inc.php"); +echo("
"); ?> diff --git a/html/includes/print-interface-graphs.inc.php b/html/includes/print-interface-graphs.inc.php index 30d062077..0b16dd1a1 100644 --- a/html/includes/print-interface-graphs.inc.php +++ b/html/includes/print-interface-graphs.inc.php @@ -2,27 +2,15 @@ global $config; - if(!$graph_type) { $graph_type = $_GET['type']; } - - if(!$device) { $device['device_id'] = getifhost($interface['interface_id']); } + #if(!$graph_type) { $graph_type = $_GET['type']; } + #if(!$device) { $device['device_id'] = getifhost($interface['interface_id']); } $graph_array['height'] = "100"; $graph_array['width'] = "215"; $graph_array['to'] = $now; - $graph_array['port'] = $interface['interface_id']; + $graph_array['id'] = $interface['interface_id']; $graph_array['type'] = $graph_type; - $periods = array('day', 'week', 'month', 'year'); - -if($graph_type == "etherlike" && !is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/etherlike-" . $interface['ifIndex'] . ".rrd")) { -} else { - - 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($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); - } - -} + include("includes/print-quadgraphs.inc.php"); ?> diff --git a/html/pages/device/health/current.inc.php b/html/pages/device/health/current.inc.php index 12e8d61c2..69a04ca71 100644 --- a/html/pages/device/health/current.inc.php +++ b/html/pages/device/health/current.inc.php @@ -20,35 +20,13 @@ while($current = mysql_fetch_array($query)) { echo(""); $graph_type = "sensor_current"; + + $graph_array['id'] = $current['sensor_id']; + $graph_array['type'] = $graph_type; -// start current graphs + include("includes/print-quadgraphs.inc.php"); - $daily_current = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150"; - - $weekly_current = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150"; - - $monthly_current = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150"; - - $yearly_current = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - - - echo(""); - - - $row++; + $i++; } diff --git a/html/pages/device/health/diskio.inc.php b/html/pages/device/health/diskio.inc.php index 54588e6ba..c1397237f 100644 --- a/html/pages/device/health/diskio.inc.php +++ b/html/pages/device/health/diskio.inc.php @@ -18,14 +18,6 @@ while($drive = mysql_fetch_array($query)) { if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } -# $total = $drive['storage_size']; -# $used = $drive['storage_used']; -# $free = $drive['storage_free']; -# $perc = round($drive['storage_perc'], 0); -# $used = formatStorage($used); -# $total = formatStorage($total); -# $free = formatStorage($free); - $fs_url = "/device/".$device['device_id']."/health/diskio/"; $fs_popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$drive['diskio_descr']; @@ -46,21 +38,12 @@ while($drive = mysql_fetch_array($query)) { echo(''); - $graph_array['height'] = "100"; - $graph_array['width'] = "215"; - $graph_array['to'] = $now; $graph_array['id'] = $drive['diskio_id']; $graph_array['type'] = $graph_type; - $periods = array('day', 'week', 'month', 'year'); + include("includes/print-quadgraphs.inc.php"); - 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($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); - } - - echo(''); + echo(""); } diff --git a/html/pages/device/health/fanspeeds.inc.php b/html/pages/device/health/fanspeeds.inc.php index 916e8b368..d9e513aad 100644 --- a/html/pages/device/health/fanspeeds.inc.php +++ b/html/pages/device/health/fanspeeds.inc.php @@ -21,28 +21,10 @@ while($fan = mysql_fetch_array($query)) { $graph_type = "sensor_fanspeed"; -// start fanspeed graphs + $graph_array['id'] = $fan['sensor_id']; + $graph_array['type'] = $graph_type; - $daily_fan = "graph.php?id=" . $fan['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $fan['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150"; - - $weekly_fan = "graph.php?id=" . $fan['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $fan['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150"; - - $monthly_fan = "graph.php?id=" . $fan['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $fan['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150"; - - $yearly_fan = "graph.php?id=" . $fan['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $fan['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); + include("includes/print-quadgraphs.inc.php"); echo(""); diff --git a/html/pages/device/health/frequencies.inc.php b/html/pages/device/health/frequencies.inc.php index eb44dbaee..964941fe8 100644 --- a/html/pages/device/health/frequencies.inc.php +++ b/html/pages/device/health/frequencies.inc.php @@ -21,28 +21,10 @@ while($freq = mysql_fetch_array($query)) { $graph_type = "sensor_frequency"; -// start frequency graphs + $graph_array['id'] = $freq['sensor_id']; + $graph_array['type'] = $graph_type; - $daily_freq = "graph.php?id=" . $freq['freq_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $freq['freq_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150"; - - $weekly_freq = "graph.php?id=" . $freq['freq_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $freq['freq_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150"; - - $monthly_freq = "graph.php?id=" . $freq['freq_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $freq['freq_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150"; - - $yearly_freq = "graph.php?id=" . $freq['freq_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $freq['freq_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); + include("includes/print-quadgraphs.inc.php"); echo(""); diff --git a/html/pages/device/health/humidity.inc.php b/html/pages/device/health/humidity.inc.php index dee94c931..14856c2ff 100644 --- a/html/pages/device/health/humidity.inc.php +++ b/html/pages/device/health/humidity.inc.php @@ -21,28 +21,10 @@ while($humidity = mysql_fetch_array($query)) { $graph_type = "sensor_humidity"; -// start humidity graphs + $graph_array['id'] = $humidity['sensor_id']; + $graph_array['type'] = $graph_type; - $daily_humidity = "graph.php?id=" . $humidity['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $humidity['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150"; - - $weekly_humidity = "graph.php?id=" . $humidity['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $humidity['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150"; - - $monthly_humidity = "graph.php?id=" . $humidity['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $humidity['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150"; - - $yearly_humidity = "graph.php?id=" . $humidity['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $humidity['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); + include("includes/print-quadgraphs.inc.php"); echo(""); diff --git a/html/pages/device/health/memory.inc.php b/html/pages/device/health/memory.inc.php index a02cf06b7..37cf668ed 100644 --- a/html/pages/device/health/memory.inc.php +++ b/html/pages/device/health/memory.inc.php @@ -43,26 +43,13 @@ $graph_type = "mempool_usage"; echo(""); - $daily_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - - $weekly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - - $monthly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - - $yearly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); + + $graph_array['id'] = $mempool['mempool_id']; + $graph_array['type'] = $graph_type; + + include("includes/print-quadgraphs.inc.php"); + + echo(""); $i++; diff --git a/html/pages/device/health/processors.inc.php b/html/pages/device/health/processors.inc.php index 80c6c5fc3..01075d9be 100644 --- a/html/pages/device/health/processors.inc.php +++ b/html/pages/device/health/processors.inc.php @@ -2,68 +2,51 @@ $graph_type = "processor_usage"; - echo("
"); - echo(""); - $i = '1'; - $procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'"); - while($proc = mysql_fetch_array($procs)) { +echo("
"); +echo("
"); +$i = '1'; +$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'"); +while($proc = mysql_fetch_array($procs)) { - $proc_url = $config['base_url']."/device/".$device['device_id']."/health/processors/"; + $proc_url = $config['base_url']."/device/".$device['device_id']."/health/processors/"; - $mini_url = $config['base_url'] . "/graph.php?id=".$proc['processor_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; + $mini_url = $config['base_url'] . "/graph.php?id=".$proc['processor_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; - $text_descr = $proc['processor_descr']; + $text_descr = $proc['processor_descr']; - $text_descr = rewrite_entity_descr($text_descr); + $text_descr = rewrite_entity_descr($text_descr); - $proc_popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$text_descr; - $proc_popup .= "
"; - $proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; + $proc_popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$text_descr; + $proc_popup .= "
"; + $proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; - $perc = round($proc['processor_usage']); + $perc = round($proc['processor_usage']); - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } + if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; + } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; + } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; + } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; + } else { $left_background='9abf5b'; $right_background='bbd392'; } - echo(" - - - - "); + echo(" + + + + "); echo(""); - - $i++; - } - echo("
" . $text_descr . " - ".print_percentage_bar (400, 20, $perc, $perc."%", "ffffff", $left_background, (100 - $perc)."%" , "ffffff", $right_background)." -
" . $text_descr . " + ".print_percentage_bar (400, 20, $perc, $perc."%", "ffffff", $left_background, (100 - $perc)."%" , "ffffff", $right_background)." +
"); - $daily_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $graph_array['id'] = $proc['processor_id']; + $graph_array['type'] = $graph_type; - $weekly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + include("includes/print-quadgraphs.inc.php"); - $monthly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; +} - $yearly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("
"); - echo("
"); +echo(""); +echo("
"); ?> diff --git a/html/pages/device/health/storage.inc.php b/html/pages/device/health/storage.inc.php index 2159d4996..d5a1e25f2 100644 --- a/html/pages/device/health/storage.inc.php +++ b/html/pages/device/health/storage.inc.php @@ -45,30 +45,12 @@ while($drive = mysql_fetch_array($query)) { " . $free . ""); -// start temperature graphs - - $daily_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$day&to=$now&width=212&height=100"; - $daily_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150"; - - $weekly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$week&to=$now&width=212&height=100"; - $weekly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150"; - - $monthly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$month&to=$now&width=212&height=100"; - $monthly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150"; - - $yearly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$year&to=$now&width=212&height=100"; - $yearly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150"; + $graph_array['id'] = $storage['storage_id']; + $graph_array['type'] = $graph_type; echo(""); - echo("".$device['hostname']." - ".$drive['storage_descr']."', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"> - "); - echo("".$device['hostname']." - ".$drive['storage_descr']."', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"> - "); - echo("".$device['hostname']." - ".$drive['storage_descr']."', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"> - "); - echo("".$device['hostname']." - ".$drive['storage_descr']."', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"> - "); + include("includes/print-quadgraphs.inc.php"); echo(""); diff --git a/html/pages/device/health/temperatures.inc.php b/html/pages/device/health/temperatures.inc.php index f2473b1d4..38921f585 100644 --- a/html/pages/device/health/temperatures.inc.php +++ b/html/pages/device/health/temperatures.inc.php @@ -21,29 +21,10 @@ while($temp = mysql_fetch_array($query)) { $graph_type = "sensor_temperature"; -// start temperature graphs - - $daily_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150"; - - $weekly_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150"; - - $monthly_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150"; - - $yearly_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); + $graph_array['id'] = $temp['sensor_id']; + $graph_array['type'] = $graph_type; + include("includes/print-quadgraphs.inc.php"); echo(""); diff --git a/html/pages/device/health/voltages.inc.php b/html/pages/device/health/voltages.inc.php index 6739ad62f..1cf74e32f 100644 --- a/html/pages/device/health/voltages.inc.php +++ b/html/pages/device/health/voltages.inc.php @@ -21,28 +21,10 @@ while($volt = mysql_fetch_array($query)) { $graph_type = "sensor_voltage"; -// start voltage graphs + $graph_array['id'] = $volt['sensor_id']; + $graph_array['type'] = $graph_type; - $daily_volt = "graph.php?id=" . $volt['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $volt['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150"; - - $weekly_volt = "graph.php?id=" . $volt['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150"; - - $monthly_volt = "graph.php?id=" . $volt['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150"; - - $yearly_volt = "graph.php?id=" . $volt['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); - echo("', LEFT);\" onmouseout=\"return nd();\"> - "); + include("includes/print-quadgraphs.inc.php"); echo(""); diff --git a/html/pages/device/overview/ports.inc.php b/html/pages/device/overview/ports.inc.php index 42445e578..f6be41c96 100644 --- a/html/pages/device/overview/ports.inc.php +++ b/html/pages/device/overview/ports.inc.php @@ -7,7 +7,7 @@ if($ports['total']) { $graph_array['height'] = "100"; $graph_array['width'] = "490"; $graph_array['to'] = $now; - $graph_array['device'] = $device['device_id']; + $graph_array['id'] = $device['device_id']; $graph_array['type'] = "device_bits"; $graph_array['from'] = $day; $graph_array['legend'] = "no"; @@ -28,7 +28,10 @@ if($ports['total']) { $content .= generate_graph_tag($graph_array); $content .= ""; - echo(overlib_link($_SERVER['REQUEST_URI'], $graph, $content, NULL)); + $link = $config['base_url'] . "/graphs/" . $graph_array['id'] . "/" . $graph_array['type'] . "/" . $graph_array['day'] . "/" . $config['now'] . "/"; + + + echo(overlib_link($link, $graph, $content, NULL)); echo('
'); diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php new file mode 100644 index 000000000..92af53be9 --- /dev/null +++ b/html/pages/graphs.inc.php @@ -0,0 +1,119 @@ +[A-Za-z0-9]+)_(?P.+)/', mres($graph_type), $graphtype); + + $type = $graphtype['type']; + $subtype = $graphtype['subtype']; + + if(isset($config['graph'][$type][$subtype])) { $descr = $config['graph'][$type][$subtype]; } else { $descr = $graph_type; } + + if(is_file("includes/graphs/".$type."/auth.inc.php")) + { + include("includes/graphs/".$type."/auth.inc.php"); + } else { + #### FIXME. UGLY ERROR + echo("Missing auth for this graph type! This is a bug. Please report it."); + exit(); + } + + if(isset($config['graph'][$type][$subtype])) { $title .= " :: ".$config['graph'][$type][$subtype]; } else { $title .= " :: ".$graph_type; } + + $graph_array['height'] = "60"; + $graph_array['width'] = "150"; + $graph_array['legend'] = "no"; + $graph_array['to'] = $now; + $graph_array['id'] = $id; + $graph_array['type'] = $graph_type; + $graph_array['from'] = $day; + $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; + + + print_optionbar_start(); + echo($title); + print_optionbar_end(); + + + echo("
"); + + echo("
"); + + echo(""); + + $graph_array['from'] = $twoday; + echo(""); + + $graph_array['from'] = $week; + echo(""); + + $graph_array['from'] = $config['twoweek']; + echo(""); + + $graph_array['from'] = $month; + echo(""); + + $graph_array['from'] = $config['twomonth']; + echo(""); + + + $graph_array['from'] = $year; + echo(""); + + echo("
"); + + $graph_array['height'] = "300"; + $graph_array['width'] = "1075"; + $graph_array['from'] = $from; + $graph_array['to'] = $to; + $graph_array['legend'] = "yes"; + + echo("
"); + echo(generate_graph_tag($graph_array)); + echo("
"); + + + echo("
"); + + +?> diff --git a/includes/discovery/mempools-hrstorage.inc.php b/includes/discovery/mempools-hrstorage.inc.php index 0bee7fb34..7cdbdfece 100755 --- a/includes/discovery/mempools-hrstorage.inc.php +++ b/includes/discovery/mempools-hrstorage.inc.php @@ -17,6 +17,8 @@ if(is_array($storage_array)) { if ($device['os'] == "routeros" && $descr == "main memory") { $deny = 0; } if(strstr($descr, "MALLOC") || strstr($descr, "UMA")) { $deny = 1; } ## Ignore FreeBSD INSANITY + if(strstr($descr, "procfs") || strstr($descr, "/proc")) { $deny = 1; } ## Ignore ProcFS + if(!$deny && is_numeric($index)) { discover_mempool($valid_mempool, $device, $index, "hrstorage", $descr, $units, NULL, NULL); diff --git a/includes/functions.php b/includes/functions.php index 8c0da6051..a4b4c3b8b 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -89,6 +89,19 @@ function device_array($device_id) return $device; } +function get_port_by_id($port_id) +{ + if(is_numeric($port_id)) { + $port = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '".$port_id."'")); + } + if(is_array($port)){ + return $port; + } else { + return FALSE; + } + +} + function get_device_id_by_interface_id($interface_id) { if(is_numeric($interface_id)) { $device_id = mysql_result(mysql_query("SELECT `device_id` FROM `ports` WHERE `interface_id` = '".$interface_id."'"),0); diff --git a/includes/static-config.php b/includes/static-config.php index 191f8fb9c..2a49dfb38 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -396,6 +396,16 @@ $config['os'][$os]['type'] = "network"; $device_types = array('server', 'network', 'firewall', 'workstation', 'printer', 'power', 'environment'); +$config['graph']['device']['bits'] = "Total Traffic"; +$config['graph']['device']['hrusers'] = "Users Logged In"; +$config['graph']['device']['temperatures'] = "Temperatures"; +$config['graph']['device']['memory'] = "Memory Usage"; +$config['graph']['device']['processors'] = "Processor Usage"; +$config['graph']['device']['cpu'] = "Processor Usage"; +$config['graph']['device']['storage'] = "Disk Usage"; + + + ############################## # No changes below this line # ############################## @@ -443,12 +453,15 @@ $week = time() - (7 * 24 * 60 * 60); $month = time() - (31 * 24 * 60 * 60); $year = time() - (365 * 24 * 60 * 60); -$config['now'] = $now; -$config['day'] = $day; -$config['twoday'] = $twoday; -$config['week'] = $week; -$config['month'] = $month; -$config['year'] = $year; +$config['now'] = time(); +$config['day'] = time() - (24 * 60 * 60); +$config['twoday'] = time() - (2 * 24 * 60 * 60); +$config['week'] = time() - (7 * 24 * 60 * 60); +$config['twoweek'] = time() - (2 * 7 * 24 * 60 * 60); +$config['month'] = time() - (31 * 24 * 60 * 60); +$config['twomonth'] = time() - (2 * 31 * 24 * 60 * 60); +$config['threemonth'] = time() - (3 * 31 * 24 * 60 * 60); +$config['year'] = time() - (365 * 24 * 60 * 60); ?>