Solved Collecting resource usage data for basic system monitoring

Keve

Member

Reaction score: 10
Messages: 56

I have the feeling that some of my FreeBSD devices have far more memory or processing power than what they actually use, while others could benefit from a little more RAM or a more powerful CPU/GPU. So I would like to collect basic system resource usage data over a period of 3-5 days, with each machine under its usual load, to see how they are doing.
As I do not need an all-time system monitoring solution, the likes of munin/cacti/nagios/rrdtools would be an overkill. I do not need to remotely access this data, I do not need to visualize it real-time. I just let the data be gathered for a few days and then I generate graphs, see maximum and minimum values, draw my conclusions, and then throw it all away.
  • With the coretemp/amdtemp modules loaded, I can run sysctl periodically to query CPU temperature data.
  • With the smartmontools package installed, I can run smartctl periodically to collect HDD/SSD temperature data.
  • Running swapinfo periodically, I can record how much swap space is being used.
  • Running du -sch I can see how a directory grows/shrinks in size.
  • Running df -h I can record how much storage space on a volume is used.
  • How would I keep track of CPU utilization?
  • How could I record the amount of memory used?
For the processor usage, it would be particularly interesting to record utilization per core. For the memory and CPU usage, maybe the output of top could some way be used.
Any suggestion along these thoughts is more than welcome!
Any hack on how to query a certain system detail, any idea on what other useful data to collect, post a comment please!
 

mjollnir

Daemon

Reaction score: 699
Messages: 1,154

sysrc accounting_enable=YES & RTFM periodic.conf(5) (search for accounting). It does not do per-core accounting, but it's a starting point. Pay attention to daily_accounting_flags, it sets options to sa(8).
 
OP
Keve

Keve

Member

Reaction score: 10
Messages: 56

CPU load averages for the last 1-minute, 5-minutes and 10-minutes periods are shown by the output of both uptime() and w(). The same data is printed by sysctl vm.loadavg.
This can also be captured from the output of top -n 0, together with memory usage information. With the -P flag, one can also get the per-core CPU load status I was after. So for my particular case, top -nP 0 prints out everything I was still looking to capture and record.
 
  • Like
Reactions: JAW

diizzy

Well-Known Member

Reaction score: 83
Messages: 307

Netdata will do this (except monitoring a specific directory) out of the box as long as you install the package :)
 
OP
Keve

Keve

Member

Reaction score: 10
Messages: 56

Netdata will do this (except monitoring a specific directory) out of the box
This comes with more than a dozen dependency packages, so one needs to be willing to install those too. For my particular use, this would be overkill. For reasons mentioned in my original post.
I prefer to avoid installing something, if I already have all the required functionality at my disposal in the base system.
Netdata seems to be a good choice for those cases when real-time or remote monitoring is a requirement.
 

T-Daemon

Daemon

Reaction score: 470
Messages: 1,011

Apropos net-mgmt/netdata, for those who might missed it glancing through the documentation and don't want to reveal certain system informations:

"Netdata collects anonymous usage information by default and sends it to Google Analytics. Read about the information collected, and learn how to-opt, on our anonymous statistics page."

One must opt-out to prevent telemetry being send:
 
Top