Monitor Cherokee web server performance with Grafana and Prometheus metrics collection

Intermediate 45 min May 03, 2026 65 views
Ubuntu 24.04 Debian 12 AlmaLinux 9 Rocky Linux 9

Set up comprehensive Cherokee web server monitoring with Prometheus metrics collection and Grafana dashboards. Configure alerting rules, performance thresholds, and real-time visualization for production Cherokee deployments.

Prerequisites

  • Root or sudo access
  • Cherokee web server installed
  • Basic familiarity with web server configuration

What this solves

Cherokee web server performance monitoring becomes critical in production environments where response times, resource usage, and error rates directly impact user experience. This tutorial sets up comprehensive monitoring using Prometheus to collect Cherokee metrics and Grafana to visualize performance data with customizable dashboards and alerting rules.

Step-by-step installation

Update system packages

Start by updating your package manager to ensure you get the latest versions of all components.

sudo apt update && sudo apt upgrade -y
sudo dnf update -y

Install Cherokee web server

Install Cherokee with performance monitoring modules enabled for metrics collection.

sudo apt install -y cherokee libcherokee-mod-admin libcherokee-mod-streaming
sudo dnf install -y cherokee cherokee-admin
sudo dnf install -y epel-release
sudo dnf install -y cherokee-devel

Configure Cherokee with performance modules

Enable Cherokee's built-in status module and configure it to expose metrics for Prometheus collection.

sudo cherokee-admin -b &

Access the Cherokee admin interface at http://your-server-ip:9090 and configure the status module.

Create Cherokee status configuration

Configure Cherokee to expose server status and metrics through a dedicated endpoint.

vserver!2!nick = status
vserver!2!document_root = /var/www/status
vserver!2!rule!1!match = directory
vserver!2!rule!1!match!directory = /server-status
vserver!2!rule!1!handler = server_info
vserver!2!rule!1!handler!server_info!just_about = 0
vserver!2!bind!1!port = 8080

Install Prometheus

Download and install Prometheus server for metrics collection and storage.

cd /opt
sudo wget https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz
sudo tar xzf prometheus-2.45.0.linux-amd64.tar.gz
sudo mv prometheus-2.45.0.linux-amd64 prometheus
sudo chown -R prometheus:prometheus /opt/prometheus

Create Prometheus user and directories

Set up dedicated user and directory structure for Prometheus with proper permissions.

sudo useradd --no-create-home --shell /bin/false prometheus
sudo mkdir -p /etc/prometheus /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus /var/lib/prometheus

Install Cherokee Prometheus exporter

Create a custom exporter to translate Cherokee status information into Prometheus metrics format.

cd /opt
sudo wget https://github.com/prometheus/node_exporter/releases/download/v1.6.0/node_exporter-1.6.0.linux-amd64.tar.gz
sudo tar xzf node_exporter-1.6.0.linux-amd64.tar.gz
sudo mv node_exporter-1.6.0.linux-amd64/node_exporter /usr/local/bin/
sudo chown prometheus:prometheus /usr/local/bin/node_exporter

Create Cherokee metrics exporter script

Build a custom Python script to parse Cherokee status and export metrics in Prometheus format.

#!/usr/bin/env python3
import time
import requests
from http.server import HTTPServer, BaseHTTPRequestHandler
import urllib.parse

class MetricsHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        if self.path == '/metrics':
            try:
                response = requests.get('http://localhost:8080/server-status')
                metrics = self.parse_cherokee_status(response.text)
                
                self.send_response(200)
                self.send_header('Content-type', 'text/plain')
                self.end_headers()
                self.wfile.write(metrics.encode())
            except Exception as e:
                self.send_error(500, str(e))
        else:
            self.send_error(404)
    
    def parse_cherokee_status(self, status_text):
        metrics = []
        lines = status_text.split('\n')
        
        for line in lines:
            if 'Requests per second' in line:
                rps = float(line.split(':')[1].strip())
                metrics.append(f'cherokee_requests_per_second {rps}')
            elif 'Total accesses' in line:
                total = int(line.split(':')[1].strip())
                metrics.append(f'cherokee_total_requests {total}')
            elif 'Total traffic' in line:
                traffic = line.split(':')[1].strip().split()[0]
                metrics.append(f'cherokee_total_bytes {traffic}')
        
        return '\n'.join(metrics) + '\n'

