首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Perfmon计数器在脚本中不工作

Perfmon计数器在脚本中不工作
EN

Stack Overflow用户
提问于 2014-01-30 23:23:14
回答 1查看 479关注 0票数 0

我有一个简单的脚本,它创建了一系列Perfmon计数器,然后启动它们。

由于某种原因,脚本中的任何处理器信息计数器(以CPU命名的计数器)都不能工作。将创建一个输出文件,但它只包含日期时间值,而不包含实际的计数器值。但是,如果我将行复制到命令窗口,它将成功运行。

代码语言:javascript
复制
echo Objective Reporting Data Extraction - %date% - %time%

REM Write output to this location
set OUTPUTDIR=PERFMON_CSV
mkdir %OUTPUTDIR%

REM Counter collection frequency
set PERIOD=00:00:05

REM Create some collectors to collect the Server Health Check perfmon stats

c:\Windows\System32\Logman.exe create counter Obj_HC_svr_memory_5sec -o "%OUTPUTDIR%\obj_HC_svr_Memory_5sec" -f csv -v mmddhhmm  -max 300 -c "\Memory\Available MBytes" "\Memory\Pages/sec" "\Memory\Page faults/sec" "\Memory\Free system page table entries" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter Obj_HC_svr_bytes_received_5sec -o "%OUTPUTDIR%\obj_HC_svr_bytes_received_5sec" -f csv -v mmddhhmm  -max 300 -c "\Network Interface(*)\Bytes Received/sec" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter Obj_HC_svr_bytes_sent_5sec -o "%OUTPUTDIR%\obj_HC_svr_bytes_sent_5sec" -f csv -v mmddhhmm  -max 300 -c "\Network Interface(*)\Bytes Sent/sec" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_Disk_queue_5sec -o "%OUTPUTDIR%\obj_HC_svr_Disk_queue_5sec" -f csv -v mmddhhmm  -max 300 -c "\PhysicalDisk(*)\Avg. Disk Queue Length" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_Disk_read_5sec -o "%OUTPUTDIR%\obj_HC_svr_Disk_read_5sec" -f csv -v mmddhhmm  -max 300 -c "\PhysicalDisk(*)\Avg. Disk sec/Read" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_disk_write_5sec -o "%OUTPUTDIR%\obj_HC_svr_disk_write_5sec" -f csv -v mmddhhmm  -max 300 -c "\PhysicalDisk(*)\Avg. Disk sec/Write" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_disk_bytes_5sec -o "%OUTPUTDIR%\obj_HC_svr_disk_bytes_5sec" -f csv -v mmddhhmm  -max 300 -c "\PhysicalDisk(*)\Disk Bytes/sec" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_disk_transfer_5sec -o "%OUTPUTDIR%\obj_HC_svr_disk_transfer_5sec" -f csv -v mmddhhmm  -max 300 -c "\PhysicalDisk(*)\Disk Transfers/sec" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_CPU_time_5sec -o "%OUTPUTDIR%\obj_HC_svr_CPU_time_5sec" -f csv -v mmddhhmm  -max 300 -c "\Processor Information(*)\% Processor Time" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_CPU_privileged_5sec -o "%OUTPUTDIR%\obj_HC_svr_CPU_privileged_5sec" -f csv -v mmddhhmm  -max 300 -c "\Processor Information(*)\% Privileged Time" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_CPU_idle_5sec -o "%OUTPUTDIR%\obj_HC_svr_CPU_idle_5sec" -f csv -v mmddhhmm  -max 300 -c "\Processor Information(*)\% Idle Time" -si %PERIOD%
c:\Windows\System32\Logman.exe create counter obj_HC_svr_Processor_5sec -o "%OUTPUTDIR%\obj_HC_svr_Processor_5sec" -f csv -v mmddhhmm  -max 300 -c "\System\Processor Queue Length" "\System\Context switches/sec" -si %PERIOD%


REM Now start them
c:\Windows\System32\Logman.exe start Obj_HC_svr_memory_5sec
c:\Windows\System32\Logman.exe start Obj_HC_svr_bytes_received_5sec
c:\Windows\System32\Logman.exe start Obj_HC_svr_bytes_sent_5sec
c:\Windows\System32\Logman.exe start obj_HC_svr_Disk_queue_5sec 
c:\Windows\System32\Logman.exe start obj_HC_svr_Disk_read_5sec
c:\Windows\System32\Logman.exe start obj_HC_svr_disk_write_5sec
c:\Windows\System32\Logman.exe start obj_HC_svr_disk_bytes_5sec
c:\Windows\System32\Logman.exe start obj_HC_svr_disk_transfer_5sec 
c:\Windows\System32\Logman.exe start obj_HC_svr_CPU_time_5sec
c:\Windows\System32\Logman.exe start obj_HC_svr_CPU_privileged_5sec
c:\Windows\System32\Logman.exe start obj_HC_svr_CPU_idle_5sec
c:\Windows\System32\Logman.exe start obj_HC_svr_Processor_5sec
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-03 20:59:13

问题是需要转义的%字符。我代替了

代码语言:javascript
复制
"\Processor Information(*)\% Processor Time"

使用

代码语言:javascript
复制
"\Processor Information(*)\%% Processor Time"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21469584

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档