ping-test
is a Python script that monitors the network connection and reports outages by sending emails with outage details. It checks for network outages, logs the start and end times of the outages, and notifies specified recipients via email.
- Monitors network connection and detects outages.
- Logs outage start and end times.
- Sends outage details via email to specified recipients.
Before running the script, ensure you have:
- Python installed on your system.
- Required Python packages installed. You can install them using
pip install -r requirements.txt
. - A valid
.env
file with necessary environment variables.
-
Clone the repository:
git clone https://github.com/your-username/ping-test.git
-
Navigate to the project directory:
cd ping-test
-
Install dependencies:
pip install -r requirements.txt
-
Set up the environment variables in a .env file:
[email protected] EMAIL_PASSWORD=your_email_password SMTP_SERVER=your_smtp_server
-
Update the emails.py file with your recipient lists:
# emails.py to_recipients = ['[email protected]', '[email protected]'] cc_recipients = ['[email protected]', '[email protected]'] bcc_recipients = ['[email protected]', '[email protected]']
-
Run the script:
python ping_test.py
- EMAIL_ADDRESS: Your email address for sending notifications.
- EMAIL_PASSWORD: Your email password or an App Password for secure authentication.
- SMTP_SERVER: Your SMTP server for sending emails.
- You can customize the script further by modifying the
ping_test.py
file. - Adjust the sleep duration in the main function based on how frequently you want to check the network status.
This project is licensed under the MIT License - see the LICENSE file for details.