Support specifying your own basekey prefix

Currently the default is 'vmstats' and hardcoded. When multiple nodes
are involved, custom prefix might be better.

This patch introduces a backwards-compatible environment variable
setting that allows to override this value.
Fix up patch

- Remove some dead whitespace
- Rework a few functions
- Define the "vmstats" default value for the base key