Server Monitor is a lightweight command-line application written in Rust that allows you to monitor the uptime of various servers and applications. It periodically pings the specified servers and displays their status in an easy-to-read table format.
- Monitors the availability of multiple servers and applications.
- Displays the current status of each server along with the last checked timestamp.
- Supports custom intervals for checking server status.
- Color-coded status indicators for active (green) and inactive (red) servers.
- Rust programming language installed on your machine. You can install it from rust-lang.org.
- Access to the
ping
command on your operating system (available on most systems).
-
Clone this repository:
git clone https://github.com/yourusername/server-monitor.git cd server-monitor
-
Build the project:
cargo build --release
-
The compiled binary will be located in the
target/release
directory.
You can run the server-monitor
application by executing the compiled binary with the desired arguments. The basic syntax is:
./target/debug/service_monitor --servers server1,app1 server2,app2 --interval <seconds>
-
--servers
(or-s
): A list of servers and application names in the formatserver,app
. You can specify multiple pairs. If this argument is omitted, default servers will be monitored. -
--interval
(or-i
): Sets the interval in seconds for refreshing the status. The default value is 180 seconds.
To monitor Google DNS servers:
./target/debug/service_monitor --servers 8.8.8.8,Google DNS --interval 55
If no servers are specified, the application will monitor the following default servers:
chat.com
- ChatGPT Application: will display inactive b/c sign in reqireddns.google
- Google DNS Servicejsonplaceholder
- API example
The application displays the server statuses in a table format:
+-----------------+----------------------+-------------------------+----------------------+
| Server | App | Result | Last Checked |
+-----------------+----------------------+-------------------------+----------------------+
| chat.com | Chat Application | Inactive ● | 2024-11-30 16:43:17 |
| 192.4.5.11 | Example App | Unknown ● | 2024-11-30 16:43:22 |
| jsonplacehol... | REST Api Example | Active ● | 2024-11-30 16:43:23 |
| dns.google | Google DNS Service | Active ● | 2024-11-30 16:43:23 |
+-----------------+----------------------+-------------------------+----------------------+
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any modifications or improvements.
This project makes use of the following crates:
clap
: for argument parsing.colored
: for colored output in the terminal.chrono
: for date and time handling.regex
: for regular expression operations.