Multiple CPU Testing

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
scott.carroll@brulant.com
Posts: 29
Joined: Fri Dec 29, 2006 10:17 am

Multiple CPU Testing

Post by scott.carroll@brulant.com »

Does anyone know how to monitor multiple CPUs on the same box? I really like the software and I am using the CPU Usage test via an agent, but I would like to monitor a box with more than one CPU and set up a test per CPU. Any ideas?

Thanks in advance!
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Do you want to monitor each CPU separately?
In such case, I think, you may use WMI test method using Win32_PerfFormattedData_PerfOS_Processor class. http://www.ks-soft.net/hostmon.eng/mfra ... ts.htm#wmi
Also you may use Performance Counters test method, but WMI is much more reliable. http://www.ks-soft.net/hostmon.eng/mfra ... erfcounter

If you do not need to monitor each processo separately, you may use CPU Usage test method. http://www.ks-soft.net/hostmon.eng/tests.htm#cpuUsage

Regards,
Max
scott.carroll@brulant.com
Posts: 29
Joined: Fri Dec 29, 2006 10:17 am

Post by scott.carroll@brulant.com »

I do want to monitor each CPU separately.

I was hoping there would be some sort of built in individual CPU monitor, but WMI should to the trick too. I'll give that a shot and see how it works out.

Thanks!
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Probably, it would be better to use LoadPercentage property of Win32_Processor class instead of Win32_PerfFormattedData_PerfOS_Processor class.
Anyway, you may try.

Regards,
Max
scott.carroll@brulant.com
Posts: 29
Joined: Fri Dec 29, 2006 10:17 am

Post by scott.carroll@brulant.com »

That did the trick! I'm seeing the CPU load now by using the following WMI:

select LoadPercentage from Win32_Processor where DeviceID='CPU0'

and so on for each processor.

Just two more quick questions:

1) When I run select LoadPercentage from Win32_Processor, it shows 4 processors, but there are only 2 on this particular machine. Any idea why that is?

2) What about a Linux box? How would I monitor each CPU separately there?

Thanks again!
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

scott.carroll@brulant.com wrote:1) When I run select LoadPercentage from Win32_Processor, it shows 4 processors, but there are only 2 on this particular machine. Any idea why that is?
You may select other properties, that could help to figure it out:
http://msdn2.microsoft.com/en-us/library/aa394373.aspx
scott.carroll@brulant.com wrote:2) What about a Linux box? How would I monitor each CPU separately there?
You should install RMA for Linux on the particular linux server:
http://www.ks-soft.net/hostmon.eng/rma-unix/index.htm

Regards,
Max
FLynch
Posts: 75
Joined: Tue Jun 18, 2002 6:00 pm
Location: London UK

Post by FLynch »

"1) When I run select LoadPercentage from Win32_Processor, it shows 4 processors, but there are only 2 on this particular machine. Any idea why that is? "

Probably you have a dual core processor which Windows will show as 2 virtual processors for every physical processor.
scott.carroll@brulant.com
Posts: 29
Joined: Fri Dec 29, 2006 10:17 am

Post by scott.carroll@brulant.com »

I was wondering if that was the case with the virtuals...makes sense. Thanks!

As for the Linux stuff, Linux doesn't support WMI and I have the agent installed and can use the "CPU Usage" test, but that won't provide the individual CPU Usage for each of the CPUs in that server. Is there a way to write a script that will monitor each CPU separately or is there an existing test within Hostmonitor that I can use?

Thanks.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You may create script using cpu.sh as a basis. Use vmstat or mpstat utility to retrieve information about CPU usage.
I cannot give you exact script because output format may depend on version of these utilities (there are too many different Linux versions). Use "man vmstat" and "man mpstat" commands to get all necessary information specific to your system

Regards
Alex
scott.carroll@brulant.com
Posts: 29
Joined: Fri Dec 29, 2006 10:17 am

Post by scott.carroll@brulant.com »

Okey doke. So I created a couple new scripts on my Linux (RHEL 3.0) box and called them cpu00_idle.sh and cpu01_idle.sh and put them in the same directory as the RMA on that box. I can run them no problem on the server and they return what I am looking for. But gow do I go about getting HostMonitor to see these new scripts? Can I run them from HostMonitor when they are stored locally on the server with the agent or do I somehow have to create them inside of HostMonitor?

My scripts are:

top | grep -m 1 cpu00 | awk '{print $8}'
top | grep -m 1 cpu01 | awk '{print $8}'

Each returns the idle time of the correspnding processor (I was having problems using vmstat to get anything but an overall processor utilization - it wouldn't give me individual processor info).

Thanks.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

scott.carroll@brulant.com wrote:Okey doke. So I created a couple new scripts on my Linux (RHEL 3.0) box and called them cpu00_idle.sh and cpu01_idle.sh and put them in the same directory as the RMA on that box. I can run them no problem on the server and they return what I am looking for.
Great!
scott.carroll@brulant.com wrote:But gow do I go about getting HostMonitor to see these new scripts? Can I run them from HostMonitor when they are stored locally on the server with the agent or do I somehow have to create them inside of HostMonitor?
Both ways are possible. However, I would recommend you to use Shell Script test method: http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
You may invoke Script Manager and create new scripts using your code. http://www.ks-soft.net/hostmon.eng/mfra ... m#shellmng
HostMonitor has just a few requirements, that must be obeyed when creating a script: http://www.ks-soft.net/hostmon.eng/mfra ... m#shellres

Within the Script manager you will find some useful UNIX-specific scripts that are included into the package, so you may use them as an example.

Regards,
Max
scott.carroll@brulant.com
Posts: 29
Joined: Fri Dec 29, 2006 10:17 am

Post by scott.carroll@brulant.com »

OK. So I went into Script Manager and wrote the script and I get the correct output, but it doesn't seem to recognize one of my variables:

#!/bin/sh

idle=0

top | grep -m 1 cpu00 | awk 'BEGIN {$idle=($8*1)}
END { if ($idle>=10) {printf("ScriptRes:Ok:%d \%\n",100-$idle)} else {printf("ScriptRes:Bad:%d \%\n",100-$idle)} }'


It returns $8 as 0 everytime. If I say $idle=4 instead of $idle=($8*1) then idle=4 from there on out and 96 is output as the idle time (which is good). If I say $idle=91, then idle=91 from there on out and 9 is output as the idle time.

Any ideas? I know it's a coding issue, but any help would be appreciated.

Thanks.
scott.carroll@brulant.com
Posts: 29
Joined: Fri Dec 29, 2006 10:17 am

Post by scott.carroll@brulant.com »

My apologies, when 96 and 9 are output, they are put out as the CPU usage, not the idle time where 96 is bad and 9 is good. Swapped my wording a little.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Actually, I do not think it is a good idea to use command "top" within the script, because such command loads CPU and in such case, script does not return you true CPU usage. Anyway, you may use following syntax:

Code: Select all

top | grep -m 1 cpu00 | awk '{if ($8>=10) {printf("ScriptRes:Ok:%d %%\n",100-$8)} else {printf("ScriptRes:Bad:%d %%\n",100-$8)} }'
Instead of "10" I would recommend you to use parameter, which you may pass into script.

Regards,
Max
scott.carroll@brulant.com
Posts: 29
Joined: Fri Dec 29, 2006 10:17 am

Post by scott.carroll@brulant.com »

When I try that, I get the following:

"Script started, no results received"

Any ideas?

Also, I would be more than happy to use vmstat, but it gives overall CPU usage rather than individual CPU usage - which is was I need (meaning it gives the usage of both CPUs together rather than CPU00 and CPU01 separately).

Thanks again.
Post Reply