An AI-powered SNMP query system that translates natural language queries into SNMP commands.
SNMP-AI is a Python-based application that utilizes OpenAI's API to facilitate natural language queries for SNMP (Simple Network Management Protocol) data. The application acts as an intermediary, translating human-readable queries into structured JSON requests suitable for a high-performance SNMP scanner.
- Natural language interface for SNMP queries
- Integration with OpenAI's API for query processing
- Support for SNMP v1, v2c protocols
- MIB processing and OID mapping
- Structured JSON output for responses
- Query caching for improved performance
- RESTful API for integration with other systems
- CLI for command-line usage
- Clone the repository:
git clone https://github.com/yourusername/snmp-ai.git
cd snmp-ai- Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Create a
.envfile based on the provided example:
cp .env.example .env- Edit the
.envfile and add your OpenAI API key:
OPENAI_API_KEY=your-api-key-here
OPENAI_MODEL=gpt-4 # Or another available model
python main.py api --host 0.0.0.0 --port 8000Or directly with uvicorn:
uvicorn app.api.main:app --host 0.0.0.0 --port 8000Process a query:
python main.py cli query "Get the system description from the device at 192.168.1.1"List loaded MIBs:
python main.py cli mibs listAdd a MIB file:
python main.py cli mibs add /path/to/mib/fileResolve an OID:
python main.py cli oid resolve sysDescrTranslate an OID:
python main.py cli oid translate 1.3.6.1.2.1.1.1.0The SNMP Explorer provides a comprehensive analysis of SNMP devices:
python snmp_explorer.py 192.168.1.1 --community public --mode standardAvailable modes:
standard: Basic device analysisexecutive: Executive-friendly summarydiscover: Detailed device discovery
Save the analysis to a file:
python snmp_explorer.py 192.168.1.1 -o device-report.jsonGET /: Health check and API informationPOST /query: Process a natural language SNMP queryGET /mibs: List loaded MIBsPOST /mibs/upload: Upload a new MIB filePOST /oid/resolve: Resolve an OID name to a numeric OIDPOST /oid/translate: Translate a numeric OID to a symbolic namePOST /clear-cache: Clear the application cacheGET /cache/stats: Get cache statistics
- "What is the system description of the device at 192.168.1.1?"
- "Walk the interfaces table on 10.0.0.1 using community string 'public'"
- "Get the uptime of 172.16.1.10 using SNMP version 2c"
- "Check the CPU usage on the switch at 192.168.10.5"
- "List all interfaces and their status on 10.0.1.1"
Build and run the Docker container:
docker-compose up -dMIT License