Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
unstable
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PROINFODATA
unstable
Commits
ed511cfa
Commit
ed511cfa
authored
11 years ago
by
Eduardo L. Buratti
Browse files
Options
Downloads
Plain Diff
Merge branch 'build-env' of git.c3sl.ufpr.br:proinfodata/unstable into build-env
parents
d482f7bb
962d09c5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
collect/net/bandwidth.sh
+3
-2
3 additions, 2 deletions
collect/net/bandwidth.sh
collect/network-scripts/collect/use/bandwidth-usage.tree
+11
-36
11 additions, 36 deletions
collect/network-scripts/collect/use/bandwidth-usage.tree
collect/network-usage.sh
+6
-3
6 additions, 3 deletions
collect/network-usage.sh
with
20 additions
and
41 deletions
collect/net/bandwidth.sh
+
3
−
2
View file @
ed511cfa
...
...
@@ -28,7 +28,7 @@ function check_traffic_date()
# If there is no TRAFFIC (probably its the first run), then just create a
# new one.
if
!
test
-f
"
$TRAFFIC
"
;
then
echo
$(
date
+%F
)
>
$TRAFFIC
echo
$(
date
+%F
)
>
$TRAFFIC
return
fi
...
...
@@ -46,6 +46,7 @@ function check_traffic_date()
# Finally, create a new TRAFFIC (keeping the previous one as
# PREVIOUS_TRAFFIC) if the dates doesnt match.
if
test
$CURRENT_DATE
-ne
$TRAFFIC_DATE
;
then
mkdir
-p
"./previous"
cp
$TRAFFIC
$PREVIOUS_TRAFFIC
echo
$(
date
+%F
)
>
$TRAFFIC
fi
...
...
@@ -86,7 +87,7 @@ cd $PREFIX
TRAFFIC
=
"./traffic.txt"
# Collected data on the last day before the machine is disconnected
PREVIOUS_TRAFFIC
=
"./previous
-
traffic.txt"
PREVIOUS_TRAFFIC
=
"./previous
/
traffic
-
$(
date
+%F
)
.txt"
# Stored interfaces from the last run
INTERFACES
=
"./interfaces.txt"
...
...
This diff is collapsed.
Click to expand it.
collect/network-scripts/collect/use/bandwidth-usage.tree
+
11
−
36
View file @
ed511cfa
...
...
@@ -53,26 +53,6 @@ function xml_print()
printf
"</netuse>"
}
# Function: xml_print_zero
# Function that prints the contents of XML when there was no collected
# data. Print the statistics with zeroed content.
function
xml_print_zero
()
{
local
TRAFFIC_TIME
=
$(
printf
"%02d:%02d:30"
$TRAFFIC_HOUR
$TRAFFIC_MINUTE
)
printf
"<netuse id=
\"
$((
COUNT+1
))
\"
>"
printf
"<date value=
\"
$TRAFFIC_DATE
\"
type=
\"
string
\"
/>"
printf
"<time value=
\"
$TRAFFIC_TIME
\"
type=
\"
string
\"
/>"
printf
"<rx>"
printf
"<packets value=
\"
0
\"
type=
\"
int
\"
/>"
printf
"<bytes value=
\"
0
\"
type=
\"
int
\"
/>"
printf
"</rx>"
printf
"<tx>"
printf
"<packets value=
\"
0
\"
type=
\"
int
\"
/>"
printf
"<bytes value=
\"
0
\"
type=
\"
int
\"
/>"
printf
"</tx>"
printf
"</netuse>"
}
# Function: xml_data_generator
# This function compares the file date of the last day of collection
...
...
@@ -105,12 +85,6 @@ function xml_data_generator()
else
INTERVALID
=
$(
cut
-d
" "
-f1
<<<
$line
)
while
test
$COUNT
-lt
$INTERVALID
-a
$COUNT
-lt
288
;
do
xml_print_zero
COUNT
=
$((${
COUNT
}
+
1
))
increment_time
done
if
test
$COUNT
-eq
$INTERVALID
-a
$COUNT
-lt
288
;
then
xml_print
COUNT
=
$((${
COUNT
}
+
1
))
...
...
@@ -118,12 +92,9 @@ function xml_data_generator()
fi
fi
done
<
$TRAFFIC
while
test
$COUNT
-lt
288
;
do
xml_print_zero
COUNT
=
$((${
COUNT
}
+
1
))
increment_time
done
else
# If date in TRAFFIC file is older than 15 days then remove the file.
rm
-f
$TRAFFIC
fi
printf
"
\n
"
...
...
@@ -142,10 +113,14 @@ if test "$(bash $PROJECT)" != "0" -o "${FIRST_EXECUTION}"; then
exit
0
fi
TRAFFIC
=
"
${
PREFIX
}
/../../../net/previous
-traffic.txt
"
TRAFFIC
S
=
"
${
PREFIX
}
/../../../net/previous"
test
-f
"
${
TRAFFIC
}
"
||
exit
0
test
-s
$TRAFFIC
||
exit
0
test
-d
${
TRAFFICS
}
||
exit
0
# Call the function xml_data_generator to generate the data to XML
xml_data_generator
for
TRAFFIC
in
$(
ls
-r
${
TRAFFICS
}
)
do
if
test
-s
$TRAFFIC
;
then
xml_data_generator
fi
done
This diff is collapsed.
Click to expand it.
collect/network-usage.sh
+
6
−
3
View file @
ed511cfa
...
...
@@ -66,7 +66,7 @@ function clientExec()
# ------------------------------------------------------------------------------
export
PREFIX
=
"
$(
dirname
$(
readlink
-f
$0
))
"
source
${
PREFIX
}
/load-config.sh
||
exit
1
PREVIOUS_TRAFFIC
=
"
${
PREFIX
}
/net/previous
-traffic.txt
"
PREVIOUS_TRAFFIC
=
"
${
PREFIX
}
/net/previous"
exec
>>
${
LOGFILE
}
2>&1
...
...
@@ -82,7 +82,7 @@ fi
# Collect and send system data if elapsed enough time or if it's the first
# execution of the agent
if
elapsedTime
&&
test
-
s
"
${
PREVIOUS_TRAFFIC
}
"
;
then
if
elapsedTime
&&
test
-
d
"
${
PREVIOUS_TRAFFIC
}
"
;
then
if
test
-z
"
${
NETXMLFILENAME
}
"
;
then
printf
"ERROR: Net XML filename not defined at configuration file.
\n
"
exit
3
...
...
@@ -106,7 +106,10 @@ if elapsedTime && test -s "${PREVIOUS_TRAFFIC}"; then
if
!
clientExec
--net-usage
;
then
exit
6
fi
# Remove data already sent
rm
-rf
${
PREVIOUS_TRAFFIC
}
# Record the current execution time to be used by elapsedTime()
date
+%s
>
${
NETLASTEXEC
}
fi
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment