Adds Banner and increases the timer
This commit is contained in:
@ -2,9 +2,8 @@
|
||||
Description=Run System Health Monitoring Daemon Daily
|
||||
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
RandomizedDelaySec=1h
|
||||
Persistent=true
|
||||
OnCalendar=hourly
|
||||
RandomizedDelaySec=300
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
@ -37,7 +37,6 @@ class SystemHealthMonitor:
|
||||
}
|
||||
CONFIG = {
|
||||
'TICKET_API_URL': 'http://10.10.10.45/create_ticket_api.php',
|
||||
'STATE_FILE': '/tmp/last_health_check.json',
|
||||
'THRESHOLDS': {
|
||||
'DISK_CRITICAL': 90,
|
||||
'DISK_WARNING': 80,
|
||||
@ -65,7 +64,6 @@ class SystemHealthMonitor:
|
||||
|
||||
def __init__(self,
|
||||
ticket_api_url: str = 'http://10.10.10.45/create_ticket_api.php',
|
||||
state_file: str = '/tmp/last_health_check.json',
|
||||
dry_run: bool = False):
|
||||
"""
|
||||
Initialize the system health monitor.
|
||||
@ -129,8 +127,17 @@ class SystemHealthMonitor:
|
||||
:param health_report: The comprehensive health report from the checks.
|
||||
:return: A detailed description for the issue.
|
||||
"""
|
||||
description = issue + "\n\n"
|
||||
banner = """
|
||||
=================================================================
|
||||
AUTOMATED TICKET - Generated by Hardware Monitoring Service (hwmonDaemon)
|
||||
Host: {}
|
||||
Generated: {}
|
||||
=================================================================
|
||||
|
||||
""".format(socket.gethostname(), datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
||||
|
||||
description = banner + issue + "\n\n"
|
||||
|
||||
if "Disk" in issue:
|
||||
for partition in health_report.get('drives_health', {}).get('drives', []):
|
||||
if partition.get('mountpoint') in issue:
|
||||
@ -599,7 +606,6 @@ def main():
|
||||
|
||||
# Parse command-line arguments or read from configuration file
|
||||
ticket_api_url = "http://10.10.10.45/create_ticket_api.php"
|
||||
state_file = "/tmp/last_health_check.json"
|
||||
|
||||
# Instantiate the SystemHealthMonitor class
|
||||
monitor = SystemHealthMonitor(
|
||||
|
||||
Reference in New Issue
Block a user