Is it possible, on a linux box, to import dstat and use it as an api to collect OS metrics and then compute stats on them? 
I have downloaded the source and tried to collect some metrics, but the program seems to be optimized for command line usage. 
Any suggestions as to how to get my desired functionality either using Dstat or any another library?
The Dstat source-code includes a few sample programs using Dstat as a library.
DSTAT as a Python API ?