summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Smoogen <smooge@redhat.com>2017-02-15 19:57:02 +0000
committerStephen Smoogen <smooge@redhat.com>2017-02-15 19:57:02 +0000
commitc9f72584af9af793f2886e7028710f87d6d2c0bb (patch)
tree42f65ab31c1d0d16fdf174e28636196fd36075c9
parentd4b9ad71b8d18ab26cc925e49ee0c82c05477ac7 (diff)
downloadansible-c9f72584af9af793f2886e7028710f87d6d2c0bb.tar.gz
ansible-c9f72584af9af793f2886e7028710f87d6d2c0bb.tar.xz
ansible-c9f72584af9af793f2886e7028710f87d6d2c0bb.zip
try this fix
-rw-r--r--roles/web-data-analysis/files/hotspot-data.awk29
1 files changed, 11 insertions, 18 deletions
diff --git a/roles/web-data-analysis/files/hotspot-data.awk b/roles/web-data-analysis/files/hotspot-data.awk
index 496def828..244d61689 100644
--- a/roles/web-data-analysis/files/hotspot-data.awk
+++ b/roles/web-data-analysis/files/hotspot-data.awk
@@ -4,37 +4,30 @@ BEGIN{
sum=0;
most=0;
least=0
+ print date ",AVG,LEAST,MAX"
}
{
newdate=strftime("%F",$1); # convert this to a printable date
- if (date == strftime("%F",0)){ # we hit a min time and need to just print same stuff.
- print date ",AVG,LEAST,MAX"
+ if (date != newdate){
+ print date "," int(sum/count) "," least "," most;
date=newdate;
count=1; # start count to 0. we should have 288 per day but logs are stupid
sum=$2; # start the sum
most=$2; # what is going to be our most per day
least=$2; # what is going to be our least per day
} else {
- if (date != newdate){
- print date "," int(sum/count) "," least "," most;
- date=newdate;
- count=1; # start count to 0. we should have 288 per day but logs are stupid
- sum=$2; # start the sum
- most=$2; # what is going to be our most per day
- least=$2; # what is going to be our least per day
- } else {
- count=count+1;
- sum=sum+$2;
- if ($2 > most){
- most=$2;
- };
- if ($2 < least) {
- least=$2;
- }
+ count=count+1;
+ sum=sum+$2;
+ if ($2 > most){
+ most=$2;
+ };
+ if ($2 < least) {
+ least=$2;
}
}
}
+
END{
print date "," int(sum/count) "," least "," most;
}