Récupération d'informations Livebox Play

J'ai subi des déconnexions et des pertes de débits à répétition pendant un mois et demi, au téléphone avec Orange pratiquement tous les jours pour tomber sur des interlocuteurs de niveau 1 et 2 incapables de comprendre le pourquoi malgré une supervision DLM de ma ligne avec des checks toutes les 2 minutes.

Mon installation est impeccable et n'a pas changée en 2 ans, pas de DTI, une prise murale Legrand RJ11 en direct reliée à la paire de cuivre avec des scotchlocks.

Perdant patience, j'ai créé un script appelé par cronie qui log l'état de la Livebox dans un fichier texte toutes les minutes, ce script est envoyé par scp sur un serveur distant à condition d'être connecté et en cas de chute des débits ou de reconnexion, je reçois un email.

A force de les harceler et suite à mon analyse, j'ai obtenu le numéro d'un responsable qui comprenait enfin mon vocabulaire, je ne suis pourtant pas du métier, c'est déprimant.

Au passage, je remercie cette personne qui a pu faire avancer mon dossier très rapidement (une journée pour obtenir un technicien).

J'ai donc pu pointer à la minute près mes problèmes qui arrivaient de manière très aléatoire et les remonter à l'expertise qui ont pu confirmer mes dires pour que enfin, un technicien me change de paire de cuivre du répartiteur à chez moi.

Pour l'instant, je n'ai pas eu de problèmes depuis 2 jours, si ce n'est 10 CRC simultanés qui n'ont causé aucun problème, mais au vu du caractère aléatoire de mon problème, je me méfie, si je ne constate aucun vrai problème pendant 1 semaine, je pourrais considérer que tout est résolu.

Bref, j'ai épuré le script afin d'y enlever l'envoi par scp et la notification par email, à vous de l'adapter, à savoir que je ne suis pas un expert de la regex alors si vous voulez proposer des améliorations c'est avec plaisir.

#!/bin/sh

# Declaration des variables

myLivebox=192.168.1.1
myUserName=admin
myPassword=changeme
myBashDir=`readlink -f $0 | xargs dirname`
myOutput=$myBashDir/myOutput.txt
myCookies=$myBashDir/myCookies.txt

# Connexion et recuperation du cookies

curl -s -o "$myOutput" -X POST -i -H "Content-type: application/json" -c "$myCookies" "http://$myLivebox/authenticate?username=$myUserName&password=$myPassword" > /dev/null

# Lecture du cookies pour utilisation ulterieure

cookiesContextID=$(tail -n1 "$myOutput" | sed 's/{"status":0,"data":{"contextID":"//1'| sed 's/"}}//1')

# Recuperation des json

getMIBs=`curl -s -i -b "$myCookies" -X POST -H 'Content-Type: application/json' -H 'X-Context: '$cookiesContextID'' -d '{"parameters":{}}' http://$myLivebox/sysbus/NeMo/Intf/data:getMIBs | tail -n1`
getDSLStats=`curl -s -i -b "$myCookies" -X POST -H 'Content-Type: application/json' -H 'X-Context: '$cookiesContextID'' -d '{"parameters":{}}' http://$myLivebox/sysbus/NeMo/Intf/dsl0:getDSLStats | tail -n1`
getWANStatus=`curl -s -i -b "$myCookies" -X POST -H 'Content-Type: application/json' -H 'X-Context: '$cookiesContextID'' -d '{"parameters":{}}' http://$myLivebox/sysbus/NMC:getWANStatus | tail -n1`

# Deconnexion et suppression des fichiers temporaires

curl -s -i -b "$myCookies" -X POST http://$myLivebox/logout > /dev/null
rm "$myCookies" "$myOutput"

# Parse des json

ReceiveBlocks=`echo $getDSLStats | sed 's/.*"ReceiveBlocks"://' | grep -Eo '[0-9]+' | head -n1`
TransmitBlocks=`echo $getDSLStats | sed 's/.*"TransmitBlocks"://' | grep -Eo '[0-9]+' | head -n1`
CellDelin=`echo $getDSLStats | sed 's/.*"CellDelin"://' | grep -Eo '[0-9]+' | head -n1`
LinkRetrain=`echo $getDSLStats | sed 's/.*"LinkRetrain"://' | grep -Eo '[0-9]+' | head -n1`
InitErrors=`echo $getDSLStats | sed 's/.*"InitErrors"://' | grep -Eo '[0-9]+' | head -n1`
InitTimeouts=`echo $getDSLStats | sed 's/.*"InitTimeouts"://' | grep -Eo '[0-9]+' | head -n1`
LossOfFraming=`echo $getDSLStats | sed 's/.*"LossOfFraming"://' | grep -Eo '[0-9]+' | head -n1`
ErroredSecs=`echo $getDSLStats | sed 's/.*"ErroredSecs"://' | grep -Eo '[0-9]+' | head -n1`
SeverelyErroredSecs=`echo $getDSLStats | sed 's/.*"SeverelyErroredSecs"://' | grep -Eo '[0-9]+' | head -n1`
FECErrors=`echo $getDSLStats | sed 's/.*"FECErrors"://' | grep -Eo '[0-9]+' | head -n1`
ATUCFECErrors=`echo $getDSLStats | sed 's/.*"ATUCFECErrors"://' | grep -Eo '[0-9]+' | head -n1`
HECErrors=`echo $getDSLStats | sed 's/.*"HECErrors"://' | grep -Eo '[0-9]+' | head -n1`
ATUCHECErrors=`echo $getDSLStats | sed 's/.*"ATUCHECErrors"://' | grep -Eo '[0-9]+' | head -n1`
CRCErrors=`echo $getDSLStats | sed 's/.*"CRCErrors"://' | grep -Eo '[0-9]+' | head -n1`
ATUCCRCErrors=`echo $getDSLStats | sed 's/.*"ATUCCRCErrors"://' | grep -Eo '[0-9]+' | head -n1`
IPAddress=`echo $getWANStatus | sed 's/.*"IPAddress":"//' | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | head -n1`
UpstreamCurrRate=`echo $getMIBs | sed 's/.*"UpstreamCurrRate"://' | grep -Eo '[0-9]+' | head -n1`
DownstreamCurrRate=`echo $getMIBs | sed 's/.*"DownstreamCurrRate"://' | grep -Eo '[0-9]+' | head -n1`

