Added band as attribute

This commit is contained in:
Rob Lee 2020-04-06 23:04:27 +01:00
parent 9492a058e8
commit 3de9e7f556

View File

@ -26,6 +26,7 @@ def prom_exporter():
#pprint.pprint(client.device.information()) # Needs valid authorization, will throw exception if invalid credentials are passed in URL
dev = 'deviceName="'+ client.device.information().get('DeviceName')+'",iccid="'+client.device.information().get('Iccid')+'"'
devband = dev+',band="'+client.device.signal().get('band')+'"'
signal = { 'band' : client.device.signal().get('band'),
'rsrp' : client.device.signal().get('rsrp').replace("dBm", ""),
'rsrq' : client.device.signal().get('rsrq').replace("dB", ""),
@ -45,19 +46,19 @@ def prom_exporter():
# rsrp
response.append('HELP rsrp The average power received from a single Reference signal, and Its typical range is around -44dbm (good) to -140dbm(bad)')
response.append('TYPE rsrp gauge')
response.append('rsrp{'+dev+'} '+signal.get('rsrp'))
response.append('rsrp{'+devband+'} '+signal.get('rsrp'))
# rsrq
response.append('HELP rsrq Indicates quality of the received signal, and its range is typically -19.5dB(bad) to -3dB (good)')
response.append('TYPE rsrq gauge')
response.append('rsrq{'+dev+'} '+signal.get('rsrq'))
response.append('rsrq{'+devband+'} '+signal.get('rsrq'))
# rssi
response.append('HELP rssi Represents the entire received power including the wanted power from the serving cell as well as all co-channel power and other sources of noise in dBm')
response.append('TYPE rssi gauge')
response.append('rssi{'+dev+'} '+signal.get('rssi'))
response.append('rssi{'+devband+'} '+signal.get('rssi'))
# sinr
response.append('HELP sinr The signal-to-noise ratio of the given signal in dB')
response.append('TYPE sinr gauge')
response.append('rsrq{'+dev+'} '+signal.get('sinr'))
response.append('rsrq{'+devband+'} '+signal.get('sinr'))
s='\n'
return s.join(response)