locked
_ Gather performance data and creating a 3-state monitor for a log file RRS feed

  • Question

  • Let’s say I have a log file that has performance information written into it, something like this:

     

    2009-11-17  PERF  [SomeCounter] 16 ms SomeMessage

     

    Question 1

     

    I want to create a three-state monitor using the bolded

    ms

    data.  So I was thinking I would create a 3-state script monitor.  I can easily write a script that opens this log file, parses a line from it to get the value, and returns that value.

     

    But here is where I get stumped.  My script will be opening the entire log file every time it runs.  As such, it won’t know what was old data that was already in the text file, versus the new data that was added since last time to the log file.  Obviously I don’t want to grab the same information multiple times.

     

    Do you have any suggestions on how to get around that problem?  Or is there a better/different way in your opinion to create this 3-state monitor?

     

    Question 2

     

    Using the same log file, I want to capture the bolded ms performance information and be able to view it in a performance view in the operations console.

     

    Initially I thought I could use a Performance Based Collection Rule to do this, but there aren’t any for working with log files.  There are only Event Based Collection Rules.  So then I thought to use a Probe Based Script Collection Rule.  However, I’ll run into the same problem that I did above.

     

    Do you have any suggestions on how to get around this problem?  Is there a better/different way in your opinion to gather this performance information?

    Thursday, November 19, 2009 11:50 PM

Answers

  • Can be done. Get ready for your black belt in MP authoring :)

    Recipe outline goes like this:

    Using the logfile reader (assumes one piece of data per line, file grows continuously, and never gets reset back to empty)
    Output the data in a property bag with three name/value pairs.  Object, counter, instance.  If there is more than one counter or a repeat, use multiple property bags.

    Compose this with the system performance mapper.  This converts the property bag data.  This becomes a data source module that outputs performance data.

    Use this with collection rules and your three state threshold - making sure the rule config and the monitor config have the exact same config parmeters being passed to the data source - this enables cookdown so all of your monitors and rules use the same copy of the data.

    The data then behaves exactly like a normal performance counter.
    Microsoft Corporation
    • Marked as answer by Marnix WolfMVP Friday, December 18, 2009 8:33 AM
    Friday, November 20, 2009 2:03 AM

All replies

  • Can be done. Get ready for your black belt in MP authoring :)

    Recipe outline goes like this:

    Using the logfile reader (assumes one piece of data per line, file grows continuously, and never gets reset back to empty)
    Output the data in a property bag with three name/value pairs.  Object, counter, instance.  If there is more than one counter or a repeat, use multiple property bags.

    Compose this with the system performance mapper.  This converts the property bag data.  This becomes a data source module that outputs performance data.

    Use this with collection rules and your three state threshold - making sure the rule config and the monitor config have the exact same config parmeters being passed to the data source - this enables cookdown so all of your monitors and rules use the same copy of the data.

    The data then behaves exactly like a normal performance counter.
    Microsoft Corporation
    • Marked as answer by Marnix WolfMVP Friday, December 18, 2009 8:33 AM
    Friday, November 20, 2009 2:03 AM
  • Thanks for getting me started!

    Ok, more questions, you knew this was coming.

    So I know how to read a line of the file in.  I can use the System.ApplicationLog.GenericLogReader module.  That would let me access each line of the file using Params/Param[1].

    But how do I output that data as a property bag with three name/value pairs?  How do I parse the Params/Param[1] to pull out the value I need and put it in a property bag?  What module would I use?

    Does that make sense?
    Friday, November 20, 2009 6:08 AM
  • No activity for 30 days, will mark this thread as answered now. Feel free to open it again.
    Best regards, Marnix Wolf

    (Thoughts on OpsMgr)
    Friday, December 18, 2009 8:33 AM
  • Thanks for getting me started!

    Ok, more questions, you knew this was coming.

    So I know how to read a line of the file in.  I can use the System.ApplicationLog.GenericLogReader module.  That would let me access each line of the file using Params/Param[1].

    But how do I output that data as a property bag with three name/value pairs?  How do I parse the Params/Param[1] to pull out the value I need and put it in a property bag?  What module would I use?

    Does that make sense?

    I'm attempting to perform this same type of task.

     

    My text file contains different types of entries, but the specific one I'm searching for appears like so

    May 2011 16:41:55:277 [INFO] - Total number of users connected to the system: 0

    I tried following what Dan Rogers suggested however I would prefer more specifics like Mickey stated such as the module used and the type

     

     

    Wednesday, May 25, 2011 10:58 PM