博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Hash Table
阅读量:6642 次
发布时间:2019-06-25

本文共 3274 字,大约阅读时间需要 10 分钟。

$results=@()

foreach ($m in $ms)
{
$result=""|select a,b,c
$result.a = $m.a
$result.b = $m.b
$result.c = $m.c
$results += $result
}
$results | export-csv -encoding utf8 -notypeinformation -path c:\perc\result.csv

 

####################################################################

 

$performance_monitor_result = "C:\scom_collect\performance_monitor.csv"

#定义RMS服务器名称
$rmsServerName="CSserver.testj.com"
#向当前会话添加scom管理单元
add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client"
#$error|out-file c:\scomm\error.txt
#将当前工作会话设置为SCOM
Set-Location "OperationsManagerMonitoring::"
#测试管理组连接是否正常,管理组可以更改
$mgConn = New-ManagementGroupConnection -connectionString:$rmsServerName
if($mgConn -eq $null)
{
[String]::Format("Failed to connect to RMS on '{0}'",$rmsServerName)
return;
}
#设置当前工作会话到scom管理控制台服务器
Set-Location $rmsServerName

$start = get-date

#获取计数器名称

function GetCountername ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$countername = $config.config.countername
return $countername
}

#获取监控频率

function Getfrequency ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$frequency = $config.config.frequency
if ($frequency -eq $null)
{$frequency = "intervalseconds is:" + $config.config.IntervalSeconds}
return $frequency
}
#获取阀值
function Getthreshold ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$threshold = $config.Config.Threshold
if($threshold -eq $null)
{ $threshold = $config.Config.MemoryThreshold }
if($threshold -eq $null)
{ $threshold = $config.Config.CPUPercentageThreshold }
if($threshold -eq $null)
{
if($config.Config.Threshold1 -ne $null -and $config.Config.Threshold2 -ne $null)
{ $threshold = "first threshold is:" + $config.Config.Threshold1 + " second threshold is:" + $config.Config.Threshold2 }
}
if($threshold -eq $null)
{
if($config.Config.ThresholdWarnSec -ne $null -and $config.Config.ThresholdErrorSec -ne $null)
{ $threshold = "warning threshold is:" + $config.Config.ThresholdWarnSec + " error threshold is:" + $config.Config.ThresholdErrorSec }
}
if($threshold -eq $null)
{
if($config.Config.LearningAndBaseliningSettings -ne $null)
{ $threshold = "no threshold (baseline monitor)" }
}
return $frequency,$threshold
}

#获取采样数

function GetNumSamples ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$NumSamples = $config.config.NumSamples
return $NumSamples
}

$perhealths = get-monitor|?{$_.Category -eq "PerformanceHealth"}

$perhealths |select-object @{name = "monitor_name";expression = {$_.displayname}},`
@{name = "monitor_name_real";expression = {$_.name}},`
@{name = "monitor_server";expression = {foreach-object {(get-monitoringclass -id:$_.target.id).displayname}}},`
@{name = "countername";expression = {foreach-object {GetCountername $_.configuration}}},`
@{name = "threshold";expression = {foreach-object {Getthreshold $_.configuration}}},`
@{name = "numbersamples";expression = {foreach-object {GetNumSamples $_.configuration}}},`
@{name = "frequency";expression = {foreach-object {Getfrequency $_.configuration}}},`
@{name = "configuration";expression = {$_.configuration}}`
|sort monitor_name |export-csv -encoding UTF8 -path C:\scom_collect\performance_monitor.csv

 

 

转载地址:http://zyovo.baihongyu.com/

你可能感兴趣的文章
vue 点击图片显示大图
查看>>
Hadoop基础-Protocol Buffers串行化与反串行化
查看>>
Hadoop生态圈-phoenix(HBase)的索引配置
查看>>
LitJson使用方法
查看>>
Windows 7上安装配置TensorFlow-GPU运算环境
查看>>
【VS2013编译DirectX Tutorials时遇到的错误】FXC : error X3501: 'main': entrypoint not found
查看>>
npm上传vue组件
查看>>
在网页内预览pdf
查看>>
加载MySQL、Oracle、SQL Server 2000、SQL Server 2005及以上版本 的加载数据库驱动程序...
查看>>
WebGL学习笔记四点一
查看>>
java-switch语句
查看>>
[Android Security] APK自我保护 - DEX/APK校验
查看>>
[web前端] yarn和npm命令使用
查看>>
Minimum Expression of String 字符串最小表示
查看>>
國王遊戲(2012年NOIP全国联赛提高组)
查看>>
谈谈 ES6 的 Promise 对象
查看>>
PHP $_SERVER['PHP_SELF']、$_SERVER['SCRIPT_NAME'] 与 $_SERVER['REQUEST_URI'] 之间的区别
查看>>
创业者要有杀手气质和传教士能力
查看>>
Eclipse报错Resource '/.org.eclipse.jdt.core.external.folders/.link5' already exists.
查看>>
jmeter实例,如果有说明错误,请各位大神批评
查看>>