Multiple CPU Testing
-
- Posts: 29
- Joined: Fri Dec 29, 2006 10:17 am
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!
Thanks in advance!
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
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
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
-
- Posts: 29
- Joined: Fri Dec 29, 2006 10:17 am
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
-
- Posts: 29
- Joined: Fri Dec 29, 2006 10:17 am
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!
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!
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
You may select other properties, that could help to figure it out: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?
http://msdn2.microsoft.com/en-us/library/aa394373.aspx
You should install RMA for Linux on the particular linux server:scott.carroll@brulant.com wrote:2) What about a Linux box? How would I monitor each CPU separately there?
http://www.ks-soft.net/hostmon.eng/rma-unix/index.htm
Regards,
Max
-
- Posts: 29
- Joined: Fri Dec 29, 2006 10:17 am
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.
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.
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
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
-
- Posts: 29
- Joined: Fri Dec 29, 2006 10:17 am
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.
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.
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Great!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.
Both ways are possible. However, I would recommend you to use Shell Script test method: http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShellscott.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?
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
-
- Posts: 29
- Joined: Fri Dec 29, 2006 10:17 am
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.
#!/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.
-
- Posts: 29
- Joined: Fri Dec 29, 2006 10:17 am
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
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:
Instead of "10" I would recommend you to use parameter, which you may pass into script.
Regards,
Max
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)} }'
Regards,
Max
-
- Posts: 29
- Joined: Fri Dec 29, 2006 10:17 am
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.
"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.