CPU Usage in Linux RMA
CPU Usage in Linux RMA
Hi, I Installed the RMA for linux 1.0 and I'm getting 254% cpu usage ? is this correct ? is this a bug ?
How can I get a number from 0 to 100 % ? does this include the system CPU or just the User CPU ?
Thanks, Pablo
How can I get a number from 0 to 100 % ? does this include the system CPU or just the User CPU ?
Thanks, Pablo
CPU Usage on UNIX systems are checked by simple shell script "cpu.sh" that is located in RMA's directory.
This script was tested on Linux Mandrake 8 and 9, Solaris 9, FreeBSD 4.5 and 5.2 But it may not work correctly on some other versions.
cpu.sh script uses standard vmstat utility to retrieve necessary information. Please check manual for vmstat utility that is installed on your system and modify script accordingly
Regards
Alex
This script was tested on Linux Mandrake 8 and 9, Solaris 9, FreeBSD 4.5 and 5.2 But it may not work correctly on some other versions.
cpu.sh script uses standard vmstat utility to retrieve necessary information. Please check manual for vmstat utility that is installed on your system and modify script accordingly
Regards
Alex
-
- Posts: 10
- Joined: Mon Feb 26, 2007 7:56 am
Hi,
sorry for *bumping* this rather old thread. I'm having an issue with checking CPU load on a linux machine.
The check currently shows up in the HostMon console with a value of >14, whereas when I run the vmstat code in cpu.sh manually on the machine, it returns something like 2 or 3.
The disk space checks run OK, so do you have any ideas, why the return of this check is b0rked?
sorry for *bumping* this rather old thread. I'm having an issue with checking CPU load on a linux machine.
The check currently shows up in the HostMon console with a value of >14, whereas when I run the vmstat code in cpu.sh manually on the machine, it returns something like 2 or 3.
The disk space checks run OK, so do you have any ideas, why the return of this check is b0rked?
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
What exact linux do you use? What output do you get using 'uname' utility?RicochetPeter wrote:The check currently shows up in the HostMon console with a value of >14, whereas when I run the vmstat code in cpu.sh manually on the machine, it returns something like 2 or 3.
Have you tried to refresh "SPU usage test"? If you have installed mpstat utility on your system, you may try to change linux related string in cpu.sh with the following string:
Code: Select all
Linux) mpstat -P ALL | tail -1 | awk '{print 100-$(NF-1)}';;
Max
-
- Posts: 10
- Joined: Mon Feb 26, 2007 7:56 am
Ubuntu 6.06 x86 hereKS-Soft Europe wrote:What exact linux do you use?
What output do you get using 'uname' utility?
Code: Select all
root@leia:/usr/local/hostmon# uname -a
Linux leia 2.6.15-26-server #1 SMP Fri Sep 8 21:00:37 UTC 2006 i686 GNU/Linux
Yes, I manually refreshed the test, too.Have you tried to refresh "SPU usage test"?
Did that, same effect: running the script on the agent machine returns "1.56", f.e., but hostmon shows 9, or 10.If you have installed mpstat utility on your system, you may try to change linux related string in cpu.sh with the following string:Code: Select all
Linux) mpstat -P ALL | tail -1 | awk '{print 100-$(NF-1)}';;
-
- Posts: 10
- Joined: Mon Feb 26, 2007 7:56 am
by the way, using
instead of
makes more sense, if you ask me...
Code: Select all
Linux) mpstat -P ALL | grep all | awk '{print 100-$(NF-1)}';;
Code: Select all
Linux) mpstat -P ALL | tail -1 | awk '{print 100-$(NF-1)}';;
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Sorry, I cannot see any reason why it shows such difference. Probably, you have to recompile the agent on your system. Please send request to support@ks-soft.net and we will send you the source codes.RicochetPeter wrote:Did that, same effect: running the script on the agent machine returns "1.56", f.e., but hostmon shows 9, or 10.
Actually, both these commands are equivalent and correct. You may use both of them.RicochetPeter wrote:Linux) mpstat -P ALL | grep all | awk '{print 100-$(NF-1)}';;
Linux) mpstat -P ALL | tail -1 | awk '{print 100-$(NF-1)}';;
Regards,
Max
-
- Posts: 10
- Joined: Mon Feb 26, 2007 7:56 am
Thanks.KS-Soft Europe wrote:Sorry, I cannot see any reason why it shows such difference. Probably, you have to recompile the agent on your system. Please send request to support@ks-soft.net and we will send you the source codes.RicochetPeter wrote:Did that, same effect: running the script on the agent machine returns "1.56", f.e., but hostmon shows 9, or 10.
I don't think so. In a multi-CPU machine, the version with "grep" shows the mpstat summary for all CPUs, the version with "tail" shows the last CPU...Actually, both these commands are equivalent and correct. You may use both of them.RicochetPeter wrote:Linux) mpstat -P ALL | grep all | awk '{print 100-$(NF-1)}';;
Linux) mpstat -P ALL | tail -1 | awk '{print 100-$(NF-1)}';;
Regards,
Max
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
In general, the syntax you offered is more correct. However, I have the following output on the multi-proc system:RicochetPeter wrote: I don't think so. In a multi-CPU machine, the version with "grep" shows the mpstat summary for all CPUs, the version with "tail" shows the last CPU...
Code: Select all
mpstat -P ALL
Linux XXXXX. (xxx.xxx.xxxx) 02/26/2007
22:05:51 CPU %user %nice %system %iowait %irq %soft %idle intr/s
22:05:51 all 12,08 0,00 1,46 4,57 0,20 0,08 81,61 825,25
22:05:51 0 12,19 0,00 1,56 4,84 0,05 0,24 81,12 314,30
22:05:51 1 12,75 0,00 1,46 4,30 1,37 0,06 80,06 381,88
.....
22:05:51 7 11,86 0,00 1,41 4,44 0,00 0,06 82,22 12,64
Code: Select all
mpstat -P ALL
Linux XXXXXX (XXXX.XXXX.XXXX) 02/26/2007
06:49:05 PM CPU %user %nice %system %iowait %irq %soft %idle intr/s
06:49:05 PM all 11.92 0.00 6.85 16.08 0.16 0.03 64.97 1034.89
06:49:05 PM 0 11.92 0.00 6.85 16.08 0.16 0.03 64.97 1034.82
Regards,
Max
-
- Posts: 10
- Joined: Mon Feb 26, 2007 7:56 am
Sorry, it will only get the value for the last CPU, as far as I understand the "tail" programme. If that's intended, like in a single CPU machine, it's OK, but surely not in a multi-CPU machine.KS-Soft Europe wrote: In both cases, mpstat -P ALL | tail -1 gets the correct line.
Argh, that's correct, I haven't thought of that.Another thing is that "grep all" will not work on localized systems, where second string does not contain "all" word, but contains some localized characters.
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Sorry, my fault. It really shows the last CPU on multi-CPU machine. You are right. So, you may use "grep all".RicochetPeter wrote:Sorry, it will only get the value for the last CPU, as far as I understand the "tail" programme. If that's intended, like in a single CPU machine, it's OK, but surely not in a multi-CPU machine.
Regards,
Max
Hi!
Having similar issues on SUSE Linux Enterprise Desktop 10 32-bit.
First, the sysstat package must be installed as it provides mpstat.
HostMonitor reports like 95% utilization on a mostly idle system.
I ran:
mpstat -P ALL | grep ALL | awk '{print 100-$(NF-1)}';
and the result is always 49.07, which also seems odd.
Here's some sample output:
mattj@linux-n1e2:~> mpstat -P ALL
Linux 2.6.16.27-0.9-smp (linux-n1e2) 03/22/2007
07:08:29 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
07:08:29 PM all 20.44 0.01 27.28 0.50 0.45 0.36 0.00 50.97 470.35
07:08:29 PM 0 16.42 0.01 17.63 0.90 0.90 0.72 0.00 63.42 470.34
07:08:29 PM 1 24.46 0.00 36.93 0.10 0.00 0.00 0.00 38.52 0.00
My machine is a Pentium D, so is a dual-core and it shows as 2 processors.
Any suggestions, please let me know! Will also test on SUSE Linux Enterprise Server 9 and 10 soon. Will be happy to share the results with the rest of the class.
Thanks.
-m
Having similar issues on SUSE Linux Enterprise Desktop 10 32-bit.
First, the sysstat package must be installed as it provides mpstat.
HostMonitor reports like 95% utilization on a mostly idle system.
I ran:
mpstat -P ALL | grep ALL | awk '{print 100-$(NF-1)}';
and the result is always 49.07, which also seems odd.
Here's some sample output:
mattj@linux-n1e2:~> mpstat -P ALL
Linux 2.6.16.27-0.9-smp (linux-n1e2) 03/22/2007
07:08:29 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
07:08:29 PM all 20.44 0.01 27.28 0.50 0.45 0.36 0.00 50.97 470.35
07:08:29 PM 0 16.42 0.01 17.63 0.90 0.90 0.72 0.00 63.42 470.34
07:08:29 PM 1 24.46 0.00 36.93 0.10 0.00 0.00 0.00 38.52 0.00
My machine is a Pentium D, so is a dual-core and it shows as 2 processors.
Any suggestions, please let me know! Will also test on SUSE Linux Enterprise Server 9 and 10 soon. Will be happy to share the results with the rest of the class.
Thanks.
-m
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Correctinvisik wrote:First, the sysstat package must be installed as it provides mpstat.
Have you made changes in cpu.sh file? You should replace Linux related string using the following (please note: grep all in lowercase!):invisik wrote:HostMonitor reports like 95% utilization on a mostly idle system.
Code: Select all
Linux) mpstat -P ALL | grep all | awk '{print 100-$(NF-1)}';;
According to the output of mpstat utility you mentioned, average Idle time on your machine is 50.97 So, utilized time calculated as 100-50.97 = 49.03invisik wrote:I ran:
mpstat -P ALL | grep ALL | awk '{print 100-$(NF-1)}';
and the result is always 49.07, which also seems odd.
Looks like correct.
Regards,
Max