Kitz Forum

Broadband Related => Router Monitoring Software => Topic started by: kitz on December 28, 2017, 08:11:25 PM

Title: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 28, 2017, 08:11:25 PM
Admin note - topic split from original thread here (http://forum.kitz.co.uk/index.php/topic,19955.0.html)

can't you automate that with dslstats?


Was able to stop it using the following commands rather than a modem power cycle.

adsl connection --down
adsl connection --up


OK looking for suggestions here please.

Whatever it is happens daily.   It will always be in the morning - anytime between 8am and mid-day, but not at a set time so that using a timer to reboot the modem wouldn't be of help.

I also now have quite a lot of Smart Home equipment which relies on the modem and/or wifi being up, so manually turning the modem off if I'm out for the day is no longer ideal.  eg recent examples
1) Didn't realise until walking into a cold house, when in theory Hive would have either (a) detected I was on the way home and started warming the house or (b) I could have turned it on via my mobile phone.
2) Although still havent got a bulb to fit the porch light, as long as the router is on, I can still get either Hive or a TP-link plug to turn on one of the other lights before I enter.


I think I need some sort of automated script that would detect if the CRCs exceed 10k for more than 5 mins then get the modem to carry out the above commands.
One very important consideration though - it must not loop repeatedly just in case on the off-chance a modem reset doesn't clear and I then end up with a far worse situation of banding rather than INP.


----
ETA screen cap from MDWS to show what happens.   From this you can see the CRC spike each day, and also how on occasion it gets stuck, which in turns causes the Err Secs to attract the attention of DLM.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: NewtronStar on December 29, 2017, 12:36:46 AM
I would look for a script that says if errored seconds are => than 2000 then adsl connection --down
adsl connection -up you don't want the errored seconds to go above 2880 ES threshold for the Speed profile.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: burakkucat on December 29, 2017, 01:10:01 AM
if errored seconds are => than 2000
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 29, 2017, 01:33:18 AM
If Err Secs > 2000 could be dangerous, as that could commence a constant resync loop and result in banding.  :(


I had been looking at the warning options from within DSLstats (see below).

Err/Secs per hour could be a bit too late.... and it certainly would have been for the last episode.
CRC's are usually the first and most noticeable sign when it sticks.   Problem there being that it can hit 10k CRCs, but then recover soon after.   

It will have to be something like if last 5 or 10 min CRCs are each more than 10k then send command to modem.

This isn't something that there will be any script out there anywhere on the Internet for.   
DSLstats could probably detect this, and can email a warning...  but its then how to get that info to send the command to the modem.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 29, 2017, 02:51:29 AM
Just set up email alerts and hit another snag.   At first I thought it wasn't working, then I realised that something I run to help prevent spam doesn't much like the fact that there is no date in the email sent field despite adding the address to safe sender list.
 
No date means it always goes to the bottom of the pile and when you get as much mail as I do, then unless Ive just downloaded mail from the server, there's a good chance I wont see it. :(

Quote
DSLstats alert
me@myemail.com
Sent: None
To me@myemail.com
Test alert
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: Chrysalis on December 29, 2017, 05:22:01 AM
Request to Eric then I guess?  I have email alerts which is how I was aware of my burst.

Here is what I configured.

SNRM below 2db, send alert.
ES/hour rises above 300 send alert.
Resync occurred send alert.

Given I usually get less than 300 ES/day tho the avg hourly rate for me is barely 10 per hour so I could probably set much lower to something like 50/hour to get more advanced warnings of problems.

These emails are not treated high priority by me tho, so dont goto my phone, so I keep 300 and it serves to inform probably after the event when I eventually check email something has happened.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on December 29, 2017, 09:42:34 AM
Hi kitz

I hope you don’t mind but following this thread, I think you would always run the risk of a loop

I might simply suggest just to have 2 cron (schedule) jobs, first to stop adsl and the second to start adsl.

I would have these run after a known time when any issues are over so say 12.30 each day, with the first to run at 12.30.30 and the second to start 5 minutes later 12.35.30

You would have a 5 minute break in broadband but no risk of looping causing banding

You would have to make it a time when dslstats is not connecting to modem which is why I showed 30 seconds past the minute

I could be entirely wrong though, so apologies in advance

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: roseway on December 29, 2017, 10:14:39 AM
Quote
Request to Eric then I guess?

Yes, noted. I'll look at this ASAP, but it won't be immediate, I'm afraid.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: NewtronStar on December 29, 2017, 09:45:14 PM
If Err Secs > 2000 could be dangerous, as that could commence a constant resync loop and result in banding.  :(

Then if Err Secs > 2000 then adsl connection --down so modem is awaiting for end-user to manually send the command adsl connection --up once they arrive back home this would stop the loop of death your worried about if I'm right you would need 20 retrains in 24 hours on the speed profile to become banded by DLM.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 30, 2017, 03:00:05 AM
I hope you don’t mind but following this thread, I think you would always run the risk of a loop

Not at all - all suggestions appreciated.   Yes I agree 2 separate commands would be best.  There would presumably have to be some sort of delay to let the modem come down before issuing the up command.

I so wish it was the same time each day, but I've seen it occur anything from between 7.30 up until mid-day. Therefore your suggestion of 12:30 makes sense.   

Except...  if whatever causes it happened before 10am then I'm stuffed.   As per the graph, Err Secs went from practically 0 at 10am to >13k by 2:30pm.
It only needs 1-2 hrs unnoticed before it will trigger DLM.    If I knew what time it was going to happen I could either use a timer plug or control it from my phone using a smart plug. 

I've racked my brains for months how best to approach it and from watching line behaviour think something like

Code: [Select]
If (5 consecutive mins of CRCs > 10k) {
   adsl --down;
   Wait 10 mins;
   adsl --up; }

This should then ensure no looping.   But tbh I think its wishful thinking because thats the bit I don't know how can be done.
I can get DSL stats to inform me if CRCs are > 10k per min.    Therefore if I get 5 of those emails in a row I know the line is freaking out.
The next problem is doing something automated with that information...  so back to

Quote
I think I need some sort of automated script that would detect if the CRCs exceed 10k for more than 5 mins then get the modem to carry out the above commands.

The automated script problem I think would still exist even if it was Err/Secs.  :( 
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 30, 2017, 03:00:34 AM
Yes, noted. I'll look at this ASAP, but it won't be immediate, I'm afraid.

Thank you muchly :)
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 30, 2017, 03:25:49 AM
Then if Err Secs > 2000 then adsl connection --down so modem is awaiting for end-user to manually send the command adsl connection --up once they arrive back home this would stop the loop of death your worried about if I'm right you would need 20 retrains in 24 hours on the speed profile to become banded by DLM.


Thanks NS, but would like it to come back up for the following reasons.

1) As mentioned above because of Smart Home equipment. 
  - Alexa voice commands don't work without Internet connection.
  - Can't remote control lighting and heating from phone from an outside network or using mobile phone unless modem is up.
  - Location services wont work - although Ive not yet tried this, the app is capable of automatically detecting you are 'x' miles from home and auto turn on the heating to your desired temp for when you get home.



2) Leaving the router turned off for 'x' hours after getting 2000 Err/Secs would be exceedingly risky and likely to result in DLM taking action.  DLM doesnt work on a straight forward number of errors per day.  It uses MTBE (Mean Time between errors) of 30 for Speed profile. The 2880 figure is based on the modem being up for a full 24hrs. Switching the router off for 'x' hours reduces this trigger figure proportionately.  Best action is rebooting modem and getting it back to normal asap to balance for full day MTBE.

