A Prometheus exporter for OpenWebUI that provides detailed metrics about users, chats, documents, models, and system status.
- Comprehensive metrics collection from OpenWebUI's PostgreSQL database
- Connection pooling for efficient database access
- Time-windowed queries to prevent database overload
- Flexible time window specification (seconds, minutes, hours, days)
- Modular collector design for easy maintenance and extensions
- Detailed monitoring of:
- User activity and authentication
- Chat conversations and folders
- Documents and knowledge bases
- AI models and tools
- System configuration and health
- Create a docker-compose.yml file:
services:
exporter:
image: nicholascecere/exporter-openwebui:latest
ports:
- "9091:9090"
environment:
- OPENWEBUI_DB_PASSWORD=your_password_here
- OPENWEBUI_DB_HOST=your_db_host- Start the exporter:
docker-compose up -d- Create or download the k8s/deployment.yaml file and configure your database connection:
# In ConfigMap section
data:
OPENWEBUI_DB_HOST: "your_db_host"
# In Secret section
stringData:
OPENWEBUI_DB_PASSWORD: "your_password_here"- Apply the Kubernetes manifests:
kubectl apply -f k8s/deployment.yamlThe exporter will start on port 9090. Metrics will be available at:
http://localhost:9090/metrics # Docker Compose
http://openwebui-exporter:9090/metrics # Kubernetes
All configuration is done through environment variables. For a complete list of available environment variables, their descriptions, defaults, and examples, see ENV-VARS.md.
Key configuration features:
- Time windows for limiting SQL query ranges
- Database connection pooling
- Configurable metric update intervals
openwebui_users_total: Total number of registered usersopenwebui_users_active: Number of active users (within 24 hours)openwebui_active_users: Number of users active in the last 30 minutesopenwebui_users_by_role: Number of users by roleopenwebui_user_last_active_seconds: Timestamp of last user activity
openwebui_chats_total{model_name="..."}: Total number of chats by modelopenwebui_chats_active{model_name="..."}: Number of non-archived chats by modelopenwebui_chats_archived{model_name="..."}: Number of archived chats by modelopenwebui_chats_pinned{model_name="..."}: Number of pinned chats by modelopenwebui_chats_by_user{model_name="..."}: Number of chats per user by modelopenwebui_chats_shared: Number of shared chatsopenwebui_messages_by_model{model_name="..."}: Number of messages by modelopenwebui_messages_total: Total number of messages across all chatsopenwebui_chat_age_seconds: Age distribution of chats
openwebui_documents_total: Total number of documentsopenwebui_files_total: Total number of filesopenwebui_files_by_user: Number of files per useropenwebui_knowledge_bases_total: Total number of knowledge basesopenwebui_prompts_total: Total number of prompts
openwebui_models_total: Total number of base models (where base_model_id IS NULL)openwebui_assistants_total: Total number of assistants (where base_model_id IS NOT NULL)openwebui_models_active: Number of active modelsopenwebui_model_unique_users: Number of unique users that have used a modelopenwebui_tools_total: Total number of toolsopenwebui_tools_by_user: Number of tools per useropenwebui_functions_total: Total number of functionsopenwebui_functions_active: Number of active functionsopenwebui_functions_global: Number of global functions
openwebui_config_version: Current configuration versionopenwebui_config_last_update: Timestamp of last configuration updateopenwebui_groups_total: Total number of groupsopenwebui_users_in_groups: Number of users in groupsopenwebui_feedback_total: Total number of feedback entries
Add the following to your prometheus.yml:
scrape_configs:
- job_name: 'openwebui'
scrape_interval: 15s
static_configs:
- targets: ['localhost:9090'] # Docker Compose
# Or for Kubernetes:
# - targets: ['openwebui-exporter:9090']The exporter is organized into modular collectors:
user_metrics.py: User and authentication metricschat_metrics.py: Chat and conversation metricsdocument_metrics.py: Document and file metricsmodel_metrics.py: AI model and tool metricssystem_metrics.py: System configuration metrics
Each collector can be extended or modified independently to add new metrics or modify existing ones.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License