Building a devopsfetch tool for Server Information Retrieval and Monitoring

Overview

DevOpsFetch is a tool designed for DevOps professionals to collect and display system information. It retrieves data such as active ports, user logins, Nginx configurations, Docker images, and container statuses. Additionally, it in…


This content originally appeared on DEV Community and was authored by Udoh Deborah

Overview

DevOpsFetch is a tool designed for DevOps professionals to collect and display system information. It retrieves data such as active ports, user logins, Nginx configurations, Docker images, and container statuses. Additionally, it includes a systemd service to continuously monitor and log these activities.

Features

  • Ports: Display all active ports and services or provide detailed information about a specific port.
  • Docker: List all Docker images and containers or provide detailed information about a specific container.
  • Nginx: Display all Nginx domains and their ports or provide detailed configuration information for a specific domain.
  • Users: List all users and their last login times or provide detailed information about a specific user.
  • Time Range: Display activities within a specified time range.

Requirements

  • net-tools
  • docker.io
  • nginx
  • logrotate

Installation

Prerequisites

Ensure your system has the necessary dependencies installed. You can install them using the installation script provided.

Installation Steps

  1. Clone the repository:
   git clone https://github.com/yourusername/devopsfetch.git
   cd devopsfetch
  1. Run the installation script:
   chmod +x setup_devopsfetch.sh
   sudo ./setup_devopsfetch.sh

This script will:

  • Install the required dependencies.
  • Copy the main script to /usr/local/bin.
  • Set up and start the systemd service.
  • Configure log rotation for the service.

Usage

Command-line Flags

  • -p, --port [port_number]: Display active ports. If a port number is provided, detailed information about that port is shown.
  • -d, --docker [container_name]: Display Docker information. If a container name is provided, detailed information about that container is shown.
  • -n, --nginx [domain]: Display Nginx information. If a domain is provided, detailed configuration information for that domain is shown.
  • -u, --users [username]: Display user information. If a username is provided, detailed information about that user is shown.
  • -t, --time [start] [end]: Display activities within the specified time range.
  • -h, --help: Display help information.

Examples

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

Provide detailed information about a specific Docker container

sudo devopsfetch -d container_name

Display all Nginx domains and their ports

sudo devopsfetch -n

Provide detailed configuration information for a specific Nginx domain

sudo devopsfetch -n example.com

List all users and their last login times

sudo devopsfetch -u

Provide detailed information about a specific user

sudo devopsfetch -u username

Display activities within a specified time range

sudo devopsfetch -t "2024-07-01 00:00:00" "2024-07-01 23:59:59"

Logging

DevOpsFetch logs its activities to /var/log/devopsfetch.log. Log rotation is configured to manage log files, rotating them daily and retaining logs for 7 days. To view the logs, you can use the following command:

sudo tail -f /var/log/devopsfetch.log

This document provides a comprehensive overview of the DevOpsFetch project, including its features, installation instructions, usage examples, logging mechanism, and contribution guidelines. Adjust the repository URL and any other specific details as necessary.


This content originally appeared on DEV Community and was authored by Udoh Deborah


Print Share Comment Cite Upload Translate Updates
APA

Udoh Deborah | Sciencx (2024-07-24T19:58:57+00:00) Building a devopsfetch tool for Server Information Retrieval and Monitoring. Retrieved from https://www.scien.cx/2024/07/24/building-a-devopsfetch-tool-for-server-information-retrieval-and-monitoring/

MLA
" » Building a devopsfetch tool for Server Information Retrieval and Monitoring." Udoh Deborah | Sciencx - Wednesday July 24, 2024, https://www.scien.cx/2024/07/24/building-a-devopsfetch-tool-for-server-information-retrieval-and-monitoring/
HARVARD
Udoh Deborah | Sciencx Wednesday July 24, 2024 » Building a devopsfetch tool for Server Information Retrieval and Monitoring., viewed ,<https://www.scien.cx/2024/07/24/building-a-devopsfetch-tool-for-server-information-retrieval-and-monitoring/>
VANCOUVER
Udoh Deborah | Sciencx - » Building a devopsfetch tool for Server Information Retrieval and Monitoring. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/24/building-a-devopsfetch-tool-for-server-information-retrieval-and-monitoring/
CHICAGO
" » Building a devopsfetch tool for Server Information Retrieval and Monitoring." Udoh Deborah | Sciencx - Accessed . https://www.scien.cx/2024/07/24/building-a-devopsfetch-tool-for-server-information-retrieval-and-monitoring/
IEEE
" » Building a devopsfetch tool for Server Information Retrieval and Monitoring." Udoh Deborah | Sciencx [Online]. Available: https://www.scien.cx/2024/07/24/building-a-devopsfetch-tool-for-server-information-retrieval-and-monitoring/. [Accessed: ]
rf:citation
» Building a devopsfetch tool for Server Information Retrieval and Monitoring | Udoh Deborah | Sciencx | https://www.scien.cx/2024/07/24/building-a-devopsfetch-tool-for-server-information-retrieval-and-monitoring/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.