3) If err secs >2000...  as b*cat has already mentioned what timescale. If its per day, then the modem still stand the probability of looping. If DSLstats has already recorded 2000 so far that day as the figure would be >2000 for the remainder of the day.

Retrains work in same way.  Whilst it may be 20 per full day,  DLM actually works on MTBR of 4200, so any long period downtime is going to reduce the trigger.


 
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on December 30, 2017, 10:10:59 AM
Hi kitz

Many thanks

As a short term fix, you could schedule each hour to cover the period and dlm should not take action

You could use ns to bring down and run a startup schedule say every 15 minutes (based on startup adsl should fail if adsl already up)

I know it’s not ideal, but a short term fix until better is created

It’s just a thought and if you want, I’ll post up a vbs script for you to stop start adsl.

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on December 30, 2017, 10:56:45 AM
Hi

Sorry, I thought I would show my telnet script in case anyone wanted to use/adapt it

You need to change x.x.x.x with your router IP address and username password with your your username password

If you want 2 scripts to stop and start, just delete the entries accordingly and save

Save the file as yourfilename.vbs

This script is based on windows, Linux is easier but not created a Linux script

You can adjust the wait times

Many thanks

John

set WshShell = WScript.CreateObject("WScript.Shell")
 
WshShell.run"telnet.exe x.x.x.x"
 
WScript.Sleep 100
'WshShell.SendKeys"telnet x.x.x.x"
'WshShell.SendKeys("{Enter}")
WScript.Sleep 100
'write the user name to the cmd window
WshShell.SendKeys"Username"
WshShell.SendKeys("{Enter}")
WScript.Sleep 100
'write the password to the cmd window
WshShell.SendKeys"Password"
WshShell.SendKeys("{Enter}")
WScript.Sleep 100
WshShell.SendKeys"show adsl"
WshShell.SendKeys("{Enter}")
WshShell.SendKeys"adsl connection --down"
WshShell.SendKeys("{Enter}")
WScript.Sleep 100000
WshShell.SendKeys"adsl connection --up"
WshShell.SendKeys("{Enter}")
WshShell.SendKeys"quit"
WshShell.SendKeys("{Enter}")
 
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 30, 2017, 11:13:34 AM
Code: [Select]
set WshShell = WScript.CreateObject("WScript.Shell")
 
WshShell.run"telnet.exe x.x.x.x"
 
