Skip to main content
APA
Sponsored byCAST AI — Kubernetes cost optimizationBetter Stack — Uptime monitoring and log managementVictoriaMetrics — Fast, open-source time series database and drop-in Prometheus replacement.

Memcached logoMemcached Prometheus Alert Rules

10 Prometheus alerting rules for Memcached.Exported via prometheus/memcached_exporter.These rules cover critical and warning conditions — copy and paste the YAML into your Prometheus configuration.

⚠️

Alert thresholds depend on the nature of your applications. Some queries may have arbitrary tolerance thresholds. Building an efficient monitoring platform takes time. 😉

wget https://raw.githubusercontent.com/samber/awesome-prometheus-alerts/refs/heads/master/dist/rules/memcached/memcached-exporter.yml
critical

2.9.1.Memcached down

Memcached instance is down on {{ $labels.instance }}

  # 1m delay allows a restart without triggering an alert.
- alert: MemcachedDown
  expr: 'memcached_up == 0'
  for: 1m
  labels:
    severity: critical
  annotations:
    summary: Memcached down (instance {{ $labels.instance }})
    description: "Memcached instance is down on {{ $labels.instance }}\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

2.9.2.Memcached flapping

Memcached on {{ $labels.instance }} changed state {{ $value | printf "%.0f" }} times in the last 10 minutes.

  # Catches a crash-looping service, which the down rule misses because each successful scrape resets its for: timer.
  # 4 changes means at least 2 down/up cycles in 10m; one outage followed by a recovery counts only 2.
- alert: MemcachedFlapping
  expr: 'changes(memcached_up[10m]) >= 4'
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Memcached flapping (instance {{ $labels.instance }})
    description: "Memcached on {{ $labels.instance }} changed state {{ $value | printf \"%.0f\" }} times in the last 10 minutes.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

2.9.3.Memcached memory usage high (> 90%)

Memcached memory usage is above 90% on {{ $labels.instance }} (current value: {{ $value }}%)

  # High memory usage is expected if the cache is well-utilized. This alert fires when it approaches the configured limit, which may cause evictions.
- alert: MemcachedMemoryUsageHigh(>90%)
  expr: '(memcached_current_bytes / memcached_limit_bytes * 100) > 90 and memcached_limit_bytes > 0'
  for: 5m
  labels:
    severity: warning
  annotations:
    summary: Memcached memory usage high (> 90%) (instance {{ $labels.instance }})
    description: "Memcached memory usage is above 90% on {{ $labels.instance }} (current value: {{ $value }}%)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

2.9.4.Memcached connection limit approaching (> 95%)

Memcached connection usage is above 95% on {{ $labels.instance }} (current value: {{ $value }}%)

- alert: MemcachedConnectionLimitApproaching(>95%)
  expr: '(memcached_current_connections / memcached_max_connections * 100) > 95 and memcached_max_connections > 0'
  for: 2m
  labels:
    severity: critical
  annotations:
    summary: Memcached connection limit approaching (> 95%) (instance {{ $labels.instance }})
    description: "Memcached connection usage is above 95% on {{ $labels.instance }} (current value: {{ $value }}%)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

2.9.5.Memcached connection limit approaching (> 80%)

Memcached connection usage is above 80% on {{ $labels.instance }} (current value: {{ $value }}%)

- alert: MemcachedConnectionLimitApproaching(>80%)
  expr: '(memcached_current_connections / memcached_max_connections * 100) > 80 and memcached_max_connections > 0'
  for: 2m
  labels:
    severity: warning
  annotations:
    summary: Memcached connection limit approaching (> 80%) (instance {{ $labels.instance }})
    description: "Memcached connection usage is above 80% on {{ $labels.instance }} (current value: {{ $value }}%)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

2.9.6.Memcached out of memory errors

Memcached is returning out-of-memory errors on {{ $labels.instance }} ({{ $value }} errors/s)

  # 0.05 errors/s is a rough default; OOM error rate depends on your configured memory limit (-m) relative to your working set size and write traffic — adjust based on your workload.
