Commit 223bdd65 authored by 's avatar
Browse files

Debugging


git-svn-id: file:///home/svn/mapi/trunk/applications/abw@1136 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent df4d610a
......@@ -27,8 +27,9 @@
which can happen because mapi_read_result() is delayed for unknown
reason
- graph filenames should include time range and should be different for each
session.
- graph filenames should include time range
- old graphs should be deleted after some time
- abw_check_rrd.sh and abw_check_data.sh erroneously keep restarting abw
when abw.cfg is changed and some /usr/local/abw/rrd/*all.rrd files are
......
# This configuration file should be stored on each host that runs abw
# executable and is contacted by the web server. It can be a monitoring
# station (in which case we describe network cards on that particular
# monitoring station) or it can be a central station (in which case
# we describe network cards on all remote monitoring stations contacted
# by the central station through DiMAPI).
# Optional [global] section includes information common to all monitored links.
# [global]
# You must specify one [subject] section for each direction of each monitored
# link. Each [subject] section MUST include id, hostname, interface and label.
# It CAN optionally include port, direction and description.
# Hostname and interface say where the monitoring adapter is located. If the
# hostname is the same as where the ABW executable is running (either specified
# as real hostname or specified as "localhost") for all [subject] sections in
# a [scope] section (see below), then MAPI will be used, otherwise DiMAPI will
# be used.
# You must specify one [subject] section for each port on each network card
# used for monitoring. Each [subject] section MUST include id, hostname,
# interface and label. It CAN optionally include port, direction and
# description.
# Port should be specified only if you use a multi-port monitoring card.
# Direction should be specified only if you are monitoring each direction
# (in or out) separately. [subject] sections for the same link, but the
# Hostname says where the network card is located. Use fully-qualified domain
# name even if the card is on the local host. Interface is the device name.
# Port should be specified only if you use a multi-port monitoring card
# (e.g., DAG) and starts from 0. Direction should be specified only if you are
# monitoring each direction (in or out) of a monitored link separately by two
# ports or two cards. [subject] sections for the same monitored link, but the
# oposite directions MUST have the same label.
[subject]
id=1
hostname=scampi1.cesnet.cz
interface=/dev/dag0
hostname=perfmon1.cesnet.cz
interface=eth1
label=abw_test
description=ABW Test
# [subject]
# id=2
# hostname=perfmon1.cesnet.cz
# hostname=jra1-2.cesnet.cz
# interface=/dev/dag0
# label=GN2
# description=CESNET GN2
# port=1
# direction=out
# You must specify one [scope] section for each set of one or more monitored i
# links, which should be monitored together. Each [scope] section MUST include
# id and subject_ids (separated by commas). If you are unsure, specify one
# [scope] section for one [subject] section.
#
# You cannot include in one [scope] section the subjects that have different
# mpls or port fields (in abw_const.cfg file), because these fields require
# to apply different BPF_FILTER or additional INTERFACE MAPI functions,
# respectively.
# [subject] sections needs to be grouped together in [scope] sections. If you
# are unsure, specify one [scope] section for one [subject] section. Each
# [scope] section MUST include id and subject_ids (separated by commas)
# If you run abw executable on the central station, you can include more
# [subject] sections in one [scope]. This will result in one distributed
# flow (called scope) to be created by DiMAPI for all included [subjects]
# sections. All [subject] sections included in a [scope] section must have
# the same port and the same "mpls" field in the MAPI configuration file
# (mapi.conf).
[scope]
id=1
......
......@@ -15,6 +15,17 @@ function set_vars() {
$GLOBALS[$key]=$value;
} /* set_vars() */
function rand_string($len, $chars = 'abcdefghijklmnopqrstuvwxyz0123456789')
{
$string = '';
for ($i = 0; $i < $len; $i++)
{
$pos = rand(0, strlen($chars)-1);
$string .= $chars{$pos};
}
return $string;
} /* rand_string() */
?>
......@@ -2,12 +2,6 @@
/* BEGINNING OF USER CONFIGURATION SECTION */
/* QUICK START:
*
* 1. Edit WEB_DIR
*
*/
/* Username used by web server to login to remote monitoring stations */
define(REMOTE_USERNAME, "abw");
......@@ -15,7 +9,7 @@ define(REMOTE_USERNAME, "abw");
define(ABW_DIR, "/usr/local/abw");
/* Directory on the web server where ABW scripts should be installed */
define(WEB_DIR, "/var/www/perfmon/abw-test");
define(WEB_DIR, "/var/www/perfmon/abw");
/*
* Define subjects
......@@ -27,7 +21,7 @@ define(WEB_DIR, "/var/www/perfmon/abw-test");
* the abw.cfg configuration file.
*/
$subject_label=array(
"abw_test"
"Prague_PoP"
/* , "cityA_to_cityB" */
/* , "cityC_to_cityD" */
);
......@@ -38,7 +32,7 @@ $subject_label=array(
* the abw.cfg configuration file, but it is not required.
*/
$subject_description=array(
"ABW test",
"Prague PoP",
/* , "city A to city B" */
/* , "city C to city D" */
);
......@@ -50,7 +44,7 @@ $subject_description=array(
* individual remote monitoring stations directly.
*/
$subject_hostname=array(
"scampi1.cesnet.cz",
"perfmon1.cesnet.cz",
/* , "central_station.your_domain.org" */
/* , "monitoring_station.your_domain.org" */
);
......@@ -65,8 +59,13 @@ define(NET_IMG, "cesnet-logo-137.png");
/* END OF USER CONFIGURATION SECTION */
define(GRAPH_SCRIPT, ABW_DIR . "/bin/rrd_graph_all.sh");
/* define(GRAPH_SCRIPT, ABW_DIR . "/bin/rrd_graph_all.sh");
define(GRAPH_DIR, WEB_DIR . "/graph");
define(REMOTE_GRAPH_DIR, ABW_DIR . "/graph");
define(REMOTE_GRAPH_DIR, ABW_DIR . "/graph"); */
$GRAPH_SCRIPT=ABW_DIR . "/bin/rrd_graph_all.sh";
$GRAPH_DIR=WEB_DIR . "/graph";
$REMOTE_GRAPH_DIR=ABW_DIR . "/graph";
$REMOTE_USERNAME=REMOTE_USERNAME;
?>
......@@ -398,8 +398,10 @@ echo "</form><br>\n";
if ($action=="gen_graph") {
foreach (glob(GRAPH_DIR . "/*") as $filename)
unlink($filename);
$session=rand_string(6);
/* foreach (glob($GRAPH_DIR . "/*") as $filename)
unlink($filename); */
/* If at least one graph type, one subject and one time period were
selected, then generate and show graphs */
......@@ -428,7 +430,7 @@ if ($action=="gen_graph") {
$hostname=$subject_hostname[$i];
$command="ssh " . REMOTE_USERNAME . "@" . $subject_hostname[$i] . " \"" . GRAPH_SCRIPT . " -r --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 */
......@@ -522,7 +524,9 @@ if ($action=="gen_graph") {
$graph_type_description[$graph_type_key], $subject_value,
$diff);
$command="scp " . REMOTE_USERNAME . "@" . $subject_hostname[$i] . ":" . REMOTE_GRAPH_DIR . "/* " . GRAPH_DIR;
mkdir($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);
......@@ -553,7 +557,7 @@ if ($action=="gen_graph") {
$time_length[$time_key];
if ($time_all || in_array($time_label, $times)) {
$graph_filename="graph/graph_" . $subject_value . "_" .
$graph_filename="graph/" . $session . "/graph_" . $subject_value . "_" .
$graph_type . "_" . $r1[$time_key] . "s_" .
$r2[$time_key] . "s_" . $time_length[$time_key] .
".png";
......@@ -581,7 +585,7 @@ if ($action=="gen_graph") {
} /* if (!strcmp($time_type, "predefined")) */
else {
$graph_filename="graph/graph_" . $subject_value . "_" .
$graph_filename="graph/" . $session . "/graph_" . $subject_value . "_" .
$graph_type . "_" . $r1_sec . "s_" . $r2_sec . "s_" .
$time_length_number . $time_length_unit . ".png";
......
......@@ -6,7 +6,7 @@ td { font-size: x-small; }
input { font-size: x-small; }
img#logo { margin-right: 15px }
img#logo { margin-right: 25px }
*#white { color: white; }
*#black { color: black; }
......
......@@ -43,7 +43,8 @@ usage() {
echo "Usage: $0 [ -r ] [ -m ]"
echo " --graph_type={l4|apps|cpu}"
echo " --subject_id=<subject_id>"
echo " --label=<label>"
echo " --label=<label>"
echo " --session=<session>"
echo " --parameters_id=<parameters_id>"
echo " --maxline={y|n|a} - draw maximum line yes/no/auto (default a)"
echo " --time=\"resolution1 resolution2 length hhmm YYYYMMDD\""
......@@ -53,6 +54,7 @@ usage() {
echo " cpu - generate graphs for CPU load"
echo " subject_id - id in [subject] section in abw configuration file"
echo " label - label in [subject] secion in abw configuration file"
echo " session - arbitrary string that identifies graphs for one request"
echo " parameters_id - id in [parameters] section in abw configuration file"
echo " resolution1 resolution2 - plot averages over these periods"
echo " length - start time is end time minus this length"
......@@ -90,6 +92,7 @@ MAXLINE="a"
SUBJECT_LABEL_NO=0
PARAMETERS_NO=0
TIME_NO=0
unset SESSION
while [ $# -gt 0 ]; do
......@@ -114,6 +117,9 @@ while [ $# -gt 0 ]; do
LABEL[$SUBJECT_LABEL]=${1:8}
SUBJECT_LABEL_NO=`expr $SUBJECT_LABEL_NO + 1`
elif [ "${1:0:10}" = "--session=" ]; then
SESSION=${1:10}
elif [ "${1:0:16}" = "--parameters_id=" ]; then
PARAMETERS_ID[$PARAMETERS_NO]=${1:16}
PARAMETERS_NO=`expr $PARAMETERS_NO + 1`
......@@ -202,6 +208,10 @@ if [ $REMOVE_OLD -gt 0 ]; then
rm -f $GRAPH_DIR/graph*
fi
if [ -n $SESSION ]; then
mkdir -p ${GRAPH_DIR}/${SESSION}
fi
#####################################################
### Go over all --subject_id or --label arguments ###
#####################################################
......@@ -395,7 +405,7 @@ for (( I=0 ; $I<$SUBJECT_LABEL_NO ; I++ )) ; do
fi
fi
COMMAND="$COMMAND ${GRAPH_DIR}/graph_${LABEL[$I]}_${GRAPH_TYPE}_${R1}s_${R2}s_${TIME_LENGTH}.png end-${TIME_LENGTH} \"${END_TIME}\" ${R1} ${R2}"
COMMAND="$COMMAND ${GRAPH_DIR}/${SESSION}/graph_${LABEL[$I]}_${GRAPH_TYPE}_${R1}s_${R2}s_${TIME_LENGTH}.png end-${TIME_LENGTH} \"${END_TIME}\" ${R1} ${R2}"
if [ ${SUBJECT_ID[$I]} -gt 0 ]; then
COMMAND="$COMMAND \"${DESCRIPTION}\""
else
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
......@@ -10,6 +10,7 @@ SUBDIRS =
install-exec-local:
@cp $(top_srcdir)/scripts/* $(prefix)/bin
@chmod 755 $(prefix)/bin
@ln -sf $(prefix)/bin/mapi.sh /usr/local/bin
@ln -sf $(prefix)/bin/abw.sh /usr/local/bin
@ln -sf $(prefix)/bin/abw_mapi.sh /usr/local/bin
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment