Installation & Configuration
Follow these steps to get `space-guard` compiled and configured on your system.
You'll need a C++ compiler and the `ncursesw` development library.
# On Debian/Ubuntu
sudo apt-get install build-essential libncursesw5-dev
# On RHEL/CentOS/Fedora
sudo yum groupinstall "Development Tools"
sudo yum install ncurses-devel
Create a text file (e.g., `vps_list.txt`) with the hostnames or IP addresses of the servers to monitor, one per line. Lines starting with `#` are ignored.
# Production Web Servers
192.168.1.10
vps.primary.com
# Staging Environment
vps-staging.internal
Save the source code as `space-guard.cpp` and run the compilation command.
g++ -std=c++11 -pthread space-guard.cpp -lncursesw -o space-guard
Usage Simulator
`space-guard` has two primary modes. Use the toggle below to see how each one is used and what its output looks like.
Interactive Dashboard Mode
This is the default mode, providing a real-time terminal UI. Ideal for hands-on monitoring.
space-guard /path/to/vps_list.txt
Simulated Output:
[ VPS Disk Space Guard v2.0 ]
# Host | Initial | Free Space Now
-------------------------------------------------------------------------
1 vps.primary.com | 7.62 GiB | ✓ 33%
2 vps-staging.internal | 14.65 GiB | ✓ 15%
3 vps.high-usage.com | 94.81 GiB | ✓ 8%
4 vps.critical.com | 1.20 GiB | 1.85 GiB
Technical Reference
Detailed information about interpreting output, exit codes, and troubleshooting common issues.
The color-coding in the "Free Space Now" column gives an at-a-glance view of server health:
- Green (✓ 33-100%): Healthy. No action needed.
- Yellow (✓ 20-32%): Warning. Space is getting low.
- Red (✓ 0-19%): Critical. Low space may impact services.
- GiB Value: Indicates the log file was truncated. The value shown is the new amount of free space.
The program uses standard exit codes for scripting:
- 0: Success. All checks completed, even if truncations occurred.
- 1: Error. A check failed or an invalid argument was provided.
- "Error" in output: Typically means an SSH connection failed. Verify passwordless SSH access, that the host is online, and check firewall rules.
- "ParseErr" in output: The program received data from `df` but couldn't understand it. This may happen on non-standard Linux distributions.
- Permission Denied: Ensure the remote user has permission to run `/bin/df` and write to `/etc/msDNS/multiseeder.log`.