DevOpsFetch is a tool designed with Python exclusively for DevOps professionals to collect and display essential system information. This tool supports retrieving details about active ports, Docker containers, Nginx configurations, user logins, and system activities within a specified time range. Additionally, it offers continuous monitoring and logging capabilities via a systemd service.
To develop a tool that provides:
- Active ports and services
- Docker images and container statuses
- Nginx configurations
- User logins and details
- System activities within a time range
-
Ports:
-por--port: Display all active ports and services.-p <port_number>: Provide detailed information about a specific port.
-
Docker:
-dor--docker: List all Docker images and containers.-d <container_name>: Provide detailed information about a specific container.
-
Nginx:
-nor--nginx: Display all Nginx domains and their ports.-n <domain>: Provide detailed configuration information for a specific domain.
-
Users:
-uor--users: List all users and their last login times.-u <username>: Provide detailed information about a specific user.
-
Time Range:
-tor--time: Display activities within a specified time range in the formatYYYY-MM-DD HH:MM:SS,YYYY-MM-DD HH:MM:SS.
- Outputs are formatted in well-structured tables for clarity, with descriptive column names and text wrapping to ensure readability.
To install and set up DevOpsFetch, follow these steps:
- Clone the Repository:
git clone https://github.com/fortis-07/DevOps_Fetch cd fetchy - Install Dependencies
sudo apt-get install -y python3 python3-pip
pip3 install -r requirements.txt- Install the Script
sudo ./install.shsudo chmod +x /usr/local/bin/devopsfetch- *Set Up Systemd Service
sudo systemctl daemon-reload
sudo systemctl enable devopsfetch.service
sudo systemctl start devopsfetch.serviceDevOpsFetch can be used with various command-line flags:
- Display all active ports:
sudo devopsfetch -p- Display information for a specific port:
sudo devopsfetch -p 80- List all Docker images and containers:
sudo devopsfetch -d- Display information for a specific container:
sudo devopsfetch -d my_container_name- Display all Nginx domains and their ports:
devopsfetch -n#- Display configuration for a specific domain
devopsfetch -n example.com- List all users and their last login times:
sudo devopsfetch -u- Display system activities within a specified time range:
sudo devopsfetch -t "YYYY-MM-DD HH:MM:SS,YYYY-MM-DD HH:MM:SS"- Display usage instructions:
sudo devopsfetch -hDevOpsFetch uses systemd for logging. Logs are stored in the system journal and a dedicated log file.
To view the systemd service logs:
sudo journalctl -u devopsfetch.serviceTo view the dedicated log file:
sudo cat /var/log/devopsfetch.logLogging Logs for continuous monitoring are stored in /var/log/devopsfetch.log. To view the logs, you can use:
sudo cat /var/log/devopsfetch.log