WScript.Sleep 100
'WshShell.SendKeys"telnet x.x.x.x"
'WshShell.SendKeys("{Enter}")
WScript.Sleep 100
'write the user name to the cmd window
WshShell.SendKeys"Username"
WshShell.SendKeys("{Enter}")
WScript.Sleep 100
'write the password to the cmd window
WshShell.SendKeys"Password"
WshShell.SendKeys("{Enter}")
WScript.Sleep 100
WshShell.SendKeys"show adsl"
WshShell.SendKeys("{Enter}")
WshShell.SendKeys"adsl connection --down"
WshShell.SendKeys("{Enter}")
WScript.Sleep 100000
WshShell.SendKeys"adsl connection --up"
WshShell.SendKeys("{Enter}")
WshShell.SendKeys"quit"
WshShell.SendKeys("{Enter}")

Thank you so much for that. <3    Yes that would work if I scheduled it to run each hour between 9am and 1pm.  So 5 resyncs.
Looking back it mostly happens between 8:30 and 11:30 and there's only been a couple of times ever that its been before and after that, neither which have stuck. 
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on December 30, 2017, 11:31:45 AM
Hi kitz

Many thanks

I’m sorry, you need to check it works on your router first.

Just save it as a .vbs file, then double click file (you may need to hash out the quit line so you can see result)

The wait timing between down and up need adjusting to the time you want, and I think they are in ms rather then seconds

Once happy it works, add the quit line back in and schedule

I would suggest on the hour with 4 schedule starting at 9am to 12 noon, so it covers both prior to 8.30 and after 11.30, but this just my thoughts

Hopefully a better solution will surface very soon

I did think of snmp or if you run a snmp server, but there may not be oid for your router so may not work, as snmp traps could signal action to take

I hope it helps you a little

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 30, 2017, 11:51:09 AM
I've also got another idea forming.   

I hate email on my phone - I get too much of it and the final straw was the day a certain impatient member of this forum started bombarding me with email whilst at a close friends funeral demanding attention.  Luckily I had the phone switched off for the public church service and following crem service for family , but I think a few of you may have seen my subsequent reaction when I did turn my phone on and see all the emails.   :mad:
Since that day I deleted all mail from my phone however......


Within the past half hour, I've stumbled across a feature on Android phones (presumably Apple with have something similar) called Priority Senders. 
I'm not quite sure if this would work yet from reading this (https://forums.androidcentral.com/samsung-galaxy-s4/613082-email-notifications-only-priority-senders-samsung-galaxy-s4.html) but perhaps something for me to play with on my S5 Neo.
I could even create an email address just for use with DSLstats. 

I'm likely to get an email each day, but if things work as they should...   5 emails in a row should alert me that there is a problem.   

THEN
- if I'm home..  easy peasy go reboot the modem, or I could even be lazy and use an adaptation of d2d4j's script to run once.
- OR if Im not.   Use the Kasa app to remotely turn off one of the HS100 smart plugs which has the modem directly plugged into.

Right now I don't have a spare HS100 as both are in use elsewhere - but one of them is currently controlling an extension lead for several plugs for xmas lights.   Come next week I could re-use that.  I am so kicking myself I didn't pick up another when I qualified for the tplink £9.99 offer.
Atm Alexa controls all the smart plugs, but Im pretty sure I can still use Kasa as a stand alone in addition to the Alexa integration.    -  Yes I can... just tested it.     
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on December 30, 2017, 12:07:22 PM
Hi kitz

Good idea and not seen that on iPhone

Just a point over turning of power socket to modem - how would you turn it back on if away or did you mean repower the power socket

There is another way I just thought of, but depends upon how many email alerts you would normally receive - email to sms - we use this to communicate to clients and works well - email to sms does cost though

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 30, 2017, 12:42:31 PM
Quote
Just a point over turning of power socket to modem - how would you turn it back on if away or did you mean repower the power socket

The standalone Kasa app is quite simple to use as a simple on/off.   
 atm I use the Alexa integration feature, but a quick test still allows me to use Kasa independently.   
Can remote switch on/off or even set schedules.     Oooooh now...  theres another thought and perhaps something to play with as so far I've only directly used it for on/off.

-------------

GGGGGGGGGRRRRRRRRRRRRRRRRRRRRRRRRRR.    Noooooooooooo  :wall: :wall:  :doh:

"Repowering the socket should hopefully cause the modem to come back on."   How the heck am I going to do that remotely if its the modem which is off.  :'( :'( :'(

Need to think this through further.   Perhaps schedule to come back up 5 mins after I manually turn it off.   :hmm:
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on December 30, 2017, 08:33:40 PM
May be able to do something with Kaza scheduler.   Ive managed to successfully set up a schedule within Kaza that appears to turn the tree lights on even if my phone and router wifi is off.  It may be possible to schedule the plug controlling the modem to switch back on... as long as I enter a schedule before turning it off.      Need to do some further testing on this method when the plug is free to test with the router rather than just xmas lights. 
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: ejs on December 31, 2017, 07:04:18 PM
Has enabling the sesdrop capability of the modem been considered? I'm assuming that the CRCs start racking up at a high enough rate for seconds to be classed as SES.

xdslctl configure --sesdrop on

Of course I don't actually know if it works or does what it sounds like it does, you'd have to try it and find out.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: burakkucat on December 31, 2017, 08:36:48 PM
xdslctl configure --sesdrop on

Of course I don't actually know if it works or does what it sounds like it does, you'd have to try it and find out.

Ah, it took me a couple of moments but then I realised what you were considering . . . if it does work that way, then that could well be a solution.  :)
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 02, 2018, 08:34:43 AM
@ejs.   I see what you mean. :)
Quote
I'm assuming that the CRCs start racking up at a high enough rate for seconds to be classed as SES.