# Affichage du resultat

date +"%Y-%m-%d %Hh%Mm%Ss"
echo ReceiveBlocks : $ReceiveBlocks
echo TransmitBlocks : $TransmitBlocks
echo CellDelin : $CellDelin
echo LinkRetrain : $LinkRetrain
echo InitErrors : $InitErrors
echo InitTimeouts : $InitTimeouts
echo LossOfFraming : $LossOfFraming
echo ErroredSecs : $ErroredSecs
echo SeverelyErroredSecs : $SeverelyErroredSecs
echo FECErrors : $FECErrors
echo ATUCFECErrors : $ATUCFECErrors
echo HECErrors : $HECErrors
echo ATUCHECErrors : $ATUCHECErrors
echo CRCErrors : $CRCErrors
echo ATUCCRCErrors : $ATUCCRCErrors
echo IPAddress : $IPAddress
echo UpstreamCurrRate : $UpstreamCurrRate
echo DownstreamCurrRate : $DownstreamCurrRate

Sur l'exemple ci-dessous, on peut constater que j'ai beaucoup trop de CRC et que je vais subir des secondes erronées dans le sens descendant, ce qui va créer une déconnexion, un recalcul DLM de mes débits et une reconnexion après 2 minutes.

2015-10-22 22h22m02s
ReceiveBlocks : 6686280
TransmitBlocks : 6686278
CellDelin : 0
LinkRetrain : 5
InitErrors : 49
InitTimeouts : 4294967295
LossOfFraming : 0
ErroredSecs : 76
SeverelyErroredSecs : 21
FECErrors : 143919
ATUCFECErrors : 1909
HECErrors : 0
ATUCHECErrors : 0
CRCErrors : 258
ATUCCRCErrors : 49
IPAddress : 82.X.X.X
UpstreamCurrRate : 18320
DownstreamCurrRate : 46928

2015-10-22 22h23m04s
ReceiveBlocks : 6689733
TransmitBlocks : 6689730
CellDelin : 0
LinkRetrain : 5
InitErrors : 49
InitTimeouts : 4294967295
LossOfFraming : 0
ErroredSecs : 77
SeverelyErroredSecs : 24
FECErrors : 143919
ATUCFECErrors : 1909
HECErrors : 0
ATUCHECErrors : 0
CRCErrors : 258
ATUCCRCErrors : 49
IPAddress : 82.X.X.X
UpstreamCurrRate : 18320
DownstreamCurrRate : 46928

2015-10-22 22h24m02s
ReceiveBlocks : 6689733
TransmitBlocks : 6689730
CellDelin : 0
LinkRetrain : 6
InitErrors : 51
InitTimeouts : 4294967295
LossOfFraming : 0
ErroredSecs : 77
SeverelyErroredSecs : 24
FECErrors : 143919
ATUCFECErrors : 1909
HECErrors : 0
ATUCHECErrors : 0
CRCErrors : 258
ATUCCRCErrors : 49
IPAddress : 82.X.X.X
UpstreamCurrRate : 0
DownstreamCurrRate : 0

2015-10-22 22h25m01s
ReceiveBlocks : 6689733
TransmitBlocks : 6689730
CellDelin : 0
LinkRetrain : 6
InitErrors : 53
InitTimeouts : 4294967295
LossOfFraming : 0
ErroredSecs : 77
SeverelyErroredSecs : 24
FECErrors : 143919
ATUCFECErrors : 1909
HECErrors : 0
ATUCHECErrors : 0
CRCErrors : 258
ATUCCRCErrors : 49
IPAddress : 0.0.0.0
UpstreamCurrRate : 0
DownstreamCurrRate : 0

2015-10-22 22h26m03s
ReceiveBlocks : 6680773
TransmitBlocks : 6680771
CellDelin : 0
LinkRetrain : 6
InitErrors : 53
InitTimeouts : 4294967295
LossOfFraming : 0
ErroredSecs : 77
SeverelyErroredSecs : 24
FECErrors : 143919
ATUCFECErrors : 1909
HECErrors : 0
ATUCHECErrors : 0
CRCErrors : 258
ATUCCRCErrors : 49
IPAddress : 0.0.0.0
UpstreamCurrRate : 6048
DownstreamCurrRate : 10376

2015-10-22 22h27m03s
ReceiveBlocks : 6683939
TransmitBlocks : 6683937
CellDelin : 0
LinkRetrain : 6
InitErrors : 53
InitTimeouts : 4294967295
LossOfFraming : 0
ErroredSecs : 77
SeverelyErroredSecs : 24
FECErrors : 143919
ATUCFECErrors : 1909
HECErrors : 0
ATUCHECErrors : 0
CRCErrors : 258
ATUCCRCErrors : 49
IPAddress : 88.X.X.X
UpstreamCurrRate : 6048
DownstreamCurrRate : 10376

Amusez-vous bien, ou pas...