Open shtrom opened 6 years ago
I added the FreeBSD support, did you try if the solution for FreeBSD also works in OpenBSD?
it would be these shell commands:
/sbin/sysctl -n hw.physmem hw.pagesize vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count
/usr/sbin/swapinfo
If that doesn't work, you could add a case for OpenBSD where you parse the information.
Yup, I tried it out before opening this ticket:
$ /sbin/sysctl -n hw.physmem hw.pagesize vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count
2090799104
4096
sysctl: second level name stats in vm.stats.vm.v_inactive_count is invalid
sysctl: second level name stats in vm.stats.vm.v_cache_count is invalid
sysctl: second level name stats in vm.stats.vm.v_free_count is invalid
$ /usr/sbin/swapinfo
-bash: /usr/sbin/swapinfo: No such file or directory
The converse, though, is that I think my suggestion of parsing the output of top
should also work on FreeBSD (and hopefully a number of other Unices). Could you try it out and confirm?
For OpenBSD, I found this: https://www.cyberciti.biz/faq/openbsd-checking-for-ram-memory-size/
so it seems there is a chance if we parse the sysctl output a bit differently. I also found this project which does the job for a number of different systems: https://github.com/jrgp/linfo
Meminfo currently only supports Linux and FreeBSD [0]
The output of
top
contains this information, and OpenBSD (and perhaps others?) have a-d
option, which only refreshes the requested number of times.So we could
exec
this and parse the information out.[0] https://github.com/nextcloud/serverinfo/blob/203e90df095ed70a0a9cbbe498e8e601f893d4b5/lib/SystemStatistics.php#L79