This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>OS Health Checker</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
margin: 20px; | |
background: #f4f6f9; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify, send_from_directory | |
import os | |
import paramiko | |
import datetime | |
app = Flask(__name__) | |
BASE_REPORT_DIR = os.path.join(os.path.dirname(__file__), "health_reports") | |
os.makedirs(BASE_REPORT_DIR, exist_ok=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paramiko | |
# Required tools list | |
REQUIRED_TOOLS = ["python3", "curl", "wget", "htop"] | |
def run_remote_command(host, username, password, command): | |
"""Run a command on the remote server via SSH""" | |
try: | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Remote OS Health Check</title> | |
<style> | |
body { font-family: Arial, sans-serif; margin: 20px; } | |
.server { border: 1px solid #ccc; padding: 10px; margin-bottom: 10px; } | |
button { margin-top: 10px; } | |
.download-link { display: block; margin-top: 5px; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify, render_template, send_file | |
import paramiko | |
import os | |
from datetime import datetime, timezone | |
import zipfile | |
app = Flask(__name__) | |
BASE_REPORT_DIR = "/home/thenila/health_reports" | |
# Ensure base directory exists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Remote OS Health Check</title> | |
<style> | |
body { font-family: Arial, sans-serif; margin: 20px; } | |
.server { border: 1px solid #ccc; padding: 10px; margin-bottom: 10px; } | |
button { margin-top: 10px; } | |
.download-link { display: block; margin-top: 5px; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import subprocess | |
from datetime import datetime, timezone | |
# ----------------------------- | |
# Timestamp & Report Directory | |
# ----------------------------- | |
timestamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify | |
import paramiko | |
import os | |
app = Flask(__name__) | |
@app.route('/run_health_check', methods=['POST']) | |
def run_health_check(): | |
data = request.json | |
target_ip = data.get("ip") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify | |
import paramiko | |
import os | |
app = Flask(__name__) | |
@app.route('/run_health_check', methods=['POST']) | |
def run_health_check(): | |
data = request.json | |
target_ip = data.get("ip") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import subprocess | |
from datetime import datetime | |
# ========================== | |
# Setup report directories | |
# ========================== | |
home_dir = os.path.expanduser("~") |
NewerOlder