Current CPU and Disk Activity.

Microsoft Windows
Post Reply
User avatar
MigrationUser
Posts: 336
Joined: 2021-Jul-12, 1:37 pm
Contact:

Current CPU and Disk Activity.

Post by MigrationUser »

27 Aug 2010 14:01
sarbjitsinghgill

Hello Friends,

Currently I need to watch CPU and disk activity of the system. This should be command line. Script does not matter, it could be windows command script (.bat), vbs or java.

Also another third party utility can be useful, only in case when this cannot be done via native scripts.

I am on Windows 2003 server, and I use IBM DB2 on this system.

Thanks

Last edited by sarbjitsinghgill (27 Aug 2010 14:01)

Sarbjit Singh Gill
IBM certified DBA, MQ Solution Developer

----------------------------

#2 28 Aug 2010 11:53
Simon Sheppard


Perfmon
https://ss64.com/nt/typeperf.html

gwmi win32_process
https://ss64.com/ps/get-wmiobject.html

Last edited by Simon Sheppard (05 Sep 2010 16:29)

----------------------------

#3 01 Sep 2010 12:45
bluesxman


Also look at the "typeperf" command -- console version of perfmon.

cmd | *sh | ruby | chef

----------------------------

#4 01 Sep 2010 22:48
npocmaka


logman is also an option.

here is a little example:
C:\>Logman.exe create counter CPU-Meter -f bincirc -v mmddhhmm -max 250 -c "\\MyPC\Processor(_Total)\% Processor Time"
C:\>Logman.exe start CPU-Meter
C:\> start somtething else
C:\>Logman.exe stop CPU-Meter

this will create CPU-Meter_xxxxxx.blg (in c:\perflogs by default) file which you can open with perfmon.exe
You can use relog.exe to create readable text file ->

C:\PerfLogs>relog CPU-Meter_xxxxxx.blg -f csv -o CPU-Meter.csv -t 2

There are a lot of counters that you can use and can see them in perfmon.

Here are some articles:
http://blogs.technet.com/b/askperf/arch ... n-exe.aspx
http://www.windowsitpro.com/article/per ... lysis.aspx
https://docs.microsoft.com/en-us/previo ... dfrom=MSDN

http://blogs.technet.com/b/askperf/arch ... eperf.aspx

I prefer the logman because it's easier to be stopped , but typeperf is easier to be started :-D

----------------------------

#5 05 Sep 2010 15:48
sarbjitsinghgill


Thanks All,

I am grateful to all you three. Such an rich information. Actually I never had needed this before.

Simon, WMI was my quest. But Bluesxman has opened another door. TypePerf will be easier for .bat scripts.

Thanks npocmaka, logman is also wealthful, I will defnitely use this and typeperf and will see which one is easy for me to stop or start.

Thanks thanks thanks

Last edited by sarbjitsinghgill (05 Sep 2010 15:51)

Sarbjit Singh Gill
IBM certified DBA, MQ Solution Developer

----------------------------

#6 06 Sep 2010 00:15
bluesxman


The beauty of typeperf is that you can tell it to spit out just a single iteration, so all starting and stopping can be at the whim of your script.

cmd | *sh | ruby | chef

----------------------------

#7 06 Sep 2010 20:31
sarbjitsinghgill


Right,
I have already dumpded a block for online backup last nigh. It is beautiful. The dump was helpful.

On other hand LOGMAN can help me define an alert, although I was not able to setup one.

Can some one help me setup an alert with LOGMAN for 45% cpu. I was able to setup counter as below.

Code: Select all

logman create counter  CpuMon  -f CSV -cf mycounter.txt.txt -o D:\sgill\Dev\logman\Processor.csv
I am not confortable with logman yet. i want to setup alert and then assign a task to it

I used following command which did not work. Actually maybe I did not understand the syntax.

Code: Select all

D:\SGILL\Dev\db2memory>logman create alert SSG_CPU -th "\Processor(_Total)\% Processor Time>45"
Unknown parameter "SSG_CPU"
Unknown parameter "-th"
Unknown parameter "\Processor(_Total)\% Processor Time>45"
Missing parameter: counter
Missing parameter: trace

The syntax of the command is incorrect.

Help please.

Sarbjit Singh Gill
IBM certified DBA, MQ Solution Developer

----------------------------

#8 06 Sep 2010 23:25
Simon Sheppard


You need Windows 7 or 2008 to use the -th option

If you are on WinXP then try -c "\Processor(_Total)\% Processor Time"

----------------------------

#9 07 Sep 2010 03:53
sarbjitsinghgill


Oh yes,

Sorry I missed a line at the page. Only counters and traces are available in XP.

thanks

Sarbjit Singh Gill
IBM certified DBA, MQ Solution Developer

----------------------------

#10 07 Sep 2010 14:08
npocmaka
Simon Sheppard wrote:

You need Windows 7 or 2008 to use the -th option

If you are on WinXP then try -c "\Processor(_Total)\% Processor Time"
I'm not sure if this will work...

The error says:
Missing parameter: counter
Missing parameter: trace

To create alert over trace use this:
Logman.exe create alert CPU_alert -f csv -ft "\Processor(_Total)\% Processor Time>45"

to create alert over counter try like this:

>Logman.exe create counter CPU -f csv -ft "\Processor(_Total)\% Processor Time"

>Logman.exe create alert CPU_alert2 -f csv -c CPU>45
Post Reply