devopsfetch
is a monitoring tool, it retrieves and displays system information such as active ports, Docker containers, Nginx configurations, and user logins. The tool includes continuous monitoring capabilities through a systemd
service that logs activities regularly.
- Ports: Display active ports and services; provide details for specific ports.
- Docker: List Docker images and containers; provide details for specific containers.
- Nginx: Display Nginx domains and ports; provide detailed configuration for specific domains.
- Users: List users and their last login times; provide details for specific users.
- Time Range: Filter and display activities within a specified time range.
- help: Display information about this service
Ensure that the following packages are installed on your system:
jq
docker.io
nginx
logrotate
To install the necessary dependencies, set up the devopsfetch
tool, and create systemd services, run the following installation script:
sudo ./installations.sh
- Dependencies Installation: Updates package lists and installs
jq
,docker.io
,nginx
, andlogrotate
. - Docker and Nginx Services: Enables and starts Docker and Nginx services.
- Tool Setup: Copies
devopsfetch.sh
to/usr/local/bin/
and creates a symbolic link. - Monitoring Script: Creates a script
system_monitor.sh
to rundevopsfetch
periodically and log the output. - Systemd Service for Monitoring: Sets up a
systemd
service to run the monitoring script. - Log Rotation: Configures log rotation for the monitoring logs.
- Systemd Service for devopsfetch: Sets up a
systemd
service to ensuredevopsfetch
runs continuously.
-p, --port [PORT_NUMBER]
: Display all active ports and services or details for a specific port.-d, --docker [CONTAINER_NAME]
: List Docker images and containers or details for a specific container.-n, --nginx [DOMAIN]
: Display Nginx domains and their ports or details for a specific domain.-u, --users [USERNAME]
: List users and their last login times or details for a specific user.-t, --time [TIME_RANGE]
: Display activities within a specified time range (format:start_date,end_date
).-h, --help
: Show help message and usage instructions.
-
List all active ports:
devopsfetch -p
-
List specific details for a port:
devopsfetch -p 80
-
List Docker images and containers
devopsfetch -d
-
Get details for a specific Docker container:
devopsfetch -d <container_name>
-
Display Nginx domains:
devopsfetch -n
-
Display Nginx details for a specific domain
devopsfetch -n localhost
-
List users and their last login times
devopsfetch -u
-
Get user details:
devopsfetch -u <username>
-
Filter activities within a time range:
devopsfetch -t "2024-07-01,2024-07-23"
-
Show help message and usage instructions.
devopsfetch -h
- Continuous Monitoring: The
system-monitor.service
ensures that thesystem_monitor.sh
script runs every 12 hours to monitor and log system activities. - Log Files: Logs are saved to
/var/log/system_monitor.log
.
Log rotation is managed by logrotate
to compress and rotate log files. The configuration files are located in /etc/logrotate.d/
.