daemon: Fix invalid memory accesses in resource monitors.

Wrap the index correctly in GetSamples and don't run it in a thread.
The samples can not be read from multiple threads.