diff --git a/.idea/sourcesync.xml b/.idea/sourcesync.xml new file mode 100644 index 0000000..ea0b3b3 --- /dev/null +++ b/.idea/sourcesync.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/Controller/__pycache__/mysql_connect.cpython-39.pyc b/Controller/__pycache__/mysql_connect.cpython-39.pyc index b6e813d..bf3df06 100644 Binary files a/Controller/__pycache__/mysql_connect.cpython-39.pyc and b/Controller/__pycache__/mysql_connect.cpython-39.pyc differ diff --git a/Controller/__pycache__/rds_export.cpython-39.pyc b/Controller/__pycache__/rds_export.cpython-39.pyc index ea96ba8..eb03729 100644 Binary files a/Controller/__pycache__/rds_export.cpython-39.pyc and b/Controller/__pycache__/rds_export.cpython-39.pyc differ diff --git a/Controller/__pycache__/smtp_export.cpython-39.pyc b/Controller/__pycache__/smtp_export.cpython-39.pyc index 76cf20f..378d2d0 100644 Binary files a/Controller/__pycache__/smtp_export.cpython-39.pyc and b/Controller/__pycache__/smtp_export.cpython-39.pyc differ diff --git a/Controller/__pycache__/ssh_tunnel.cpython-39.pyc b/Controller/__pycache__/ssh_tunnel.cpython-39.pyc new file mode 100644 index 0000000..95ca148 Binary files /dev/null and b/Controller/__pycache__/ssh_tunnel.cpython-39.pyc differ diff --git a/Controller/__pycache__/system_info.cpython-39.pyc b/Controller/__pycache__/system_info.cpython-39.pyc index 4640d6a..ce5ff14 100644 Binary files a/Controller/__pycache__/system_info.cpython-39.pyc and b/Controller/__pycache__/system_info.cpython-39.pyc differ diff --git a/Controller/check_alive_time.py b/Controller/check_alive_time.py index e69de29..8a62eb0 100644 --- a/Controller/check_alive_time.py +++ b/Controller/check_alive_time.py @@ -0,0 +1,44 @@ +import mysql.connector.locales.eng +import mysql.connector +import os +import time +os.environ['TZ'] = 'Europe/Berlin' +time.tzset() + +def database(query,name,user): + # server.start() + + mydb = mysql.connector.connect( + host="172.17.1.21", + port=3306, + user="root", + password="N53yBCswuawzBzS445VNAhWVMs3N59Gb9szEsrzXRBzarDqpdETpQeyt5v5CGe", + database="" + name, + auth_plugin='mysql_native_password', + ) + mydb.connect() + cursor = mydb.cursor() + if "SELECT" in query: + if user: + cursor.execute(query, user) + return cursor.fetchone() + else: + cursor.execute(query, user) + return cursor.fetchall() + if "SHOW" in query: + cursor.execute(query) + return cursor.fetchall() + if "INSERT" in query: + cursor.execute(query,user) + mydb.commit() + if "UPDATE" in query: + cursor.execute(query,user) + mydb.commit() + mydb.close() + +# mysql_connect.database("SELECT * from `Ping-Server` WHERE NAME='TNPTS01' ORDER BY time DESC LIMIT 1;") +server = database("SELECT DISTINCT NAME FROM `Ping-Server`","Stines-GmbH","") +for i in server: + print(i[0]) + time = database(f"SELECT * from `Ping-Server` WHERE NAME='{i[0]}' ORDER BY time DESC LIMIT 1;","Stines-GmbH","") + print(time[0][0]) \ No newline at end of file