diff --git a/applications/abw/htdocs/index.php b/applications/abw/htdocs/index.php index a64bc66b667ad8e8ccb8a25693cbeecf384e8c8e..e5a4542b7ff9143ff0bae9778171e4b62360eefa 100644 --- a/applications/abw/htdocs/index.php +++ b/applications/abw/htdocs/index.php @@ -1,7 +1,7 @@ \n"; echo "\n"; -echo "\n"; +echo "\n"; echo "\n"; echo "\n"; if (defined('NET_IMG')) - echo "\n"; + echo "\n"; -echo "

ABW - Passive bandwith usage monitoring

\n"; +echo "

ABW - Passive capacity usage monitoring

\n"; if (!isset($subject_selected)) $subject_selected=1; @@ -227,23 +227,27 @@ foreach ($subject_label as $key => $value) { /* if (($i%2)==0) echo "\n"; */ -echo "all links\n"; +echo "all links\n"; echo "\n"; +echo ">\n"; $i++; -if (($i%2)>0) - echo "  "; -echo "\n"; +/* if (($i%2)>0) + echo "  "; */ +echo "\n"; + +/* echo "

Note: PIONIER monitoring stations are down due to moving to a different subnet.\n"; */ /* * Print form to select time granularities and periods */ echo "

\n"; -echo "

Step 3: Select time period and granularity:

\n"; +echo "

Step 3: Select time period and resolution:

\n"; +echo "(how is data aggregated)\n"; +echo "

\n"; echo "

Time type:
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -309,6 +313,7 @@ echo "\n"; +echo "

Start or end date:
\n"; echo "\n"; echo "

Time length:
\n"; -echo "\n"; +if (isset($time_length_number)) + $time_length_number_preset=$time_length_number; +else + $time_length_number_preset=""; +echo "\n"; echo "\n"; /* Interval + avg/max are as a separate table */ -echo "

