locked
SCOM performance monitoring RRS feed

  • Question

  • Hello,

    Lets say I have performance rule for total processor time and I need the new samples export to CSV. Is this possible?

    Thank you

    Wednesday, February 20, 2019 8:08 AM

Answers

All replies

  • Hello,

    You can create a SCOM report for the total processor time, and from the report you can export it to a CSV file.

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Wednesday, February 20, 2019 8:29 AM
  • I have 5 minute sample interval and I need every result in csv file. 
    Wednesday, February 20, 2019 8:34 AM
  • You can get that with PowerShell, here's a blog post that might help you out:

    SCOM: Access Performance Data with PowerShell
    https://model-technology.com/blog/scom-access-performance-data-with-powershell/


    Blog: https://thesystemcenterblog.com LinkedIn:

    Wednesday, February 20, 2019 8:38 AM
  • I did modify the script:

    ## Set some values as variables
    $PerfCounterTargetClassName = 'Windows Server 2012 R2 Operating System'
    $PerfCounterName = '% Processor Time'

    ## Retrieve the class instance containing the performance data
    $ComputerInstance = Get-SCOMClassInstance |Where-Object {$_.DisplayName -like "exch*"}| ?{$_.GetClasses().DisplayName -eq "Windows Computer"}
    $ClassInstance = $ComputerInstance.GetRelatedMonitoringObjects() | ?{$_.GetClasses().DisplayName -eq $PerfCounterTargetClassName}

    ## Retrieve the performance counter data

    $PercentProcessorTime = $ClassInstance.GetMonitoringPerformanceData() | ?{$_.CounterName -eq $PerfCounterName}

    ## Retrieve the performance samples
    $SampleStartTime = (Get-Date).AddHours(-2)
    $SampleEndTime = (Get-Date)
    ForEach($PerformanceValues in $ComputerInstance){
    $PerformanceValues = $PercentProcessorTime.GetValues($SampleStartTime,$SampleEndTime)
    $PerformanceValues 
    }

    Result:

    MonitoringPerformanceDataId : 123
    SampleValue                 : 9.42449951171875
    TimeSampled                 : 2/20/2019 10:44:42 AM
    TimeAdded                   : 2/20/2019 10:45:03 AM
    Id                          : 47124232323232112121212
    ManagementGroup             : MGMT-GROUP
    ManagementGroupId           : 123456789

    This only one sample, i have bunch of samples for each Exchange server, but I do not know, which result belongs where.

    How Can I add for each one $ComputerInstance

    Wednesday, February 20, 2019 11:38 AM
  • While I'm not a PowerShell expert, but you will probably have to iterate through the servers that you have in your $ComputerInstance variable, for example with a For Each loop.


    Blog: https://thesystemcenterblog.com LinkedIn:

    • Proposed as answer by CyrAz Thursday, February 21, 2019 7:27 AM
    • Marked as answer by Stoyan ChalakovMVP Tuesday, April 2, 2019 12:37 PM
    Thursday, February 21, 2019 12:08 AM
  • You could also fetch the performance data from the datawarehouse
    Thursday, February 21, 2019 7:28 AM
  • How would you do that please?

    Thanks

    Thursday, February 21, 2019 8:27 AM
  • SOmething like this : 

    SELECT
          entity.[Path],
    	  [DateTime],
    	  SampleValue
    FROM [OperationsManagerDW].[Perf].[vPerfRaw] AS Perf LEFT JOIN [OperationsManagerDW].[dbo].[vManagedEntity] AS entity ON perf.ManagedEntityRowId = entity.ManagedEntityRowId
    WHERE PerformanceRuleInstanceRowId IN 
    	(
    	SELECT [PerformanceRuleInstanceRowId]  
    	FROM [OperationsManagerDW].[dbo].[vPerformanceRuleInstance]  
    	WHERE RuleRowId IN 
    		(
    		SELECT [RuleRowId]  
    		FROM [OperationsManagerDW].[dbo].[vPerformanceRule]  
    		WHERE ObjectName='Processor Information' AND CounterName='% Processor Time')
    		) 
    AND [DateTime] >= DATEADD(HOUR, -2, GETDATE())
    ORDER BY [DateTime]

    Thursday, February 21, 2019 11:31 AM
  • Hi,

    I would do it with Powershell also (as Leon suggested), but a SQL query can get the job done also.

    Check here the performance (Datawarehouse section) :

    SCOM SQL queries

    Haven't tried those, but they seem very promising also:

    CPU, Disk and Memory utilization SQL queries

    Check this one also:

    SCOM 2012 R2 – SQL Queries to retrieve SCOM performance data

    now you have two options for obtaining the data. Please let us know which way you chose to go. Thanks!

    Regards,


    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Thursday, February 21, 2019 12:22 PM
  • Any Ideas how to write this? I am not realy Powershell guy.

    Thanks

    Thursday, February 21, 2019 1:34 PM
  • Hi,

    I would try the SQL queries first. The references I gave you are pretty close, CyrAz's suggestion needs also attention.

    I cannot develop and test the Powershell option right now, maybe next week. So, if you cannot wait, try the SQL query options. 

    Regards, 


    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Thursday, February 21, 2019 2:02 PM
  • Can I do every two hour task sheduler for this SQL query and export result to csv file?

    Thanks

    Thursday, February 21, 2019 2:28 PM
  • I believe you can. See

    https://pythoncodesnippets.wordpress.com/2016/01/14/execute-sql-script-using-windows-task-scheduler/

    Cheers


    Sam (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" wherever applicable. Thanks!) Blog:AnalyticOps Insights Twitter:Sameer Mhaisekar

    Thursday, February 21, 2019 2:30 PM
  • Hi, yes, you can...it is not that elegant, but you can.

    As an alternative you can use this MP and create a monitor that runs your Query:

    A new free Management Pack to create SCOM monitors from any SQL query

    or you could schedule your own custom report with the query:

    SCOM 2012 Report Builder 3 Custom Performance Report

    Regards,


    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Thursday, February 21, 2019 2:34 PM
  • That brings another question : what are you actually trying to achieve? Why do you need to export this as csv on a regular basis?

    There probably is a better solution...

    Thursday, February 21, 2019 3:58 PM