A microservice developed by Nybsys Inc for managing device fault data. The service supports REST and gRPC interfaces, consumes fault events from RabbitMQ, persists data to MongoDB, and sends SNMP traps.
fms/
├── app/
│ ├── cli-test/ # CLI tools for manual testing/debugging
│ │ └── test.py
│ ├── consumers/
│ │ └── fault_consumer.py # RabbitMQ consumer for fault events
│ ├── data_source/
│ │ └── mongo_service.py # MongoDB connection and access logic
│ ├── models/
│ │ └── model.py # Pydantic/ORM models for fault data
│ ├── repository/
│ │ ├── abstract/
│ │ │ └── abstract_fault.py # Abstract base class for fault repos
│ │ └── fault_repository.py # Implementation of fault data repo
│ ├── routes/
│ │ ├── grpc/
│ │ │ ├── protos/
│ │ │ │ ├── fault_service.proto # Proto file for gRPC service
│ │ │ │ ├── fault_service_pb2.py # Auto-generated (DO NOT EDIT)
│ │ │ │ └── fault_service_pb2_grpc.py# Auto-generated (DO NOT EDIT)
│ │ │ └── grpc_devices.py # gRPC server logic
│ │ └── rest/
│ │ └── fault_router.py # FastAPI REST API endpoints
│ ├── services/
│ │ └── [Coming soon or internal logic]
│ ├── utils/
│ │ └── snmp_sender.py # SNMP trap sender utility
│ ├── docs/ # Documentation files
│
├── tests/
│ └── test_fault_routes.py # Unit tests for REST APIs
│
├── .env # Environment variables
├── main.py # Main entry point
├── requirements.txt # Python dependencies
├── README.md # This file
├── .gitignore
- RabbitMQ Consumer: Listens to
fault_queueand processes real-time device fault messages. - SNMP Trap Sender: Sends alerts to SNMP managers.
- REST API (FastAPI): Exposes fault information and endpoints.
- gRPC Server: Supports high-performance protocol-based communication.
- MongoDB Integration: Persists structured fault data for querying and analytics.
git clone https://github.com/nybsys/fms.git
cd fmspython -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windowspip install -r requirements.txtDEVICE_ALARM_REPORT="./device_backups/alarm_reports/"
GRPC_HOST=localhost:50051
SNMP_TRAP_TARGET=192.168.1.1
SNMP_COMMUNITY=public
# RabbitMQ
RABBITMQ_URL=amqp://guest:guest@localhost:5672/
RABBITMQ_QUEUE=fault_queue
# MongoDB
MONGO_URI=mongodb://localhost:27018/
MONGO_DB_NAME=genieacsif
MONGO_FAULTS_COLLECTION=devicespython main.py- REST API at
http://localhost:8000 - gRPC server at
localhost:50051 - RabbitMQ consumer (background)
- SNMP trap sender (background)
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health check / welcome |
| GET | /faults/... |
Fault data operations |
Swagger UI: http://localhost:8000/docs
- Proto:
app/routes/grpc/protos/fault_service.proto - Server:
grpc_devices.py - Compiled with:
grpcio-tools
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. fault_service.proto- SNMP trap sent via
pysnmp - Target & community configured in
.env - Sent automatically upon critical fault detection
- Database:
genieacsif - Collection:
devices - Fields: Defined in
model.py
pytest tests/Tests are located in tests/, currently covering REST routes.
- Developer: Saad Md Minhaz
- Company: Nybsys Inc
- Copyright: © 2025
This is a private repository. All rights reserved by Nybsys Inc.
- Regenerate gRPC bindings when modifying
*.protofiles. - For production, consider using
uvicornor Docker for deployment.