Commit 340fa5e1 authored by 's avatar

Graphs for multiple links can be created in one call


git-svn-id: file:///home/svn/mapi/trunk@705 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent a12393cf
......@@ -4,31 +4,6 @@ ABW_DIR=/usr/local/abw
RRD_DIR=/usr/local/abw/rrd
GRAPH_DIR=/usr/local/abw/graph
if [ $# -lt 1 ]; then
echo "Usage: $0 { l4 | apps } [ link_number ]"
exit -1
fi
if [ $1 = "l4" ]; then
GRAPH_SCRIPT=${ABW_DIR}/bin/rrd_graph_l4.sh
elif [ $1 = "apps" ]; then
GRAPH_SCRIPT=${ABW_DIR}/bin/rrd_graph_apps.sh
else
echo "Unknown graph type (only l4 and apps are supported)"
exit -1
fi
echo "GRAPH_SCRIPT: $GRAPH_SCRIPT"
if [ $# -gt 1 ]; then
SUBJECT_SELECTED=$2
else
SUBJECT_SELECTED=-1
fi
echo "SUBJECT_SELECTED: $SUBJECT_SELECTED"
LINK[0]="GN2-CESNET2"
LINK[1]="Prague_PoP"
LINK[2]="Plzen_PoP"
......@@ -61,74 +36,122 @@ PREFIX_OUT[4]="${RRD_DIR}/perfmon-liberec.cesnet.cz-eth2-0-1"
PREFIX_IN[5]="${RRD_DIR}/perfmon2.cesnet.cz-eth1-0-1"
PREFIX_OUT[5]="${RRD_DIR}/perfmon2.cesnet.cz-eth1-0-1"
CURRENT_MIN=`date +%M`
CURRENT_HOUR=`date +%H`
CURRENT_DAY=`date +%Y%m%d`
# Link number should be set in I variable
generate_graphs_for_link() {
CURRENT_10MIN=`expr $CURRENT_MIN / 10 \* 10`
CURRENT_5HOUR=`expr $CURRENT_HOUR / 5 \* 5`
echo "Generating graphs for link number $I"
echo "Link name: ${LINK[$I]}"
echo "Title: ${TITLE[$I]}"
echo "GRAPH_SCRIPT: $GRAPH_SCRIPT"
rm -f $GRAPH_DIR/graph*
if [ $I -lt 0 -o $I -ge ${#LINK[*]} ]; then
echo "Link number $I is out of range"
exit -1
fi
for (( I=0 ; ${#LINK[$I]} > 0 ; I++ )) ; do
echo "Link number: $I"
echo "Link name: ${LINK[$I]}"
echo "Title: ${TITLE[$I]}"
# Resolution 1
if [ $SUBJECT_SELECTED -lt 0 -o $SUBJECT_SELECTED -eq $I ]; then
echo "generate graphs for this subject"
time ${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_${GRAPH_TYPE}_1s_60s_10min.png \
"end-10min" "${CURRENT_HOUR}:${CURRENT_MIN} ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
# Resolution 1
time ${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_${GRAPH_TYPE}_1s_60s_60min.png \
"end-60min" "${CURRENT_HOUR}:${CURRENT_MIN} ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_l4_1s_60s_10min.png \
"end-10min" "${CURRENT_HOUR}:${CURRENT_MIN} ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
# Resolution 2
${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_l4_1s_60s_60min.png \
"end-60min" "${CURRENT_HOUR}:${CURRENT_MIN} ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
time ${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_${GRAPH_TYPE}_10s_600s_5h.png \
"end-5h" "${CURRENT_HOUR}:${CURRENT_10MIN} ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
# Resolution 2
time ${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_${GRAPH_TYPE}_10s_600s_1day.png \
"end-1day" "${CURRENT_HOUR}:${CURRENT_10MIN} ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_l4_10s_600s_5h.png \
"end-5h" "${CURRENT_HOUR}:${CURRENT_10MIN} ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
# Resolution 3
${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_l4_10s_600s_1day.png \
"end-1day" "${CURRENT_HOUR}:${CURRENT_10MIN} ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
time ${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_${GRAPH_TYPE}_60s_3600s_1day.png \
"end-1day" "${CURRENT_HOUR}:00 ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
# Resolution 3
time ${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_${GRAPH_TYPE}_60s_3600s_1week.png \
"end-1week" "${CURRENT_HOUR}:00 ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_l4_60s_3600s_1day.png \
"end-1day" "${CURRENT_HOUR}:00 ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
# Resolution 4
${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_l4_60s_3600s_1week.png \
"end-1week" "${CURRENT_HOUR}:00 ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
time ${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_${GRAPH_TYPE}_3600s_3600s_1month.png \
"end-1month" "${CURRENT_HOUR}:00 ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
# Resolution 4
time ${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_${GRAPH_TYPE}_3600s_3600s_1year.png \
"end-1year" "${CURRENT_HOUR}:00 ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
}
# End of generate_graphs_for_link()
${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_l4_3600s_3600s_1month.png \
"end-1month" "${CURRENT_HOUR}:00 ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
if [ $# -lt 1 ]; then
echo "Usage: $0 [ -r ] { l4 | apps } [ link_number ... ]"
echo "-r - remove old graphs before generating new graphs"
echo "l4 - generate graphs for L4 protocols"
echo "apps - generate graphs for application protocols"
echo "link_number - links whose graphs should be generated (0, 1, ...)"
echo " if omitted then graphs for all links are generated"
exit -1
fi
if [ $1 = "-r" ]; then
REMOVE_OLD=1
shift
else
REMOVE_OLD=0
fi
${GRAPH_SCRIPT} ${PREFIX_IN[$I]} ${PREFIX_OUT[$I]} \
${GRAPH_DIR}/graph_${LINK[$I]}_l4_3600s_3600s_1year.png \
"end-1year" "${CURRENT_HOUR}:00 ${CURRENT_DAY}" \
1 60 "${TITLE[$I]}"
GRAPH_TYPE=$1
else
echo "DO NOT generate graphs for this subject"
fi
if [ $GRAPH_TYPE != "l4" -a $GRAPH_TYPE != "apps" ]; then
echo "Unknown graph type (only l4 and apps are supported)"
exit -1
fi
done
GRAPH_SCRIPT=${ABW_DIR}/bin/rrd_graph_${GRAPH_TYPE}.sh
echo "GRAPH_SCRIPT: $GRAPH_SCRIPT"
CURRENT_MIN=`date +%M`
CURRENT_HOUR=`date +%H`
CURRENT_DAY=`date +%Y%m%d`
CURRENT_10MIN=`expr $CURRENT_MIN / 10 \* 10`
CURRENT_5HOUR=`expr $CURRENT_HOUR / 5 \* 5`
if [ $REMOVE_OLD -gt 0 ]; then
rm -f $GRAPH_DIR/graph*
fi
# If some link numbers are specified then generate graphs only for
# specified links
if [ $# -gt 1 ]; then
while [ $# -gt 1 ]; do
I=$2
generate_graphs_for_link
shift
done
# When no link numbers are specified then generate graphs for all links
else
for (( I=0 ; ${#LINK[$I]} > 0 ; I++ )) ; do
generate_graphs_for_link
done
fi
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