Got 3750-X monitoring working
This commit is contained in:
@@ -68,4 +68,100 @@ async def fluxIDRACWriter(
|
||||
return 1
|
||||
|
||||
return 0
|
||||
# return {"STATUS": "succesfully inserted to InfluxDB"}
|
||||
# return {"STATUS": "succesfully inserted to InfluxDB"}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async def fluxDataWriter(
|
||||
inpDict: dict
|
||||
) -> int:
|
||||
|
||||
"""
|
||||
Insert temperature data into InfluxDB
|
||||
:inputQueue: Asyncio Queue that has what is needed to be sent
|
||||
"""
|
||||
# inputQueue have multiple such Dicts
|
||||
# {
|
||||
# "source": "IDRAC",
|
||||
# "value": returnObj,
|
||||
# "type": "snmpPyIDRACData"
|
||||
# }
|
||||
|
||||
if write_fluxdb_api is None:
|
||||
return 2
|
||||
|
||||
match inpDict["source"]:
|
||||
|
||||
case "CISCO":
|
||||
|
||||
match inpDict["device"]:
|
||||
case "3750X":
|
||||
# Prep InfluxDB data
|
||||
inflxdb_3750X_Data_To_Send = (
|
||||
influxdb_client.Point(INFXLUXDB_MEASUEREMENT)
|
||||
.tag("SOURCE", inpDict["source"])
|
||||
.tag("DEVICE", inpDict["device"])
|
||||
.tag("TYPE", inpDict["type"])
|
||||
.tag("HOSTNAME", inpDict["value"].hostname)
|
||||
.field("systemStatus", inpDict["value"].systemStatus)
|
||||
.field("systemTemp", inpDict["value"].systemTemp)
|
||||
.field("last5SecUsage", inpDict["value"].last5SecUsage)
|
||||
.field("last1MinUsage", inpDict["value"].last1MinUsage)
|
||||
.field("last5MinUsage", inpDict["value"].last5MinUsage)
|
||||
.field("uptimeS", inpDict["value"].uptimeS)
|
||||
)
|
||||
|
||||
try:
|
||||
write_fluxdb_api.write(bucket=INFLUXBCKT, org=INFLUXORG, record=inflxdb_3750X_Data_To_Send)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return 1
|
||||
|
||||
case "NEXUS":
|
||||
...
|
||||
return 0
|
||||
case _:
|
||||
print(f"{inpDict['device']} is not supported.\nOnly '3750X' and 'Nexus' are.")
|
||||
return 1
|
||||
|
||||
case "IDRAC":
|
||||
# Prep InfluxDB data
|
||||
inflxdb_IDRAC_Data_To_Send = (
|
||||
influxdb_client.Point(INFXLUXDB_MEASUEREMENT)
|
||||
.tag("SOURCE", inpDict["source"])
|
||||
.tag("TYPE", inpDict["type"])
|
||||
.tag("HOSTNAME", inpDict["value"].hostname)
|
||||
.field("PowerDrawPSU1", inpDict["value"].powerDrawPSU1)
|
||||
.field("PowerDrawPSU2", inpDict["value"].powerDrawPSU2)
|
||||
.field("TotalBoardPower", inpDict["value"].powerDrawBoard)
|
||||
.field("VoltagePSU1", inpDict["value"].voltagePSU1)
|
||||
.field("VoltagePSU2", inpDict["value"].voltagePSU2)
|
||||
.field("InletTemperature", inpDict["value"].inletTemp)
|
||||
.field("ExhaustTemperature", inpDict["value"].exhaustTemp)
|
||||
.field("TemperatureCPU1", inpDict["value"].cpu1Temp)
|
||||
.field("TemperatureCPU2", inpDict["value"].cpu2Temp)
|
||||
.field("UptimeInSeconds", inpDict["value"].uptimeS)
|
||||
.field("UptimeInHours", inpDict["value"].uptimeH)
|
||||
.field("UptimeInDays", inpDict["value"].uptimeD)
|
||||
)
|
||||
|
||||
try:
|
||||
write_fluxdb_api.write(bucket=INFLUXBCKT, org=INFLUXORG, record=inflxdb_IDRAC_Data_To_Send)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return 1
|
||||
case "FANS":
|
||||
await eng.execute(
|
||||
# changeMeLater
|
||||
t1.insert(), [{"name": "some name 1"}, {"name": "some name 2"}]
|
||||
)
|
||||
|
||||
case _:
|
||||
print(f"No such source of data as {inpDict['source']}")
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
# asyncio.sleep(5)
|
||||
Reference in New Issue
Block a user