https://github.com/webdevtodayjason/ping_monitor
https://github.com/webdevtodayjason/ping_monitor
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/webdevtodayjason/ping_monitor
- Owner: webdevtodayjason
- Created: 2025-01-16T18:45:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-16T19:51:42.000Z (over 1 year ago)
- Last Synced: 2025-10-06T01:30:32.933Z (8 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IP Ping Monitor
This Python script monitors the reachability of multiple IP addresses, logs the results to a file, and provides alerts in the CLI when an IP becomes unreachable.
## Features
- Pings multiple IP addresses specified in `targets.csv`.
- Logs ping results and timestamps to `ping_log.txt`.
- Alerts in the CLI when an IP address becomes unreachable.
- Runs continuously in a detached `screen` session for background monitoring.
## Requirements
- Python 3.x
- `screen` utility (for running the script in detached mode)
## Installation
1. Clone the repository:
```bash
git clone https://github.com/webdevtodayjason/ping_monitor.git
cd ping_monitor
```
2. No external dependencies beyond Python standard library are required.
## Configuration
1. targets.csv: Edit this file to specify the IP addresses, target names, and ping intervals.
Example format:
```bash
IP,TARGET_NAME,PING_INTERVAL
8.8.8.8,Google,5
1.1.1.1,CloudFlair,10
```
## Usage
1. Start a screen session to run the monitor script in the background:
```bash
screen -S ping_monitor -dm python ip_ping_monitor.py
```
This command starts a detached screen session named ping_monitor and runs the monitor.py script, which continuously monitors the IP addresses specified in targets.csv.
2. To view the ping_monitor screen session:
```bash
screen -x ping_monitor
```
Press Ctrl+A followed by Ctrl+D to detach from the screen session without terminating it.
3. To stop the monitor script, reattach to the ping_monitor screen session and press Ctrl+C to interrupt the script execution. Then, you can exit the screen session.
## Logging
The script logs all ping results and timestamps to ping_log.txt in the following format:
```ruby
YYYY-MM-DD HH:MM:SS - is reachable.
YYYY-MM-DD HH:MM:SS - is not reachable! Alert!
```
Replace with the actual IP address or target name being monitored.
## Contributing
Feel free to fork the repository, submit issues, and contribute enhancements. Pull requests are welcome!
## License
This project is licensed under the MIT License - see the LICENSE file for details.