if __name__ == '__main__':
    server = HTTPServer(('localhost', 9101), MetricsHandler)
    server.serve_forever()

Make exporter script executable and create service

Set proper permissions and create systemd service for the Cherokee metrics exporter.

sudo chmod +x /opt/cherokee_exporter.py
sudo chown prometheus:prometheus /opt/cherokee_exporter.py
[Unit]
Description=Cherokee Prometheus Exporter
After=network.target cherokee.service

[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/usr/bin/python3 /opt/cherokee_exporter.py
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Configure Prometheus

Set up Prometheus configuration to scrape metrics from Cherokee exporter and node exporter.

global:
  scrape_interval: 15s
  evaluation_interval: 15s

rule_files:
  - "cherokee_rules.yml"

alerting:
  alertmanagers:
    - static_configs:
        - targets:
          - localhost:9093

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'cherokee'
    static_configs:
      - targets: ['localhost:9101']
    scrape_interval: 5s
    metrics_path: /metrics

  - job_name: 'node'
    static_configs:
      - targets: ['localhost:9100']

Create Cherokee alerting rules

Define Prometheus alerting rules for Cherokee performance thresholds and error conditions.

groups:
  - name: cherokee_alerts
    rules:
      - alert: CherokeeHighResponseTime
        expr: cherokee_response_time_seconds > 2
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: "Cherokee response time is high"
          description: "Cherokee average response time is {{ $value }} seconds"

      - alert: CherokeeHighRequestRate
        expr: cherokee_requests_per_second > 1000
        for: 1m
        labels:
          severity: warning
        annotations:
          summary: "Cherokee request rate is very high"
          description: "Cherokee is handling {{ $value }} requests per second"

      - alert: CherokeeDown
        expr: up{job="cherokee"} == 0
        for: 30s
        labels:
          severity: critical
        annotations:
          summary: "Cherokee server is down"
          description: "Cherokee metrics exporter is not responding"

Create Prometheus systemd service

Configure Prometheus to run as a system service with automatic startup.

[Unit]
Description=Prometheus
After=network.target

[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/opt/prometheus/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/var/lib/prometheus/ \
  --web.console.templates=/opt/prometheus/consoles \
  --web.console.libraries=/opt/prometheus/console_libraries \
  --web.listen-address=0.0.0.0:9090 \
  --web.enable-lifecycle
Restart=always

[Install]
WantedBy=multi-user.target

Install and configure Grafana

Install Grafana for visualizing Cherokee performance metrics with dashboards.

wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt update
sudo apt install -y grafana
sudo rpm --import https://packages.grafana.com/gpg.key
echo '[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key' | sudo tee /etc/yum.repos.d/grafana.repo
sudo dnf install -y grafana

Configure Grafana data source

Set up Prometheus as a data source in Grafana for Cherokee metrics visualization.

apiVersion: 1

datasources:
  - name: Prometheus
    type: prometheus
    access: proxy
    url: http://localhost:9090
    isDefault: true
    editable: true

Create Cherokee dashboard configuration

Configure a comprehensive Grafana dashboard for Cherokee web server monitoring.

{
  "dashboard": {
    "id": null,
    "title": "Cherokee Web Server Monitoring",
    "tags": ["cherokee", "web server"],
    "timezone": "browser",
    "panels": [
      {
        "id": 1,
        "title": "Requests Per Second",
        "type": "stat",
        "targets": [
          {
            "expr": "cherokee_requests_per_second",
            "refId": "A"
          }
        ],
        "fieldConfig": {
          "defaults": {
            "color": {
              "mode": "palette-classic"
            },
            "custom": {
              "displayMode": "list",
              "orientation": "horizontal"
            }
          }
        },
        "gridPos": {
          "h": 8,
          "w": 12,
          "x": 0,
          "y": 0
        }
      },
      {
        "id": 2,
        "title": "Total Requests",
        "type": "graph",
        "targets": [
          {
            "expr": "rate(cherokee_total_requests[5m])",
            "refId": "A"
          }
        ],
        "gridPos": {
          "h": 8,
          "w": 12,
          "x": 12,
          "y": 0
        }
      }
    ],
    "time": {
      "from": "now-1h",
      "to": "now"
    },
    "refresh": "5s"
  }
}

Start and enable all services

Enable and start Cherokee, Prometheus, Grafana, and the custom exporter services.

sudo systemctl daemon-reload
sudo systemctl enable --now cherokee
sudo systemctl enable --now cherokee-exporter
sudo systemctl enable --now node_exporter
sudo systemctl enable --now prometheus
sudo systemctl enable --now grafana-server

Configure firewall rules

Open necessary ports for Cherokee, Prometheus, and Grafana web interfaces.

sudo ufw allow 80/tcp
sudo ufw allow 8080/tcp
sudo ufw allow 9090/tcp
sudo ufw allow 3000/tcp
sudo ufw --force enable
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --permanent --add-port=9090/tcp
sudo firewall-cmd --permanent --add-port=3000/tcp
sudo firewall-cmd --reload

Verify your setup

Check that all components are running and collecting metrics properly.

sudo systemctl status cherokee
sudo systemctl status cherokee-exporter
sudo systemctl status prometheus
sudo systemctl status grafana-server

Test Cherokee status endpoint and metrics collection:

curl http://localhost:8080/server-status
curl http://localhost:9101/metrics
curl http://localhost:9090/api/v1/targets

Access Grafana dashboard at http://your-server-ip:3000 (admin/admin) and verify Cherokee metrics are displayed.

Configure alerting and thresholds

Install Alertmanager

Set up Prometheus Alertmanager for handling Cherokee performance alerts.

cd /opt
sudo wget https://github.com/prometheus/alertmanager/releases/download/v0.25.0/alertmanager-0.25.0.linux-amd64.tar.gz
sudo tar xzf alertmanager-0.25.0.linux-amd64.tar.gz
sudo mv alertmanager-0.25.0.linux-amd64 alertmanager
sudo chown -R prometheus:prometheus /opt/alertmanager

Configure Alertmanager

Set up email notifications and alert routing for Cherokee performance issues.

global:
  smtp_smarthost: 'localhost:587'
  smtp_from: 'alerts@example.com'

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h
  receiver: 'web.hook'

receivers:
  - name: 'web.hook'
    email_configs:
      - to: 'admin@example.com'
        subject: 'Cherokee Alert: {{ .GroupLabels.alertname }}'
        body: |
          {{ range .Alerts }}
          Alert: {{ .Annotations.summary }}
          Description: {{ .Annotations.description }}
          {{ end }}

Create Alertmanager systemd service

Configure Alertmanager to run as a system service with automatic startup.

[Unit]
Description=Alertmanager
After=network.target

[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/opt/alertmanager/alertmanager --config.file=/etc/alertmanager/alertmanager.yml --storage.path=/var/lib/alertmanager
Restart=always

[Install]
WantedBy=multi-user.target

Enable Alertmanager

Start Alertmanager and verify it connects to Prometheus for alert handling.

sudo mkdir -p /var/lib/alertmanager /etc/alertmanager
sudo chown prometheus:prometheus /var/lib/alertmanager /etc/alertmanager
sudo systemctl daemon-reload
sudo systemctl enable --now alertmanager
sudo systemctl status alertmanager

Common issues

SymptomCauseFix
Cherokee exporter not respondingCherokee status module not enabledEnable server_info handler in Cherokee admin panel
Prometheus shows Cherokee target as downFirewall blocking port 9101Open port with sudo ufw allow 9101/tcp
Grafana dashboard shows no dataPrometheus data source misconfiguredVerify Prometheus URL in Grafana data source settings
Alerts not firingAlertmanager not connected to PrometheusCheck Prometheus alerting configuration and Alertmanager status
Cherokee admin panel inaccessibleCherokee admin service not startedsudo systemctl status cherokee-admin and restart if needed

Next steps

Running this in production?

Want this handled for you? Setting up monitoring once is straightforward. Keeping dashboards updated, tuning alert thresholds, and responding to incidents across environments is the harder part. See how we run infrastructure like this for European SaaS and e-commerce teams.

Automated install script

Run this to automate the entire setup

Need help?

Don't want to manage this yourself?

We handle managed devops services for businesses that depend on uptime. From initial setup to ongoing operations.