ITM resource model creation

Build custom monitoring abilities into ITM

IBM Tivoli Monitoring (ITM) is a powerful environment that gives you the ability to monitor virtually any type of resource. This tutorial shows you how easily you can build custom monitoring capabilities into ITM using the ITM Resource Model Builder. Resource Models provide a structured environment to provide resource status analysis, notification of significant events, and even automatic corrective measures. ITM Resource Model Builder is an IDE that simplifies the process of creating and debugging Resource Models.


Jason Hooper, Senior Software Engineer, IBM Tivoli Software

Jason Hooper is a Senior Software Engineer in the IBM Tivoli Software organization.- He currently assists partners who are building monitoring solutions based on IBM Tivoli Monitoring. Jason previously served as technical lead on IBM's own monitoring solutions.

Chris Morrissey, Staff Software Engineer, IBM Tivoli Software

Chris Morrissey is a Staff Software Engineer in the IBM Tivoli Software organization.- He is the lead programmer on IBM Tivoli Monitoring Resource Model Builder.

22 September 2003

Before you start

About this tutorial

This tutorial will give you hands on experience creating a resource model using the ITM Resource Model Builder and installing it in an existing ITM environment. The scenario for this tutorial demonstrates how to use the resource model to monitor all the processes on the system. If a process is taking more than 40% CPU, it will terminate that process.


You must have the following applications installed to successfully complete the steps in this tutorial:

  • IBM Tivoli Monitoring V5.1.1
  • IBM Tivoli Monitoring Resource Model Builder V1.1.1.
  • A Windows 2000 professional or Windows XP professional system
    Note: ITM Resource Model Builder runs only on Windows XP and Windows 2000, however, it can be used to develop resource models which can be deployed on many different platforms.

IBM Tivoli Monitoring V5.1.1 can be downloaded from the IBM Software Mall.- In order to access the Software Mall, you must join PartnerWorld for Developers and purchase the value pack.

Should I take this tutorial?

This tutorial is for IBM Tivoli administrators interested in extending or customizing IBM Tivoli Monitoring to monitor their enterprise resources such as applications or hardware.- This tutorial assumes a basic working knowledge of IBM Tivoli Monitoring.


Resource models are used at an endpoint to collect and analyze data regarding the state and performance of different resources, such as disks, memory, CPU, or applications. After you create a resource model, add it to your Tivoli management region.

IBM Tivoli Monitoring provides a set of default resource models. You can use IBM Tivoli Monitoring Resource Model Builder to expand the collection of available resource models according to the requirements of your system.

When you create a resource model, you specify information that controls the behavior of the resource model such as the following:

  • Thresholds you do not want a resource to exceed
  • Events to generate if a monitored resource state is not satisfactory
  • Automated corrective actions for specific events
  • Parameters to specify particular resources of interest

In addition, you can also specify that the monitoring results must be sent to the Tivoli Enterprise Console server or Tivoli Business Systems Manager. Event notifications enable you to perform more complete enterprise management of all your resources.

Settings that you configure are automatically included in the decision tree script. The script contains the settings and the monitoring algorithm that governs the runtime behavior of the resource model. The monitoring algorithm is developed using either Visual Basic or JavaScript.

Prepare the environment


The ITM Resource Model Builder is based on IBM's Eclipse open source IDE.- As such, it follows the conventions for working within that environment.

Start the ITM Resource Model Builder by selecting Start => Programs => IBM WebSphere Studio => Resource Model Builder 1.1.1.

When the ITM Resource Model Builder is started, you will be presented with the following layout.

Here, projects in which the resource model workspace files are stored are located on the left, the editor for the resource model appear in the middle, and views which present information about the resource model appear at the bottom.

Create a project

Since resource models are located in projects, you must first create a project before you can create a resource model with the wizard. To create a Tivoli Management Project:

  1. Select File => New from the menu bar.
  2. Select Project to display the New Project window.
  3. Select Tivoli Management Project from the left pane to display it in the right pane.
  4. Click on Tivoli Management Project in the right pane to highlight the name.
  5. Click Next to display the Project Name window.
  6. Enter a name for the project in the Project name text box (for example, Tutorial).
  7. Optionally, uncheck the Use default check box and specify a different directory location for the project.
  8. Click Finish.

