OPNsense Forum

Archive => 21.7 Legacy Series => Topic started by: dcol on August 01, 2021, 11:16:29 PM

Title: Viewing CPU usage per service
Post by: dcol on August 01, 2021, 11:16:29 PM
Is there a way to view CPU usage per service? Maybe a shell command?

I am using 21.1.9 and I noticed the CPU was at 60-70% driving my CPU temps high. I did a restart and now the usage is where it should be at 0-10%

How can I tell what is causing this high CPU usage? I did try resetting the netflow data and that made no difference. Only a reboot brought the usage down. I also noticed when the CPU usage was high, the memory usage was also much higher than normal using 12-14GB when normally it is at 3-4GB

Specs:Intel  i7-6700, 32GB

Thanks
Title: Re: Viewing CPU usage per service
Post by: Patrick M. Hausen on August 01, 2021, 11:26:18 PM
top?
Title: Re: Viewing CPU usage per service
Post by: dcol on August 01, 2021, 11:30:01 PM
If you are referring to pftop, I do not see any CPU usage stats in there.
Title: Re: Viewing CPU usage per service
Post by: Patrick M. Hausen on August 02, 2021, 05:41:29 AM
Log on to a command line via SSH, enter "top", followed by the "enter" key. Voila, CPU usage per process.
Title: Re: Viewing CPU usage per service
Post by: dcol on August 02, 2021, 06:56:53 PM
Thanks that helps a lot for tracking this down. Haven't seen it happen since I rebooted.
Title: Re: Viewing CPU usage per service
Post by: chemlud on August 02, 2021, 07:21:39 PM
Isn't there even htop installed? Like that much more...
Title: Re: Viewing CPU usage per service
Post by: dcol on August 02, 2021, 07:36:40 PM
htop is not listed as an available plugin.
Title: Re: Viewing CPU usage per service
Post by: Patrick M. Hausen on August 02, 2021, 07:47:51 PM
Quote from: chemlud on August 02, 2021, 07:21:39 PM
Isn't there even htop installed? Like that much more...
Nope:
root@opnsense:~ # htop
htop: Command not found.


But FreeBSD top knows some tricks the one in Linux doesn't. Type "o", then "cpu" or "size" or "res" (resident size) followed by the enter key - voila, sorting on the fly. Type "h" for full help.

Kind regards,
Patrick
Title: Re: Viewing CPU usage per service
Post by: gpb on August 02, 2021, 08:18:45 PM
I installed htop using "pkg install htop"...handy to have.

pkg add https://pkg.freebsd.org/FreeBSD:12:amd64/quarterly/All/htop-3.0.4_1.txz
Title: Re: Viewing CPU usage per service
Post by: dcol on August 02, 2021, 08:22:09 PM
That package is not found in the repository
Title: Re: Viewing CPU usage per service
Post by: gpb on August 02, 2021, 08:33:50 PM
Yep, you're right.  I went back through my command history and used this:

pkg add https://pkg.freebsd.org/FreeBSD:12:amd64/quarterly/All/htop-3.0.4_1.txz
Title: Re: Viewing CPU usage per service
Post by: dcol on August 02, 2021, 08:41:00 PM
That worked. Will check it out
Thanks