none
SCOM 2012 R2 and Later Use Powershell to List Monitored URLs RRS feed

  • Question

  • I'm trying to build a list of the URLs we're monitoring. So far I've been able to get the Web Transaction Availability Monitor URLs using this:

    get-scommonitor | where {$_.DisplayName -like '*https*'} | Select-Object Displayname

    I can get the name of the Groups/Containers for the Web Application Availability Monitors using this:

    Get-SCOMMonitoringObject -Class (Get-SCOMClass -Name Microsoft.SystemCenter.WebApplicationSolutions.SingleUrlTes
    t)| Select-Object DisplayName

    But I can't get the individual URLs.

    I've seen this which is for SCOM 2007:https://discussitnow.wordpress.com/2013/12/18/get-a-list-of-monitored-urls-out-of-scom-via-powershell/

    I've tried to translate it to SCOM 2012 but 2007 didn't have the Web Application Availability Monitors, so no success.

    Kevin Holman posted this: https://kevinholman.com/2016/12/17/getting-monitor-state-change-events-via-powershell/

    Which also is only for Web Transaction Availability Monitors. I've been playing with translating it to WAAM, but I still only get the Names of the containers, not the individual URLs.

    I'm not a PowerShell guru, so I'm running out of ideas.

    Friday, September 20, 2019 2:01 PM

Answers

  • Had a few minutes.  Try this:

    Get-scomclass -displayname 'Web Application Availability Monitoring Test' | Get-SCOMClassInstance | Select DisplayName,@{n='URL';e={ Select-Xml -Xml ([xml]($_.'[Microsoft.SystemCenter.WebApplicationTest.WebTestBase].Parameters'.Value)) -XPath "//Parameter[@name='URL']" | %{$_.Node.'#text'} }}

    • Marked as answer by No1YouKnow Wednesday, September 25, 2019 3:00 PM
    Friday, September 20, 2019 5:53 PM

All replies

  • Hi,

    First off, this is the Authoring forum and this has nothing to do with Authoring, just administration.  Second, I don't use (anymore) the WAAM provided in SCOM I do use a custom MP (which I think I posted a while back).

    That said, I will try to help and couple things come to mind:

    1. If all your WAAM are in the same MP, then you could simply export the MP to XML and search the URLs in there.  Best would be to use an XPath query (Using select-XML in PowerShell, for example) or just search for the word "http"
    2. The info should be within the instance properties. Trick would be to find the class and property name, then search for the instances and export the property.  Both of which you can find in an exported MP's XML.  In short (replace what is in italics with what you've found above)
      Get-SCOMClass -Name classname | Get-SCOMClassInstance | Select propertyname

    HTH

    Friday, September 20, 2019 4:05 PM
  • Had a few minutes.  Try this:

    Get-scomclass -displayname 'Web Application Availability Monitoring Test' | Get-SCOMClassInstance | Select DisplayName,@{n='URL';e={ Select-Xml -Xml ([xml]($_.'[Microsoft.SystemCenter.WebApplicationTest.WebTestBase].Parameters'.Value)) -XPath "//Parameter[@name='URL']" | %{$_.Node.'#text'} }}

    • Marked as answer by No1YouKnow Wednesday, September 25, 2019 3:00 PM
    Friday, September 20, 2019 5:53 PM
  • HI,

     

    We can also query the URLs via SQL:

     

    Firstly ,run the following command and find out one parameter start with parameters_GUID. It contains the URLS in web application availability monitoring.

     

    select m.mpfriendlyname, was.* from

    managementpack m inner join discovery d on

    m.managementpackid = d.managementpackid inner join

    discoverysource ds on ds.discoveryruleid=d.discoveryid inner join

    discoverysourcetotypedmanagedentity ds2 on ds2.discoverysourceid=ds.discoverysourceid

    inner join MT_Microsoft$SystemCenter$webApplicationSolutions$singleURLTest was

    on was.basemanagedentityid=ds2.typedmanagedentityid where m.mpfriendlyname='test'

    Note: Please change the MP name for your reference.


     

    Then you can copy out all the URLs in this parameter.

     

    Hope it can help.

     

    Best regards.

    Crystal


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Monday, September 23, 2019 2:58 AM
  • Hi,

    How's everything going? Is there anything we can help? If yes, please let us know.

    Thanks and have a nice day.

    Best regards.

    Crystal


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, September 25, 2019 6:24 AM
  • Perfect!

    I have thousands or monitored urls spread over 6 Management Groups in numerous MPs, so your PS was exactly what I needed.

    Thanks!

    Wednesday, September 25, 2019 3:07 PM