feat: add homelab deployment configs, documentation, and automation scripts
This commit is contained in:
30
scripts/check_grafana_sqlite.py
Normal file
30
scripts/check_grafana_sqlite.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
py_script = """import sqlite3
|
||||
conn = sqlite3.connect('/tmp/grafana_real.db')
|
||||
cur = conn.cursor()
|
||||
tables = [t[0] for t in cur.execute("SELECT name FROM sqlite_master WHERE type='table';").fetchall()]
|
||||
for t in tables:
|
||||
if 'source' in t or 'dash' in t or 'user' in t:
|
||||
print('Matching table:', t)
|
||||
|
||||
print('--- data_source content ---')
|
||||
for row in cur.execute('SELECT * FROM data_source').fetchall():
|
||||
print(row)
|
||||
|
||||
print('--- dashboard content ---')
|
||||
for row in cur.execute('SELECT id, title, slug, uid FROM dashboard').fetchall():
|
||||
print(row)
|
||||
"""
|
||||
|
||||
stdin, stdout, stderr = c.exec_command("cat > /tmp/inspect_grafana.py && python3 /tmp/inspect_grafana.py")
|
||||
stdin.write(py_script)
|
||||
stdin.close()
|
||||
print(stdout.read().decode())
|
||||
print(stderr.read().decode())
|
||||
|
||||
c.close()
|
||||
Reference in New Issue
Block a user