├── API V8.pdf ├── FAN request V8.txt ├── LICENSE ├── README.md ├── Sensor.PNG ├── Switch Request V8.txt ├── Temp request V8.txt ├── Traffic Ports Request V8.txt ├── disk request V8.txt ├── disques_partitions.PNG ├── freebox_061.py ├── ports.PNG ├── ref fichier python.PNG ├── stations.PNG └── telegraf api 8.conf /API V8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bruno78310/Freebox-Revolution-Monitoring/b2f36e9b9e482d62333e84f0b04060f163340716/API V8.pdf -------------------------------------------------------------------------------- /FAN request V8.txt: -------------------------------------------------------------------------------- 1 | SELECT last("id"), last("value") AS "Fan" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Fan' AND "tag3" = 'NULL') AND time >= now() - 12h GROUP BY "tag2" -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 bruno78310 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Freebox-Revolution-Monitoring 2 | Freebox Revolution monitoring using telegraf/influxdb/grafana dockers on Synology NAS 3 | Using API V8 for maximum compatibility with Freebox OS boxes 4 | ** Si vous venez d'une version précédente, il est grandement conseillé de créer une nouvelle base influxdb 5 | ** Par ailleurs, le polling telegraf est toujurs laissé à 10sec, mais le timeout est positionné à 8sec. car 5sec. provoque de temps en temps des timeout de requetes. 6 | 7 | Vous trouverez le script Python (freebox_061.py), des screenshot des évolutions avec les requêtes grafana correspondantes. 8 | Enfin, un fichier API V8.pdf donnant l'ensemble des paramètres accessibles en fonction des arguments passés au script. 9 | -------------------------------------------------------------------------------- /Sensor.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bruno78310/Freebox-Revolution-Monitoring/b2f36e9b9e482d62333e84f0b04060f163340716/Sensor.PNG -------------------------------------------------------------------------------- /Switch Request V8.txt: -------------------------------------------------------------------------------- 1 | SELECT last("mode") AS "mode", last("Etat") AS "Etat" FROM "freebox" WHERE ("tag1" = 'Switch') AND time >= now() - 12h GROUP BY "tag1", "tag2" -------------------------------------------------------------------------------- /Temp request V8.txt: -------------------------------------------------------------------------------- 1 | B:1 rows 2 | 3 | SELECT last("id") AS "id", last("value") AS "cpub" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_cpub') AND time >= now() - 12h GROUP BY "tag1";SELECT last("id") AS "id", last("value") AS "cpum" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_cpum') AND time >= now() - 12h GROUP BY "tag1";SELECT last("value") AS "sw", last("id") AS "id" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_sw') AND time >= now() - 12h GROUP BY "tag1" 4 | 5 | C:1 rows 6 | 7 | SELECT last("id") AS "id", last("value") AS "cpub" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_cpub') AND time >= now() - 12h GROUP BY "tag1";SELECT last("id") AS "id", last("value") AS "cpum" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_cpum') AND time >= now() - 12h GROUP BY "tag1";SELECT last("value") AS "sw", last("id") AS "id" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_sw') AND time >= now() - 12h GROUP BY "tag1" 8 | 9 | D:1 rows 10 | 11 | SELECT last("id") AS "id", last("value") AS "cpub" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_cpub') AND time >= now() - 12h GROUP BY "tag1";SELECT last("id") AS "id", last("value") AS "cpum" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_cpum') AND time >= now() - 12h GROUP BY "tag1";SELECT last("value") AS "sw", last("id") AS "id" FROM "freebox" WHERE ("tag1" = 'System' AND "tag2" = 'Sensor' AND "tag3" = 'temp_sw') AND time >= now() - 12h GROUP BY "tag1" -------------------------------------------------------------------------------- /Traffic Ports Request V8.txt: -------------------------------------------------------------------------------- 1 | SELECT "bytes_rate" *8 FROM "freebox" WHERE time >= now() - 12h GROUP BY "tag1", "tag2" -------------------------------------------------------------------------------- /disk request V8.txt: -------------------------------------------------------------------------------- 1 | SELECT last("model") AS "model", last("serial") AS "serial", last("firmware") AS "firmware", last("total_bytes") AS "total_bytes", last("type") AS "type", last("state") AS "state", last("temp") AS "temp", last("used_bytes") AS "used_bytes", last("free_bytes") AS "free_bytes", last("fstype") AS "fstype", last("label") AS "label", last("disk_id") AS "disk_id", last("part_disk_id") AS "part_disk_id", last("part_id") AS "part_id" FROM "freebox" WHERE ("tag1" = 'Disque' AND "tag1" = 'Disque') AND time >= now() - 12h GROUP BY "tag2", "tag3" -------------------------------------------------------------------------------- /disques_partitions.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bruno78310/Freebox-Revolution-Monitoring/b2f36e9b9e482d62333e84f0b04060f163340716/disques_partitions.PNG -------------------------------------------------------------------------------- /freebox_061.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | #-*- coding: utf-8 -*- 3 | # coding: utf-8 4 | # pylint: disable=C0103,C0111,W0621 5 | 6 | 7 | from __future__ import print_function 8 | from __future__ import unicode_literals 9 | 10 | import requests 11 | import os 12 | import json 13 | import hmac 14 | import time 15 | import argparse 16 | import sys 17 | import time 18 | from time import strftime, gmtime 19 | from datetime import datetime 20 | from hashlib import sha1 21 | 22 | 23 | # To install the latest version of Unidecode from the Python package index, use these commands: 24 | # $ pip install unidecode 25 | from unidecode import unidecode 26 | # 27 | if sys.version_info >= (3, 0): 28 | import configparser as configp 29 | else: 30 | import ConfigParser as configp 31 | 32 | # 33 | # Freebox API SDK / Docs: http://dev.freebox.fr/sdk/os/login/ 34 | # version 8 35 | # 36 | 37 | VERSION = "0.6.1 2021/04/27" 38 | 39 | # version 059 40 | # prise en compte api v8 (option -H en particulier) 41 | # meilleure prise en compte des autres plateforme que Fbox Rev. 42 | # avec en particulier meilleur traitement des listes de paramètres. 43 | # version 060 44 | # le Rasp Pi vu sans nom depuis le DHCP freebox n'apparait pas dans la liste des hotes ! 45 | # verifier ce qui se passe si on a l'addr MAC mais pas de nom 46 | # => aller prendre les données DHCP statiques et dynamiques 47 | # version 061 48 | # prise en compte de l agregation xdsl / lte 49 | # prise en compte corrections xdsl en cas de connexion state=down 50 | # prise en compte test présence disk 51 | 52 | 53 | def get_creation_date(file): 54 | stat = os.stat(file) 55 | return stat.st_mtime 56 | 57 | def get_challenge(freebox_app_id): 58 | api_url = '%s/login/authorize/%s' % (ENDPOINT, freebox_app_id) 59 | 60 | r = requests.get(api_url) 61 | 62 | if r.status_code == 200: 63 | return r.json() 64 | else: 65 | print("Failed request: %s\n" % r.text) 66 | 67 | 68 | def open_session(password, freebox_app_id): 69 | api_url = '%s/login/session/' % ENDPOINT 70 | 71 | app_info = { 72 | 'app_id': freebox_app_id, 73 | 'password': password 74 | } 75 | json_payload = json.dumps(app_info) 76 | 77 | r = requests.post(api_url, data=json_payload) 78 | 79 | if r.status_code == 200: 80 | return r.json() 81 | else: 82 | print("Failed request: %s\n" % r.text) 83 | 84 | def get_internal_disk_stats(headers): 85 | api_url = '%s/storage/disk/' % ENDPOINT 86 | 87 | r = requests.get(api_url, headers=headers) 88 | 89 | if r.status_code == 200: 90 | return r.json() 91 | else: 92 | print("Failed request: %s\n" % r.text) 93 | 94 | 95 | def get_connection_stats(headers): 96 | api_url = '%s/connection/' % ENDPOINT 97 | 98 | r = requests.get(api_url, headers=headers) 99 | 100 | if r.status_code == 200: 101 | return r.json() 102 | else: 103 | print("Failed request: %s\n" % r.text) 104 | 105 | 106 | def get_ftth_status(headers): 107 | api_url = '%s/connection/ftth/' % ENDPOINT 108 | 109 | r = requests.get(api_url, headers=headers) 110 | 111 | if r.status_code == 200: 112 | return r.json() 113 | else: 114 | print('Failed request: %s\n' % r.text) 115 | 116 | 117 | def get_xdsl_status(headers): 118 | api_url = '%s/connection/xdsl/' % ENDPOINT 119 | 120 | r = requests.get(api_url, headers=headers) 121 | 122 | if r.status_code == 200: 123 | return r.json() 124 | else: 125 | print('Failed request: %s\n' % r.text) 126 | 127 | 128 | def get_lteconfig_status(headers): 129 | api_url = '%s/connection/lte/config' % ENDPOINT 130 | 131 | r = requests.get(api_url, headers=headers) 132 | 133 | if r.status_code == 200: 134 | return r.json() 135 | else: 136 | print('Failed request: %s\n' % r.text) 137 | 138 | 139 | def get_cnx_status(headers): 140 | api_url = '%s/connection/' % ENDPOINT 141 | 142 | r = requests.get(api_url, headers=headers) 143 | 144 | if r.status_code == 200: 145 | return r.json() 146 | else: 147 | print('Failed request: %s\n' % r.text) 148 | 149 | def get_system_config(headers): 150 | api_url = '%s/system/' % ENDPOINT 151 | 152 | r = requests.get(api_url, headers=headers) 153 | 154 | if r.status_code == 200: 155 | return r.json() 156 | else: 157 | print('Failed request: %s\n' % r.text) 158 | 159 | 160 | def get_switch_status(headers): 161 | api_url = '%s/switch/status/' % ENDPOINT 162 | 163 | r = requests.get(api_url, headers=headers) 164 | 165 | if r.status_code == 200: 166 | return r.json() 167 | else: 168 | print('Failed request: %s\n' % r.text) 169 | 170 | def get_switch_port_stats(headers, port): 171 | # -P => update pour avec POP 172 | api_url = '%s/switch/port/%s/stats/' % (ENDPOINT, port) 173 | 174 | r = requests.get(api_url, headers=headers) 175 | 176 | if r.status_code == 200: 177 | return r.json() 178 | else: 179 | print('Failed request: %s\n' % r.text) 180 | 181 | def get_lan_config(headers): 182 | api_url = '%s/lan/config/' % ENDPOINT 183 | r = requests.get(api_url, headers=headers) 184 | 185 | if r.status_code == 200: 186 | return r.json() 187 | else: 188 | print('Failed request: %s\n' % r.text) 189 | 190 | def get_wifi_stats(headers, num): 191 | api_url = '%s/wifi/ap/%s/stations' % (ENDPOINT, num) 192 | 193 | r = requests.get(api_url, headers=headers) 194 | 195 | if r.status_code == 200: 196 | return r.json() 197 | else: 198 | print('Failed request: %s\n' % r.text) 199 | 200 | def get_wifi_statsx(headers): 201 | api_url = '%s/wifi/ap/' % (ENDPOINT) 202 | 203 | r = requests.get(api_url, headers=headers) 204 | 205 | if r.status_code == 200: 206 | return r.json() 207 | else: 208 | print('Failed request: %s\n' % r.text) 209 | 210 | 211 | def get_lan_interfaces(headers): 212 | api_url = '%s/lan/browser/interfaces/' % ENDPOINT 213 | r = requests.get(api_url, headers=headers) 214 | 215 | if r.status_code == 200: 216 | return r.json() 217 | else: 218 | print('Failed request: %s\n' % r.text) 219 | 220 | def get_interfaces_hosts(headers, interf): 221 | api_url = '%s/lan/browser/%s/' % (ENDPOINT, interf) 222 | 223 | r = requests.get(api_url, headers=headers) 224 | 225 | if r.status_code == 200: 226 | return r.json() 227 | else: 228 | print('Failed request: %s\n' % r.text) 229 | 230 | def get_static_dhcp(headers): 231 | api_url = '%s/dhcp/static_lease/' % ENDPOINT 232 | r = requests.get(api_url, headers=headers) 233 | if r.status_code == 200: 234 | return r.json() 235 | else: 236 | print('Failed request: %s\n' % r.text) 237 | 238 | def get_dynamic_dhcp(headers): 239 | api_url = '%s/dhcp/dynamic_lease/' % ENDPOINT 240 | r = requests.get(api_url, headers=headers) 241 | 242 | if r.status_code == 200: 243 | return r.json() 244 | else: 245 | print('Failed request: %s\n' % r.text) 246 | 247 | 248 | 249 | def get_and_print_metrics(creds, s_switch, s_ports, s_sys, s_disk, s_lan, s_wifi, s_lan_interfaces, s_interfaces_hosts, s_static_dhcp, s_dynamic_dhcp, s_xdsl_tunnel): 250 | #freebox_app_id = "fr.freebox.seximonitor" 251 | #freebox_app_id = "fr.freebox.grafanamonitor" 252 | freebox_app_id = creds['app_id'] 253 | # 254 | 255 | # setup output dataformat, default Graphite 256 | 257 | # tag for influxdb 258 | # regle de nommage : mettre les informations (rx, tx, port 1, ...) dans les tags. 259 | # ne mettre que des noms de valeurs de variables generiques : bytes, bits, rate, bandwidth, firmware ..... 260 | # les tags sont la pour donnner le contexte 261 | # cela permettra des tris et regroupements plus complets sous grafana 262 | # 3 tags séparé par des "." 263 | # chaque valeur aura donc un nom de la forme : tag1.tag2.tag3.valeur 264 | # 265 | tag1=tag2=tag3="" 266 | 267 | dataformat='influxdb' 268 | 269 | # Fetch challenge 270 | resp = get_challenge(creds['track_id']) 271 | challenge = resp['result']['challenge'] 272 | 273 | # Generate session password 274 | if sys.version_info >= (3, 0): 275 | h = hmac.new(bytearray(creds['app_token'], 'ASCII'), bytearray(challenge, 'ASCII'), sha1) 276 | else: 277 | h = hmac.new(creds['app_token'], challenge, sha1) 278 | password = h.hexdigest() 279 | 280 | # Fetch session_token 281 | resp = open_session(password, freebox_app_id) 282 | session_token = resp['result']['session_token'] 283 | 284 | # Setup headers with the generated session_token 285 | headers = { 286 | 'X-Fbx-App-Auth': session_token 287 | } 288 | 289 | # Setup hashtable for results 290 | my_data = {} 291 | 292 | # Fetch connection stats 293 | json_raw = get_connection_stats(headers) 294 | #Additionnal informations when state is down 295 | connection_media = "" 296 | if 'result' in json_raw: 297 | if 'state' in json_raw['result']: 298 | if json_raw['result']['state'] == 'down': 299 | json_raw['result']['ipv4'] = 'None' 300 | json_raw['result']['ipv6'] = 'None' 301 | json_raw['result']['ipv4_port_range'] = [0,0] 302 | connection_media = 'None' 303 | 304 | # fbx telegraf docker info 305 | tag1="python" 306 | tag2="version" 307 | tag3="NULL" 308 | my_data[tag1+"."+tag2+"."+tag3+"."+'version_script'] = VERSION 309 | tag2="fichier" 310 | my_data[tag1+"."+tag2+"."+tag3+"."+'nom_fichier'] = __file__ 311 | tag2="derniere modification" 312 | # Convertir Timestamp en datetime 313 | update_date = datetime.fromtimestamp(get_creation_date(__file__)) 314 | update_str = datetime.ctime(update_date) 315 | my_data[tag1+"."+tag2+"."+tag3+"."+'last_updated'] = update_str 316 | 317 | # Generic datas, same for FFTH or xDSL 318 | # ffth for FFTH (default) 319 | # xdsl for xDSL, with or without 4G 320 | if connection_media != 'None' : 321 | connection_media = json_raw['result']['media'] 322 | 323 | 324 | tag1="box" 325 | if 'result' in json_raw: 326 | 327 | tag3 = "NULL" 328 | 329 | tag2 = "down" 330 | my_data[tag1+"."+tag2+"."+tag3+"."+'bytes'] = json_raw['result']['bytes_down'] # total in bytes since last connection 331 | my_data[tag1+"."+tag2+"."+tag3+"."+'rate'] = json_raw['result']['rate_down'] # current rate in byte/s 332 | my_data[tag1+"."+tag2+"."+tag3+"."+'bandwidth'] = json_raw['result']['bandwidth_down'] # available bw in bit/s 333 | my_data[tag1+"."+tag2+"."+tag3+"."+'bytes'] = json_raw['result']['bytes_down'] 334 | 335 | tag2 = "up" 336 | my_data[tag1+"."+tag2+"."+tag3+"."+'bytes'] = json_raw['result']['bytes_up'] 337 | my_data[tag1+"."+tag2+"."+tag3+"."+'rate'] = json_raw['result']['rate_up'] 338 | my_data[tag1+"."+tag2+"."+tag3+"."+'bandwidth'] = json_raw['result']['bandwidth_up'] 339 | my_data[tag1+"."+tag2+"."+tag3+"."+'bytes'] = json_raw['result']['bytes_up'] 340 | 341 | tag2 = "NULL" 342 | my_data[tag1+"."+tag2+"."+tag3+"."+'media'] = connection_media 343 | my_data[tag1+"."+tag2+"."+tag3+"."+'ipv4'] = json_raw['result']['ipv4'] 344 | my_data[tag1+"."+tag2+"."+tag3+"."+'ipv6'] = json_raw['result']['ipv6'] 345 | 346 | tag2 = "ip_port_range" 347 | my_data[tag1+"."+tag2+"."+tag3+"."+'ipv4_port_range_low'] = json_raw['result']['ipv4_port_range'][0] 348 | my_data[tag1+"."+tag2+"."+tag3+"."+'ipv4_port_range_up'] = json_raw['result']['ipv4_port_range'][1] 349 | 350 | tag2 = "state" 351 | my_data[tag1+"."+tag2+"."+tag3+"."+'cnx_state'] = json_raw['result']['state'] 352 | 353 | 354 | cnx_status = get_cnx_status(headers) 355 | 356 | 357 | # FTTH specific 358 | if connection_media == "ftth": 359 | json_raw = get_ftth_status(headers) 360 | 361 | if 'result' in json_raw: 362 | 363 | tag1="box" 364 | tag2="signal" 365 | tag3 = "NULL" 366 | my_data[tag1+"."+tag2+"."+tag3+"."+'sfp_has_signal'] = json_raw['result']['sfp_has_signal'] # BrW : cet attribu est bien présent: boolean 367 | 368 | # xDSL specific (galm : ajout condition state=up) 369 | if connection_media == "xdsl" and json_raw['result']['state'] == 'up': 370 | json_raw = get_xdsl_status(headers) 371 | 372 | tag1="box" 373 | tag2="xDSL" 374 | tag3 = "NULL" 375 | 376 | if 'result' in json_raw: 377 | 378 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_modulation'] = json_raw['result']['status']['modulation'] + " ("+json_raw['result']['status']['protocol']+")" # in seconds 379 | 380 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_uptime'] = json_raw['result']['status']['uptime'] # in seconds 381 | 382 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_status_string'] = json_raw['result']['status']['status'] 383 | if json_raw['result']['status']['status'] == "down": # unsynchronized 384 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_status'] = 0 385 | elif json_raw['result']['status']['status'] == "training": # synchronizing step 1/4 386 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_status'] = 1 387 | elif json_raw['result']['status']['status'] == "started": # synchronizing step 2/4 388 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_status'] = 2 389 | elif json_raw['result']['status']['status'] == "chan_analysis": # synchronizing step 3/4 390 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_status'] = 3 391 | elif json_raw['result']['status']['status'] == "msg_exchange": # synchronizing step 4/4 392 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_status'] = 4 393 | elif json_raw['result']['status']['status'] == "showtime": # ready 394 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_status'] = 5 395 | elif json_raw['result']['status']['status'] == "disabled": # disabled 396 | my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_status'] = 6 397 | else: # unknown 398 | my_data['xdsl_status'] = 999 399 | 400 | if 'es' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_es'] = json_raw['result']['down']['es'] # increment 401 | if 'attn' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_attn'] = json_raw['result']['down']['attn'] # in dB 402 | if 'snr' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_snr'] = json_raw['result']['down']['snr'] # in dB 403 | if 'rate' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_rate'] = json_raw['result']['down']['rate'] # ATM rate in kbit/s 404 | if 'hec' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_hec'] = json_raw['result']['down']['hec'] # increment 405 | if 'crc' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_crc'] = json_raw['result']['down']['crc'] # increment 406 | if 'ses' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_ses'] = json_raw['result']['down']['ses'] # increment 407 | if 'fec' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_fec'] = json_raw['result']['down']['fec'] # increment 408 | if 'maxrate' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_maxrate'] = json_raw['result']['down']['maxrate'] # ATM max rate in kbit/s 409 | if 'rtx_tx' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_rtx_tx'] = json_raw['result']['down']['rtx_tx'] # G.INP on/off 410 | if 'rtx_c' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_rtx_c'] = json_raw['result']['down']['rtx_c'] # G.INP corrected 411 | if 'rtx_uc' in json_raw['result']['down']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_down_rtx_uc'] = json_raw['result']['down']['rtx_uc'] # G.INP uncorrected 412 | 413 | if 'es' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_es'] = json_raw['result']['up']['es'] 414 | if 'attn' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_attn'] = json_raw['result']['up']['attn'] 415 | if 'snr' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_snr'] = json_raw['result']['up']['snr'] 416 | if 'rate' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_rate'] = json_raw['result']['up']['rate'] 417 | if 'hec' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_hec'] = json_raw['result']['up']['hec'] 418 | if 'crc' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_crc'] = json_raw['result']['up']['crc'] 419 | if 'ses' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_ses'] = json_raw['result']['up']['ses'] 420 | if 'fec' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_fec'] = json_raw['result']['up']['fec'] 421 | if 'maxrate' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_maxrate'] = json_raw['result']['up']['maxrate'] 422 | if 'rtx_tx' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_rtx_tx'] = json_raw['result']['up']['rtx_tx'] 423 | if 'rtx_c' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_rtx_c'] = json_raw['result']['up']['rtx_c'] # G.INP corrected 424 | if 'rtx_uc' in json_raw['result']['up']: my_data[tag1+"."+tag2+"."+tag3+"."+'xdsl_up_rtx_uc'] = json_raw['result']['up']['rtx_uc'] # G.INP uncorrected 425 | 426 | 427 | # -4 4G lte xdsl tunnel 428 | if s_xdsl_tunnel and connection_media == "xdsl" : 429 | 430 | json_raw2 = get_lteconfig_status(headers) 431 | tag1="4G_lte" 432 | tag2="NULL" 433 | tag3="NULL" 434 | if 'result' in json_raw2: 435 | 436 | if 'antenna' in json_raw2['result']: my_data[tag1+"."+tag2+"."+tag3+"."+'antenna_']=json_raw2['result']['antenna'] 437 | if 'enabled' in json_raw2['result']: my_data[tag1+"."+tag2+"."+tag3+"."+'enabled_']=json_raw2['result']['enabled'] 438 | if 'fsm_state' in json_raw2['result']: my_data[tag1+"."+tag2+"."+tag3+"."+'fsm_state_']=json_raw2['result']['fsm_state'] 439 | if 'has_external_antennas' in json_raw2['result']: my_data[tag1+"."+tag2+"."+tag3+"."+'has_external_antennas_']=json_raw2['result']['has_external_antennas'] 440 | if 'state' in json_raw2['result']: my_data[tag1+"."+tag2+"."+tag3+"."+'state']=json_raw2['result']['state'] 441 | 442 | if 'network' in json_raw2['result']: 443 | tag2="network" 444 | if 'has_ipv4' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_has_ipv4']=json_raw2['result']['network']['has_ipv4'] 445 | if 'has_ipv6' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_has_ipv6']=json_raw2['result']['network']['has_ipv6'] 446 | if 'ipv4' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_ipv4']=json_raw2['result']['network']['ipv4'] 447 | if 'ipv4_dns' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_ipv4_dns']=json_raw2['result']['network']['ipv4_dns'] 448 | if 'ipv4_netmask' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_ipv4_netmask']=json_raw2['result']['network']['ipv4_netmask'] 449 | if 'ipv6' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_ipv6']=json_raw2['result']['network']['ipv6'] 450 | if 'ipv6_dns' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_ipv6_dns']=json_raw2['result']['network']['ipv6_dns'] 451 | if 'ipv6_netmask' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_ipv6_netmask']=json_raw2['result']['network']['ipv6_netmask'] 452 | if 'pdn_up' in json_raw2['result']['network']: my_data[tag1+"."+tag2+"."+tag3+"."+'network_pdn_up']=json_raw2['result']['network']['pdn_up'] 453 | 454 | if 'radio' in json_raw2['result']: 455 | tag2="radio" 456 | if 'associated' in json_raw2['result']['radio']: my_data[tag1+"."+tag2+"."+tag3+"."+'radio_associated']=json_raw2['result']['radio']['associated'] 457 | if 'bands' in json_raw2['result']['radio']: # liste 458 | l=len(json_raw2['result']['radio']['bands']) 459 | i=0 460 | while i