Yes they do,   last time I got somewhere in the region of 3570 SES.

I have tried researching sesdrop but there seems very little information about what it does.   
The only parameters I can see are on/off

Most of the info seems to be either for the d-link or old netgear routers. 

link1 (https://translate.googleusercontent.com/translate_c?depth=1&hl=en&prev=search&rurl=translate.google.co.uk&sl=hu&sp=nmt4&u=https://logout.hu/cikk/uj_firmware_d-link_adsl_modemekhez/adsl_finomhangolas.html&usg=ALkJrhiG1vPxxliVkcuaaSm8iczvK7bV4g)
Quote
1. By setting the sesdrop, the modem will disconnect the ADSL connection if SES detects an error. Turn ON NOT recommended!

Several other references suggest it shouldnt be switched off eg here (https://prohardver.hu/tema/t-online_internet_t-home_tv_hdtv_barmi_gondod_van_gyere_es_megoldjuk/hsz_27901-27950.html).

I found something on the TT forum which seemed to lack understanding, but I also this (https://community.plus.net/t5/Broadband/Joined-Plus-net-today-and-its-nightmare/td-p/1175679/page/11), which appears to have been semi-copied from a convo Asbokid & snadge made a few years ago on these forums. here (http://forum.kitz.co.uk/index.php?topic=11113.0) about sesdrop.
Quote
Sesdrop
Enabling this option, it will be possible to reduce/eliminate transmission controls and error corrections on data packets, trying to reduce latency in particular on "Interleaved" path ADSL line. It's recommended not to use this option, because many unwanted reliability issues may occur, but if you have excellent line values, you can try to see its effects.
Selecting: default, the router will use ISP predefined setting, normally disabled.

No-one appears to be brave enough to try it, but everything seems to imply that it will drop the line whenever a [single] SES is detected.
So yes it could be a solution..  but I'm also wondering how risky it would be if it dropped the line several times..  thats assuming if it automatically comes back up.    I don't usually get many SES unless the line is on one of its 'stuck' periods.

In the meantime, I remotely played with the Kaza app whilst at someone elses house and it looks like as long as I reschedule the line to come back up before dropping it then that may also work.   Ive only tested it so far with the tree lights and not the modem.   
Because Ive had guests staying Ive also not had chance to play with setting up a new email for DSLstats and setting priority mail on my phone.   

Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on January 02, 2018, 01:00:22 PM
Hi kitz

Sorry I didn’t follow everything re NS

I believe sesdrop will drop and reconnect back - ie the router is designed to reconnect if connection dropped unless you have set not too. This maybe very risky and why it is defaulted to off

If your brave enough to try it I wish you luck and hope I am wrong

I think your idea of scheduling a power on first before power off power socket for router should work, as it is just turning the power off (last gasp maybe signalled) and then powering on

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 02, 2018, 07:49:22 PM
Yes I think the Kaza route would probably be safest.   Aside from testing with the xmas tree lights, I still haven't had chance to play and set it up with the router  nor set up a new email for DSLstats yet,  but will do so when I've taken the Xmas decos down and have a spare smart plug to use.   
I had a look to see if there were any on offer again for £9.99 in the Jan sales, but they appear to be back up at nearer £30. :/ 

sesdrop could be a good alternative though for someone who doesnt have a smart plug without scheduling.   
It would require the line to be pretty stable.  Shame it only appears to be a simple on/off rather than say drop if 10 SES. 

I have been watching my line since ejs mentioned it and since the last remote sync, its behaving fine and although that spike is still there atm its only causing 30 CRCs per day which is lower than usual.  :fingers:
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 05, 2018, 07:23:45 PM
In between other things I've been attempting to play with this today.

I've created up an email account just for DSLstats and set priority sender for it on my phone.
Installed a new notification sound on my phone for the dslstats mail and got onscreen notifications set up.   
Phone will only auto sync every 15 mins so there could be a slight delay in reporting.

So far soo good \o/

Currently got DSLstats to do notifications on Err Secs and that works.
Unfortunately I dont think that is going to work out too well in this situation as I'm now getting emails every minute because the set threshold level has been reached.  (Setting = ES/hour rises above).

So it is going to have to be on CRCs (Setting = CRC rises above x per min) as there's no notification option for SES or ES per min.

Turned off the Err/Sec alerts and now set to CRCs..  but it will probably now be tomorrow before I get sufficient CRCs to see if it triggers an alert.

Xmas deco's down and HS-100 waiting to go into router plug socket.   I didn't want to do that today as I suspect unplugging the modem will clear the error count which is what I was testing today.   If it works with CRCs tomorrow, then I can then attempt testing with Kasa to get it to remote resync.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 09, 2018, 12:46:12 PM

So far soo good \o/

Turned off the Err/Sec alerts and now set to CRCs..  but it will probably now be tomorrow before I get sufficient CRCs to see if it triggers an alert.

Xmas deco's down and HS-100 waiting to go into router plug socket.   I didn't want to do that today as I suspect unplugging the modem will clear the error count which is what I was testing today.   If it works with CRCs tomorrow, then I can then attempt testing with Kasa to get it to remote resync.

Update.   
HS-1000 set up and ready to go.   
Problem with notifications for CRCs from DSLstats.   I have absolutely no idea why..  but I can send emails from the newly set up account and off goes the notification on my phone perfectly.    Yet when the email is sent from DSLstats no notification.   The email is there if I check manually, but for some reason any mail from DSLstats does not trigger a notification via priority sender on my phone.
The only difference I can see between mails is that mail sent via my email client includes a data and time.   Whereas its null when coming from DSLstats.

Does anyone know if it could be the null date/time field could stop the priority sender triggering an alarm on my phone?   Are there any other Galaxy S5/S6/S7 etc users out there that could test with DSLstats please.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: roseway on January 09, 2018, 03:02:36 PM
Quote
The only difference I can see between mails is that mail sent via my email client includes a data and time.   Whereas its null when coming from DSLstats.

I've been looking into this, and every email alert which I've received from DSLstats includes date/time stamps in the headers. There's a time-of-sending stamp and a time-of-delivery stamp. These stamps are presumably added en route, because I don't specify them in my code. I wonder if it might be worth trying a different email account for sending the alerts?
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on January 09, 2018, 03:30:57 PM
Hi

I was just about to post same after sending a test email

The time stamps are added by the mail server/sending client, so roseway does not need to change anything

I hope that helps a little

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: jelv on January 09, 2018, 03:36:28 PM
Off the wall suggestion:

If when you are out of the house you won't be transferring much data could you use a router that allows you use a 3/4G dongle as backup. Then when you detect a high error rate just shut the xDSL down until you return home when you can restart it manually? No risk of a loop with that approach!
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 09, 2018, 04:57:43 PM
Both Mail Washer and Outlook see no date field when sent from DSLstats

These were from the other day

1) In MailWasher - See empty date sent field and how they always go to the bottom of the screen
2) Email sent out via Outlook which automatically inserted a date field when viewed in Outlook
3) Email received from DSLstats.  Note how sent field says None when viewed in Outlook.


