NetAppSANtricity.VolumePerfDataSource (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
PerfDS DataSource System.CommandExecuterPropertyBagSource Default

Source Code:

<DataSourceModuleType ID="NetAppSANtricity.VolumePerfDataSource" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="Trace" type="xsd:integer"/>
</Configuration>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="PerfDS" TypeID="System!System.CommandExecuterPropertyBagSource">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<ApplicationName>%windir%\system32\windowspowershell\v1.0\powershell.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>-File ".\VolumePerfData.ps1" $Config/Trace$</CommandLine>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>VolumePerfData.ps1</Name>
<Contents><Script># This is MP version 3.0.0.0
param([int]$Trace)

function Get-WebServerPort([string] $dir)
{

[xml]$wsConfig = Get-Content "$dir/webserver/wsconfig.xml" -ErrorAction SilentlyContinue
$val = $wsConfig.config.port
$val
}

$scriptName = "VolumePerfData.ps1"
$E_LVL_ERROR = 1
$E_LVL_WARNING = 2
$E_LVL_INFO = 0
$E_NBR_TRACEM = 3701
$private:intPackDir = (Get-ItemProperty HKLM:\Software\NetApp\MP IntegrationPackRoot).IntegrationPackRoot

$api= New-Object -ComObject 'MOM.ScriptAPI'

$volumeId = '$Target/Property[Type="NetAppSANtricity.Volume"]/volumeId$'
$arrayWWN = '$Target/Property[Type="NetAppSANtricity.Volume"]/storageArrayWWN$'

if ( $Trace )
{
# LogScriptEvent will log events to the Operations Manager log.
$api.LogScriptEvent($ScriptName, $E_NBR_TRACEM, $E_LVL_INFO, 'volume performance monitoring started with id: ' + $volumeId)
}

# Common parameters used for the web service calls
$securePwd = ConvertTo-SecureString "rw" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("rw", $securePwd)

$wsPort = Get-WebServerPort $intPackDir
if ($wsPort -eq $null)
{
$api.LogScriptEvent($ScriptName, $E_NBR_TRACE, $E_LVL_ERROR, "Error parsing wsConfig.xml in" + $intPackDir)
$wsPort = "8080" # try 8080 if we can't find anything else...
}
$baseUrl = "http://localhost:$wsPort/devmgr/v2/storage-systems/"

# Get volume perf data for all storage systems monitored by the agent
$url = ""
$url = $baseUrl + $arrayWWN + "/analysed-volume-statistics/" + $volumeId

$volStat = Invoke-RestMethod $url -Credential $cred

$bag = $api.CreatePropertyBag()
$bag.AddValue("Read Response Time", [double]$volStat.readResponseTime)
$bag.AddValue("Write Response Time", [double]$volStat.writeResponseTime)
$bag.AddValue("Combined Response Time", [double]$volStat.combinedResponseTime)
$bag.AddValue("Read IOps", [double]$volStat.readIOps)
$bag.AddValue("Write IOps", [double]$volStat.writeIOps)
$bag.AddValue("Combined IOps", [double]$volStat.combinedIOps)
$bag.AddValue("Write Throughput", [double]$volStat.writeThroughput)
$bag.AddValue("Read Throughput", [double]$volStat.readThroughput)
$bag.AddValue("Combined Throughput", [double]$volStat.combinedThroughput)
$api.AddItem($bag)

$api.Return($bag)</Script></Contents>
</File>
</Files>
</DataSource>
</MemberModules>
<Composition>
<Node ID="PerfDS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>