Skip to content

Syslogger 0.2.0-alpha

Latest

Choose a tag to compare

@Efolingo Efolingo released this 09 Apr 19:28
· 4 commits to main since this release
8d54df8

System Monitoring and Alert Program with Email and Voice Notifications
This Python program is designed to monitor the system's hardware usage (CPU, GPU, RAM, Disk, and Network) in real time, logging the details into a file on the desktop and sending email alerts when critical thresholds are exceeded. Additionally, it can provide audio alerts (via text-to-speech) when the CPU, GPU, or RAM usage exceeds a specified percentage, offering an accessible and proactive solution for system resource monitoring.

Key Features:
System Information Collection:

The program collects detailed system information such as:

Operating System details (name, version, architecture).

Hardware Information (CPU cores, processor details).

RAM Usage (Total, Available, Used).

Disk Usage (Total size, used, and free space).

Network Usage (bytes sent and received).

Battery Status (for laptops).

CPU and GPU Information (including temperature and load).

System Uptime (how long the system has been running).

Log File Management:

The system information is written to a log file located on the desktop.

The log file is automatically rotated when its size exceeds 1MB, ensuring that older logs are kept in an organized manner.

Email Alerts:

When system resources exceed critical thresholds (e.g., CPU > 90%, RAM > 85%, or Disk > 90%), the program sends an email alert to a predefined recipient. This allows users to monitor their system remotely and take necessary actions to avoid crashes or slowdowns.

Voice Alerts:

In addition to email alerts, the program can also speak out loud warnings using pyttsx3 (a Python library for text-to-speech).

If CPU, GPU, or RAM usage exceeds 99%, a voice notification will announce the overload status, providing an audible warning to the user.

Customization:

You can customize the email sender, recipient, password, and other system parameters.

The voice notification settings (rate, volume, and voice type) are also customizable, ensuring flexibility in how alerts are presented.

How it Works:
System Resource Monitoring:

The program continuously monitors key system metrics like CPU, RAM, GPU, and Disk usage.

It checks the usage of the system every second and updates the log file accordingly.

Threshold Checking:

If any monitored resource exceeds the predefined threshold (e.g., CPU > 90%, RAM > 85%), the program will trigger an email notification and a voice alert.

Log Rotation:

The log file, named syslog.txt, is stored on the desktop. If the file size exceeds 1MB, it is automatically renamed with a timestamp and a new log file is created.

Sending Alerts:

If the system load is high, emails are sent to inform the user about the overload. You can specify the recipient email, subject, and body content.

Voice alerts are spoken using pyttsx3, providing immediate auditory feedback about the system status.

Error Handling:

The program includes error handling to ensure smooth operation. For example, if the email fails to send or if there is an issue with fetching system data, the program will catch exceptions and print relevant error messages.

Usage Scenarios:
System Monitoring: Ideal for server or workstation environments where continuous monitoring of system resources is critical.

Overload Detection: Useful for applications that need to ensure system resources are not being overused (e.g., for gaming PCs, render farms, etc.).

Automation: The program can be run on a schedule to automatically log system stats and alert users when system resources are in danger of reaching critical levels.

Accessibility: With voice notifications, the program is useful for users who might not be looking directly at their screen, allowing them to receive alerts audibly.

Technologies Used:
psutil: For fetching system statistics such as CPU, RAM, disk usage, network data, and more.

GPUtil: To fetch GPU statistics (if a compatible GPU is present).

pyttsx3: For converting text to speech, providing voice alerts for system overloads.

smtplib: For sending email alerts.

datetime: For generating timestamps to log system data and rotate logs.

Conclusion:
This program offers a comprehensive solution for real-time system monitoring with proactive notifications through email and voice alerts. It's ideal for users who need to monitor the health of their system and receive instant feedback when critical thresholds are crossed, ensuring system stability and performance. With customizable alerts and log management, this tool is perfect for both personal use and more advanced system administration needs.