- alert: MemcachedOutOfMemoryErrors
  expr: 'sum without (slab) (rate(memcached_slab_items_outofmemory_total[5m])) > 0.05'
  for: 5m
  labels:
    severity: warning
  annotations:
    summary: Memcached out of memory errors (instance {{ $labels.instance }})
    description: "Memcached is returning out-of-memory errors on {{ $labels.instance }} ({{ $value }} errors/s)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

2.9.7.Memcached high eviction rate

Memcached is evicting items at a high rate on {{ $labels.instance }} ({{ $value }} evictions/s)

  # A sustained eviction rate indicates memory pressure. Consider increasing memcached memory limit or reducing cache usage. Threshold of 10 evictions/s is a rough default — adjust based on your workload.
- alert: MemcachedHighEvictionRate
  expr: 'rate(memcached_items_evicted_total[5m]) > 10'
  for: 5m
  labels:
    severity: warning
  annotations:
    summary: Memcached high eviction rate (instance {{ $labels.instance }})
    description: "Memcached is evicting items at a high rate on {{ $labels.instance }} ({{ $value }} evictions/s)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

2.9.8.Memcached low cache hit rate (< 80%)

Memcached cache hit rate is below 80% on {{ $labels.instance }} (current value: {{ $value }}%)

  # A low hit rate may indicate poor cache utilization, incorrect cache keys, or TTLs that are too short. Threshold of 80% is a rough default — adjust based on your workload and access patterns.
- alert: MemcachedLowCacheHitRate(<80%)
  expr: '(rate(memcached_commands_total{command="get", status="hit"}[5m]) / (rate(memcached_commands_total{command="get", status="hit"}[5m]) + rate(memcached_commands_total{command="get", status="miss"}[5m])) * 100) < 80 and (rate(memcached_commands_total{command="get", status="hit"}[5m]) + rate(memcached_commands_total{command="get", status="miss"}[5m])) > 0'
  for: 10m
  labels:
    severity: warning
  annotations:
    summary: Memcached low cache hit rate (< 80%) (instance {{ $labels.instance }})
    description: "Memcached cache hit rate is below 80% on {{ $labels.instance }} (current value: {{ $value }}%)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

2.9.9.Memcached connections rejected

Memcached is rejecting connections on {{ $labels.instance }} ({{ $value }} rejections in the last 5m)

  # 3 rejections in 5m is a rough default; rejection volume correlates with your traffic load relative to the configured maxconns limit — adjust based on your workload.
- alert: MemcachedConnectionsRejected
  expr: 'increase(memcached_connections_rejected_total[5m]) > 3'
  for: 5m
  labels:
    severity: warning
  annotations:
    summary: Memcached connections rejected (instance {{ $labels.instance }})
    description: "Memcached is rejecting connections on {{ $labels.instance }} ({{ $value }} rejections in the last 5m)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
info

2.9.10.Memcached items too large

Memcached is rejecting items exceeding max-item-size on {{ $labels.instance }} ({{ $value }} rejections in the last 5m)

  # 3 rejections in 5m is a rough default; depends on how often your application attempts to cache items exceeding your configured max-item-size — adjust based on your workload and item sizing.
- alert: MemcachedItemsTooLarge
  expr: 'increase(memcached_item_too_large_total[5m]) > 3'
  for: 5m
  labels:
    severity: info
  annotations:
    summary: Memcached items too large (instance {{ $labels.instance }})
    description: "Memcached is rejecting items exceeding max-item-size on {{ $labels.instance }} ({{ $value }} rejections in the last 5m)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"

Share your alerting rules

Your production alerts can make this collection better. Share your rule files in one command: only Prometheus rule files and PrometheusRule resources are uploaded, while prometheus.yml, alertmanager.yml and other configurations are skipped, as they often contain credentials.

npx awesome-prometheus-alerts share /etc/prometheus/rules

Add --dry-run to preview what would be sent.