The project structure is organized as follows:
ncclient_3/
: Rust application source code.dockerfile
: Dockerfile for building the Rust application.src/
: Source directory containing Rust code.main.rs
: Main entry point of the Actix Web application.models.rs
: Definitions of data models.opt_utils.rs
: Utilities for handling Prometheus metrics.routes/
: Module containing route handlers.utils/
: Utility functions.
prometheus.yaml
: Prometheus configuration file.docker-compose.yml
: Docker Compose configuration file.
-
Build and Run the Application:
docker-compose up --build
main.rs
The main entry point of the Actix Web application. Initializes HTTP server, registers routes, and configures Prometheus metrics.
Metrics for the application are collected using Prometheus, with configuration defined in prometheus.yaml.
The docker-compose.yml file defines services for Rust application, Prometheus, and Grafana. It sets up networking between containers and volumes for data persistence.
- GET
/get_json/{host}
: Retrieves JSON data from a network device specified by {host}. - POST
/add_host
: Adds a new host with parameters (host, port, user, password) to the application.