how to get prometheus rinning on docker code example

Example: alertmanager rules for docker containers

ALERT ContainerMissing
  IF absent(container_last_seen{name=~"pheromon|6element"}) or on (name) (time() - container_last_seen{name=~"pheromon|6element"} > 3600)
  WITH {}
  SUMMARY "Instance {{$labels.instance}} down"
  DESCRIPTION "{{$labels.instance}} of job {{$labels.job}} seems down."

ALERT HighMemoryAlert
  IF container_memory_usage_bytes > 1000000000
  FOR 1m
  WITH {}
  SUMMARY "High Memory usage for a container"
  DESCRIPTION "High Memory usage on {{$labels.instance}} for container {{$labels.name}} (current value: {{$value}})"

ALERT Test
  IF count_scalar(container_last_seen) > 1
  SUMMARY "TEST"
  DESCRIPTION "Test usage on {{$labels.instance}} for container {{$labels.name}} (current value: {{$value}})"

Tags:

Misc Example