0

I am wanting to write a utility that does some reporting based on data available in the /proc directory.

Is this as simple as reading and parsing the contents of the virtual file I am interested in? I have seen this approach implemented in Python when doing similar things.

Is there a superior way to do this in Go?

For backstory, I am using ZFS on Linux and want to retrieve data from this virtual file: /proc/spl/kstat/zfs/arcstats

This is a Python program that operates directly on that file.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Joenarr Bronarsson
  • 515
  • 2
  • 5
  • 20
  • > Is this as simple as reading and parsing the contents of the virtual file I am interested in? As far as I know: yes. But you might try looking at https://github.com/c9s/goprocinfo to see what they do there, or if you can use that package instead. – jrefior Jul 09 '18 at 02:29
  • @jrefior You should transform your comment in a full answer. – dolmen Jul 09 '18 at 18:24

1 Answers1

0

Is this as simple as reading and parsing the contents of the virtual file I am interested in?

As far as I know: yes.

But you might try looking at github.com/c9s/goprocinfo to see what they do there, or if you can use that package instead.

See also this SO question and answer.

jrefior
  • 4,092
  • 1
  • 19
  • 29