KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Multiple CPU Testing
Goto page 1, 2  Next
 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
scott.carroll@brulant.com



Joined: 29 Dec 2006
Posts: 29

PostPosted: Fri Dec 29, 2006 10:19 am    Post subject: Multiple CPU Testing Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Fri Dec 29, 2006 11:23 am    Post subject: Reply with quote

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/mframe.htm#tests.htm#wmi
Also you may use Performance Counters test method, but WMI is much more reliable. http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#perfcounter

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
scott.carroll@brulant.com



Joined: 29 Dec 2006
Posts: 29

PostPosted: Fri Dec 29, 2006 11:30 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Fri Dec 29, 2006 11:42 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
scott.carroll@brulant.com



Joined: 29 Dec 2006
Posts: 29

PostPosted: Fri Dec 29, 2006 12:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Fri Dec 29, 2006 12:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
FLynch



Joined: 18 Jun 2002
Posts: 75
Location: London UK

PostPosted: Fri Dec 29, 2006 1:22 pm    Post subject: Reply with quote

"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
View user's profile Send private message
scott.carroll@brulant.com



Joined: 29 Dec 2006
Posts: 29

PostPosted: Wed Jan 03, 2007 10:33 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12062
Location: USA

PostPosted: Wed Jan 03, 2007 12:56 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
scott.carroll@brulant.com



Joined: 29 Dec 2006
Posts: 29

PostPosted: Thu Jan 04, 2007 10:05 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Thu Jan 04, 2007 10:24 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
scott.carroll@brulant.com



Joined: 29 Dec 2006
Posts: 29

PostPosted: Fri Jan 05, 2007 9:27 am    Post subject: Reply with quote

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
View user's profile Send private message
scott.carroll@brulant.com



Joined: 29 Dec 2006
Posts: 29

PostPosted: Fri Jan 05, 2007 9:30 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Fri Jan 05, 2007 11:19 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
scott.carroll@brulant.com



Joined: 29 Dec 2006
Posts: 29

PostPosted: Fri Jan 05, 2007 12:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index