Header from email with null date field,  does show a delivery time though.
Code: [Select]
Return-Path: <xxxxx.co.uk>
Delivered-To: xxxxxx.co.uk
Received: from kitz.servers.eqx.misp.co.uk
by kitz.servers.eqx.misp.co.uk with LMTP id 8BGyADUiUlp5cQAAJ4RmLg
for <xxxxxxco.uk>; Sun, 07 Jan 2018 13:35:49 +0000
Return-path: <xxxxxxco.uk>
Envelope-to: xxxxxxxco.uk
Delivery-date: Sun, 07 Jan 2018 13:35:49 +0000
Received: from [my IP] (port=49369 helo=si7)
by kitz.servers.eqx.misp.co.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
(Exim 4.89_1)
(envelope-from <xxxxxxx.co.uk>)
id 1eYB76-0007ax-Rd
for xxxxxxxco.uk; Sun, 07 Jan 2018 13:35:48 +0000
From: xxxxxxxxco.uk
To: xxxxxxxxx.co.uk
Subject: DSLstats alert

Headers from email sent via outlook.   Note additional fields under the Subject field which includes a date field.

Code: [Select]
Return-Path: <xxxxxx.co.uk>
Delivered-To: xxxxxx.co.uk
Received: from kitz.servers.eqx.misp.co.uk
by kitz.servers.eqx.misp.co.uk with LMTP id EDEiAcQbUlqRYgAAJ4RmLg
for <xxxxxxxco.uk>; Sun, 07 Jan 2018 13:08:20 +0000
Return-path: <xxxxxxxxco.uk>
Envelope-to: xxxxxxx.co.uk
Delivery-date: Sun, 07 Jan 2018 13:08:20 +0000
Received: from [myIP] (port=65517 helo=si7)
by kitz.servers.eqx.misp.co.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
(Exim 4.89_1)
(envelope-from <xxxxxxxx.co.uk>)
id 1eYAgV-0006Yu-Og
for xxxxxxxx; Sun, 07 Jan 2018 13:08:19 +0000
From: "xxxxxxx.co.uk>
To: "'DSLalarm'" <xxxxxxxco.uk>
Subject: kitz alarm test
Date: Sun, 7 Jan 2018 13:08:19 -0000
Message-ID: <012401d387b8$96e88770$c4b99650$@co.uk>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0125_01D387B8.96E88770"
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: AdOHuJa/NVcLJQ7kSeuYCDHhdkUkDw==
Content-Language: en-gb

Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 09, 2018, 05:13:34 PM
Off the wall suggestion:

If when you are out of the house you won't be transferring much data could you use a router that allows you use a 3/4G dongle as backup. Then when you detect a high error rate just shut the xDSL down until you return home when you can restart it manually? No risk of a loop with that approach!