Predefined $value) { echo "
all predefined time periods
\n"; +echo "

Interval:Avg/Max:
\n"; echo "
Resolution:Avg/Max:
\n"; echo "\n"; + echo "

\n"; + /* echo "

\n"; echo "\n"; */ mkdir($GRAPH_DIR . "/" . $session); @@ -439,17 +448,12 @@ if ($action=="gen_graph") { $i=0; foreach ($subject_label as $subject_key => $subject_value) { - if (($subject_all || in_array($subject_value, $subjects)) && + if ((isset($subject_all) || in_array($subject_value, $subjects)) && !$subject_disabled[$subject_key]) { $hostname=$subject_hostname[$i]; - if ($hostname!="localhost") - $command="ssh " . $REMOTE_USERNAME . "@" . $hostname; - else - $command=""; - - $command=$command . " \"" . $GRAPH_SCRIPT . " --session=" . $session . " --graph_type=" . $graph_type_value . " --label=" . $subject_value . " --parameters_id=1"; + $command="ssh " . $REMOTE_USERNAME . "@" . $subject_hostname[$i] . " \"" . $GRAPH_SCRIPT . " --session=" . $session . " --graph_type=" . $graph_type_value . " --label=" . $subject_value . " --parameters_id=1"; /* If maxline is not default ("a"), then request it */ @@ -463,8 +467,10 @@ if ($action=="gen_graph") { foreach ($time_description as $time_key => $time_value) { $time_label=$r1[$time_key] . "_" . $r2[$time_key] . "_" . $time_length[$time_key]; - if ($time_all || in_array($time_label, $times)) { - $hhmmYYYYMMDD=date("G:i Ymd", (int)(time() / $r2[$time_key]) * $r2[$time_key] - $r2[$time_key]); + if (isset($time_all) || in_array($time_label, $times)) { + /* Rounding was removed */ + $hhmmYYYYMMDD=date("G:i Ymd", (int)(time() )); + // $hhmmYYYYMMDD=date("G:i Ymd", (int)(time() / $r2[$time_key]) * $r2[$time_key]); $command=$command . " --time=\\\"" . $r1[$time_key] . " " . $r2[$time_key] . " " . @@ -489,17 +495,21 @@ if ($action=="gen_graph") { $r1_sec=time_to_sec($r1_number, $r1_unit); $r2_sec=time_to_sec($r2_number, $r2_unit); /* echo "r1_sec: $r1_sec, r2_sec: $r2_sec
\n"; */ - if ($r1_sec<=0 || $r2_sec<=0 || $r2_sec<$r1_sec || - ($r2_sec%$r1_sec)>0) { - echo "Incorrect time or date specification.
\n"; + if ($r1_sec<=0 || $r2_sec<=0) { + echo "Incorrect time or date specification (resolution and avg/max must be greater than zero).
\n"; + exit(); + } + if ($r2_sec<$r1_sec) { + echo "Incorrect time or date specification (avg/max must be greater than equal to resolution).
\n"; exit(); } $time_length_sec=time_to_sec($time_length_number, $time_length_unit); - $time_length_sec= - ((int)($time_length_sec / $r2_sec)) * $r2_sec; + /* Rounding was removed */ + // $time_length_sec= + // ((int)($time_length_sec / $r2_sec)) * $r2_sec; if ($time_length_sec<=0) { - echo "Incorrect time or date specification.
\n"; + echo "Incorrect time or date specification (time length must be greater than zero).
\n"; exit(); } @@ -507,22 +517,26 @@ if ($action=="gen_graph") { $timestamp=strtotime($time_year . "-" . $time_month . "-" . $time_day . " " . $time_hour . ":" . $time_minute); + + /* Adjust timestamp to R2 boundary */ + + /* Rounding was removed */ + // $timestamp=((int)($timestamp / $r2_sec)) * $r2_sec; /* echo "timestamp: $timestamp
\n"; */ - $hhmmYYYYMMDD=date("G:i Ymd", $timestamp); - /* echo "hhmmYYYYMMDD: $hhmmYYYYMMDD
\n"; */ /* If start time was given, then compute end time */ if (!strcmp($time_type, "start_time")) { $timestamp=$timestamp + $time_length_sec; /* echo "timestamp + time_length: $timestamp
\n"; */ - $hhmmYYYYMMDD=date("G:i Ymd", $timestamp); - /* echo "hhmmYYYYMMDD + time_length: $hhmmYYYYMMDD
\n"; */ } + if ($timestamp>time()) { + echo "Incorrect time or date specification (end time must not be in the future).
\n"; + exit(); + } - /* Adjust timestamp to R2 boundary */ - - $timestamp=((int)($timestamp / $r2_sec)) * $r2_sec; + $hhmmYYYYMMDD=date("G:i Ymd", $timestamp); + /* echo "hhmmYYYYMMDD + time_length: $hhmmYYYYMMDD
\n"; */ $command=$command . " --time=\\\"" . $r1_sec . " " . $r2_sec . " " . $time_length_number . @@ -543,12 +557,7 @@ if ($action=="gen_graph") { $graph_type_description[$graph_type_key], $subject_value, $diff); */ - if ($hostname!="localhost") - $command="scp " . $REMOTE_USERNAME . "@" . $hostname . ":"; - else - $command="cp "; - - $command=$command . $REMOTE_GRAPH_DIR . "/" . $session . "/* " . $GRAPH_DIR . "/" . $session; + $command="scp " . $REMOTE_USERNAME . "@" . $subject_hostname[$i] . ":" . $REMOTE_GRAPH_DIR . "/" . $session . "/* " . $GRAPH_DIR . "/" . $session; syslog(LOG_DEBUG, "Command: $command"); $time1=gettimeofday(TRUE); system($command); @@ -568,7 +577,7 @@ if ($action=="gen_graph") { $graphs=0; foreach ($subject_label as $subject_key => $subject_value) { - if (($subject_all || in_array($subject_value, $subjects)) && + if ((isset($subject_all) || in_array($subject_value, $subjects)) && !$subject_disabled[$subject_key]) { if (!strcmp($time_type, "predefined")) { @@ -576,7 +585,7 @@ if ($action=="gen_graph") { foreach ($time_description as $time_key => $time_value) { $time_label=$r1[$time_key] . "_" . $r2[$time_key] . "_" . $time_length[$time_key]; - if ($time_all || in_array($time_label, $times)) { + if (isset($time_all) || in_array($time_label, $times)) { foreach($graph_types as $graph_type) { $graph_filename="graph/" . $session . "/graph_" . $subject_value . "_" . @@ -590,10 +599,10 @@ if ($action=="gen_graph") { echo "\n"; @@ -620,10 +629,10 @@ if ($action=="gen_graph") { echo "
Graph typeLinkTime (gen / copy)
\n"; echo " \n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo "
" . $graph_type_description[array_search($graph_type, $graph_type_label)] . ", Monitored link: " . $subject_description[$subject_key] . "
$time_description[$time_key]
" . $graph_type_description[array_search($graph_type, $graph_type_label)] . ", Monitored link: " . $subject_description[$subject_key] . "
$time_description[$time_key]
\n"; echo "
\n"; echo " \n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; - echo "
" . $graph_type_description[array_search($graph_type, $graph_type_label)] . ", Monitored link: " . $subject_description[$subject_key] . "
$time_length_number $time_length_unit"; + echo "
" . $graph_type_description[array_search($graph_type, $graph_type_label)] . ", Monitored link: " . $subject_description[$subject_key] . "
$time_length_number $time_length_unit"; if (!strcmp($time_type, "start_time")) echo " from"; else