git clone git://github.com/justinkirby/emetric.git cd emetric && ./rebar compile ./emetric --node=slow@localhost --cookie=monster start gather=sys,mnesia scatter=file mods=emetric_filter_csv tail /tmp/emetric_slow@localhost_201103102159.csv ./emetric --node=slow@localhost --cookie=monster stop
emetric creates a high level view of the resources that a running erlang system consumes over time. This is useful for long running stress tests.
The goal is to have a single file that is easy to ‘install’ on any environment that has erlang. There is no complicated release install process (inspired by rebar)
This is a standard rebar build
./rebar compile
After a successful build, there will be a single executable file, emetric.
emetric will do the following:
- connect to a remote node
- inject the necessary modules
- start emetric
Each command may have dependencies. If it does then those are run first. You do not have to specify all commands in order if you simply want to start recording.
Of course, there are the help and version commands, which do the obvious.
This will connect to an erlang node and make sure that emetric can communicate with it.
./emetric --node=slow@localhost --cookie=monster connect
It is one of those lovely commands that will do nothing on success and be very noisy during failure. It does, however, return 0 on success and >=1 on failure
This requires a successful connect.
The modules for gathering the statistics, scattering them to files and filtering them need to be specified here.
./emetric --node=slow@localhost --cookie=monster inject gather=sys,mnesia scatter=file mods=emetric_filter_csv
The above will gather system wide metrics, mnesia statistics and dump them all out to a csv file in /tmp
This will start recording of all requested metrics and push them out to a file (easy to add more datasources) every two seconds.
Supported metrics are:
- system and linux
- mnesia
- ejabberd
./emetric --node=slow@localhost --cookie=monster inject gather=sys,mnesia scatter=file mods=emetric_filter_csv
The above will make sure all the appropriate modules are injected in the remote slow@localhost node. It will start the internal ticker that is triggered every two seconds to gather the metrics.
Once the metrics are all gathered for that ‘tick’, it is sent to the scatter modules, in this case a file. The filter is applied before writing the data.
The file name is created via the following template:
/tmp/emetric_node()_YYYYMMDDHHmm.ext
Example
/tmp/emetric_slow@localhost_201103102211.csv
The emetric will happily keep recording data until either the host node dies or you tell it to stop. (hopefully it is the latter.)
./emetric --node=slow@localhost --cookie=monster stop