Now that we have isolation through cgroups it would be really nice if we could also do some monitoring of various usage metrics from the cgroups.
For the most part this looks like reading some special files if they exist.
We should be able to read /proc/self/cgroup to see which cgroup we are a part of (or if we are in a CGroup). And then read in the config about where the CGroup is mounted storm.cgroup.hierarchy.dir
After that we can read
memory.usage_in_bytes - current usage in bytes
memory.limit_in_bytes - current limit in bytes
cpuacct.usage - The aggregate CPU time, in nanoseconds, consumed by all tasks in this group.
OR cpuacct.stat - aggregate user and system time consumed by tasks in this group.
The format is
NOTE: cpuacct does not need to be mounted for cgroup support to work, so if those files don't exist don't register the metric (or just don't report anything).