mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-01-24 04:49:26 +00:00
bitwarden
This commit is contained in:
parent
5eb1eae04f
commit
25e8a4c92b
@ -7,7 +7,6 @@ if paho.mqtt.__version__[0] > '1':
|
|||||||
client = mqttClient.Client(mqttClient.CallbackAPIVersion.VERSION1)
|
client = mqttClient.Client(mqttClient.CallbackAPIVersion.VERSION1)
|
||||||
else:
|
else:
|
||||||
client = mqttClient.Client()
|
client = mqttClient.Client()
|
||||||
|
|
||||||
from getmac import get_mac_address
|
from getmac import get_mac_address
|
||||||
import platform
|
import platform
|
||||||
import socket
|
import socket
|
||||||
@ -25,7 +24,7 @@ import random
|
|||||||
import requests
|
import requests
|
||||||
#import psutil
|
#import psutil
|
||||||
stats = {}
|
stats = {}
|
||||||
VERSION = "1.0.23"
|
VERSION = "1.0.26"
|
||||||
curos = platform.system()
|
curos = platform.system()
|
||||||
host = platform.node().lower()
|
host = platform.node().lower()
|
||||||
print(host)
|
print(host)
|
||||||
@ -84,27 +83,32 @@ def writeLog(msg, svr="INFO"):
|
|||||||
def check_router():
|
def check_router():
|
||||||
stats["uptime"] = uptime()
|
stats["uptime"] = uptime()
|
||||||
stats["version"] = VERSION
|
stats["version"] = VERSION
|
||||||
|
stats["status"] = "on"
|
||||||
cmnd = "crontab -l"
|
cmnd = "crontab -l"
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
|
|
||||||
if "#Skynet_banmalware#" in output:
|
if "#Skynet_banmalware#" in output:
|
||||||
stats["skynet"] = "on"
|
stats["skynet"] = "On"
|
||||||
else:
|
else:
|
||||||
stats["skynet"] = "off"
|
stats["skynet"] = "Off"
|
||||||
if "#Diversion_CountAds#" in output:
|
if "#Diversion_CountAds#" in output:
|
||||||
stats["diversion"] = "on"
|
stats["diversion"] = "On"
|
||||||
else:
|
else:
|
||||||
stats["diversion"] = "off"
|
stats["diversion"] = "Off"
|
||||||
|
|
||||||
|
|
||||||
cmnd = "nvram get vpn_client1_state"
|
cmnd = "nvram get vpn_client1_state"
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
writeLog("Openvpn1 Status : " + str(output))
|
writeLog("VpnClient1 Status : " + str(output))
|
||||||
stats["vpnclient1"] = output
|
stats["vpnclient1"] = "On" if output == "2" else "Off"
|
||||||
cmnd = "nvram get vpn_client2_state"
|
cmnd = "nvram get vpn_client2_state"
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
writeLog("Openvpn2 Status : " + str(output))
|
writeLog("VpnClient2 Status : " + str(output))
|
||||||
stats["vpnclient2"] = output
|
stats["vpnclient2"] = "On" if output == "2" else "Off"
|
||||||
|
cmnd = "nvram get vpn_server1_state"
|
||||||
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
|
writeLog("VpnServer1 Status : " + str(output))
|
||||||
|
stats["vpnserver1"] = "On" if output == "2" else "Off"
|
||||||
cmnd = "ncat -z 192.168.77.106 25"
|
cmnd = "ncat -z 192.168.77.106 25"
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
if status == 0:
|
if status == 0:
|
||||||
@ -238,11 +242,11 @@ if _PUBLISH:
|
|||||||
print("Connected to MQTT Broker!")
|
print("Connected to MQTT Broker!")
|
||||||
else:
|
else:
|
||||||
print("Failed to connect, return code %d\n", rc)
|
print("Failed to connect, return code %d\n", rc)
|
||||||
|
|
||||||
if paho.mqtt.__version__[0] > '1':
|
if paho.mqtt.__version__[0] > '1':
|
||||||
client = mqttClient.Client(mqttClient.CallbackAPIVersion.VERSION1)
|
client = mqttClient.Client(mqttClient.CallbackAPIVersion.VERSION1)
|
||||||
else:
|
else:
|
||||||
client = mqttClient.Client(client_id)
|
client = mqttClient.Client()
|
||||||
|
|
||||||
client.username_pw_set(username, password)
|
client.username_pw_set(username, password)
|
||||||
client.on_connect = on_connect
|
client.on_connect = on_connect
|
||||||
client.connect(MQTT_HOST, MQTT_PORT)
|
client.connect(MQTT_HOST, MQTT_PORT)
|
||||||
@ -334,6 +338,8 @@ elif host == "SERVER":
|
|||||||
mac = str(get_mac_address("enp2s0"))
|
mac = str(get_mac_address("enp2s0"))
|
||||||
elif host == "ASUS" and curos != "Windows":
|
elif host == "ASUS" and curos != "Windows":
|
||||||
mac = str(get_mac_address("enp3s0f1"))
|
mac = str(get_mac_address("enp3s0f1"))
|
||||||
|
elif host == "morefine" and curos != "Windows":
|
||||||
|
mac = str(get_mac_address("eno1"))
|
||||||
else:
|
else:
|
||||||
mac = str(get_mac_address("Ethernet"))
|
mac = str(get_mac_address("Ethernet"))
|
||||||
|
|
||||||
@ -366,7 +372,7 @@ def on_connect(client, userdata, flags, rc):
|
|||||||
if host.lower() == "nas":
|
if host.lower() == "nas":
|
||||||
print("Getting VM info")
|
print("Getting VM info")
|
||||||
|
|
||||||
cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh list --all"
|
cmnd = "/share/ZFS532_DATA/.qpkg/QKVM/usr/bin/virsh list --all"
|
||||||
print(cmnd)
|
print(cmnd)
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
l = 1
|
l = 1
|
||||||
@ -384,7 +390,7 @@ def on_connect(client, userdata, flags, rc):
|
|||||||
|
|
||||||
for m in VMS:
|
for m in VMS:
|
||||||
|
|
||||||
cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + m
|
cmnd = "/share/ZFS532_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + m
|
||||||
#out = subprocess.Popen(cmnd.split())
|
#out = subprocess.Popen(cmnd.split())
|
||||||
print(cmnd)
|
print(cmnd)
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
@ -473,7 +479,8 @@ def on_message(client, userdata, msg):
|
|||||||
|
|
||||||
if myObj["cmd"] == "nas_cmd":
|
if myObj["cmd"] == "nas_cmd":
|
||||||
print("Executing NAS")
|
print("Executing NAS")
|
||||||
cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + str(myObj["target"])
|
#cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + str(myObj["target"])
|
||||||
|
cmnd = "/share/ZFS532_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + str(myObj["target"])
|
||||||
print(cmnd)
|
print(cmnd)
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
print(output)
|
print(output)
|
||||||
@ -489,7 +496,7 @@ def on_message(client, userdata, msg):
|
|||||||
cmd_type = "shutdown"
|
cmd_type = "shutdown"
|
||||||
|
|
||||||
|
|
||||||
cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh " + cmd_type + " " + str(myObj["target"])
|
cmnd = "/share/ZFS532_DATA/.qpkg/QKVM/usr/bin/virsh " + cmd_type + " " + str(myObj["target"])
|
||||||
subprocess.Popen(cmnd.split())
|
subprocess.Popen(cmnd.split())
|
||||||
print(cmnd)
|
print(cmnd)
|
||||||
if myObj["command"] == "start":
|
if myObj["command"] == "start":
|
||||||
@ -791,37 +798,38 @@ def on_message(client, userdata, msg):
|
|||||||
mon3 = "DVI-I-2-1"
|
mon3 = "DVI-I-2-1"
|
||||||
mon4 = "eDP-1-1"
|
mon4 = "eDP-1-1"
|
||||||
'''
|
'''
|
||||||
mon1 = "HDMI-1"
|
right = ["HDMI-A-0", "1920x1080"]
|
||||||
mon2 = "HDMI-2"
|
tleft = ["HDMI-A-0", "1920x1080"]
|
||||||
mon3 = "DVI-I-1-1"
|
tright = ["DVI-I-1-1", "1920x1080"]
|
||||||
mon4 = "eDP-1"
|
left = ["DisplayPort-0", "2560x1440"]
|
||||||
writeLog(mon3)
|
mid = ["DisplayPort-1", "3440x1440"]
|
||||||
if myObj["target"] == "mid":
|
|
||||||
myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " +mon1 + " --off --output " + mon4 + " --off"
|
|
||||||
elif myObj["target"] == "left":
|
|
||||||
myCmd = "xrandr --output " + mon1 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " +mon2 + " --off --output " + mon4 + " --off"
|
|
||||||
|
|
||||||
|
#xrandr --output DisplayPort-1 --primary --auto --mode 3440x1440 --output HDMI-A-0 --auto --left-of DVI-I-1-1 --mode 1920x1080 --output DisplayPort-0 --auto --left-of DisplayPort-1 --mode 2560x1440 --output DVI-I-1-1 --above DisplayPort-1 --mode 1920x1080
|
||||||
|
if myObj["target"] == "mid":
|
||||||
|
myCmd = f"xrandr --output {mid[0]} --primary --auto --mode {mid[1]} --output {left[0]} --off --output {tleft[0]} --off --output {tright[0]} --off"
|
||||||
|
elif myObj["target"] == "left":
|
||||||
|
myCmd = f"xrandr --output {left[0]} --primary --auto --mode {left[1]} --output {mid[0]} --off --output {tleft[0]} --off --output {tright[0]} --off"
|
||||||
elif myObj["target"] == "all":
|
elif myObj["target"] == "all":
|
||||||
myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
|
myCmd = f"xrandr --output {mid[0]} --primary --auto --mode {mid[1]} --pos 0x0 --output {tleft[0]} --auto --pos -1920x-1080 --mode {tleft[1]} --output {left[0]} --auto --left-of {mid[0]} --mode {left[1]} --output {tright[0]} --above {mid[0]} --mode {tright[1]}"
|
||||||
|
#myCmd = f"xrandr --output {mid[0]} --primary --auto --mode {mid[1]} --output {right[0]} --auto --right-of {mid[0]} --mode {right[1]} --output {left[0]} --auto --left-of {mid[0]} --mode {left[1]}"
|
||||||
elif myObj["target"] == "midleft":
|
elif myObj["target"] == "midleft":
|
||||||
myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --off"
|
myCmd = f"xrandr --output {mid[0]} --primary --auto --mode {mid[1]} --output {tleft[0]} --off --output {left[0]} --auto --left-of {mid[0]} --mode {left[1]} --output {tright[0]} --off"
|
||||||
elif myObj["target"] == "midtop":
|
elif myObj["target"] == "midtop":
|
||||||
myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --off --output " + mon4 + " --off"
|
myCmd = f"xrandr --output {mid[0]} --primary --auto --mode {mid[1]} --output {tright[0]} --auto --above {mid[0]} --mode {tright[1]} --output {left[0]} --off --output {tleft[0]} --off"
|
||||||
elif myObj["target"] == "midleftbuild":
|
elif myObj["target"] == "midlefttleft":
|
||||||
myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
|
myCmd = f"xrandr --output {mid[0]} --primary --auto --mode {mid[1]} --pos 0x0 --output {tright[0]} --off --output {left[0]} --auto --left-of {mid[0]} --mode {left[1]} --output {tleft[0]} --auto --pos -1920x-1080 --mode {tleft[1]}"
|
||||||
elif myObj["target"] == "midbuild":
|
elif myObj["target"] == "lefttlefttright":
|
||||||
myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --off --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
|
myCmd = f"xrandr --output {mid[0]} --off --output {tleft[0]} --auto --pos 640x-1080 --mode {tright[1]} --output {left[0]} --primary --auto --mode {left[1]} --pos 0x0 --output {tright[0]} --right-of {tleft[0]} --mode {tright[1]}"
|
||||||
elif myObj["target"] == "midlefttop":
|
elif myObj["target"] == "lefttleft":
|
||||||
myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --off"
|
myCmd = f"xrandr --output {mid[0]} --off --output {tleft[0]} --auto --pos 640x-1080 --mode {tright[1]} --output {left[0]} --primary --auto --mode {left[1]} --pos 0x0 --output {tright[0]} --off"
|
||||||
elif myObj["target"] == "build":
|
|
||||||
myCmd = "xrandr --output " + mon2 + " --off --output " + mon3 + " --off --output " + mon1 + " --off --output " + mon4 + " --auto --mode 1920x1080"
|
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
writeLog(myCmd)
|
writeLog(myCmd)
|
||||||
if myCmd != "":
|
if myCmd != "":
|
||||||
print(myCmd)
|
print(myCmd)
|
||||||
writeLog("Executing")
|
writeLog("Executing : {myCmd}")
|
||||||
#subprocess.Popen(myCmd.split())
|
#subprocess.Popen(myCmd.split())
|
||||||
status, output = subprocess.getstatusoutput(myCmd)
|
status, output = subprocess.getstatusoutput(myCmd)
|
||||||
writeLog(output)
|
writeLog(output)
|
||||||
@ -924,13 +932,13 @@ def on_message(client, userdata, msg):
|
|||||||
except:
|
except:
|
||||||
print("not a json!")
|
print("not a json!")
|
||||||
|
|
||||||
try:
|
if paho.mqtt.__version__[0] > '1':
|
||||||
client = mqttClient.Client(mqttClient.CallbackAPIVersion.VERSION1)
|
client = mqttClient.Client(mqttClient.CallbackAPIVersion.VERSION1)
|
||||||
except:
|
else:
|
||||||
client = mqttClient.Client()
|
client = mqttClient.Client()
|
||||||
payload = "off"
|
payload = '{"status": "off"}'
|
||||||
client.username_pw_set("jaydee", password="jaydee1")
|
client.username_pw_set("jaydee", password="jaydee1")
|
||||||
client.will_set("sectorq/systems/" + host.lower() + "/stat", payload=payload, qos=0, retain=True)
|
client.will_set("home-assistant/" + host.lower() + "/hwstats", payload=payload, qos=0, retain=True)
|
||||||
client.on_connect = on_connect
|
client.on_connect = on_connect
|
||||||
client.on_message = on_message
|
client.on_message = on_message
|
||||||
writeLog(MQTT_HOST)
|
writeLog(MQTT_HOST)
|
||||||
@ -998,6 +1006,7 @@ if curos == "Windows":
|
|||||||
try:
|
try:
|
||||||
key = winreg.OpenKeyEx(path, r"SOFTWARE\\FinalWire\\AIDA64\\SensorValues")
|
key = winreg.OpenKeyEx(path, r"SOFTWARE\\FinalWire\\AIDA64\\SensorValues")
|
||||||
results = {}
|
results = {}
|
||||||
|
results["status"] = "on"
|
||||||
for k in aide_refs:
|
for k in aide_refs:
|
||||||
k2 = "Value." + str(k)
|
k2 = "Value." + str(k)
|
||||||
try:
|
try:
|
||||||
@ -1022,6 +1031,7 @@ if curos == "Windows":
|
|||||||
print(swap_data)
|
print(swap_data)
|
||||||
print("MEM : {}".format(mem_data.percent))
|
print("MEM : {}".format(mem_data.percent))
|
||||||
print(psutil.getloadavg())
|
print(psutil.getloadavg())
|
||||||
|
#lodctr /R
|
||||||
try:
|
try:
|
||||||
print(psutil.sensors_temperatures())
|
print(psutil.sensors_temperatures())
|
||||||
except:
|
except:
|
||||||
@ -1044,24 +1054,47 @@ else:
|
|||||||
|
|
||||||
NEXT_CHECK = 0
|
NEXT_CHECK = 0
|
||||||
while True:
|
while True:
|
||||||
print(VERSION)
|
#print(VERSION)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
try:
|
try:
|
||||||
mtime = os.path.getmtime(sys.argv[0])
|
mtime = os.path.getmtime(sys.argv[0])
|
||||||
except OSError:
|
except OSError:
|
||||||
mtime = 0
|
mtime = 0
|
||||||
print(mtime)
|
#print(mtime)
|
||||||
if NEXT_CHECK < int(time.time()):
|
if NEXT_CHECK < int(time.time()):
|
||||||
NEXT_CHECK = int(time.time()) + 20
|
NEXT_CHECK = int(time.time()) + 20
|
||||||
writeLog("Blalala : Next : " + str(NEXT_CHECK))
|
writeLog("Blalala : Next : " + str(NEXT_CHECK))
|
||||||
|
|
||||||
if host.lower() == "asus":
|
if host.lower() == "asus" or host.lower() == "morefine":
|
||||||
print(psutil.sensors_temperatures())
|
print(psutil.sensors_temperatures())
|
||||||
#print(psutil.sensors_fans())
|
#print(psutil.sensors_fans())
|
||||||
sences = psutil.sensors_temperatures()
|
sences = psutil.sensors_temperatures()
|
||||||
cpu_data = sences["coretemp"][0]
|
print("SENCES")
|
||||||
|
print(sences)
|
||||||
|
print("#"*40)
|
||||||
|
try:
|
||||||
|
cpu_data = sences["coretemp"][0]
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
cpu_data = sences["k10temp"][0]
|
||||||
|
except:
|
||||||
|
cpu_data = "None"
|
||||||
|
print("CPUDATA")
|
||||||
|
print(cpu_data)
|
||||||
|
print("#"*40)
|
||||||
|
|
||||||
|
|
||||||
mb_data = sences["acpitz"][0]
|
mb_data = sences["acpitz"][0]
|
||||||
fan_data = psutil.sensors_fans()["asus"][0]
|
print("MBDATA")
|
||||||
|
print(mb_data)
|
||||||
|
print(mb_data.current)
|
||||||
|
print("#"*40)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
fan_data = psutil.sensors_fans()["asus"][0].current
|
||||||
|
except:
|
||||||
|
fan_data = "None"
|
||||||
mem_data = psutil.virtual_memory()
|
mem_data = psutil.virtual_memory()
|
||||||
swap_data = psutil.swap_memory()
|
swap_data = psutil.swap_memory()
|
||||||
#cpu_usage = psutil.cpu_percent(interval=1)
|
#cpu_usage = psutil.cpu_percent(interval=1)
|
||||||
@ -1082,7 +1115,7 @@ else:
|
|||||||
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
|
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
|
||||||
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
|
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
|
||||||
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
|
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
|
||||||
client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on", "version":"' + VERSION + '","MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":' + str(fan_data.current) + ', "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
|
client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on", "version":"' + VERSION + '","TCPU":"NA", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":"' + str(fan_data) + '", "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
|
||||||
client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
|
client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
|
||||||
elif host.lower() == "openmediavault" or host.lower() == "omv":
|
elif host.lower() == "openmediavault" or host.lower() == "omv":
|
||||||
#print(psutil.sensors_temperatures())
|
#print(psutil.sensors_temperatures())
|
||||||
@ -1124,7 +1157,7 @@ else:
|
|||||||
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
|
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
|
||||||
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
|
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
|
||||||
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
|
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
|
||||||
client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on","version":"' + VERSION + '","reboot":"' + str(reboot_pending) + '", "uptime":"' + str(sys_uptime) + '", "raid_usage": ' + str(disk_usage) + ',"rsync":"' + str(stat_rsync) +'", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":0, "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
|
client.publish("home-assistant/" + host + "/hwstats", payload='{"version":"' + VERSION + '","reboot":"' + str(reboot_pending) + '", "uptime":"' + str(sys_uptime) + '", "raid_usage": ' + str(disk_usage) + ',"rsync":"' + str(stat_rsync) +'", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":0, "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
|
||||||
elif host.lower() == "router":
|
elif host.lower() == "router":
|
||||||
check_router()
|
check_router()
|
||||||
elif host.lower() == "nas":
|
elif host.lower() == "nas":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user