Page 1 of 2

when off peak starts after midnight, wrong buckets

Posted: Wed Jul 02, 2008 11:55 am
by govogy
Hi again,

My off-peak hours are 1am - 7am, and when I use the settings below, usage at 8pm ends up in the off-peak bucket. I guess I could use peak start = 1 and offpeak start = 7 and mentally switcheroo... That will get confusing after not too long though :lol:

<entry name=\"Peak Start Hour\">7</entry> <!--Hour when your ISP's peak time kicks in. -1 to disable peak time support-->
<entry name=\"Offpeak Start Hour\">1</entry> <!--Hour when your ISP's offpeak time kicks in. (0 = 24 = midnight)-->

Have a good one

Posted: Thu Jul 03, 2008 12:51 am
by phil
Hi, I will take a look at this too... I suspect that because up till now the offpeak start has always been after (later) than the onpeak start there os probably something in the code that does not like it the other way round.

I will have a look when I get back... maybe sometime this weekend but I cant promise anything immediatly because I have got some other things happening this weekend.


Posted: Thu Jul 03, 2008 11:02 pm
by govogy
Thanks for that; my ISP is a bit mean to start offpeak so late.

Have a good weekend!

Posted: Sat Jul 26, 2008 12:22 pm
by phil
Hi Govogy,

I've got a new version for you to try - it should work with your off peak hours (I hope). If you don't mind, I'd like you to check before I release it properly just in case I've missed something.

I've attached it to this post. Just extract over the top of your current version (it will replaces 2 files).

Sorry its taken so long, let me know how you get on.


Posted: Fri Aug 01, 2008 12:21 pm
by govogy
Hi Phil, many thanks for that. It doesn't seem to have quite done the trick though. I will upload today's report.

The peak hours i've selected are 7am to 1am. The hourly report shows the peak colour scheme on hours 1 through 7 inclusive, and the rest as off-peak. The second issue is that the hourly totals don't seem to be categorized into buckets the for the daily totals, they all end up in offpeak.

I think something like the following would do the trick to work out if a particular hour is peak. That VB is derived from the attached spreadsheet. I think you are C#(?) so I'm sure you'll be able to tell what is going on.

Code: Select all

function isPeak (t as Date, peakStart as Integer, offPeakStart as Integer) as boolean
   dim adjustedStartHour as Integer = peakStart - t.hour
   dim adjustedOtherStartHour as Integer = offPeakStart - t.hour
   if adjustedStartHour <= 0 then adjustedStartHour += 24
   if adjustedOtherStartHour <= 0 then adjustedOtherStartHour += 24
   return adjustedStartHour > adjustedOtherStartHour 
end function
I cleared out my Device1.xml. Is there anything else I should be doing if I make config changes?

Thanks for getting back to me. I think your program will be useful for others on the same ISP as me who often complain about quota issues.

Ah the weekend again :D

Posted: Fri Aug 01, 2008 12:47 pm
by govogy
Brilliant, thanks for 2.6 Beta 2

Sorry for the previous post. I took so long over it, that I missed the updated file. Haha

The daily total now looks good, as well as the raw data in Device_1.xml. I will clear everything and run for a day or 2 to make sure.

The only thing that's not quite right is the way the shading is applied to to each hour on the daily report. hours 1-7 are shaded peak colours (yellow) when it should be 1-6 in off-peak colours.

Just in time for my quota rollover, thank you!

Posted: Sat Aug 02, 2008 1:01 am
by phil
OK, I'll take a look at the colours tomorrow or Sunday.
I am running an off-line test on my router with peak set to 8am till 1am so I should be able to figure out any more problems.

OK, I just took another look and it seems that my test is also wrong (with the off-peak coloured as peak and visa-versa)...
Now the question is, are the raw stats good and is it just a html generation problem.. :)

I will look into it.


Posted: Sat Aug 02, 2008 1:11 am
by phil
Ooops :oops:

I think I found the problem. Its not in the raw stats, and its fine on all graphs except the hourly one :)

Try 2.6.3 (attached) and let me know :?:


