Skip to content

CLI tool to monitor if services and applications are active

Notifications You must be signed in to change notification settings

yen936/cli_service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Server Monitor

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.

Features

  • 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.

Prerequisites

  • 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).

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/server-monitor.git
    cd server-monitor
  2. Build the project:

    cargo build --release
  3. The compiled binary will be located in the target/release directory.

Usage

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>

Arguments

  • --servers (or -s): A list of servers and application names in the format server,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.

Example

To monitor Google DNS servers:

./target/debug/service_monitor --servers 8.8.8.8,Google DNS --interval 55

Default Servers

If no servers are specified, the application will monitor the following default servers:

  • chat.com - ChatGPT Application: will display inactive b/c sign in reqired
  • dns.google - Google DNS Service
  • jsonplaceholder - API example

Output Format

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  |
+-----------------+----------------------+-------------------------+----------------------+

License

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

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any modifications or improvements.

Acknowledgements

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.

About

CLI tool to monitor if services and applications are active

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages