DevOpsFetch is a bash tool designed for retrieving and monitoring server information. It can display active ports, user logins, Nginx configurations, Docker images, and container statuses. The tool also includes a systemd service for continuous monitoring and logging.
- Display all active ports and services
- Provide detailed information about a specific port
- List all Docker images and containers
- Provide detailed information about a specific Docker container
- Display all Nginx domains and their ports
- Provide detailed configuration information for a specific Nginx domain
- List all users and their last login times
- Provide detailed information about a specific user
- Display activities within a specified time range
- Continuous monitoring and logging with log rotation
Ensure the following packages are installed on your system:
ss
(part ofiproute2
)docker.io
nginx
journalctl
finger
jq
-
Clone the repository:
git clone https://github.com/AugustHottie/devopsfetch-stage5a.git cd devopsfetch
-
Run the installation script to set up dependencies and the systemd service:
sudo ./install.sh
This will install necessary dependencies, set up the devopsfetch command, and
enable the devopsfetch systemd service.
-p, --port
: Display all active ports and services.-p <port_number>
: Display detailed information about a specific port.-d, --docker
: List all Docker images and containers.-d <container_name>
: Display detailed information about a specific Docker container.-n, --nginx
: Display all Nginx domains and their ports.-n <domain>
: Display detailed configuration information for a specific Nginx domain.-u, --users
: List all users and their last login times.-u <username>
: Display detailed information about a specific user.-t, --time <start> <end>
: Display activities within a specified time range.-h, --help
: Display usage instructions.
To display all active ports and services, run:
./devopsfetch.sh -p
To provide detailed information about a specific port, run:
./devopsfetch.sh -p <port_number>
Example:
./devopsfetch.sh -p 80
To list all Docker images and containers, run:
./devopsfetch.sh -d
To provide detailed information about a specific Docker container, run:
./devopsfetch.sh -d <container_name>
Example:
./devopsfetch.sh -d my_container
To display all Nginx domains and their ports, run:
./devopsfetch.sh -n
To provide detailed configuration information for a specific Nginx domain, run:
./devopsfetch.sh -n <domain>
Example:
./devopsfetch.sh -n example.com
To list all users and their last login times, run:
./devopsfetch.sh -u
To provide detailed information about a specific user, run:
./devopsfetch.sh -u <username>
Example:
./devopsfetch.sh -u myuser
To display activities within a specified time range, run:
./devopsfetch.sh -t "<start_time>" "<end_time>"
Example:
./devopsfetch.sh -t "2024-07-21 00:00:00" "2024-07-22 00:00:00"
Logs are stored in the /var/log/devopsfetch.log
directory. Log rotation is implemented to manage log file size. Log rotation is configured to rotate logs daily, keeping up to 7 days of logs.
To display the help message with usage instructions, run:
./devopsfetch.sh -h