locked
Get Last Heartbeat Time Using SDK RRS feed

  • Question

  • Hi,

    I'm currently migrating a piece of code written using the MOM 2005 SDK to Operations Manager 2007 R2.  The code retrieves information about a subset of our managed servers, including details of any open alerts currently affecting them.

    I'm having difficulty retrieving the last heartbeat time for managed servers from the Operations Manager 2007 SDK - in MOM 2005 I used the TimeLastContacted property of the Computer class but I can't find anything equivalent in the new SDK.  I've read elsewhere that heartbeat data isn't stored in the same way in Ops Mgr 2007 as it was in MOM 2005 so is it even possible to retrieve this information?

    Thanks.

    Wednesday, April 7, 2010 2:42 PM

Answers

  • Hi

    This is the best info I have on getting this (via SQL rather than SDK):

    http://blogs.msdn.com/mariussutara/archive/2008/07/24/last-contacted.aspx

    Good Luck

    Graham


    View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
    • Proposed as answer by Marco Shaw Wednesday, April 7, 2010 3:42 PM
    • Marked as answer by Nicholas Li Wednesday, April 14, 2010 7:39 AM
    Wednesday, April 7, 2010 3:23 PM
  • Hi

    To list all servers, just remove the following

    A.IsAvailable = 0 and

    so that the where clause becomes

                    where B.IsDeleted = 0

    Just be careful with the query - it could be very resource intensive if you have lots of agents

    Cheers

    Graham


    View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
    • Proposed as answer by Nicholas Li Tuesday, April 13, 2010 10:17 AM
    • Marked as answer by Nicholas Li Wednesday, April 14, 2010 7:39 AM
    Friday, April 9, 2010 1:19 PM

All replies

  • Hi

    This is the best info I have on getting this (via SQL rather than SDK):

    http://blogs.msdn.com/mariussutara/archive/2008/07/24/last-contacted.aspx

    Good Luck

    Graham


    View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
    • Proposed as answer by Marco Shaw Wednesday, April 7, 2010 3:42 PM
    • Marked as answer by Nicholas Li Wednesday, April 14, 2010 7:39 AM
    Wednesday, April 7, 2010 3:23 PM
  • Thanks Graham, I did notice that blog post but thought it only applied to servers which Ops Mgr sees as unavailable at the time the SQL query is executed.  We need the last heartbeat time for any server regardless of its current availability.  Not to worry though, I'll remove this functionality from our code.
    Thursday, April 8, 2010 8:27 AM
  • Hi

    To list all servers, just remove the following

    A.IsAvailable = 0 and

    so that the where clause becomes

                    where B.IsDeleted = 0

    Just be careful with the query - it could be very resource intensive if you have lots of agents

    Cheers

    Graham


    View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
    • Proposed as answer by Nicholas Li Tuesday, April 13, 2010 10:17 AM
    • Marked as answer by Nicholas Li Wednesday, April 14, 2010 7:39 AM
    Friday, April 9, 2010 1:19 PM