Skip to main content

Monitoring

Setting up comprehensive monitoring for WuKongIM ensures optimal performance and early detection of issues.

Prerequisites

Install Prometheus for metrics collection and monitoring.

Install Prometheus

Configure Prometheus

Add WuKongIM monitoring targets under the scrape_configs section in your Prometheus configuration.

Single Node Configuration

For single node deployment, create /etc/prometheus/prometheus.yml:

Multi-Node Configuration

For multi-node cluster deployment:
Configuration Parameters:
  • job_name: Unique job name for each WuKongIM node
  • targets: WuKongIM internal IP + port 5300
  • labels.id: WuKongIM node ID
  • labels.instance: Human-readable instance name
Replace xx.xx.xx.xx with the actual internal IP address of your WuKongIM nodes.

Configure WuKongIM

Add Prometheus configuration to each node’s wk.yaml file:
Replace xx.xx.xx.xx with the internal IP address of your Prometheus server.

Complete WuKongIM Configuration Example

Start Services

Start Prometheus

Create a systemd service file for Prometheus:
Add the following content:
Enable and start Prometheus:

Restart WuKongIM

After updating the configuration, restart WuKongIM on all nodes:

Verification

Check Prometheus Targets

  1. Access Prometheus web interface: http://prometheus-server-ip:9090
  2. Go to StatusTargets
  3. Verify all WuKongIM targets are UP

Check Metrics

Query WuKongIM metrics in Prometheus:

Key Metrics to Monitor

System Metrics

Cluster Metrics (Multi-node)

Performance Metrics

Alerting Rules

Create alerting rules in /etc/prometheus/alert_rules.yml:
Update Prometheus configuration to include alert rules:

Grafana Dashboard

Install Grafana

Configure Data Source

  1. Access Grafana: http://grafana-server-ip:3000 (admin/admin)
  2. Add Prometheus data source: http://prometheus-server-ip:9090
  3. Import WuKongIM dashboard or create custom dashboards

Sample Dashboard Queries

Connection Count:
Message Rate:
Memory Usage:
CPU Usage:

Troubleshooting

Prometheus Not Collecting Metrics

WuKongIM Not Sending Metrics

Next Steps

Performance Tuning

Optimize WuKongIM performance based on monitoring data

Backup Strategy

Set up automated backup and recovery

Load Testing

Test system performance under load

Cluster Management

Learn about cluster scaling and management