EDIT: thanks for the VB example - yes SNMPTP is C# but its always good to see another perspective. That's not at all like how I've done it (but probably makes it a lot easier) lol...
Anyway, let me know how you get on with B3 - if that doesn't work maybe I'll borrow your example :)

Posted: Sat Aug 02, 2008 1:56 am
by phil
Scrap that.

There is something wrong, looking at my test system right now (1:55am) its registering as peak still.

This will take a little more investigation so I can't do it right now (a little too much alkywhole in my system).

I'll post again when I think Ive fixed it properly - and this time I might test it a little more :)


Posted: Sun Aug 03, 2008 3:31 am
by phil
OK, Here is v2.6.5 beta

It not only supports your off-peak times properly (and I've tested it for a while this time) but it has some nice new features.

You can now tell SNMPTP your usage allowance (cap) for peak / off-peak (or a combined value) and it will display remaining usage in the summary page and percent of allowance used in the billing page.

You can also set SNMPTP to send email notifications and warnings when certain configurable limits are reached (e.g.. percentage of remaining allowance falls below a specified value (or values)).

I've included all the files in the archive so be careful not to overwrite your exiting configuration XML file.

If you want to use the new features, you can find the XML configuration items in the example configuration XML.

Please let me know how you get on with this one :)


Re: when off peak starts after midnight, wrong buckets

Posted: Tue Aug 05, 2008 1:03 pm
by govogy
This is excellent, thanks Phil!

All looks perfect. :cheers:

I haven't tried the emailing support. Does it take the port number in the SMTP Mail Server entry? eg.

<entry name="SMTP Mail Server"></entry> <!-- The SMTP Email server address -->

Being able to specify that the quota only applies to inward traffic is great.

I got SNMPThroughput service-ified in a few easy steps. Using instsvc and srvany from an ancient windows resource kit (not sure if it will work on Vista). had the clearest explanation I found with the required tools for download.


Re: when off peak starts after midnight, wrong buckets

Posted: Tue Aug 05, 2008 5:40 pm
by phil
I haven't added the option to include the mail server port yet - typically I didn't think it would be that important lol. It also doesn't support SMTP authentication yet.
I will do so in the next beta, or at least before I release 2.7 final.

At least now it seems to be working.
As for service-ified, yes, I use Fire daemon but to be quite honest that is not working very well.. SvrAny is MS's rather reg edit dependant version is it not?

The advantage of FireDaemon (I'm not sure about svrany) is that it will restart the app if for any reason it stops running. I also have my own very basic version of this sort of app which will run the app as a service, monitor it and restart it if needed but its very basic (although I did get it working with Vista is some cases lol)

Out of interest, what ISP are you with that has off-peak as 1am-7am? I've just noticed that my ISP is operating similar off-peak times on their new ADSL2 service and I'm not looking forward to that lol.


Re: when off peak starts after midnight, wrong buckets

Posted: Tue Aug 05, 2008 11:37 pm
by phil
OK, as promised, this one supports setting the SMTP port and authentication.
I hope this is the last version before I release 2.7 :)


Re: when off peak starts after midnight, wrong buckets

Posted: Tue Aug 05, 2008 11:55 pm
by govogy
My ISP is TPG in Australia. Popular because of cheap plans. One or two annoyances , but overall they've been pretty good for me. A perennial complaint people have is with the usage accounting; the rude shock of getting shaped unexpectedly.

Yes, srvany involves a bit of regedit. All pretty straightforward though (... oops, oh dear, there goes HKEY_LOCAL_MACHINE, will that be a problem?) :lol:

Re: when off peak starts after midnight, wrong buckets

Posted: Wed Aug 06, 2008 12:13 am
by phil
Yes I know what you mean. Caps and shapping seem to be pretty hated here too. My current ISP isnt too bad but Im on an office package which makes it a bit expensive but I get 8am-8pm peak time and offpeak all weekends! But their new ADSL2 plans (I'm still ADSL1 as is most of the UK) are going 1am-7am off peak (inc. weekends).

I'm now looking to switch to a new ADSL2+ ISP for unlimited/unshapped usage - and it actually costs less ?!!! There must be a catch - but they have a good rep for a high quality network too :o