Create a simple resource model

Start the wizard

The simplest way to create a Resource Model is to use the Basic Resource Model Wizard provided by Resource Model Builder.- This wizard allows you to easily specify the source for your data and the logic upon which events will be generated without having to enter into some of the more complicated resource model concepts.

To start the wizard, select File => New => Basic Resource Model Wizard.

Select the script language and platforms

Select JavaScript as the scripting language selection and w32-ix86 as the platform.

Click Next to go to the data source selection page.

Select the data source

Select CIM/WMI as the data source.

Select the CIM class

The information you want to use is in the CIMV2 namespace, which is the default namespace used in the next dialog. To pull information about the processes running on the machine,- search through the classes in root\CIMV2 to find TMW_Resource. Expand it and select TMW_Process.

Resource Model Builder ships with several examples for many platforms, including Linux, AIX, and Solaris that include CIM based data sources which can be reused in your own customized resource models.

Note that if you were building a resource model for another platform, such as UNIX, you would need to import the CIM class definitions for the resource you want to monitor using the Mof Compiler.

Click Next.

Select the class properties

Specify which class properties you want. Process will already be selected, but you need to select ID and PercentProcessorTime. Double click the properties to move them over to the Selected field.

Click Collection Test to see what information is returned.-

In the collection test you'll notice metrics such as Idle and _Total you'll want to exclude. In order to exclude items, set conditions to filter. If there is a particular server process that you want to allow more CPU (for example, Apache) then that process name should be excluded as well.

Click OK to close the Collected Instances window.

Set the filtering conditions

You can use the Resource Model Builder to set filtering conditions if the resource model is being developed to run on Windows based platforms. For resource models that run on other platforms, set filters using the scripting language (JavaScript).

To use the Resource Model Builder to set filters:

  1. Double-click the Process field and enter the condition Process <> (not equal to) "Idle".
  2. Click OK.
    Note: the process name is case sensitive.
  3. Click AND, then double click Process again.
  4. Now set the condition to not equal to (<>) _Total.
  5. Click OK.

    Now when the resource model runs it will not include Idle or Total processes in the evaluation.

    - Set the filtering conditions

  6. Click Next.

Create the triggering condition

To know when a process is taking up more than 40% of the processor time, define the triggering condition.

  1. Double click PercentProcessorTime.
  2. Enter > (greater than) and 40 for the PercentProcessorTime, 3 for the number of occurrences before an event is triggered (this is the persistency check), 1 for the number of allowed monitoring cycles, and CRITICAL for the event severity. TEC and TBSM are not configured so uncheck those boxes.
  3. Click OK.

    -Create the triggering condition

    You should now see this set as an event trigger.

  4. Click Next.

Select properties to log

Select all of the properties so that they are logged. Click Finish.

-Select properties

Click Finish again to see the summary page.

Review default internal names

The internal names for the various resource model pieces are used programmatically in the decision tree script.- Continue with the defaults by selecting Next and set the cycle time to 30 seconds. Click Next.

Save the resource model

Select the folder to save the resource model by clicking the project name (for example, Tutorial) and then click Finish to save the resource model.

Add an automatic corrective action


In this section, you'll use the resource model editor to add an automatic corrective action that will be triggered when an event is generated.

You should now see the main editing screen for resource models.

Add process ID information to the event

Now, remember the goal was to assure no process took over 40% of the CPU. One way to automate this is to create an event action that kills any process that generates an event based on our criteria defined previously.

  1. Expand the Events tree and click EV_TMW_Process_PercentProcessorTime_too_high.
  2. Under the Attributes, you'll see PercentProcessorTime (NUMERIC), UpperBound (NUMERIC), and Process (STRING).
  3. Add the ID property: Click Add and enter this attribute (ID) with the NUMERIC type.
  4. Define the action to be executed. Click the Actions button.

For this exercise you will be running a command file that runs an NT program called ntprocinfo.exe that can kill a process based on the ID number.

