Files
ContecMonitor/fiveparaminte-main/scratch/check_db_devices.py
T

19 lines
544 B
Python
Raw Normal View History

import sqlite3
def main():
conn = sqlite3.connect("hl7_forwarder.db")
cursor = conn.cursor()
try:
cursor.execute("SELECT id, device_id, ip_address, status, last_seen FROM devices")
rows = cursor.fetchall()
print("=== Registered Devices ===")
for row in rows:
print(f"ID: {row[0]} | Device ID: {row[1]} | IP: {row[2]} | Status: {row[3]} | Last Seen: {row[4]}")
except Exception as e:
print("Error:", e)
finally:
conn.close()
if __name__ == "__main__":
main()