Finished InfluxDB integration
This commit is contained in:
parent
b6c91e4ac4
commit
582925b8a1
@ -3,16 +3,8 @@
|
||||
services:
|
||||
mdfanchanger:
|
||||
container_name: MD_Fan_Changer
|
||||
image: yuruc3/md1200_fan_controll:v1.2.1
|
||||
environment:
|
||||
# - MD1200BAUD=
|
||||
- SERIALADAPTER=/dev/ttyUSB0
|
||||
- TEMP_FACTOR=17
|
||||
- EPPYSLEEPY=0.5
|
||||
- MDSERIALTIMEOUT=0.5
|
||||
# - LOW_FAN_TRSHD=
|
||||
# - HIGH_FAN_TRSHD=
|
||||
env_file: "md1200.env"
|
||||
image: yuruc3/md1200_fan_controll:v2-flux
|
||||
env_file: md1200.env
|
||||
devices:
|
||||
- /dev/ttyUSB0:/dev/ttyUSB0
|
||||
restart: unless-stopped
|
||||
|
@ -10,7 +10,7 @@ MD1200BAUD = int(os.getenv("MD1200BAUD", 38400))
|
||||
# used if you want to run it on multiple JBODs
|
||||
SERIALADAPTER = os.getenv("SERIALADAPTER", "/dev/ttyUSB0")
|
||||
# Factor that defines how aggressive the temperature curve is
|
||||
TEMP_FACTOR = int(os.getenv("TEMP_FACTOR", 16))
|
||||
TEMP_FACTOR = int(os.getenv("TEMP_FACTOR", 19))
|
||||
# time between sending command to get temp and storing it. It's there to allow JBOD to answer
|
||||
EPPYSLEEPY = float(os.getenv("EPPYSLEEPY", 1))
|
||||
|
||||
@ -59,10 +59,11 @@ MDict = {}
|
||||
fluxSending = False
|
||||
currentTime = 0
|
||||
lastTempReading = 0
|
||||
inflxdb_LeData = []
|
||||
# Initialize InfluxDB client and influxdb API
|
||||
# ---------------------UNCOMMENT-----------------------
|
||||
# inflxdb_client = influxdb_client.InfluxDBClient(url=url, token=token, org=org)
|
||||
# write_api = inflxdb_client.write_api(write_options=SYNCHRONOUS)
|
||||
inflxdb_client = influxdb_client.InfluxDBClient(url=url, token=token, org=org)
|
||||
write_api = inflxdb_client.write_api(write_options=SYNCHRONOUS)
|
||||
# ---------------------UNCOMMENT-----------------------
|
||||
|
||||
|
||||
@ -177,42 +178,34 @@ def process_temps():
|
||||
# {'bp1': 35, 'bp2': 29, 'sim0': 35, 'sim1': 34, 'exp0': 56, 'exp1': 54}
|
||||
# ---LeData---
|
||||
if fluxSending:
|
||||
# Prep InfluxDB data
|
||||
# ---------------------UNCOMMENT-----------------------
|
||||
# inflxdb_Data_To_Send = (
|
||||
# influxdb_client.Point(f"{measurement}-script")
|
||||
# .tag("MACHINE", MACHINE_TAG)
|
||||
# .tag("LOCATION", LOCATION)
|
||||
# .field("Backplane1", MDict["bp1"])
|
||||
# .field("Backplane2", MDict["bp2"])
|
||||
# .field("SASIntModule0", MDict["sim0"])
|
||||
# .field("SASIntModule1", MDict["sim1"])
|
||||
# .field("Expander0", MDict["exp0"])
|
||||
# .field("Expander1", MDict["exp1"])
|
||||
# .field("Average", MDict["avg"])
|
||||
# )
|
||||
# Prep InfluxDB data
|
||||
inflxdb_Data_To_Send = (
|
||||
influxdb_client.Point(f"{measurement}-script")
|
||||
.tag("MACHINE", MACHINE_TAG)
|
||||
.tag("LOCATION", LOCATION)
|
||||
.field("Backplane1", MDict["bp1"])
|
||||
.field("Backplane2", MDict["bp2"])
|
||||
.field("SASIntModule0", MDict["sim0"])
|
||||
.field("SASIntModule1", MDict["sim1"])
|
||||
.field("Expander0", MDict["exp0"])
|
||||
.field("Expander1", MDict["exp1"])
|
||||
.field("Average", MDict["avg"])
|
||||
)
|
||||
|
||||
# inflxdb_Datazz_To_Send.append(inflxdb_Data_To_Send)
|
||||
# # Send data to InfluxDB
|
||||
# write_api.write(bucket=bucket, org=org, record=inflxdb_Data_To_Send)
|
||||
# # time.sleep(INFLX_SEPARATE_POINTS) # separate points
|
||||
|
||||
# # print(f"{len(bigDict)} <--- This many entrys")
|
||||
# Prep/append data
|
||||
inflxdb_LeData.append(inflxdb_Data_To_Send)
|
||||
# Send data to InfluxDB
|
||||
write_api.write(bucket=bucket, org=org, record=inflxdb_Data_To_Send)
|
||||
|
||||
|
||||
# # Clean up before another loop
|
||||
# bigDict.clear()
|
||||
# inflxdb_Datazz_To_Send.clear()
|
||||
# ---------------------UNCOMMENT-----------------------
|
||||
print("I'm sending stuff to InfluxDB")
|
||||
# Clean up before another loop
|
||||
inflxdb_LeData.clear()
|
||||
print("Sending data to InfluxDB", flush=True)
|
||||
|
||||
fluxSending = False
|
||||
|
||||
|
||||
# print("----------------")
|
||||
# return ()
|
||||
else:
|
||||
continue
|
||||
time.sleep(0.25)
|
||||
|
||||
|
||||
|
||||
|
@ -1,14 +1,19 @@
|
||||
# baud_rate=
|
||||
# serial_adapter=
|
||||
# wait_time=
|
||||
# temp_factor=
|
||||
# lower_treshold=
|
||||
# upper_treshold=
|
||||
INFLUX_TOKEN=apg1gysUeCcxdcRTMmosJTenbEppmUNi9rXlANDB2oNadBdWAu2GVTDc_q_dyo0iyYsckKaOvPRm6ba2NK0y_A==
|
||||
# MD1200BAUD=
|
||||
SERIALADAPTER=/dev/ttyUSB0
|
||||
|
||||
EPPYSLEEPY=1
|
||||
MDSERIALTIMEOUT=1
|
||||
TEMPREADINTERVAL=15
|
||||
|
||||
TEMP_FACTOR=17
|
||||
# LOW_FAN_TRSHD=21
|
||||
# HIGH_FAN_TRSHD=40
|
||||
|
||||
# Influxdb config
|
||||
INFLUX_TOKEN=-3rZgq6EprG9i-gKqBDSFCC3hTS3U49fxGkg==
|
||||
INFLUX_BUCKET=JBOD
|
||||
INFLUX_ORG=staging
|
||||
INFLUX_URL=http://localhost:8086
|
||||
INFLUX_ORG=FUBUKUS
|
||||
INFLUX_URL=http://192.168.1.101:8086
|
||||
INFLUX_MEASUREMENT=MD1200
|
||||
INFLUX_MACHINE_TAG=CHONGUS1200
|
||||
INFLUX_LOCATION=HQ
|
||||
INFLX_SEPARATE_POINTS=0.1
|
||||
INFLUX_LOCATION=HQ
|
19
PC_CONTROL_CODE/dockerInflux/md1200.env.defaults
Normal file
19
PC_CONTROL_CODE/dockerInflux/md1200.env.defaults
Normal file
@ -0,0 +1,19 @@
|
||||
MD1200BAUD=38400
|
||||
SERIALADAPTER=/dev/ttyUSB0
|
||||
|
||||
EPPYSLEEPY=1
|
||||
MDSERIALTIMEOUT=1
|
||||
TEMPREADINTERVAL=15
|
||||
|
||||
TEMP_FACTOR=19
|
||||
LOW_FAN_TRSHD=21
|
||||
HIGH_FAN_TRSHD=40
|
||||
|
||||
# Influxdb config
|
||||
INFLUX_TOKEN===
|
||||
INFLUX_BUCKET=JBOD
|
||||
INFLUX_ORG=staging
|
||||
INFLUX_URL=http://localhost:8086
|
||||
INFLUX_MEASUREMENT=MD1200
|
||||
INFLUX_MACHINE_TAG=CHONGUS1200
|
||||
INFLUX_LOCATION=HQ
|
Loading…
x
Reference in New Issue
Block a user