Add the automatic corrective action

  1. Click Add Program and define the program actions. The internal name can be anything you want, but keep it short, and don't use spaces or dashes.
  2. For the shell command, use the full path and file name to the command file: c:/tmp/ntkill. You'll create the command file in the next step.
  3. Finally, give it a descriptive name and description of your choice.
  4. Close all of the dialog boxes so you are back to the Resource Model Builder main panel.

Create the process termination script

  1. Keep the Resource Model Builder open (you'll come back to it).
  2. Go to a DOS prompt to create the command file.
  3. Change to the directory you specified for the Shell Command in the above exercise by entering cd \tmp.
  4. To create the command file enter notepad ntkill.cmd.
  5. Enter the following commands:
    @set /a INTEGER_PID=EV_TMW_Process_PercentProcessorTime_too_high_ID
    @c:\tmp\ntprocinfo.exe -k %INTEGER_PID%
  6. Save and exit. You will need to copy ntprocinfo.exe to the \tmp directory for this to work. You can find this on a TMR server in the \Tivoli\bin\lcf_bundle.40\bin\w32-ix86\tools directory.

Test the resource model

Start the resource model

If you are developing a resource model for a Windows-based platform, before creating the package you can test the resource model and action directly using Resource Model Builder. For resource models that aren't Windows-based, you need to test it from the platform it is developed to run on.

To test the resource model using Resource Model Builder, return to the Resource Model Builder, click the Source tab, and click the Start icon.

Start a CPU stressing program

You used a program called CPU Stress ( to act as the offending program that the resource model will terminate.- This program can be downloaded. You must copy it to the \tmp directory.- A similar program called cpustres is available to MSDN subscribers in the Resource Kit.

To run CPU Stress:

  1. Go to Start => Run...
  2. Enter c:\tmp\CPUstress1.0.2.exe.
  3. Set the activity level for Thread 1 to Busy.

Verify that an event is generated

Watch the bottom of the Resource Model Builder in the Resource Model Builder Event Viewer for this program to show up as an event. Once the count goes to 3 occurrences, the CPU Stress program should be killed.

Test the logging output

Resource Model Builder also has a Resource Model Builder Logging Viewer that allows you to see data that would be sent to a local database for use by the ITM Web Health Console or for storage in the Tivoli Enterprise Data Warehouse.

To get data to show up in the Resource Model Builder Logging Viewer, add a statement to the resource model script.
In the VisitTree function, after the line

hPropTable = Svc.CreateMap()

add the line


Build and install the resource model

Build the resource model package

The last step is to build the package. Select ITM/Generate Package from the menu bar. Give the package a name.

Install the resource model into ITM

You are now ready to add this Resource Model to your ITM installation.

For convenience, create a shortcut on the Windows Desktop for a command prompt with the Tivoli environment set:

  1. Right click on the Desktop and select Create/Shortcut.
  2. In the location field enter:
    C:\WINNT\system32\CMD.EXE /k C:\WINNT\system32\drivers\etc\Tivoli\setup_env.cmd
  3. Click Next and name the shortcut Tivoli.
  4. Open a Tivoli prompt and change to the directory where you saved the resource model. If you used the example above, enter cd\ to make sure you are at the root of c:\.
  5. Use the wdmrm command to add the resource: At the prompt, enter bash, which will take you to a Bash prompt where you can execute Tivoli shell commands. To see the syntax of the command, enter wdmrm at the prompt.
  6. To add a resource model, enter wdmrm -add WizRM_TMW_Process_CPU.tar (if you named your resource something different use that name).
  7. To verify the resource model was added, enter wdmrm -list.

You can now create and distribute a profile with this Resource.

Wrap up


In this tutorial you created, tested, and installed a basic ITM resource model.- Resource Models can be very powerful and provide a great deal of flexibility for monitoring a wide range of enterprise resources.- The links in the Resources will provide additional information to help you get started.



Get products and technologies

  • Build your next development project with IBM trial software, available for download directly from developerWorks.



developerWorks: Sign in

Required fields are indicated with an asterisk (*).

Need an IBM ID?
Forgot your IBM ID?

Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.


All information submitted is secure.

Dig deeper into Tivoli (service management) on developerWorks

Zone=Tivoli (service management), Tivoli
ArticleTitle=ITM resource model creation