View previous topic :: View next topic |
Author |
Message |
scott.carroll@brulant.com
Joined: 29 Dec 2006 Posts: 29
|
Posted: Fri Dec 29, 2006 10:19 am Post subject: Multiple CPU Testing |
|
|
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! |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
|
Back to top |
|
|
scott.carroll@brulant.com
Joined: 29 Dec 2006 Posts: 29
|
Posted: Fri Dec 29, 2006 11:30 am Post subject: |
|
|
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! |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Fri Dec 29, 2006 11:42 am Post subject: |
|
|
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 |
|
Back to top |
|
|
scott.carroll@brulant.com
Joined: 29 Dec 2006 Posts: 29
|
Posted: Fri Dec 29, 2006 12:31 pm Post subject: |
|
|
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! |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Fri Dec 29, 2006 12:47 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
FLynch
Joined: 18 Jun 2002 Posts: 75 Location: London UK
|
Posted: Fri Dec 29, 2006 1:22 pm Post subject: |
|
|
"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. |
|
Back to top |
|
|
scott.carroll@brulant.com
Joined: 29 Dec 2006 Posts: 29
|
Posted: Wed Jan 03, 2007 10:33 am Post subject: |
|
|
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. |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12805 Location: USA
|
Posted: Wed Jan 03, 2007 12:56 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
scott.carroll@brulant.com
Joined: 29 Dec 2006 Posts: 29
|
Posted: Thu Jan 04, 2007 10:05 am Post subject: |
|
|
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. |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Thu Jan 04, 2007 10:24 am Post subject: |
|
|
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/mframe.htm#tests.htm#chkShell
You may invoke Script Manager and create new scripts using your code. http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#shellmng
HostMonitor has just a few requirements, that must be obeyed when creating a script: http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#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 |
|
Back to top |
|
|
scott.carroll@brulant.com
Joined: 29 Dec 2006 Posts: 29
|
Posted: Fri Jan 05, 2007 9:27 am Post subject: |
|
|
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. |
|
Back to top |
|
|
scott.carroll@brulant.com
Joined: 29 Dec 2006 Posts: 29
|
Posted: Fri Jan 05, 2007 9:30 am Post subject: |
|
|
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. |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Fri Jan 05, 2007 11:19 am Post subject: |
|
|
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: | 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 |
|
Back to top |
|
|
scott.carroll@brulant.com
Joined: 29 Dec 2006 Posts: 29
|
Posted: Fri Jan 05, 2007 12:46 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
|