This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Monitor multiple processes

Does anyone know how to monitor the CPU and Memory utilization of multiple processes? We have 12 copies of the same process running on our servers (on purpose). We would like to know which of the 12 has gone haywire and track it's usage so we can go back and determine when it got crazy. For example sometimes a single process will have a memory issue and start using 10x more memory than normal.

  • Do those processes have a different command line parameters? If yes, then you could use 'Command Line Filter' setting when editing component options to specify which instance you are interested in.

  • Not sure I know what you mean. We start a service for our application and it in turn starts 12 instances of this process.

  • I mean command line arguments like

    c:\process.exe /some_specific_argument_to_identify_instance

    If there is no specific argument specified, then it's not possible to distinguish various instances from each other (between polls). Because when process is restarted, it gets a new PID and it's not possible to match it against historical data from previous polls.

  • I'm ok with not being able to detect historical information. All I need to monitor is the following:

    1. Are there currently 12 instances running. if not I need an alert

    2. Are any of the 12 using over XXX amount of Memory or above YYY CPU utilization

    3. If possible, are any of them restarting (different PID than before).

     

    Number 3 may not be possible but I'd be happy with numbers 1 and 2.

     

    Maybe some sort of script could do it?

  • Hi,
    I was able to get scripts for all three options with some additional tweaks I hope you will be able to use them.

    What you will have to do is create new alert and set it for custom SQL type and monitored property will be APM component. Then in text box below you will enter particular scripts. 

    For options 1, 2 you will have to specify process name to not get alert for all monitored processes.

    Options three is self-resetting after 10 minutes because is measuring number of changed PIDs in time period per component.

    Instance count differs alert script:

     
    WHEREAPM_AlertsAndReportsData.ComponentId IN
    (
          SELECT [ComponentId] FROM [dbo].[APM_CurrentComponentStatus] [CS]
          INNER JOIN[dbo].[APM_ProcessEvidence_Detail] [E] ON [CS].[ComponentStatusID]= [E].[ComponentStatusID]
          GROUP BY[ComponentId]
          HAVING
                -- Alerts are evealuated for all components
                -- I want this alert only for processes with specified name
                MAX([Name]) = 'calc.exe'
               
                -- Where count of instances does not match this number
                AND COUNT([E].[ID]) <>  10
    )

    Memory or CPU level reached for any of instances:

    WHEREAPM_AlertsAndReportsData.ComponentId IN
    (
          SELECT [ComponentId] FROM [dbo].[APM_CurrentComponentStatus] [CS]
          INNER JOIN[dbo].[APM_ProcessEvidence_Detail] [E] ON [CS].[ComponentStatusID]= [E].[ComponentStatusID]
          GROUP BY[ComponentId]
          HAVING
                -- Alerts are evealuated for all components
                -- I want this alert only for processes with specified name
                MAX([Name]) = 'calc.exe'
               
                -- Any of monitored processes has memory usage greater than XX
                AND
                (
                      MAX([E].[PercentMemory]) > 10 -- % of memory
                     
                      -- Any of monitored processes has CPU usage greater than XX
                      OR MAX([E].[PercentCpu]) > 20 -- % CPU
                )
    )

    PID has changed for any of instances in last 10 minutes:

    Trigger Condition:

     
     
    WHERE APM_AlertsAndReportsData.ComponentId IN
    (
     
    SELECT [C].[ID] FROM [dbo].[APM_Component] [C]
    INNER JOIN [dbo].[APM_CurrentComponentStatus] [CS] ON [C].[ID] = [CS].[ComponentID]
    INNER JOIN [dbo].[APM_ProcessEvidence_Detail] [PED] ON [CS].[ComponentStatusID] = [PED].[ComponentStatusID]
     
    WHERE
    [PED].[PID] IS NOT NULL
      AND (
      SELECT COUNT(*) FROM [dbo].[APM_ComponentStatus_Detail] [PRECS] 
    WHERE [C].[ID] = [PRECS].[ComponentID] AND [TimeStamp] > DATEADD(minute,-10, GETUTCDATE())
    )
    <>
    (
    SELECT COUNT(*) FROM [dbo].[APM_ComponentStatus_Detail] [PRECS] 
    JOIN [dbo].[APM_ProcessEvidence_Detail] [PE] ON [PRECS].[ID] = [PE].[ComponentStatusID]
        WHERE [C].[ID] = [PRECS].[ComponentID] AND [TimeStamp] > DATEADD(minute,-10, GETUTCDATE())
    AND [PE].[PID] = [PED].[PID]
    )
    )

     

     

    Reset Condition:

    WHERE NOT APM_AlertsAndReportsData.ComponentId IN
    (

    SELECT [C].[ID] FROM [dbo].[APM_Component] [C]

    INNER JOIN [dbo].[APM_CurrentComponentStatus] [CS] ON [C].[ID] = [CS].[ComponentID]

    INNER JOIN [dbo].[APM_ProcessEvidence_Detail] [PED] ON [CS].[ComponentStatusID] = [PED].[ComponentStatusID]

     

    WHERE

    [PED].[PID] IS NOT NULL AND

    (

      SELECT COUNT(*) FROM [dbo].[APM_ComponentStatus_Detail] [PRECS] 

    WHERE [C].[ID] = [PRECS].[ComponentID] AND [TimeStamp] > DATEADD(minute,-10, GETUTCDATE())

    )

    <>

    (

    SELECT COUNT(*) FROM [dbo].[APM_ComponentStatus_Detail] [PRECS] 

    JOIN [dbo].[APM_ProcessEvidence_Detail] [PE] ON [PRECS].[ID] = [PE].[ComponentStatusID]

        WHERE [C].[ID] = [PRECS].[ComponentID] AND [TimeStamp] > DATEADD(minute,-10, GETUTCDATE())

    AND [PE].[PID] = [PED].[PID]

    )

    )

  • Thanks V. forgive me but I've never created such types. Do I set up a script APM monitor first and just type "sql" in the box where it defaults to "vbscript"? Or something else.

     

    Thank you so much for your help!

  • For part three I'm having an issue with:

    "The multi-part identifier "" could not be bound."

    I am interested in having an alert when any component has its PID change.  I also had some issues with table names but so I am assuming the following:

    [PED] = APM_ProcessEvidence_Detail, [PE] = APM_ProcessEvidence and [C] = APM_Component

    Any help would be awesome.

    Thanks,

    Tim

  • Here is a quick description how to set up advanced SQL alert.

    1)     Run Advanced Alert Manager (All Programs\SolarWinds Orion\Alerting, Reporting and Mapping\Advanced Alert Manager)

    2)     Click [Configure Alerts] button, list of configured alerts appears.

    3)     Click [New] as you want to create new alert.

    4)     Select trigger condition tab.

    5)     In “Type of Property to Monitor” combo box select “Custom SQL Alert”.

    6)     In combo box “Set up your Trigger Query” select “Property” that is alert working with.

    Now you have to text boxes in dialog. The upper one is read only and shows base query (depending on property you are monitoring) and the bottom one is editable and allows you to add custom SQL where clause that reduces net objects IDs returned to those one matching conditions claimed as significant.
    This is the box where SQL scripts (parts of them) go and both text boxes combined together forms a complete script that one should be able to run against database which you can test for error by hitting [Validate SQL]

    For more information about alerts and how to set them please read Administrator's Guide.

  • I'm sorry for the inconvenience but I accidentally put just part of the third script in post. It is fixed (edited) now in original post with scripts.

    Thanks,

  • Ok,

    The steps for number three are now working.  However I my trigger actions are not being performed and my reset actions are being performed every time the alert is checked (as long as we're within ten minutes of the PID change).

    This means I never get the trigger email and I get 10 alert reset emails.

    Any ideas what may be causing this.

    Thanks