Commit 81332213 authored by 's avatar

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();
......
This diff is collapsed.
......@@ -139,17 +139,19 @@ var packetlossStatus = {
var record = packetlossStatus.bufferarr[i].split(";");
var stats = record[0];
var category = record[1];
var h0 = record[2];
var d0 = record[3];
var relation = record[4];
var h1 = record[5];
var d1 = record[6];
var id = record[7];
var label = record[8];
var value = record[9];
var unit = record[10];
var ct = record[11];
var alarm = record[12];
var s0 = record[2];
var h0 = record[3];
var d0 = record[4];
var relation = record[5];
var s1 = record[6];
var h1 = record[7];
var d1 = record[8];
var id = record[9];
var label = record[10];
var value = record[11];
var unit = record[12];
var ct = record[13];
var alarm = record[14];
if(id == "ts") {
packetlossStatus.setUpToDate(parseInt(value));
......@@ -197,7 +199,7 @@ var packetlossStatus = {
packetlossStatus.delayFollow = parseInt(value) + "000";
}
packetlossStatus.arr.push({category: category, h0: h0, d0: d0, relation: relation, h1: h1, d1: d1, id: id, label: label, value: value, unit: unit, ct: ct, alarm: alarm});
packetlossStatus.arr.push({category: category, s0: s0, h0: h0, d0: d0, relation: relation, s1: s1, h1: h1, d1: d1, id: id, label: label, value: value, unit: unit, ct: ct, alarm: alarm});
}
if(packetlossStatus.debug && packetlossStatus.logging) if(packetlossStatus.logger) packetlossStatus.logger.smartlog("packetlossStatus.js: Stored " + packetlossStatus.arr.length + " records");
},
......@@ -221,9 +223,11 @@ var packetlossStatus = {
for(var i = 0; i < packetlossStatus.arr.length; i++) {
var record = packetlossStatus.arr[i];
var category = record["category"];
var s0 = record["s0"];
var h0 = record["h0"];
var d0 = record["d0"];
var relation = record["relation"];
var s1 = record["s1"];
var h1 = record["h1"];
var d1 = record["d1"];
var id = record["id"];
......@@ -233,7 +237,7 @@ var packetlossStatus = {
var ct = record["ct"];
var alarm = record["alarm"];
var uid = ("id_" + h0 + d0 + relation + h1 + d1 + id).replace(/\*/g, "_");
var uid = ("id_" + s0 + h0 + d0 + relation + s1 + h1 + d1 + id).replace(/\*/g, "_");
if(!packetlossStatus.objarr[uid]) {
packetlossStatus.objarr[uid] = document.getElementById(uid);
}
......
......@@ -22,7 +22,7 @@ class Config {
for($i = 0; $i < count($rarr); $i++) {
$line = trim($rarr[$i]);
if($line[0] != "" && $line[0] != "#") {
if($line != "" && $line[0] != "" && $line[0] != "#") {
$property = trim(trim(strtok($line,"=")), "\"");
$value = trim(strtok(""));
if($value != ltrim($value, "\"")) $value = trim($value, "\"");
......@@ -36,7 +36,7 @@ class Config {
function abspath($rootdir, $path, $search="", $replace="") {
if($search && $replace) $path = str_replace($search, $replace, $path);
if($path[0] == "/") $abspath = $path;
if($path != "" && $path[0] == "/") $abspath = $path;
else $abspath = $rootdir."/".$path;
return $abspath;
}
......
This diff is collapsed.
<?php
# File name: flows.php
# Date: 2008/06/06
# Author: Ales Friedl <ales.friedl@email.cz>
# Includes {{{
include_once "${DIR}lib/graph.php";
# }}}
class Flows_Graph extends Graph {
public function __construct($rrddsid, $start="now-3600s", $end="now", $step="", $avg="", $max="", $min="", $width="500", $height="300", $title="Untitled", $info="", $withstarts="false") {
$this->type = "flows";
parent::__construct($this->type, $rrddsid, $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
}
}
// vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 :
?>
<?php
# File name: matchedflows.php
# Date: 2008/06/06
# Author: Ales Friedl <ales.friedl@email.cz>
# Includes {{{
include_once "${DIR}lib/graph.php";
# }}}
class Matchedflows_Graph extends Graph {
public function __construct($rrddsid, $start="now-3600s", $end="now", $step="", $avg="", $max="", $min="", $width="500", $height="300", $title="Untitled", $info="", $withstarts="false") {
$this->type = "matchedflows";
parent::__construct($this->type, $rrddsid, $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
}
}
// vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 :
?>
<?php
# File name: packetcount.php
# Date: 2008/06/06
# Author: Ales Friedl <ales.friedl@email.cz>
# Includes {{{
include_once "${DIR}lib/graph.php";
# }}}
class Packetcount_Graph extends Graph {
public function __construct($rrddsid, $start="now-3600s", $end="now", $step="", $avg="", $max="", $min="", $width="500", $height="300", $title="Untitled", $info="", $withstarts="false") {
$this->type = "packetcount";
parent::__construct($this->type, $rrddsid, $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
}
}
// vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 :
?>
<?php
# File name: packetloss.php
# Date: 2008/06/06
# Author: Ales Friedl <ales.friedl@email.cz>
# Includes {{{
include_once "${DIR}lib/graph.php";
# }}}
class Packetloss_Graph extends Graph {
public function __construct($rrddsid, $start="now-3600s", $end="now", $step="", $avg="", $max="", $min="", $width="500", $height="300", $title="Untitled", $info="", $withstarts="false") {
$this->type = "packetloss";
parent::__construct($this->type, $rrddsid, $start, $end, $step, $avg, $max, $min, $width, $height, $title, $info, $withstarts);
}
}
// vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 :
?>
......@@ -8,10 +8,10 @@ class Highlight {
/**
* static
*/
function keywordize($str,$keyword="",$class){
function keywordize($str,$keyword="",$class,$cs=false){
if($keyword=="")return $str;
$lowstr=strtolower($str);
$keyword=strtolower($keyword);
$lowstr=$cs?$str:strtolower($str);
$keyword=$cs?$keyword:strtolower($keyword);
$arr=explode($keyword,$lowstr."_break_");