How is elastic agent gathering statistics?

Is elastic agent parsing the text output of observability tools or is it reading directly from the OS libraries and kernel interfaces?