Page 2 of 2

Re: Daily Usage Stats via Email

Posted: Mon Sep 03, 2018 3:37 pm
by BugShooter
Thankyou so much for your support.

I've configured WinSCP and now i can access email.sh

Now i realised that,what i was looking aint "quota usage stats"
actually it was daily "Bandwidth Distribution Table"

Kindly check what ive done and if you dont mind educate me.
Ive tried making a table which i'd like to get in my report but no idea about where to point the same.

Code: Select all

if printf '%s' "$data" | egrep -q "6"
then
	#Bandwidth Distribution Table
	echo -e "<br><h1>Bandwidth Distribution Table:</h1><br><table $tablestyle>" >> /tmp/email-log.txt
	echo "<tr><th $thstyle>Host</th><th $thstyle>Total</th><th $thstyle>Down</th><th $thstyle>Up</th></tr>" >> /tmp/email-log.txt;
	cat /xxx > /tmp/work.tmp
	while read line
	do
	xxx
	converttime=$(date -d @$time);
	echo "<tr><td $tdstyle>"$converttime"</td><td $tdstyle>xxx</td></tr>" >> /tmp/email-log.txt;
	done < /tmp/work.tmp
	rm /tmp/work.tmp
	echo -e "</table>" >> /tmp/email-log.txt
fi

Re: Daily Usage Stats via Email

Posted: Tue Sep 04, 2018 8:29 am
by Lantis
I’ll find some time to look at this in the next few days.
Can I just check you still want to get your quotas right?

Re: Daily Usage Stats via Email

Posted: Tue Sep 04, 2018 1:50 pm
by BugShooter
No.I mean the same thing under the bandwidth distribution pie diagram,
"bandwidth distribution table"

Actually what i needed in the table are
1)Data usage of every host for the day
2)Sum of total data for the day
3)Sum of data for the month till date

Re: Daily Usage Stats via Email

Posted: Sun Sep 09, 2018 2:30 am
by Lantis
You'll want to get the download + upload data for each IP on a per day basis using

Code: Select all

bw_get -i "bdist4-download-day-31" -h -m
bw_get -i "bdist4-upload-day-31" -h -m
The format of the data is:

Code: Select all

bdist4-download-day-31 ip_address
timestart
timeend
lasttime
32 datapoints
Examples of how the data is parsed can be found here
https://raw.githubusercontent.com/ericp ... s/bdist.js

Re: Daily Usage Stats via Email

Posted: Sun Sep 09, 2018 4:38 am
by BugShooter
Since im new to bash,i didn't have any idea to implement the same.Things are not like what i expected.
Can you help me out completing this code from the scratch.
i mean from "if printf" to "fi" for the attached output table.

Your kind assistance will be greatly appreciated.
Image
https://1drv.ms/u/s!AjQgjEoFXarEeutKRU0diO7h8dA

Re: Daily Usage Stats via Email

Posted: Sun Sep 09, 2018 5:40 am
by Lantis
I just don't have the time to do that for you i'm sorry.
I've spent plenty of time giving you the foundation and building blocks to do it yourself or for someone else to give you a hand. :)