Pavleck.Com

ULTIMA RATIO REGUM

  • Flickr Photos

    www.flickr.com
  • Things

    www.flickr.com
    This is a Flickr badge showing public photos from Jeremy Pavleck. Make your own badge here.


  • Listening To

  • Twitter

  • I Support

    Bloggers' Rights at EFF

  • Spam Blocked

  • last.fm records

    1. Made of Bricks Made of Bricks
      Kate Nash
    2. Eazy Duz It Eazy Duz It
      Eazy-E
    3. Swass Swass
      Sir Mix-a-Lot
    4. Blue Horse Blue Horse
      The Be Good Tanyas
    5. The Greatest Hits: Why Try Harder The Greatest Hits: Why Try Harder
      Fatboy Slim
    6. Punk in Drublic Punk in Drublic
      NOFX

SCOM2007: Determine Agent From Health Service ID

Posted by Jeremy on May 16th, 2008

System Center Operations Manager 2007 is great, don’t get me wrong. But it does have it’s oddities - and one of those are messages such as these:

Details:Health service ( A63BAA7B-20B1-D6C0-75B9-8A8CE3DD7E02 ) should not generate data about this managed object ( 021971E6-1EFB-E123-7E2A-452ADB511016 ).

Now, we know that Health Service ID is referring to a specific agent, but which one? Luckily, this is fairly easy to figure out. Just hop onto the database server and run the following query:

  1. SELECT DisplayName FROM BaseManagedEntity WHERE BaseManagedEntityId = ‘THE ID’

It should return the DisplayName property of said ID, which is the agent you’re looking for.

In fact, to go a step further - if you have many queries like this, you could write a PowerShell function to simplify things for you - here’s a real rough outline:

  1. function Get-AgentByHSID ([string]$hsid)
  2. {
  3. $omdbserver = "<Set Your DB Name Here>"
  4. $omdb = "OperationsManager"
  5.  
  6. $cn = new-object system.data.SqlClient.SqlConnection("Data Source=$omdbserver;Initial Catalog=$omdb;Integrated Security=SSPI;");
  7. $ds = New-Object "System.Data.DataSet" "AgentName"
  8. $q = "Select DisplayName from BaseManagedEntity where BaseManagedEntityId = ‘$HSID’"
  9. $da = new-object "System.Data.SqlClient.SqlDataAdapter" ($q, $cn)
  10. $da.Fill($ds)
  11. Write-Host "HSID $HSID is associated with the following agent:"
  12. $ds.tables
  13. }

Like I said, the script is fairly basic and assumes a trust relationship with the database. It also expects a valid HSID - I’ll clean it up later. Edit the script, entering in your SCOM DB and DB Name if necessary, then add it to your $PROFILE. Then it’s as simple as Get-AgentByHSID “long health service guid” and it does all the heavy lifting.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>