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
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.
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.
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:
- Select File => New from the menu bar.
- Select Project to display the New Project window.
- Select Tivoli Management Project from the left pane to display it in the right pane.
- Click on Tivoli Management Project in the right pane to highlight the name.
- Click Next to display the Project Name window.
- Enter a name for the project in the Project name text box (for example, Tutorial).
- Optionally, uncheck the Use default check box and specify a different directory location for the project.
- 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
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
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.
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
To use the Resource Model Builder to set filters:
- Double-click the Process field and enter
Process <> (not equal to) "Idle".
- Click OK.
Note: the process name is case sensitive.
- Click AND, then double click Process again.
- Now set the condition to not equal to (<>) _Total.
- Click OK.
Now when the resource model runs it will not include Idle or Total processes in the evaluation.
- 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.
- Double click PercentProcessorTime.
>(greater than) and
40for the PercentProcessorTime,
3for the number of occurrences before an event is triggered (this is the persistency check),
1for the number of allowed monitoring cycles, and
CRITICALfor the event severity. TEC and TBSM are not configured so uncheck those boxes.
- Click OK.
You should now see this set as an event trigger.
- Click Next.
Select properties to log
Select all of the properties so that they are logged. Click Finish.
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.
- Expand the Events tree and click EV_TMW_Process_PercentProcessorTime_too_high.
- Under the Attributes, you'll see
UpperBound (NUMERIC), and
- Add the ID property: Click Add and enter this attribute (ID) with the NUMERIC type.
- 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
can kill a process based on the ID number.
Add the automatic corrective action
- 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.
- 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.
- Finally, give it a descriptive name and description of your choice.
- Close all of the dialog boxes so you are back to the Resource Model Builder main panel.
Create the process termination script
- Keep the Resource Model Builder open (you'll come back to it).
- Go to a DOS prompt to create the command file.
to the directory you specified for the Shell Command in the
above exercise by entering
create the command file enter
- Enter the following commands:
@set /a INTEGER_PID=EV_TMW_Process_PercentProcessorTime_too_high_ID @c:\tmp\ntprocinfo.exe -k %INTEGER_PID%
- Save and exit. You will need to copy
\tmpdirectory for this to work. You can find this on a TMR server in the
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
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
available to MSDN subscribers in the Resource Kit.
To run CPU Stress:
- Go to Start => Run...
- 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:
- Right click on the Desktop and select Create/Shortcut.
- In the location field enter:
C:\WINNT\system32\CMD.EXE /k C:\WINNT\system32\drivers\etc\Tivoli\setup_env.cmd
- Click Next and name the shortcut
- 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
- Use the
wdmrmcommand 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
wdmrmat the prompt.
- To add a resource model, enter
wdmrm -add WizRM_TMW_Process_CPU.tar(if you named your resource something different use that name).
- To verify the resource model was added, enter
You can now create and distribute a profile with this Resource.
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.
- The Tivoli Software Information Center is the home for all the documents you'll need to get started with IBM Tivoli Monitoring Resource Models.
- IBM Tivoli Monitoring Version 5.1.1 Creating Resource Models and Providers is an IBM Redbook that will give you the knowledge to create much more powerful resource models.
- Stay current with developerWorks technical events and Webcasts.
Get products and technologies
- Build your next development project with IBM trial software, available for download directly from developerWorks.
Dig deeper into Tivoli (service management) on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Keep up with the best and latest technical info to help you tackle your development challenges.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.