Skip to main content
APA
Sponsored by CAST AI — Kubernetes cost optimization Better Stack — Uptime monitoring and log management
⚠️

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

Memcached Prometheus Alert Rules

9 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.

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

2.8.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 }}"
warning

2.8.2. 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 }}"
critical

2.8.3. 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.8.4. Memcached out of memory errors

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

- 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.8.5. 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 }}"
warning

2.8.6. 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.8.7. 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.8.8. Memcached connections rejected

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

- 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.8.9. Memcached items too large

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

- 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 }}"