Creating a Task to Identify Runaway Processes on Managed Computers

 

Often when memory utilization spikes to 100% on a server, the problem can subside before one can jump on the server, or connect with diagnostic tools to determine the problem. To reduce time in diagnosis; I created a task in MOM that will allow administrators to run a task that dumps memory usage for all processes running on a machine at a given point in time.

 

First, Create the Script

  1. In the MOM Administrator Console, expand Management Packs, Scripts.
  2. Right click Scripts, and select Create Script
  3. On the Script Properties – General screen

Enter a script name - 'Process Private Bytes Task Script'

Language: VBScript

 

 

  1. Click next. On the Script screen, paste the following script into the window provided.

 

'************Start cut and paste here****************************

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

 

Set colItems = objWMIService.ExecQuery _

    ("Select * From Win32_PerfFormattedData_PerfProc_Process")

 

For Each objItem in colItems

    ScriptContext.Echo objItem.Name & " -- " & objItem.PrivateBytes

Next

'************End cut and paste here****************************

 

  1. Click Next and Finish.

 

Next, Create the Task

 

  1. In the MOM Administrator Console, expand Management Packs, Tasks.
  2. Find the subfolder where you would like to store the task, or simply create one.
  3. Right click the subfolder and select Create Task from the context menu. Click Next.
  4. On the Task Run Location and Type screen.

For Run location, select agent-managed computer.

For Task type, select Script. Click Next

 

 

  1. On the Task Configuration screen:
  2. For Target role, select MOM Agent.
  3. In the Script dropdown, select the script you created in the previous section - 'Process Private Bytes Task Script'. Click Next.

 

 

  1. On the Task Name and Description screen, enter the task name and a short desription. Click Finish.

 

Now, give it a try!

 

  1. In the MOM Operator Console, select Alert View. Highlight any managed computer.
  2. In the Task Pane, run the task you just created.

 

Output looks something like this.

 

 

I hope you find this helpful. This process could easily be replicated for any number of scenarios, such as a CPU utilization per process task, etc. Experiment with different scripts and see what you can create!