mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
commit
e3af384071
@ -114,49 +114,51 @@ def getCircuitBandwidthStats(subscriberCircuits, tinsStats):
|
|||||||
allPacketsDownload = 0.0
|
allPacketsDownload = 0.0
|
||||||
allPacketsUpload = 0.0
|
allPacketsUpload = 0.0
|
||||||
for circuit in subscriberCircuits:
|
for circuit in subscriberCircuits:
|
||||||
circuit['stats']['sinceLastQuery']['bitsDownload'] = circuit['stats']['sinceLastQuery']['bitsUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['bitsDownload'] = circuit['stats']['sinceLastQuery']['bitsUpload'] = None
|
||||||
circuit['stats']['sinceLastQuery']['bytesSentDownload'] = circuit['stats']['sinceLastQuery']['bytesSentUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['bytesSentDownload'] = circuit['stats']['sinceLastQuery']['bytesSentUpload'] = None
|
||||||
circuit['stats']['sinceLastQuery']['packetDropsDownload'] = circuit['stats']['sinceLastQuery']['packetDropsUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetDropsDownload'] = circuit['stats']['sinceLastQuery']['packetDropsUpload'] = None
|
||||||
circuit['stats']['sinceLastQuery']['packetsSentDownload'] = circuit['stats']['sinceLastQuery']['packetsSentUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetsSentDownload'] = circuit['stats']['sinceLastQuery']['packetsSentUpload'] = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if (circuit['stats']['currentQuery']['bytesSentDownload'] - circuit['stats']['priorQuery']['bytesSentDownload']) >= 0.0:
|
if (circuit['stats']['currentQuery']['bytesSentDownload'] - circuit['stats']['priorQuery']['bytesSentDownload']) >= 0.0:
|
||||||
circuit['stats']['sinceLastQuery']['bytesSentDownload'] = circuit['stats']['currentQuery']['bytesSentDownload'] - circuit['stats']['priorQuery']['bytesSentDownload']
|
circuit['stats']['sinceLastQuery']['bytesSentDownload'] = circuit['stats']['currentQuery']['bytesSentDownload'] - circuit['stats']['priorQuery']['bytesSentDownload']
|
||||||
else:
|
else:
|
||||||
circuit['stats']['sinceLastQuery']['bytesSentDownload'] = 0.0
|
circuit['stats']['sinceLastQuery']['bytesSentDownload'] = None
|
||||||
if (circuit['stats']['currentQuery']['bytesSentUpload'] - circuit['stats']['priorQuery']['bytesSentUpload']) >= 0.0:
|
if (circuit['stats']['currentQuery']['bytesSentUpload'] - circuit['stats']['priorQuery']['bytesSentUpload']) >= 0.0:
|
||||||
circuit['stats']['sinceLastQuery']['bytesSentUpload'] = circuit['stats']['currentQuery']['bytesSentUpload'] - circuit['stats']['priorQuery']['bytesSentUpload']
|
circuit['stats']['sinceLastQuery']['bytesSentUpload'] = circuit['stats']['currentQuery']['bytesSentUpload'] - circuit['stats']['priorQuery']['bytesSentUpload']
|
||||||
else:
|
else:
|
||||||
circuit['stats']['sinceLastQuery']['bytesSentUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['bytesSentUpload'] = None
|
||||||
except:
|
except:
|
||||||
circuit['stats']['sinceLastQuery']['bytesSentDownload'] = 0.0
|
circuit['stats']['sinceLastQuery']['bytesSentDownload'] = None
|
||||||
circuit['stats']['sinceLastQuery']['bytesSentUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['bytesSentUpload'] = None
|
||||||
try:
|
try:
|
||||||
if (circuit['stats']['currentQuery']['packetDropsDownload'] - circuit['stats']['priorQuery']['packetDropsDownload']) >= 0.0:
|
if (circuit['stats']['currentQuery']['packetDropsDownload'] - circuit['stats']['priorQuery']['packetDropsDownload']) >= 0.0:
|
||||||
circuit['stats']['sinceLastQuery']['packetDropsDownload'] = circuit['stats']['currentQuery']['packetDropsDownload'] - circuit['stats']['priorQuery']['packetDropsDownload']
|
circuit['stats']['sinceLastQuery']['packetDropsDownload'] = circuit['stats']['currentQuery']['packetDropsDownload'] - circuit['stats']['priorQuery']['packetDropsDownload']
|
||||||
else:
|
else:
|
||||||
circuit['stats']['sinceLastQuery']['packetDropsDownload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetDropsDownload'] = None
|
||||||
if (circuit['stats']['currentQuery']['packetDropsUpload'] - circuit['stats']['priorQuery']['packetDropsUpload']) >= 0.0:
|
if (circuit['stats']['currentQuery']['packetDropsUpload'] - circuit['stats']['priorQuery']['packetDropsUpload']) >= 0.0:
|
||||||
circuit['stats']['sinceLastQuery']['packetDropsUpload'] = circuit['stats']['currentQuery']['packetDropsUpload'] - circuit['stats']['priorQuery']['packetDropsUpload']
|
circuit['stats']['sinceLastQuery']['packetDropsUpload'] = circuit['stats']['currentQuery']['packetDropsUpload'] - circuit['stats']['priorQuery']['packetDropsUpload']
|
||||||
else:
|
else:
|
||||||
circuit['stats']['sinceLastQuery']['packetDropsUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetDropsUpload'] = None
|
||||||
except:
|
except:
|
||||||
circuit['stats']['sinceLastQuery']['packetDropsDownload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetDropsDownload'] = None
|
||||||
circuit['stats']['sinceLastQuery']['packetDropsUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetDropsUpload'] = None
|
||||||
try:
|
try:
|
||||||
if (circuit['stats']['currentQuery']['packetsSentDownload'] - circuit['stats']['priorQuery']['packetsSentDownload']) >= 0.0:
|
if (circuit['stats']['currentQuery']['packetsSentDownload'] - circuit['stats']['priorQuery']['packetsSentDownload']) >= 0.0:
|
||||||
circuit['stats']['sinceLastQuery']['packetsSentDownload'] = circuit['stats']['currentQuery']['packetsSentDownload'] - circuit['stats']['priorQuery']['packetsSentDownload']
|
circuit['stats']['sinceLastQuery']['packetsSentDownload'] = circuit['stats']['currentQuery']['packetsSentDownload'] - circuit['stats']['priorQuery']['packetsSentDownload']
|
||||||
else:
|
else:
|
||||||
circuit['stats']['sinceLastQuery']['packetsSentDownload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetsSentDownload'] = None
|
||||||
if (circuit['stats']['currentQuery']['packetsSentUpload'] - circuit['stats']['priorQuery']['packetsSentUpload']) >= 0.0:
|
if (circuit['stats']['currentQuery']['packetsSentUpload'] - circuit['stats']['priorQuery']['packetsSentUpload']) >= 0.0:
|
||||||
circuit['stats']['sinceLastQuery']['packetsSentUpload'] = circuit['stats']['currentQuery']['packetsSentUpload'] - circuit['stats']['priorQuery']['packetsSentUpload']
|
circuit['stats']['sinceLastQuery']['packetsSentUpload'] = circuit['stats']['currentQuery']['packetsSentUpload'] - circuit['stats']['priorQuery']['packetsSentUpload']
|
||||||
else:
|
else:
|
||||||
circuit['stats']['sinceLastQuery']['packetsSentUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetsSentUpload'] = None
|
||||||
except:
|
except:
|
||||||
circuit['stats']['sinceLastQuery']['packetsSentDownload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetsSentDownload'] = None
|
||||||
circuit['stats']['sinceLastQuery']['packetsSentUpload'] = 0.0
|
circuit['stats']['sinceLastQuery']['packetsSentUpload'] = None
|
||||||
|
|
||||||
|
if(circuit['stats']['sinceLastQuery']['packetsSentDownload']):
|
||||||
allPacketsDownload += circuit['stats']['sinceLastQuery']['packetsSentDownload']
|
allPacketsDownload += circuit['stats']['sinceLastQuery']['packetsSentDownload']
|
||||||
|
if(circuit['stats']['sinceLastQuery']['packetsSentUpload']):
|
||||||
allPacketsUpload += circuit['stats']['sinceLastQuery']['packetsSentUpload']
|
allPacketsUpload += circuit['stats']['sinceLastQuery']['packetsSentUpload']
|
||||||
|
|
||||||
if 'priorQuery' in circuit['stats']:
|
if 'priorQuery' in circuit['stats']:
|
||||||
@ -164,12 +166,21 @@ def getCircuitBandwidthStats(subscriberCircuits, tinsStats):
|
|||||||
currentQueryTime = datetime.fromisoformat(circuit['stats']['currentQuery']['time'])
|
currentQueryTime = datetime.fromisoformat(circuit['stats']['currentQuery']['time'])
|
||||||
priorQueryTime = datetime.fromisoformat(circuit['stats']['priorQuery']['time'])
|
priorQueryTime = datetime.fromisoformat(circuit['stats']['priorQuery']['time'])
|
||||||
deltaSeconds = (currentQueryTime - priorQueryTime).total_seconds()
|
deltaSeconds = (currentQueryTime - priorQueryTime).total_seconds()
|
||||||
circuit['stats']['sinceLastQuery']['bitsDownload'] = round(
|
if (circuit['stats']['sinceLastQuery']['bytesSentDownload']):
|
||||||
((circuit['stats']['sinceLastQuery']['bytesSentDownload'] * 8) / deltaSeconds)) if deltaSeconds > 0 else 0
|
circuit['stats']['sinceLastQuery']['bitsDownload'] = round((circuit['stats']['sinceLastQuery']['bytesSentDownload'] * 8) / deltaSeconds) if deltaSeconds > 0 else 0
|
||||||
circuit['stats']['sinceLastQuery']['bitsUpload'] = round(
|
|
||||||
((circuit['stats']['sinceLastQuery']['bytesSentUpload'] * 8) / deltaSeconds)) if deltaSeconds > 0 else 0
|
|
||||||
else:
|
else:
|
||||||
|
circuit['stats']['sinceLastQuery']['bitsDownload'] = None
|
||||||
|
if (circuit['stats']['sinceLastQuery']['bytesSentUpload']):
|
||||||
|
circuit['stats']['sinceLastQuery']['bitsUpload'] = round((circuit['stats']['sinceLastQuery']['bytesSentUpload'] * 8) / deltaSeconds) if deltaSeconds > 0 else 0
|
||||||
|
else:
|
||||||
|
circuit['stats']['sinceLastQuery']['bitsUpload'] = None
|
||||||
|
|
||||||
|
else:
|
||||||
|
circuit['stats']['sinceLastQuery']['bitsDownload'] = None
|
||||||
|
if(circuit['stats']['sinceLastQuery']['bytesSentDownload']):
|
||||||
circuit['stats']['sinceLastQuery']['bitsDownload'] = (circuit['stats']['sinceLastQuery']['bytesSentDownload'] * 8)
|
circuit['stats']['sinceLastQuery']['bitsDownload'] = (circuit['stats']['sinceLastQuery']['bytesSentDownload'] * 8)
|
||||||
|
circuit['stats']['sinceLastQuery']['bitsUpload'] = None
|
||||||
|
if(circuit['stats']['sinceLastQuery']['bytesSentUpload']):
|
||||||
circuit['stats']['sinceLastQuery']['bitsUpload'] = (circuit['stats']['sinceLastQuery']['bytesSentUpload'] * 8)
|
circuit['stats']['sinceLastQuery']['bitsUpload'] = (circuit['stats']['sinceLastQuery']['bytesSentUpload'] * 8)
|
||||||
|
|
||||||
tinsStats['sinceLastQuery']['Bulk']['Download']['dropPercentage'] = tinsStats['sinceLastQuery']['Bulk']['Upload']['dropPercentage'] = 0.0
|
tinsStats['sinceLastQuery']['Bulk']['Download']['dropPercentage'] = tinsStats['sinceLastQuery']['Bulk']['Upload']['dropPercentage'] = 0.0
|
||||||
@ -275,13 +286,19 @@ def getParentNodeBandwidthStats(parentNodes, subscriberCircuits):
|
|||||||
thisParentNodeStats = {'sinceLastQuery': {}}
|
thisParentNodeStats = {'sinceLastQuery': {}}
|
||||||
for circuit in subscriberCircuits:
|
for circuit in subscriberCircuits:
|
||||||
if circuit['ParentNode'] == parentNode['parentNodeName']:
|
if circuit['ParentNode'] == parentNode['parentNodeName']:
|
||||||
|
if circuit['stats']['sinceLastQuery']['bitsDownload']:
|
||||||
thisNodeBitsDownload += circuit['stats']['sinceLastQuery']['bitsDownload']
|
thisNodeBitsDownload += circuit['stats']['sinceLastQuery']['bitsDownload']
|
||||||
|
if circuit['stats']['sinceLastQuery']['bitsUpload']:
|
||||||
thisNodeBitsUpload += circuit['stats']['sinceLastQuery']['bitsUpload']
|
thisNodeBitsUpload += circuit['stats']['sinceLastQuery']['bitsUpload']
|
||||||
#thisNodeDropsDownload += circuit['packetDropsDownloadSinceLastQuery']
|
#thisNodeDropsDownload += circuit['packetDropsDownloadSinceLastQuery']
|
||||||
#thisNodeDropsUpload += circuit['packetDropsUploadSinceLastQuery']
|
#thisNodeDropsUpload += circuit['packetDropsUploadSinceLastQuery']
|
||||||
|
if circuit['stats']['sinceLastQuery']['packetDropsDownload'] and circuit['stats']['sinceLastQuery']['packetDropsUpload']:
|
||||||
thisNodeDropsTotal += (circuit['stats']['sinceLastQuery']['packetDropsDownload'] + circuit['stats']['sinceLastQuery']['packetDropsUpload'])
|
thisNodeDropsTotal += (circuit['stats']['sinceLastQuery']['packetDropsDownload'] + circuit['stats']['sinceLastQuery']['packetDropsUpload'])
|
||||||
|
if circuit['stats']['sinceLastQuery']['packetsSentDownload']:
|
||||||
packetsSentDownloadAggregate += circuit['stats']['sinceLastQuery']['packetsSentDownload']
|
packetsSentDownloadAggregate += circuit['stats']['sinceLastQuery']['packetsSentDownload']
|
||||||
|
if circuit['stats']['sinceLastQuery']['packetsSentUpload']:
|
||||||
packetsSentUploadAggregate += circuit['stats']['sinceLastQuery']['packetsSentUpload']
|
packetsSentUploadAggregate += circuit['stats']['sinceLastQuery']['packetsSentUpload']
|
||||||
|
if circuit['stats']['sinceLastQuery']['packetsSentDownload'] and circuit['stats']['sinceLastQuery']['packetsSentUpload']:
|
||||||
packetsSentTotalAggregate += (circuit['stats']['sinceLastQuery']['packetsSentDownload'] + circuit['stats']['sinceLastQuery']['packetsSentUpload'])
|
packetsSentTotalAggregate += (circuit['stats']['sinceLastQuery']['packetsSentDownload'] + circuit['stats']['sinceLastQuery']['packetsSentUpload'])
|
||||||
circuitsMatched += 1
|
circuitsMatched += 1
|
||||||
if (packetsSentDownloadAggregate > 0) and (packetsSentUploadAggregate > 0):
|
if (packetsSentDownloadAggregate > 0) and (packetsSentUploadAggregate > 0):
|
||||||
@ -424,22 +441,34 @@ def refreshBandwidthGraphs():
|
|||||||
|
|
||||||
queriesToSendCount = 0
|
queriesToSendCount = 0
|
||||||
for chunk in chunkedsubscriberCircuits:
|
for chunk in chunkedsubscriberCircuits:
|
||||||
|
seenSomethingBesides0s = False
|
||||||
queriesToSend = []
|
queriesToSend = []
|
||||||
for circuit in chunk:
|
for circuit in chunk:
|
||||||
bitsDownload = float(circuit['stats']['sinceLastQuery']['bitsDownload'])
|
bitsDownloadMin = float(circuit['minDownload']) * 1000000 if circuit['minDownload'] else None
|
||||||
bitsUpload = float(circuit['stats']['sinceLastQuery']['bitsUpload'])
|
bitsDownloadMax = float(circuit['maxDownload']) * 1000000 if circuit['maxDownload'] else None
|
||||||
percentUtilizationDownload = round((bitsDownload / round(circuit['maxDownload'] * 1000000))*100.0, 1)
|
bitsUploadMin = float(circuit['minUpload']) * 1000000 if circuit['minUpload'] else None
|
||||||
percentUtilizationUpload = round((bitsUpload / round(circuit['maxUpload'] * 1000000))*100.0, 1)
|
bitsUploadMax = float(circuit['maxUpload']) * 1000000 if circuit['maxUpload'] else None
|
||||||
|
bitsDownload = float(circuit['stats']['sinceLastQuery']['bitsDownload']) if circuit['stats']['sinceLastQuery']['bitsDownload'] else None
|
||||||
|
bitsUpload = float(circuit['stats']['sinceLastQuery']['bitsUpload']) if circuit['stats']['sinceLastQuery']['bitsUpload'] else None
|
||||||
|
bytesSentDownload = float(circuit['stats']['sinceLastQuery']['bytesSentDownload']) if circuit['stats']['sinceLastQuery']['bytesSentDownload'] else None
|
||||||
|
bytesSentUpload = float(circuit['stats']['sinceLastQuery']['bytesSentUpload']) if circuit['stats']['sinceLastQuery']['bytesSentUpload'] else None
|
||||||
|
percentUtilizationDownload = round((bitsDownload / round(circuit['maxDownload'] * 1000000))*100.0, 1) if bitsDownload and circuit['maxDownload'] else None
|
||||||
|
percentUtilizationUpload = round((bitsUpload / round(circuit['maxUpload'] * 1000000))*100.0, 1) if bitsUpload and circuit['maxUpload'] else None
|
||||||
|
if bitsDownload and bitsUpload:
|
||||||
|
if (bitsDownload > 0.0) or (bitsUpload > 0.0):
|
||||||
|
seenSomethingBesides0s = True
|
||||||
p = Point('Bandwidth').tag("Circuit", circuit['circuitName']).tag("ParentNode", circuit['ParentNode']).tag("Type", "Circuit").field("Download", bitsDownload).field("Upload", bitsUpload).time(timestamp)
|
p = Point('Bandwidth').tag("Circuit", circuit['circuitName']).tag("ParentNode", circuit['ParentNode']).tag("Type", "Circuit").field("Download", bitsDownload).field("Upload", bitsUpload).time(timestamp)
|
||||||
queriesToSend.append(p)
|
queriesToSend.append(p)
|
||||||
p = Point('Utilization').tag("Circuit", circuit['circuitName']).tag("ParentNode", circuit['ParentNode']).tag("Type", "Circuit").field("Download", percentUtilizationDownload).field("Upload", percentUtilizationUpload).time(timestamp)
|
p = Point('Utilization').tag("Circuit", circuit['circuitName']).tag("ParentNode", circuit['ParentNode']).tag("Type", "Circuit").field("Download", percentUtilizationDownload).field("Upload", percentUtilizationUpload).time(timestamp)
|
||||||
queriesToSend.append(p)
|
queriesToSend.append(p)
|
||||||
|
|
||||||
|
if seenSomethingBesides0s:
|
||||||
write_api.write(bucket=influxDBBucket, record=queriesToSend)
|
write_api.write(bucket=influxDBBucket, record=queriesToSend)
|
||||||
# print("Added " + str(len(queriesToSend)) + " points to InfluxDB.")
|
# print("Added " + str(len(queriesToSend)) + " points to InfluxDB.")
|
||||||
queriesToSendCount += len(queriesToSend)
|
queriesToSendCount += len(queriesToSend)
|
||||||
|
|
||||||
queriesToSend = []
|
queriesToSend = []
|
||||||
|
seenSomethingBesides0s = False
|
||||||
for parentNode in parentNodes:
|
for parentNode in parentNodes:
|
||||||
bitsDownload = float(parentNode['stats']['sinceLastQuery']['bitsDownload'])
|
bitsDownload = float(parentNode['stats']['sinceLastQuery']['bitsDownload'])
|
||||||
bitsUpload = float(parentNode['stats']['sinceLastQuery']['bitsUpload'])
|
bitsUpload = float(parentNode['stats']['sinceLastQuery']['bitsUpload'])
|
||||||
@ -448,6 +477,9 @@ def refreshBandwidthGraphs():
|
|||||||
droppedPacketsAllTime += dropsTotal
|
droppedPacketsAllTime += dropsTotal
|
||||||
percentUtilizationDownload = round((bitsDownload / round(parentNode['maxDownload'] * 1000000))*100.0, 1)
|
percentUtilizationDownload = round((bitsDownload / round(parentNode['maxDownload'] * 1000000))*100.0, 1)
|
||||||
percentUtilizationUpload = round((bitsUpload / round(parentNode['maxUpload'] * 1000000))*100.0, 1)
|
percentUtilizationUpload = round((bitsUpload / round(parentNode['maxUpload'] * 1000000))*100.0, 1)
|
||||||
|
if bitsDownload and bitsUpload:
|
||||||
|
if (bitsDownload > 0.0) or (bitsUpload > 0.0):
|
||||||
|
seenSomethingBesides0s = True
|
||||||
p = Point('Bandwidth').tag("Device", parentNode['parentNodeName']).tag("ParentNode", parentNode['parentNodeName']).tag("Type", "Parent Node").field("Download", bitsDownload).field("Upload", bitsUpload).time(timestamp)
|
p = Point('Bandwidth').tag("Device", parentNode['parentNodeName']).tag("ParentNode", parentNode['parentNodeName']).tag("Type", "Parent Node").field("Download", bitsDownload).field("Upload", bitsUpload).time(timestamp)
|
||||||
queriesToSend.append(p)
|
queriesToSend.append(p)
|
||||||
p = Point('Utilization').tag("Device", parentNode['parentNodeName']).tag("ParentNode", parentNode['parentNodeName']).tag("Type", "Parent Node").field("Download", percentUtilizationDownload).field("Upload", percentUtilizationUpload).time(timestamp)
|
p = Point('Utilization').tag("Device", parentNode['parentNodeName']).tag("ParentNode", parentNode['parentNodeName']).tag("Type", "Parent Node").field("Download", percentUtilizationDownload).field("Upload", percentUtilizationUpload).time(timestamp)
|
||||||
@ -455,11 +487,13 @@ def refreshBandwidthGraphs():
|
|||||||
p = Point('Overload').tag("Device", parentNode['parentNodeName']).tag("ParentNode", parentNode['parentNodeName']).tag("Type", "Parent Node").field("Overload", overloadFactor).time(timestamp)
|
p = Point('Overload').tag("Device", parentNode['parentNodeName']).tag("ParentNode", parentNode['parentNodeName']).tag("Type", "Parent Node").field("Overload", overloadFactor).time(timestamp)
|
||||||
queriesToSend.append(p)
|
queriesToSend.append(p)
|
||||||
|
|
||||||
|
if seenSomethingBesides0s:
|
||||||
write_api.write(bucket=influxDBBucket, record=queriesToSend)
|
write_api.write(bucket=influxDBBucket, record=queriesToSend)
|
||||||
# print("Added " + str(len(queriesToSend)) + " points to InfluxDB.")
|
# print("Added " + str(len(queriesToSend)) + " points to InfluxDB.")
|
||||||
queriesToSendCount += len(queriesToSend)
|
queriesToSendCount += len(queriesToSend)
|
||||||
|
|
||||||
if 'cake diffserv4' in sqm:
|
if 'cake diffserv4' in sqm:
|
||||||
|
seenSomethingBesides0s = False
|
||||||
queriesToSend = []
|
queriesToSend = []
|
||||||
listOfTins = ['Bulk', 'BestEffort', 'Video', 'Voice']
|
listOfTins = ['Bulk', 'BestEffort', 'Video', 'Voice']
|
||||||
for tin in listOfTins:
|
for tin in listOfTins:
|
||||||
@ -467,9 +501,12 @@ def refreshBandwidthGraphs():
|
|||||||
queriesToSend.append(p)
|
queriesToSend.append(p)
|
||||||
# Check to ensure tin percentage has value (!= None) before graphing. During partial or full reload these will have a value of None.
|
# Check to ensure tin percentage has value (!= None) before graphing. During partial or full reload these will have a value of None.
|
||||||
if (tinsStats['sinceLastQuery'][tin]['Download']['percentage'] != None) and (tinsStats['sinceLastQuery'][tin]['Upload']['percentage'] != None):
|
if (tinsStats['sinceLastQuery'][tin]['Download']['percentage'] != None) and (tinsStats['sinceLastQuery'][tin]['Upload']['percentage'] != None):
|
||||||
|
if (tinsStats['sinceLastQuery'][tin]['Download']['percentage'] > 0.0) or (tinsStats['sinceLastQuery'][tin]['Upload']['percentage'] > 0.0):
|
||||||
|
seenSomethingBesides0s = True
|
||||||
p = Point('Tins Assigned').tag("Type", "Tin").tag("Tin", tin).field("Download", tinsStats['sinceLastQuery'][tin]['Download']['percentage']).field("Upload", tinsStats['sinceLastQuery'][tin]['Upload']['percentage']).time(timestamp)
|
p = Point('Tins Assigned').tag("Type", "Tin").tag("Tin", tin).field("Download", tinsStats['sinceLastQuery'][tin]['Download']['percentage']).field("Upload", tinsStats['sinceLastQuery'][tin]['Upload']['percentage']).time(timestamp)
|
||||||
queriesToSend.append(p)
|
queriesToSend.append(p)
|
||||||
|
|
||||||
|
if seenSomethingBesides0s:
|
||||||
write_api.write(bucket=influxDBBucket, record=queriesToSend)
|
write_api.write(bucket=influxDBBucket, record=queriesToSend)
|
||||||
# print("Added " + str(len(queriesToSend)) + " points to InfluxDB.")
|
# print("Added " + str(len(queriesToSend)) + " points to InfluxDB.")
|
||||||
queriesToSendCount += len(queriesToSend)
|
queriesToSendCount += len(queriesToSend)
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user