locked
Monitor different processes performance (%CPU) running on server RRS feed

  • Question

  • Hi all,

    We have a use case to monitor a CentOS server that runs throughout the day different java processes with different names (name of the process "Java*") and need to monitor their CPU usage for each one when they run.

    The ideia is that they have to be scheduled to run and some need more CPU% than others so we want to balance the scheduling distribution related to the CPU usage, meaning avoid having two of the jobs that consume for example 50% CPU each to run at the same time.

    I have been able to configure the CPU usage of a process with a Performance Rule (tried it with SCOM agent process) but that only has one process and will show like 

    Is there any way to have something like this but a different object per java process?

    Thank you


    • Edited by AzrPRD Tuesday, January 14, 2020 1:33 PM
    Tuesday, January 14, 2020 1:28 PM

Answers

All replies

  • Hi,

    It is achievable, but you would have to author your own management pack as the builtin monitoring template won't be able to do this.

    You can also search by using your favorite search engine to see if someone from the community has created a solution for monitoring multiple processes.

    If you still decide you will go for authoring part, here's some links to get you started:

    SCOM 2012: UNIX/Linux Authoring Library MP Reference - Unit Monitor Types

    UNIX/Linux Authoring Library MP for System Center 2012 - Operations Manager

    Authoring with the UNIX/Linux Authoring Library for System Center 2012 - Operations Manager

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Tuesday, January 14, 2020 1:45 PM
  • I figure it would go to that...Anything different from the out of the box MP that we have ever had to do has been put aside because of the effort required for MP authoring.

    The effort to learn MP authoring and then creating it is not compatible with this current need unfortunately.

    Thanks 

    Tuesday, January 14, 2020 2:17 PM
  • Hi,

    To achieve this, we may create a new rule "Unix/Linux Shell Command (Performance)" and save it into a separate management pack and there create a performance view to view the data we collected.



    and the core command should be as following:

    top -b n 1 | grep java* | awk '{cpu = cpu + $9} END {print cpu}'




    Here's the step-by-step guide.




    Hope the above information helps.

    Regards,

    Alex Zhu
    -----------------------------------------------
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
    Wednesday, January 15, 2020 3:40 AM
  • That's what we did but it only returns one value, it doesn't give me the data for each java process.

    Thanks

    Wednesday, January 15, 2020 8:37 AM
  • Hi,

    The above command calculates the total CPU usage of process 'java*' (wildcard is used), for example, java1, java2, if we want to view each process, we need to create a rule for each exact process.




    Hope the above information helps.

    Regards,

    Alex Zhu
    -----------------------------------------------
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
    Thursday, January 16, 2020 8:41 AM
  • I know but the process name starts with java but the rest of the string is dynamic and not always the same and we are talking about hundreads of different processes.

    Thank you anyway

    Cheers

    Thursday, January 16, 2020 9:12 AM
  • Thursday, January 16, 2020 9:49 AM
  • After spending the last 2 days trying to finally learn MP authoring with the guidelines you guys provided I think I'm nearly there except for one thing, the Rule Target.

    On the .mpx rule I'm using there is a property Target="xxxxxxxx" , i've google it a lot and try to figure what I should insert there so it is assigned to all Unix computers class but can't figure it out as all examples are related to some other .mpx discovery class loaded into the authored MP.

    I know that this would be offtopic to this post but any ideas?

    Friday, January 17, 2020 9:26 AM
  • If you want that rule to apply to all your Unix/Linux servers, you can target it at the Microsoft.Unix.Computer class.


    • Edited by CyrAz Friday, January 17, 2020 9:37 AM
    Friday, January 17, 2020 9:37 AM
  • I did apply it to Target="Unix!Microsoft.Unix.Computer" but I get the error:

    Severity	Code	Description	Project	File	Line	Suppression State
    Error		The configuration specified for Module DS is not valid.
    : Failed to validate expression: $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$
     Either target class ManagementPackElement=Microsoft.Unix.Computer in ManagementPack:[Name=Microsoft.Unix.Library, KeyToken=31bf3856ad364e35, Version=7.7.1136.0] does not have a host or too many '/Host' references have been specified in this expression.
    Failed to validate expression: $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$
     Either target class Microsoft.Unix.Computer does not have a host or too many '/Host' references have been specified in this expression.   (Path = MyMP.MyPerfCollection.Command.PropertyBag.Rule/DS)	ManagementPack5	C:\Program Files (x86)\MSBuild\Microsoft\VSAC\Microsoft.SystemCenter.OperationsManager.targets	270	
    

    Friday, January 17, 2020 9:40 AM
  • The error message is pretty explicit, but I'll grant you it's not that obvious when you just started authoring.

    What it's telling you is that you are trying to use a property of the rule's target ($Target... expression).

    More specifically, you are trying to to use a property of the target's host. ($Target/Host/...).

    But then you ask for the NetworkName property of the Microsoft.Unix.Computer class.

    And so quite logically it fails because Microsoft.Unix.Computer is your target class and not its host.

    So you simply need to remove /Host from the expression :)

    To add a bit more explanation, that example assumes it is targeted to a custom class representing a specific application that would be hosted by the Unix.Computer class; in which case you would indeed need to use the /Host syntax.


    • Edited by CyrAz Friday, January 17, 2020 9:47 AM
    Friday, January 17, 2020 9:45 AM
  • 100% agree with you that it might look pretty clear to someone with authoring knowledge but to me it really wasn't :)

    As it happens many times when learning something new I think that when I look back at my question in a couple of months I'm pretty sure I'll laugh a little.

    But that was just a side note, thank you guys for all the help, pretty cool and really appreciated 

    Friday, January 17, 2020 9:51 AM
  • Authoring has a very steep learning curve, especially because it requires you already understand the core concepts of SCOM (classes, inheritance, relationships, modules..) and it helps a lot to have someone who already knows about it at hand. 

    If you really want to spend some time learning it, there is one very thorough series of videos by Brian Wren you should absolutely watch, they will clarify a lot of things : https://channel9.msdn.com/Series/System-Center-2012-R2-Operations-Manager-Management-Packs

    But once you start mastering it, it becomes extremely rewarding... it unlocks almost endless monitoring possibilities :)

    • Edited by CyrAz Friday, January 17, 2020 9:56 AM
    Friday, January 17, 2020 9:54 AM
  • 100% agree on the unlock almost endless possibilities but a steep learning curve is far from what we can afford in terms of our time management.

    This specific use case I've managed to create but it associates with a unique PerformanceRuleInstanceRowId which I've now learned only gets resolved by creating ANOTHER management pack for the discovery of the java processes and create a new entry on the DB for each (like it happens with Filesystems for example)...which I have no idea on how to do although I've wondered through many examples already and tutorials...

    So I'm not seeing endless possibilities, I'm seeing a never ending story :)

    Nevertheless this post has been extremely help and I thank you all very much as because of it I've created my first MP and am starting to go down that rabbit hole

    Cheers

    Tuesday, January 21, 2020 8:12 AM
  • Creating a discovery (not necessarily in a different MP) in that case would be a bit problematic anyway : you are not supposed to discover objects that appear/disappear/change very frequently; and I assume your java processes come and go quite often.

    However, if I'm not mistaken, there indeed is only one rule associated to an object/counter pair in the datawarehouse; BUT using a variable Instance should still work. I can't test it now though.

    Tuesday, January 21, 2020 8:48 AM