anchor.diff:  %% for metrics gathering (great for Graphite)
   %%
   %% Usage:
  -%% ./erlang_stats.erl -c epic_erlang_cookie -n metrics@127.0.0.1 -r epic_erlang_app@127.0.0.1 -s prod.epic_erlang_app
  -%%
  -%% If the script does not work, create a test cookie like:
  -%% echo -n secret > /opt/sensu/.erlang.cookie
  -%% chmod 600 /opt/sensu/.erlang.cookie
  -%% chown sensu:sensu /opt/sensu/.erlang.cookie
  +%% ./erlang_stats.erl -c epic_erlang_cookie -n metrics@127.0.0.1 -r epic_erlang_app@127.0.0.1 -s prod.epic_erlang_app -p named_process1 -d true
   %%
   %% Copyright 2013 Panagiotis Papadomitsos <pj@ezgr.net>.
   %%
  
positive.code:             halt(3)
      end;
  parse_options([], ParsedOptions) ->
      ParsedOptions.
  
  set_local_node_name(ParsedOptions) ->
      Node = proplists:get_value(node, ParsedOptions, "metrics@localhost.localdomain"),
  
negative.code:     ok = set_local_node_name(ParsedOptions),
      ok = set_connection_cookie(ParsedOptions),
      ok = connect_to_remote_node(ParsedOptions),
      ok = collect_metrics(ParsedOptions),
      halt(0).
  
  usage() ->
      io:format(standard_error, "Usage: ~s [-s SCHEME] [-c COOKIE] [-n NODE_NAME] [-r REMOTE_NODE]~n~n", [escript:script_name()]),
      io:format(standard_error, "  -s SCHEME       Set the metric scheme (default: host FQDN)~n", []),
      io:format(standard_error, "  -p PROCESSES    Set a comma-separated list of named processes to gather process info from~n", []),
      io:format(standard_error, "  -c COOKIE       Set the Erlang cookie~n", []),
      io:format(standard_error, "  -n NODE_NAME    Set the Erlang node name (automatic short/long name detection)~n", []),
      io:format(standard_error, "  -r REMOTE_NODE  Set the Erlang node to connect to~n", []),
      io:format(standard_error, "  -d true         Enable debug mode to catch RPC call failures~n~n", []).
  
  parse_options(Options) ->
      parse_options(Options, []).
  