Zabbix AI Troubleshooting System
Automates Zabbix troubleshooting by connecting to its JSON-RPC API and using OpenAI GPT-4 to detect configuration issues and suggest fixes.
What this file does
Automates Zabbix troubleshooting by connecting to its JSON-RPC API and using OpenAI GPT-4 to detect configuration issues and suggest fixes.
When to use it
- You need to diagnose Zabbix configuration problems without manual inspection
- You want a demo or test setup that mocks Zabbix data for development
- You are building an AI-powered monitoring assistant for IT infrastructure
- You require a React + Express template with AI integration and form validation
Assumes this stack
Zabbix AI Troubleshooting System
Overview
An AI-powered web application that automatically analyzes Zabbix monitoring installations to identify configuration issues, setup problems, and best practice violations. The system connects to Zabbix servers via their JSON-RPC API, retrieves system data, and uses OpenAI's GPT-4 to provide intelligent diagnostics with step-by-step fix suggestions.
Core Purpose: Simplify Zabbix troubleshooting by automating the detection of common configuration errors, installation problems, and performance concerns through AI-driven analysis.
User Preferences
Preferred communication style: Simple, everyday language.
System Architecture
Frontend Architecture
Framework: React 18 with TypeScript using Vite as the build tool
UI Framework: shadcn/ui component library built on Radix UI primitives with Tailwind CSS for styling
Design System:
- Dark-first design optimized for IT monitoring workflows
- Custom color palette with semantic meanings (critical/error, warning, success, info, analyzing)
- Typography using Inter for UI and JetBrains Mono for code/logs
- Follows "New York" style variant from shadcn/ui
State Management:
- TanStack Query (React Query) for server state and API interaction
- React hooks for local component state
- Custom query client with automatic error handling and 401 response management
Routing: Wouter for lightweight client-side routing
Key Design Patterns:
- Component composition with Radix UI primitives
- Form handling via react-hook-form with Zod validation
- Toast notifications for user feedback
- Theme provider supporting light/dark modes with localStorage persistence
Backend Architecture
Runtime: Node.js with Express server
Language: TypeScript with ES modules
API Design: RESTful endpoints under /api namespace
/api/zabbix/test- Test Zabbix connection and retrieve system info/api/zabbix/info- Get current Zabbix system information/api/analysis/latest- Retrieve most recent analysis results/api/analysis/start- Trigger new AI-powered analysis/mock-zabbix/api_jsonrpc.php- Mock Zabbix server for testing (no real Zabbix required)
Data Flow:
- Client submits Zabbix credentials via connection form
- Server validates connection through Zabbix JSON-RPC API
- System retrieves hosts, items, triggers, templates, and problems
- AI analyzer processes data through OpenAI GPT-4
- Structured issues returned with severity, categories, and fix suggestions
Storage Strategy:
- In-memory storage implementation (MemStorage class)
- Interface-based design (IStorage) allowing future database integration
- Stores connection credentials and analysis results
- No persistence across server restarts
Key Services:
- ZabbixClient: Handles all Zabbix API communication via JSON-RPC 2.0
- AIAnalyzer: Orchestrates OpenAI API calls for configuration analysis
- Storage: Manages temporary data persistence
Data Schema & Validation
Schema Definition: Centralized in shared/schema.ts using Zod for runtime validation
Core Data Types:
ZabbixConnection: API URL, username, passwordIssue: Severity-categorized problems with AI analysis and suggested fixesAnalysisResult: Complete analysis report with timestamp, status, and issues arrayZabbixSystemInfo: Version, connection status, and resource counts
Validation Strategy: Zod schemas provide both TypeScript types and runtime validation, shared between client and server
AI Integration
Provider: OpenAI GPT-4 (configured via environment variables)
Prompt Engineering:
- System prompt establishes expert Zabbix administrator persona
- Structured to identify: configuration problems, installation issues, best practice violations, performance concerns, template errors
- Enforces JSON response format for consistent parsing
Response Structure: Issues include severity levels, categories, descriptions, affected items, AI analysis explanations, and confidence-scored fix suggestions
Error Handling: Try-catch blocks with fallback error responses when AI analysis fails
External Dependencies
Third-Party Services
OpenAI API:
- Model: GPT-4 (gpt-4o)
- Configuration via environment variables:
AI_INTEGRATIONS_OPENAI_API_KEY,AI_INTEGRATIONS_OPENAI_BASE_URL - Used for intelligent Zabbix configuration analysis
Zabbix JSON-RPC API:
- Version-agnostic integration (tested with Zabbix 6.x+)
- Authentication via user credentials
- Retrieves: API version, hosts, items, triggers, templates, problems
Mock Zabbix Server (for testing without real Zabbix):
- Built-in endpoint:
http://localhost:5000/mock-zabbix/api_jsonrpc.php - Accepts any username/password credentials
- Returns realistic test data including:
- 3 hosts (web-server-01, db-server-01, app-server-01)
- 3 monitoring items (CPU utilization, Memory utilization, MySQL service check)
- 3 triggers (High CPU usage, MySQL down [FIRING], Disk space low)
- 1 active problem (MySQL is down on Database Server 01)
- 2 templates (Template OS Linux, Template DB MySQL)
- Perfect for testing and demo purposes without Zabbix installation
Database
Current: In-memory storage (no database)
Planned: PostgreSQL via Drizzle ORM
- Configuration present in
drizzle.config.ts - Schema defined in
shared/schema.ts(currently for validation only) - NeonDB serverless driver installed (
@neondatabase/serverless) - Migration setup configured but not active
Key NPM Packages
Frontend:
react&react-dom- UI framework@tanstack/react-query- Server state managementreact-hook-form- Form handlingzod- Schema validationwouter- Routing@radix-ui/*- Headless UI primitives (20+ components)tailwindcss- Utility-first CSSclass-variance-authority&clsx- Dynamic className generation
Backend:
express- Web serveropenai- OpenAI API clientdrizzle-orm- SQL ORM (prepared for future use)tsx- TypeScript execution for development
Build Tools:
vite- Frontend build tool and dev serveresbuild- Backend bundling for productiontypescript- Type checking
Development Environment
Replit Integration:
- Custom Vite plugins for dev banner and cartographer (development only)
- Runtime error overlay modal for debugging
- Environment detection via
REPL_IDandNODE_ENV
Font Loading: Google Fonts CDN for Inter and JetBrains Mono typefaces
Session Management: connect-pg-simple installed for future PostgreSQL session storage
What's inside
Architecture overview, 2 frontend/backend sections, 4 API endpoints, 3 data schemas, 1 mock server, and 1 AI prompt structure.
Change this for your project
- Replace
AI_INTEGRATIONS_OPENAI_API_KEYwith your own OpenAI API key - Replace
AI_INTEGRATIONS_OPENAI_BASE_URLwith your OpenAI endpoint if not default - Replace
nimbus7772017/zabbix-ai-troubleshooterwith your own repository name
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Mock Zabbix server endpoint returning realistic test data for development without a real Zabbix instance
- Shared Zod schemas between client and server for consistent validation and TypeScript types
Related Documents
GOOBY - Closing Store Marketplace
Defines a full-stack marketplace app for discovering closing retail stores in NY/NJ/CT/PA, with automated closure scanning and admin review.
Lua Code Obfuscator/Deobfuscator
Provides a full-stack web app for obfuscating and deobfuscating Roblox Lua scripts with a Monaco editor and PostgreSQL storage.
GREEN NODE - Project Overview
Describes a full-stack recycling platform with three runtime modes, provider architecture, and development scripts for Cochabamba, Bolivia.
ADN Systems DMR Peer Server
Documents a forked FreeDMR server for amateur radio DMR voice/data routing with bridges, proxies, scheduled voice announcements, and centralized security.