Commit 81332213 authored by 's avatar
Browse files

Endpoints are now named "subjects", each subject consists of one host for...

Endpoints are now named "subjects", each subject consists of one host for incoming and one host for outgoing traffic. Host for incoming traffic can be the same as the one for outgoing traffic anyhow...
Lots of "ifdef's", why only I haven't already branched this nice app :)
Important memory-corruption fix.
Added graph for matched flows.
Improvements in GUI, now each subject has its own color everywhere/anytime.
Tables stylesheet for gui (dirty hack).
Modularization of graph.php started.



git-svn-id: file:///home/svn/mapi/trunk@1413 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 64a9beac
......@@ -11,19 +11,36 @@ packetloss_startlog_filename = packetloss_start.log
bpf_filter = greater 0
#cpu = 1
# number of flows than packetloss application can receive in one life-cycle (10s)
# there is a limitation of 49998 flows per device becouse DIMAPI_DATA_SIZE = 2000000 in mapiipc.h
# flows_max will be limited automatically in case it would exceeded 49998 * number_of_all_devices
flows_max = 250000
# tolerate this timestamp difference among hosts (in NTP, so in_seconds = this_value / 2^32)
# timestamp_tolerance = 2147483648 // NTP, 0.5 seconds
#timestamp_tolerance = 2147483648 // NTP, 0.5 seconds
timestamp_tolerance = 429496729 // NTP, 0.1 seconds
# set 1 if you want to reconnect every loop (may be too much time consuming)
# set 0 if you want to reconnect just on SIGUSR1
still_reconnect = 0
# specify subjects:
#
# [subject]
# lable = SUBJ1
# host_id_in = 0
# host_id_out = 1
# enabled = true
#
# [subject]
# label = SUBJ2
# host_id_in = 2
# host_id_out = 2
# enabled = true
#
#
# specify hosts:
#
# [host]
......@@ -32,6 +49,7 @@ still_reconnect = 0
# interface = /dev/dag1
# label = host1
# description =
# direction = in
# enabled = true
#
# [host]
......@@ -40,6 +58,15 @@ still_reconnect = 0
# interface = eth1
# label = host2
# description =
# direction = out
# enabled = true
#
# [host]
# hostname = host3.example.net
# interface = eth0
# label = host3
# description =
# direction = inout
# enabled = true
#
......
/* This is alternate stylesheet */
@import url(packetloss.css);
/* Sven rulez */
body { background-color: #D0D0D0;
/* font-family: sans-serif;*/
/* font-size: x-small;*/ }
/*
td { font-size: x-small; }
input { font-size: x-small; }
*/
img#logo { margin-right: 25px }
/* */
html {
background-color: #D0D0D0;
}
body {
margin-left: 10px;
}
h2 {
font-size: 1em;
}
h4 {
font-size: 1em;
margin: 0em 0em 0.5em 0em;
}
.steps .step {
margin-top: 0em;
padding: 0.5em 0.5em 0.5em 0em;
/*border: 5px solid #E0E0E0;*/
}
.steps .step .substep {
margin-top: 0.5em;
}
input.submit {
margin-top: 1em;
}
.steps .tbl label {
border-bottom: none;
}
.steps .tbl {
width: 20.2em;
display: table;
border-collapse: separate;
/*background-color: white;*/
border-color: #E0E0E0;
border-style: outset;
border-spacing: 2px;
border-width: 1px;
}
.steps .tbl .tr {
margin-right: 0em;
width: 20.2em;
padding: 0em;
padding-top: 0em;
padding-bottom: 0em;
/*border: 1px solid black;*/
/*border-width: 1px;*/
}
.steps .tbl .medium {
width: 30em;
}
.steps .tbl .normal {
width: 20em;
}
.steps .tbl .short {
width: 11em;
}
.steps .tbl .tiny {
width: 7em;
}
.steps .tbl .th {
display: table-cell;
/*border-collapse: separate;*/
border-style: inset;
border-color: white;
border-width: 1px;
padding-top: 1px;
padding-bottom: 1px;
line-height: 1.6em; /* adjust to form input elements */
}
.steps .tbl .td {
/*border: 1px solid black;*/
display: table-cell;
/*border-collapse: separate;*/
border-style: inset;
border-color: white;
border-width: 1px;
padding-top: 1px;
padding-bottom: 1px;
line-height: 1em; /* adjust to form input elements */
}
#assholder .packetloss {
position: relative;
top: 1px;
color: #A0A0A0;
font-size: 10pt;
font-family: Verdana, lucida, helvetica, arial, sans-serif;
}
#assholder .packetloss-tables {
position: relative;
top: 1px;
color: black;
font-size: 10pt;
font-family: Verdana, lucida, helvetica, arial, sans-serif;
}
......@@ -255,3 +255,222 @@ div.altitle-status {
content: " ! ";
background-color: #FFFF00;
}
div.clear {
clear: both
}
.steps {
clear: left;
}
.steps .step {
margin-top: 2em;
padding: 0.5em 0.5em 0.5em 0em;
}
.steps .step:hover {
/*border: 5px solid #F0F0F0;*/
}
.steps .step .substep {
margin-top: 1em;
}
.steps label {
display: block;
width: 100%;
border-bottom: 1px dashed #A0A0A0;
}
/*.steps label:hover {
border-bottom: 1px solid black;
}*/
.steps .tr {
/* background-color: #F0F0F0; */
float: left;
width: 20em;
margin-right: 5em;
}
.steps .widetd {
width: 50em;
}
.steps .medium {
width: 30em;
}
.steps .short {
width: 11em;
}
.steps .tiny {
width: 9em;
}
.steps .th {
/*border: 1px solid red;*/
float: left;
display: block;
width: 18em;
}
.steps .td {
float: left;
}
.steps .widetd .th {
width: 20em;
}
.steps .medium .th {
width: 28em;
}
.steps .short .th {
width: 9em;
}
.steps .tiny .th {
width: 7em;
}
.graphs {
clear: left;
margin-top: 2em;
border-top: 5px solid #F0F0F0;
}
.graphs .graph {
float: left;
margin-top: 2em;
margin-left: 1em;
}
.status {
clear: left;
margin-top: 2em;
border-top: 5px solid #F0F0F0;
}
.table {
width: 90%;
}
.thestatus {
border: 1px solid black;
margin-top: 2em;
}
.thestatus th {
border-bottom: 1px dashed #A0A0A0;
font-size-adjust: 0.519;
font-family: arial, helvetica, sans-serif;
}
.thestatus td {
border-top: none;
border-right: none;
border-bottom: 1px dashed #A0A0A0;
border-left: none;
padding: 2px;
text-align: right;
font-size: 110%;
font-size-adjust: 0.423;
font-family: "Courier New", Courier, FixedSys, System, monospace;
white-space: pre;
}
.thestatus tr.delimiter {
border-top: 2px solid #808080;
}
.thestatus th.right {
text-align: right;
}
acronym.help {
border: 1px dashed #666666;
padding: 0em 0.2em;
color: #666666;
font-size-adjust: 0.545;
font-family: Verdana, lucida, helvetica, arial, sans-serif;
font-weight: bold;
font-size: 85%;
}
.disabled {
color: gray;
}
.s0 {
color: red;
}
.s1 {
color: blue;
}
.s2 {
color: green;
}
.s3 {
color: #DD7700;
}
.s4 {
color: #FFAA00;
}
.noalarm {
color: green;
font-weight: bold;
}
.alarm0 {}
.alarm1 {
color: #FF6633;
font-weight: bold;
}
.alarm2 {
color: #FF6633;
font-weight: bold;
}
.alarm3 {
color: #FF0000;
font-weight: bold;
}
/*
.alarm1:after {
content: " ? ";
}
.alarm2:after {
content: " ! ";
}
.alarm3:after {
content: " ! ";
}
*/
input.restart {
color: black;
background-color: red;
font-weight: bold;
}
input.restart:hover {
color: #FFFF00;
}
input.reset {
color: black;
background-color: red;
font-weight: bold;
}
input.reset:hover {
color: #FFFF00;
}
#assholder .packetloss {
position: relative;
top: 1px;
color: black;
font-size: 10pt;
font-family: Verdana, lucida, helvetica, arial, sans-serif;
}
#assholder .packetloss-tables {
position: relative;
top: 1px;
color: #A0A0A0;
font-size: 10pt;
font-family: Verdana, lucida, helvetica, arial, sans-serif;
}
......@@ -19,9 +19,10 @@ rrdtool = "rrdtool"
#rrdtool_error_log = "log/packetloss_rrdtool_error.log"
# rrds
packetloss_rrd = "packetloss.rrd"
packetcount_rrd = "packetloss_packets.rrd"
flows_rrd = "packetloss_flows.rrd"
packetloss_rrd = "packetloss.rrd"
packetcount_rrd = "packetloss_packets.rrd"
flows_rrd = "packetloss_flows.rrd"
matchedflows_rrd = "packetloss_matchedflows.rrd"
# packetloss files
packetloss_status = "packetloss_status.csv"
......
......@@ -8,11 +8,11 @@
$DIR="../";
require_once "${DIR}lib/expire.php";
require_once "${DIR}lib/graph.php";
require_once "${DIR}lib/graph/flows.php";
# }}}
$allowed_args = ",host0rrddsid,host0rrddsid,start,end,step,avg,max,min,width,height,upperLimit,lowerLimit,onlyGraph,title,info,withstarts,";
$allowed_args = ",host0rrddsid,host1rrddsid,start,end,step,avg,max,min,width,height,upperLimit,lowerLimit,onlyGraph,title,info,withstarts,";
foreach(array_keys($_GET) as $key) {
if(strpos($allowed_args,",$key,") !== false) {
......@@ -20,7 +20,7 @@ foreach(array_keys($_GET) as $key) {
}
}
$graph = new Graph("flows", array($host0rrddsid, $host1rrddsid), $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
$graph = new Flows_Graph(array($host0rrddsid, $host1rrddsid), $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
//$graph->dry_run();
$graph->flush();
......
<?php
# File name: matchedflows.php
# Date: 2008/06/06 21:06
# Author: Ales Friedl <ales.friedl@email.cz>
# Includes {{{
$DIR="../";
require_once "${DIR}lib/expire.php";
require_once "${DIR}lib/graph/matchedflows.php";
# }}}
$allowed_args = ",host0rrddsid,host1rrddsid,start,end,step,avg,max,min,width,height,upperLimit,lowerLimit,onlyGraph,title,info,withstarts,";
foreach(array_keys($_GET) as $key) {
if(strpos($allowed_args,",$key,") !== false) {
$$key = $_GET[$key];
}
}
$graph = new Matchedflows_Graph(array($host0rrddsid, $host1rrddsid), $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
//$graph->dry_run();
$graph->flush();
// vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 :
?>
......@@ -4,7 +4,7 @@
$DIR="../";
require_once "${DIR}lib/expire.php";
require_once "${DIR}lib/graph.php";
require_once "${DIR}lib/graph/packetcount.php";
# }}}
......@@ -16,7 +16,7 @@ foreach(array_keys($_GET) as $key) {
}
}
$graph = new Graph("packetcount", array($host0rrddsid, $host1rrddsid), $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
$graph = new Packetcount_Graph(array($host0rrddsid, $host1rrddsid), $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
//$graph->dry_run();
$graph->flush();
......
......@@ -4,7 +4,7 @@
$DIR="../";
require_once "${DIR}lib/expire.php";
require_once "${DIR}lib/graph.php";
require_once "${DIR}lib/graph/packetloss.php";
# }}}
......@@ -16,7 +16,7 @@ foreach(array_keys($_GET) as $key) {
}
}
$graph = new Graph("packetloss", array($host0rrddsid, $host1rrddsid), $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
$graph = new Packetloss_Graph(array($host0rrddsid, $host1rrddsid), $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
//$graph->dry_run();
$graph->flush();
......
......@@ -25,9 +25,14 @@ $logging = false;
# }}}
$packetlossStatus = new packetlossStatus($config->abspath($config->packetloss_home, $config->packetloss_status));
$subjarr = $packetlossStatus->subjarr;
$subjarr_allkeys = array_keys($subjarr);
$subjarr_firstkey = array_shift($subjarr_allkeys);
while($subjarr[$subjarr_firstkey]["enabled"] == "disabled") $subjarr_firstkey = array_shift($subjarr_allkeys);
$hostarr = $packetlossStatus->hostarr;
$hostarr_allkeys = array_keys($hostarr);
$hostarr_firstkey = array_shift($hostarr_allkeys);
while($hostarr[$hostarr_firstkey]["enabled"] == "disabled") $hostarr_firstkey = array_shift($hostarr_allkeys);
# initialize form elements {{{
......@@ -35,14 +40,14 @@ $form = array();
$form["host0"] = new FormElement( // radio
"host0",
$packetlossStatus->hostarr,
$hostarr_firstkey
$packetlossStatus->subjarr,
$subjarr_firstkey
);
$form["host1"] = new FormElement( // checkboxes
"host1",
$packetlossStatus->hostarr,
$hostarr_allkeys
$packetlossStatus->subjarr,
$subjarr_allkeys
);
$form["time_type"] = new FormElement( // radio
......@@ -58,8 +63,8 @@ $form["time_type"] = new FormElement( // radio
$form["timez"] = new FormElement( // checkboxes
"timez",
$predefinedTimes = array(
"10m_10_0" => "10 minutes (int 10 sec)",
"1h_60_0" => "1 hour (int 1 min)",
"10m_10_60" => "10 minutes (int 10 sec, max 1 min)",
"1h_60_600" => "1 hour (int 1 min, max 10 min)",
"3h_180_900" => "3 hours (int 3 min, max 15 min)",
"1d_300_3600" => "1 day (int 5 min, max 1 hour)",
"1w_1800_21600" => "1 week (int 30 min, max 6 hour)",
......@@ -133,18 +138,28 @@ $form["constep_unit"] = new FormElement( // select - option
$form["consolidation"] = new FormElement( // checkboxes
"consolidation",
array(
"avg" => "Avg",
"max" => "Max",
// "min" => "Min",
"smartmax" => "SmartMax",
"starts" => "StartTime"
"avg" => array(
"label" => "Avg",
"description" => "",
),
"max" => array(
"label" => "Max",
"description" => "",
),
// "min" => array(
// "label" => "Min",
// "description" => "",
// ),
"smartmax" => array(
"label" => "SmartMax",
"description" => "With SmartMax, the maximum values will NOT be shown in graphs for intervals larger than 30 minutes. (Showing all peaks within large interval could significally degradate the average values otherwise.)",
),
),
array(
// "avg",
"max",
// "min",
"smartmax",
// "starts"
)
);
......@@ -153,12 +168,14 @@ $form["characteristics"] = new FormElement( // checkboxes
array(
"packetloss" => "Packet Lost Ratio",
"packetcount" => "Packet Loss Count",
"flows" => "Flows Count"
"flows" => "Flows Count",
"matchedflows" => "Matched Flows Count",
),
array(
"packetloss",
"packetcount",
// "flows"
// "flows",
// "matchedflows",
)
);
......@@ -167,11 +184,22 @@ $form["graph_size"] = new FormElement( // radio
array(
"small" => "Small (300 × 100)",
"normal" => "Normal (400 × 200)",
"large" => "Large (500 × 300)"