幽灵资源网 Design By www.bzswh.com
由于监控及报告需要,要统计性能计数器每天数值情况,确认数据库服务器的运行状况。若打开计数器填写,比较麻烦,现在统计用 powershell 来读取计数器的值。
第一阶段:Powershell 读取计数器文件并统计其中一个计数器的值
$startDate = (Get-Date).AddDays(-1).Date $endDate = (Get-Date).Date $perfPath = "D:\DataFiles\PERFMON\MSSQL_PERFMON_08240904.blg" #读取文件中的计数器名称 $counterList = Import-Counter -Path $perfPath $countersNameList = $counterList[0].countersamples | % {$_.path} #筛选指定计数器和时间重新导入PS $counter = $countersNameList -like '*Processor Time*' $counterData = Import-Counter -Path $perfPath -Counter $counter | Where-Object -FilterScript {($_.Timestamp -ge $startDate) -and ($_.Timestamp -lt $endDate)} #计算日期范围内的数值统计 $counterInfo = $counterData | Foreach-Object {$_.CounterSamples} | Measure-Object -property CookedValue -Average -Maximum #哈希表存储结果数据 $resultTable=@{} $resultTable."CPU 利用率——平均" = $counterInfo.Average $resultTable."CPU 利用率——最大" = $counterInfo.Maximum $resultTable
第二阶段:批量统计文件中的所有计数器并导出到文件中
$startDate = (Get-Date).AddDays(-1).Date $endDate = (Get-Date).Date $perfPath = "D:\360Downloads\*.blg" #哈希表存储结果数据 $resultTable=@{} #导入指定时间的所有计数器信息 $counterData = Import-Counter -Path $perfPath | Where-Object -FilterScript {($_.Timestamp -ge $startDate) -and ($_.Timestamp -lt $endDate)} #所有的计数器名字 $countersNameList = $counterData[0].countersamples | % {$_.Path} #遍历每个计数器,将计算结果存储到哈希表中 foreach($counterName in $countersNameList) { #$counterName = "\\hzc\system\threads" $counterDataOne = $counterData | Foreach-Object {$_.CounterSamples} | Where {$_.Path -like $counterName} $counterInfo = $counterDataOne | Measure-Object CookedValue -Average -Minimum -Maximum $resultTable.$($counterName+" :平均值") = $counterInfo.Average $resultTable.$($counterName+" :最小值") = $counterInfo.Minimum $resultTable.$($counterName+" :最大值") = $counterInfo.Maximum } #$resultTable.GetEnumerator() | sort Name | Format-Table -Auto #几种方法导出到文件 $resultTable.GetEnumerator() | sort Name | Format-Table -Auto | Out-File "D:\360Downloads\PerfmonCounter.txt" $resultTable.GetEnumerator() | sort Name | Export-Csv -Path "D:\360Downloads\PerfmonCounter.txt" -Encoding "unicode" -Force $resultTable.GetEnumerator() | sort Name | Format-List | Export-Csv -Path "D:\360Downloads\PerfmonCounter.xlsx" -Encoding "unicode" -Force
幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。