Skip to content
proarsPublic

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

InetMonit: Automated Internet Connection Monitor for Linux Systems

License: MIT

A robust, lightweight Linux shell script that automatically monitors Internet connectivity and manages system reboots for unattended servers. Perfect for headless Raspberry Pi, remote servers, and IoT devices.

🌟 Key Features

  • 🔍 Intelligent Network Monitoring

    • Real-time ICMP ping checks to verify internet connectivity
    • Configurable target hosts (default: Google DNS 8.8.8.8)
    • Smart failure detection with customizable retry attempts
  • 🔄 Automated Recovery System

    • Self-healing through automatic system reboots
    • Configurable failure thresholds
    • Zero human intervention required
  • 📊 Comprehensive Logging

    • Detailed timestamp-based logging
    • Easy-to-analyze log format
    • Built-in log rotation support

� Quick Start Guide

Installation

# Clone the repository
git clone https://github.com/proars/inetmonit.git

# Make the script executable
chmod +x inetmonit.sh

# Move to system directory (optional)
sudo mv inetmonit.sh /usr/local/bin/

Configuration

  1. Customize Settings (Optional)

    # Open the script in your favorite editor
    nano inetmonit.sh

    Adjust these variables according to your needs:

    TARGET="8.8.8.8"     # Target host for ping tests
    RETRIES=3           # Number of failed attempts before reboot
    LOGFILE="/var/log/inetmonit.log"  # Log file location
  2. Schedule Monitoring

    # Open crontab editor
    crontab -e

    Add one of these lines:

    # Check every 5 minutes
    */5 * * * * /usr/local/bin/inetmonit.sh
    
    # OR check every 30 minutes
    */30 * * * * /usr/local/bin/inetmonit.sh
  3. Set Up Log Rotation Create a new logrotate configuration:


🧪 Usage Guide

Manual Testing

# Run the script manually
sudo /usr/local/bin/inetmonit.sh

# Monitor the logs
tail -f /var/log/inetmonit.log

# Check last 20 log entries
tail -n 20 /var/log/inetmonit.log

💻 System Requirements

  • Operating System: Linux (Compatible with Debian, Ubuntu, Raspberry Pi OS, and most POSIX systems)
  • Required Tools:
    • ping utility (pre-installed on most systems)
    • cron service
    • logrotate (recommended for log management)
  • Permissions: Root access for system reboot functionality

� Contributing

We welcome contributions to make InetMonit even better! Here's how you can help:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

� License

This project is licensed under the MIT License - see the LICENSE file for details.

⭐ Support the Project

If you find InetMonit useful, please consider:

  • Giving it a star on GitHub
  • Sharing it with others who might benefit
  • Contributing to its improvement

Star History Chart

📞 Contact & Support

  • Create an issue for bug reports or feature requests
  • Star the repository to show your support
  • Fork the project to contribute improvements

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages