anchor.diff:          {ok, Prev} ->
               Val > Prev
       end.
  +
  +
  +%% Format the error message into a binary
  +fmt_to_bin(Str, Args) ->
  +    list_to_binary(lists:flatten(io_lib:format(Str, Args))).
   
   
   %% Cant currently test the alert timeouts as would need to mock
  
positive.code:     {_Name, Host} = misc:node_name_host(node()),
      case can_listen(Host) of
          false ->
              global_alert({ip, node()}, fmt_to_bin(?IP_ERR, [node()]));
          true ->
              ok
      end,
      Opaque;
  
  %% @doc check for any oom errors an any bucket
  check(oom, Opaque, _History) ->
      New = oom_errors(),
      case dict:is_key(oom, Opaque) of
          false ->
              dict:store(oom, New, Opaque);
          true ->
              Old = dict:fetch(oom, Opaque),
              case oom_increased(New, Old) of
                  [] ->
                      ok;
                  Buckets ->
                      {_Sname, Host} = misc:node_name_host(node()),
                      Key = {oom, node()},
                      [global_alert(Key, fmt_to_bin(?OOM_ERR, [Bucket, Host]))
                       || Bucket <- Buckets]
              end,
              dict:store(oom, New, Opaque)
      end.
  
  
  %% @doc list of buckets thats number of oom errors have increased
  -spec oom_increased(dict(), dict()) -> list().
  oom_increased(New, Old) ->
      [Bucket || {Bucket, Val} <- dict:to_list(New), increased(Bucket, Val, Old)].
  
  
  %% @doc check that I can listen on the current host
  
negative.code:     end.
  
  
  %% @doc list of buckets thats measured stats have increased
  -spec stat_increased(dict(), dict()) -> list().
  stat_increased(New, Old) ->
      [Bucket || {Bucket, Val} <- dict:to_list(New), increased(Bucket, Val, Old)].
  
  
  %% @doc fetch a list of a stat for all buckets
  fetch_buckets_stat(Stat) ->
      dict:from_list(
        [{Bucket, fetch_bucket_stat(Bucket, Stat)}
         || Bucket <- ns_memcached:active_buckets()]
       ).
  
  
  %% @doc fetch latest value of stat for particular bucket
  fetch_bucket_stat(Bucket, Stat) ->
      case stats_archiver:latest(Bucket, minute, Stat) of
          {Stat, X} -> X;
          _ -> 0
      end.
  
  