Other Coding Nextcloud "Server Info" for FreeBSD

stratacast1

Well-Known Member

Reaction score: 44
Messages: 339

Currently, if you go to the "Server Info" tab on Nextcloud, it will read information to you like CPU load, memory usage, user shares, etc. Well, currently, memory usage doesn't appear on FreeBSD servers because it uses information from /proc. Really all it needs then is maximum memory usage and memory used or free. I think if I grep (PHP equivalent) memory from /var/run/dmesg.boot it wouldn't be hard then to extract the data. Would this be a reasonable alternative to pursue, or is there a better method that would be similar to /proc/meminfo?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,894
Messages: 40,608

Really all it needs then is maximum memory usage and memory used or free. I think if I grep (PHP equivalent) memory from /var/run/dmesg.boot it wouldn't be hard then to extract the data. Would this be a reasonable alternative to pursue, or is there a better method that would be similar to /proc/meminfo?
It's less error-prone if you simply read a few sysctl(8).

Code:
# sysctl hw.physmem hw.usermem hw.realmem
hw.physmem: 17153437696
hw.usermem: 15900737536
hw.realmem: 17179869184

(Looking for a good one to use for "free" memory, but you may need to collect a few different values and do some basic calculations)
 
OP
stratacast1

stratacast1

Well-Known Member

Reaction score: 44
Messages: 339

Okay, I'm having trouble understanding what each value is. I assume that realmem is what is installed physically in the system, but I'm having trouble understanding the other two, especially in regards to what my values are:

hw.physmem: 8543956992
hw.usermem: 1488113664
hw.realmem: 17179869184

Looking at top, I get these memory values:

Mem: 163M Active, 552M Inact, 6729M Wired, 475M Free

Which I am trying to see how these correlate with the sysctl info
But if any of these are showing "used" for the system, then that's all I need since hw.realmem will give me the "total" system memory
 
Top