Problem atm is getting an alert on my phone when dslstats detects high error rate :(

I have Kasa set up with a TP-link HS-100 plug so that if Im out I can remotely switch the router off from my phone.   
Then as long as I schedule the modem to come back up before disconnecting it..  Kasa will bring the modem back up again.       
Bringing it back up is a good idea as this then should negate any down time affecting the days MTBE.  eg if I leave the modem off for 12 hours that means only 1440 Err Secs before DLM will take action compared to 2880 for a full day.    Rebooting the modem always clears the stuck error spikes.



-----

Quote
I wonder if it might be worth trying a different email account for sending the alerts?

Good idea, Ive tried so far with the new email account and also the site email (both had been listed as priority senders in my phone for testing).    Neither showed date.  I wonder if its something to do with both emails coming from my server.   
I shall test using my PN email as sender.

Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 09, 2018, 05:49:46 PM
I shall test using my PN email as sender.

Same problem :'(
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on January 09, 2018, 06:17:28 PM
Hi kitz

I could be wrong sorry, old tired eyes but your log of email shows 2 time stamps

If you send a test from dslstats and view using webmail, can you see the time stamps

I am wondering if you have it set to strip time stamps perhaps

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 09, 2018, 07:14:05 PM
Dont use webmail Im afraid :/

Quote
am wondering if you have it set to strip time stamps perhaps

Set up where though?   Why would it only not show the date when its been sent via dslstats?
It shows date stamp fine for every other mail just not dslstats mail :(

If sent by Outlook it shows this field   (see above for whole headers).   
DSLstats mail doesn't even though it does have the times my server received it.


Quote
Subject: kitz alarm test
Date: Sun, 7 Jan 2018 13:08:19 -0000

Both sets of headers show 2 timestamps under received sections plus a delivery date.   The one sent by Outlook shows a 4th field specifically marked Date.


I can send mail from exactly the same email address using my email client and it will always show a date and time.
Yet mail that arrives from dslstats doesnt show a date in mailwasher nor within Outlook..  or more correctly in Outlook it says 'None'.
It does this from mail sent from my own domain and plusnet mail :(

The datastamp may just be a red herring but priority notifications work if I send mail from Outlook and my phone buzzes.  Yet no notification if sent from dslstats.


-----
Nvm...    it was worth a try.    It should work, but unfort it isnt doing quite right.     
Mail does come through from DSLstats but I have to manually check rather than get an automatic notification.
One other area Ive not explored is push - v- notify.     
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on January 09, 2018, 07:24:14 PM
Hi kitz

Many thanks

Sorry I meant only to check using webmail to see if date/time stamp shows

Normally where the field date is not added, the received date is used I believe from an old memory

My outlook shows fine for correct date/time stamp

I have not used mailwasher, so not sure sorry

I don’t think cPanel is push capable but could be wrong and thinking of activesync or ews

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: roseway on January 09, 2018, 07:27:39 PM
I've been looking more at this. I think I've worked out how to add a date/time stamp to my code. I'll try it out and hopefully upload a test version of DSLstats tomorrow.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 09, 2018, 11:54:06 PM
Sorry if I came over a bit grumpy in my last post.   Thanks John for trying to help.   I think I was just frustrated at being so nearly there with it.   I shall have another play tomorrow with something like a gmail account

Eric, please don't rush, it wasn't a criticism and I know you have a lot on yourself.  It was more confusion why I couldnt get it to work and I wondered if anyone else with a Galaxy S'x' had any luck with setting it up on their phone.   It may not even be the date field but that was the only thing that I could see which was different when the mail notifications were working fine from Outlook.   I cant see why the date field should affect it. :(

Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on January 10, 2018, 09:54:13 AM
Hi kitz

Bless you

I think we all get grumpy from time to time :)

I do appreciate your posts though, very level headed in an insane world

I am sure it will be resolved

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: roseway on January 11, 2018, 10:47:52 AM
I've built a test version of DSLstats which adds a date stamp to alert emails. My own tests indicate that this is correctly reproduced in the header delivered to the recipient. You can download this version (Windows only at present) at:
http://dslstats.me.uk/files/dslstats32W-6.1.1.zip (http://dslstats.me.uk/files/dslstats32W-6.1.1.zip)
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on January 12, 2018, 10:42:54 AM
Hi roseway

Kudos to you

I have just installed this and tested (see below) and confirm date/time stamp shows

I personally do not think this was the issue, as it should pick up on the date/time stamps but I could be wrong sorry

Many thanks

John

Received: from ****** (host***-***-***-***.in-addr.btopenworld.com
[***.***.***.***]) by ******.*******.co.uk with SMTP; Fri, 12 Jan 2018
10:24:45 +0000

From: ******@********.****

To: ******@********.****

Subject: DSLstats alert

Date: Fri, 12 Jan 2018 10:25:20 +0000

Content-Type: text/plain;

               charset="utf-8"

Content-Transfer-Encoding: quoted-printable

X-Antivirus-Status: Clean

X-Antivirus: ****** (VPS 180111-8, 11/01/2018), Outbound message

Return-Path: <******@********.****>

Message-ID: <7f32a63befb64295866c7bfd82e8cf69@com>

X-******-TotalSpamWeight: 0 (Authenticated)

X-Antivirus: ****** (VPS 180112-0, 12/01/2018), Inbound message

X-Antivirus-Status: Clean

Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: roseway on January 12, 2018, 11:52:09 AM
Thank you for testing it, John.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 12, 2018, 01:20:34 PM
Thank you so much Eric.   I shall download and install new version now.

Unfortunately and I told d2d4j yesterday morning, I was messing with some hidden settings on my phone which I found on a few websites and yesterday I had had no notifications at all for anything.   Basically I  borked something and even notifications that I got previously no longer arrive, so I had to try backtrack and reverse the steps.

-----------------

OMG OMG OMG..   just as I was typing this to do a screen shot of old v new....

Suddenly my phone went off with a loud sound file alarm.  I didn't expect that as I hadn't touched anything in my phone settings since yesterday!

Thank you. Thank you. Thank you.  :hug: :hug: :hug: :hug: :hug: :thumbs: :thumbs: :thumbs: :thumbs: :thumbs:

I got no notification for the test alert sent just before I updated.
As soon as I'd installed the new version..  at 13:15 my phone went off telling me there was an email from DSLstats.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 12, 2018, 01:45:48 PM
It works! :love:

Screen caps below:-



There is a slight delay for notification on my phone - I knew and fully expected that to happen,  as it only checks every 15 mins.
Ive since sent more test mails from DSLstats and I continue to get the alert notification.

All I can assume is that because my phone only checks every 15 mins for new mail, it is only notifying of new mail if the time is within the past 15mins.   If there is no date in that particular field then no notification is given.  Does that make sense?
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: roseway on January 12, 2018, 02:01:23 PM
I think that makes sense. Any way, I'm delighted that it works. :)
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 12, 2018, 02:03:57 PM
Email headers from old version v new version.

Absolutely no changes made on my phone settings, nor to mail settings.   
The only thing different was the new version of DSLstats.



Headers from old version of DSLstats which did not generate a phone notification

Quote
Return-Path: <xxxxxx.co.uk>
Delivered-To: xxxxxx.co.uk
Received: from kitz.servers.eqx.misp.co.uk
   by kitz.servers.eqx.misp.co.uk with LMTP id CCtyN7muWFreZwAAJ4RmLg
   for <xxxxxx.co.uk>; Fri, 12 Jan 2018 12:48:58 +0000
Return-path: <xxxxxx.co.uk>
Envelope-to: xxxxxx.co.uk
Delivery-date: Fri, 12 Jan 2018 12:48:58 +0000
Received: from [my ip] (port=51010 helo=si7)
   by kitz.servers.eqx.misp.co.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
   (Exim 4.89_1)
   (envelope-from <xxxxxx.co.uk>)
   id 1eZylV-0006un-Ic
   for xxxxxx.co.uk; Fri, 12 Jan 2018 12:48:57 +0000
From: xxxxxx.co.uk
To: xxxxxx.co.uk
Subject: DSLstats alert



Headers from new version of DSLstats which does generate a notification and sound alarm.


Quote
Return-Path: <xxxxxx.co.uk>
Delivered-To: xxxxxx.co.uk
Received: from kitz.servers.eqx.misp.co.uk
   by kitz.servers.eqx.misp.co.uk with LMTP id 4FneAKOzWFq9dAAAJ4RmLg
   for <xxxxxx.co.uk>; Fri, 12 Jan 2018 13:09:55 +0000
Return-path: <xxxxxx.co.uk>
Envelope-to: xxxxxx.co.uk
Delivery-date: Fri, 12 Jan 2018 13:09:55 +0000
Received: from [my ip] (port=51237 helo=si7)
   by kitz.servers.eqx.misp.co.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
   (Exim 4.89_1)
   (envelope-from <xxxxxx.co.uk>)
   id 1eZz5m-0007lw-QO
   for xxxxxx.co.uk; Fri, 12 Jan 2018 13:09:54 +0000
From: xxxxxx.co.uk
To: xxxxxx.co.uk
Date: Fri, 12 Jan 2018 13:09:54 +0000
Subject: DSLstats alert

Thank you so much Eric :)
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: d2d4j on January 13, 2018, 09:39:14 AM
Hi kitz

I’m soo pleased it’s working.

Kudos to roseway

Many thanks

John
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 13, 2018, 11:05:18 AM
.....  and JiT.  Tested for real as this morning was one of those days when the errors decided to get stuck. 

DSLstats warning notification came through with 19780 CRCs

- Slight delay because of 15 min mail checks.
- Another slight delay whilst I remotely set up a one off schedule for a fresh resync time with Kasa.
- Then used Kasa to take the modem off line.


At 10:20 as per schedule modem came back up.   CRCs and Err Secs cleared.
Damage during this period 1394 Err Secs.


Without the warning email & phone notification I would not have known.   Thank you Eric for adding this extremely useful feature. :thumbs:
 
Without scheduling Kasa to bring the modem back up remotely, this would have altered my day's uptime and thus affecting my MTBE.   
If for example I had been at my daughters for the day and not got back until late evening, without a doubt leaving the modem off for the rest of the day whilst already having received ~1400 Err/Secs would have been sufficient to trigger DLM MTBE red threshold of 30.


---
The only possible pitfall. 
Email notification sounds are a one off.  If I don't hear the alarm first time, then unlike with text notifications the sound file doesn't repeat every 5 mins.  My phone does only check every 15 mins, and I am now pretty certain that it does only notify based on the time in the sent field.
Whilst there will be a visual notification in my notification area, obviously this wont be spotted until I physically look at my phone. 
I dont think there is anything that can be done about that, other than me being aware if Im in a noisy environment and my phone is in my bag.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 13, 2018, 11:44:41 AM
Now Im able to look at DSLstats I note that the oscillating SNRm is back, purely because I resyn'd rather than a DSLAM resync.  ???


But what I wanted to ask as Im curious
DSLstats collects stats every min. These are my current settings [see img below]


Would changing it to per sample make any difference?
And just so that I know, by design once it has reached and notified of a certain figure, will it not send out another email until that figure is higher?

The reason I ask is that despite CRCs being above 100 per min for a period of time, I was surprised that DSL stats didn't continue to send out mail every minute there after.

This is from my event log
Code: [Select]
13 Jan 2018 09:46:13 Auto snapshots taken
13 Jan 2018 09:52:13 Email alert sent: "Alert: Downstream CRC/min rose to 4863.00"
13 Jan 2018 09:53:14 Email alert sent: "Alert: Downstream CRC/min rose to 19780.00"
13 Jan 2018 10:19:13 Unable to login to modem/router
13 Jan 2018 10:20:13 Unable to login to modem/router
13 Jan 2018 10:21:13 Unable to collect stats 3 or more times in succession
13 Jan 2018 10:21:13 Unable to login to modem/router
13 Jan 2018 10:22:14 DSL connection restored. SNRMup = 9.3 dB, SNRMdown = 5.9 dB

Obviously the 'unable to login' can be ignored as by that time I'd used Kasa to power down the modem.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: roseway on January 13, 2018, 01:17:51 PM
I see you've enabled the option "Keep trigger levels at the values set here", so DSLstats should be sending an alert every time the value exceeds the threshold. Changing to "Per sample" shouldn't make any difference. I'll have to refresh my memory of how it works, because I did this part of the program a long time ago.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 13, 2018, 02:15:27 PM
No worries Eric, I was just being curious really.   

The main thing is everything worked exactly as intended this morning. 
Because I wasn't at the PC to notice it... I have no doubt that without this mornings notification,  DLM would have been on to it before me :) 
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: kitz on January 17, 2018, 04:11:57 PM
Well I can confirm this definitely works.   

Phone went off at ~ 05.45 this morning to inform me that the CRC threshold of 1000 had been breached.    I think I may have mentioned I have a specific sound file for dslstats to make it more likely to hear if my phone was in my handbag.  So yup I heard it loud and clear from the depths of sleep  (https://forum.kitz.co.uk/proxy.php?request=http%3A%2F%2Fwww.emotionless.co.uk%2Femotes%2Fb%2Fsleep6.gif&hash=ee1e822631c5f22d8a9c9970727cc82ac6be20ae)

It then went off again several times at ~10:20 when I was in a meeting.  I got the comment...  "That's an interesting ring-tone".  I cba to explain  :lol:
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: roseway on January 17, 2018, 04:40:54 PM
:)
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: Chrysalis on January 17, 2018, 05:33:13 PM
:)
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: Dray on January 18, 2018, 08:02:42 PM
I'm glad you found a way to do this.
If my memory serves there is a website called ifttt.com which would enable similar functionality on the internet.

You would need to forward the email from dslstats to trigger@recipe.ifttt.com and create a small applet.

The email would trigger the applet to turn your TPLink smart plug off then on again.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: Ixel on January 19, 2018, 07:31:24 PM
I don't know if it interests anyone here but in my free time I'm working on a small bash script which can act as a form of DLM preventative measure (or at least attempt to do so).

The plan is similar to what this thread is about, it could just be setup to re-sync if a certain number of error seconds have been reached for the current 24 hour period (based on the modem statistics). Alternatively it could also be setup to temporarily reduce the sync rate and then a little later on restore the sync rate if the errors stay low enough (such as on the following day or even the day after, depends on however it's configured).

It will be running on a Linux environment, but perhaps there's something on Windows (cygwin?) that can emulate Linux, or even a virtual machine. It will obviously need 'expect', possibly 'bc' and certainly 'telnet'. I can't say precisely when it'll be done but my aim is to have it finished by the end of next week.

The one thing I need to watch out for is a possible conflict with other stats monitoring programs when they login to telnet/SSH, as it seems devices like the Zyxel prefer only one active session at a time which sucks. So, as long as the stats monitoring program doesn't stay logged in to telnet/SSH or doesn't fetch stats at the exact same moment my 'expect' script does then it'll be fine :P.

EDIT: If anyone is interested then drop me a PM, in the meantime I'll continue testing and improving it.
Title: Re: Using DSLstats to detect line errors and force line to resync.
Post by: Chrysalis on March 06, 2018, 05:29:08 AM
interested will pm later, thanks