Automated Server Disk Cleanup via Email Alerts
detail.loadingPreview
Proactively manage server disk space by automating log purging triggered by disk usage alert emails. This workflow identifies servers with high disk utilization and executes targeted cleanup commands to free up valuable storage.
About This Workflow
This n8n workflow provides an automated solution for managing server disk space. It intelligently monitors incoming emails for disk usage alerts, extracts the relevant server IP address from the email subject, and then securely connects via SSH to execute a series of powerful cleanup commands. These commands target common culprits for disk bloat, including compressed log files, Nginx and Apache logs, journald logs, Docker build cache, and system package caches. By automating this process, you can prevent system slowdowns and potential outages caused by full disks, ensuring optimal server performance and reliability.
Key Features
- Email-Triggered Automation: Initiates cleanup actions based on specific disk alert emails.
- Intelligent Server Identification: Extracts server IP addresses directly from email subjects.
- Comprehensive Log & Cache Purging: Cleans up various log files, Docker artifacts, and system package caches.
- Secure SSH Execution: Leverages secure SSH connections for remote command execution.
- Configurable Credentials: Easily integrate with your existing IMAP and SSH credentials.
How To Use
- Configure IMAP Credentials: Set up your IMAP connection in n8n to read incoming emails.
- Set Email Filters: In the 'Check Disk Alert Emails' node, specify the IMAP search criteria (e.g., UNSEEN emails with 'disk' in the subject).
- Customize IP Extraction: Adjust the JavaScript code in the 'Extract Server IP from Email' node if your alert emails have a different format for including the server IP.
- Secure SSH Credentials: Configure your SSH credentials (e.g., using a username and password or an SSH key) in the 'Jenkins Server SSH' credential.
- Define SSH Variables: In the 'Prepare SSH Variables' node, ensure 'server_user' and 'pwd' are correctly set to match your server's SSH login details.
- Tailor Cleanup Commands: Modify the 'command' parameter in the 'Run Log Cleanup Commands via SSH' node to include or exclude specific cleanup commands relevant to your server environment.
- Activate Workflow: Enable the workflow to start automated disk cleanup.
Apps Used
Workflow JSON
{
"id": "42fc6db9-c91c-41cb-abbe-bbb579e68e81",
"name": "Automated Server Disk Cleanup via Email Alerts",
"nodes": 19,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 42fc6db9-c91c...
About the Author
Free n8n Workflows Official
System Admin
The official repository for verified enterprise-grade workflows.
Statistics
Related Workflows
Discover more workflows you might like
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.
Automate Qualys Report Generation and Retrieval
Streamline your Qualys security reporting by automating the generation and retrieval of reports. This workflow ensures timely access to crucial security data without manual intervention.
Visualize Your n8n Workflows: Interactive Dashboard with Mermaid.js
Gain unparalleled visibility into your n8n automation landscape. This workflow transforms your n8n instance into a dynamic, interactive dashboard, leveraging Mermaid.js to visualize all your workflows in one accessible place.