Ibm tivoli monitoring version 5.1.1 creating resource models and providers sg246900
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Ibm tivoli monitoring version 5.1.1 creating resource models and providers sg246900

on

  • 764 views

 

Statistics

Views

Total Views
764
Views on SlideShare
764
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Ibm tivoli monitoring version 5.1.1 creating resource models and providers sg246900 Document Transcript

  • 1. Front coverIBM Tivoli MonitoringVersion 5.1.1Creating Resource Models and ProvidersPractical step-by-step developmentexamplesCreating cross-platform Javaresource modelsProvider engineering andimplementation Tony Bhe Kiyonobu Inayama Craig Lister Massimiliano Parlione Michael Vesichibm.com/redbooks
  • 2. International Technical Support OrganizationIBM Tivoli Monitoring Version 5.1.1Creating Resource Models and ProvidersAugust 2003 SG24-6900-00
  • 3. Note: Before using this information and the product it supports, read the information in “Notices” on page xvii.First Edition (August 2003)This edition applies to Version 5, Release 1, Modification 1 of IBM Tivoli Monitoring.© Copyright International Business Machines Corporation 2003. All rights reserved.Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADPSchedule Contract with IBM Corp.
  • 4. Contents Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix The team that wrote this redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Comments welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiPart 1. ITM fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1. IBM Tivoli Monitoring architecture . . . . . . . . . . . . . . . . . . . . . . . 3 1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2 High level architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3 Engine features and abilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.4 Endpoint integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.4.1 ITM data flow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.4.2 Directory structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5 ITM Engine architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.5.1 Engine input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.5.2 Engine output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.5.3 Engine components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Chapter 2. Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.2 Using Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.2.1 The Workbench panes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.2.2 Elements in Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.2.3 Looking at the PhysicalDiskModel . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.3 Creating Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 2.3.1 Creating Resource Models using the wizard. . . . . . . . . . . . . . . . . . . 46 2.3.2 Cloning existing Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . 60 2.3.3 Registering a Resource Model into ITM . . . . . . . . . . . . . . . . . . . . . . 61 2.4 Tools and extra information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 2.4.1 WorkBench command line interface . . . . . . . . . . . . . . . . . . . . . . . . . 62 2.4.2 Microsoft tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63© Copyright IBM Corp. 2003. All rights reserved. iii
  • 5. 2.4.3 Saxsoft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 2.4.4 Rhino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Chapter 3. Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3.1 Resource Model overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 3.1.1 Logical components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 3.1.2 Physical components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 3.1.3 Types of Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 3.2 Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 3.2.1 Resource Models for each platform . . . . . . . . . . . . . . . . . . . . . . . . . 77 3.2.2 Windows Resource Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 3.2.3 UNIX Resource Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Chapter 4. Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 4.2 Industry technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 4.2.1 Web-Based Enterprise Management (WBEM) . . . . . . . . . . . . . . . . 113 4.2.2 The Common Information Model (CIM). . . . . . . . . . . . . . . . . . . . . . 113 4.2.3 Managed Object Format (MOF) . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.2.4 CIM Provider layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 4.2.5 Windows Management Interface (WMI) . . . . . . . . . . . . . . . . . . . . . 115 4.2.6 Java Management Extensions (JMX) . . . . . . . . . . . . . . . . . . . . . . . 117 4.3 Tivoli implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 4.3.1 ITM Engine components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 4.3.2 Legacy support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 4.3.3 Touchpoint Service Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 4.3.4 CIM object definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 4.3.5 Tivoli ILT Provider Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 4.3.6 Tivoli Management Extensions for Java (TMX4J). . . . . . . . . . . . . . 133Part 2. Practical examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Chapter 5. Engineering a Java ILT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 5.1 Terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 5.2 Planning and design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 5.2.1 Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 5.2.2 CIM class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 5.2.3 ILT class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 5.2.4 Provider class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 5.2.5 Component reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 5.3 Implementing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 5.3.1 Managed Object Format (MOF) . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 5.3.2 ILT Java class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 5.3.3 Provider Java class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156iv IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 6. 5.3.4 Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1615.4 Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 5.4.1 Testing and importing the MOF. . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 5.4.2 Java compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 5.4.3 Making the jar file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 5.4.4 Assembling the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . 173 5.4.5 Building the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1745.5 ITSO_Sample template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 5.5.1 ITSO_Sample.mof. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 5.5.2 ITSO_SampleIlt.java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 5.5.3 ITSO_Sample.java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 5.5.4 Resource Model JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195Chapter 6. Creating an SNMP Resource Model for Windows . . . . . . . . . 2016.1 Designing the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 6.1.1 Design overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 6.1.2 What part of ITM will we use? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 6.1.3 Detailed design Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . 2046.2 Creating the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 6.2.1 Installing SNMP and WMI SNMP on the managed machine . . . . . 205 6.2.2 Creating the new SNMP Resource Model . . . . . . . . . . . . . . . . . . . 211 6.2.3 Packaging the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 6.2.4 Testing the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2236.3 ITSO_SNMP_Interface_Bps source code . . . . . . . . . . . . . . . . . . . . . . . . 225 6.3.1 ITSO_SNMP_Interface_Bps.vba . . . . . . . . . . . . . . . . . . . . . . . . . . 225Chapter 7. Creating an SNMP Resource Model for Java . . . . . . . . . . . . . 2317.1 Terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2327.2 Planning and design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 7.2.1 Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 7.2.2 CIM class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 7.2.3 ILT class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 7.2.4 Provider class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 7.2.5 Component reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2357.3 Implementing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 7.3.1 Managed object format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 7.3.2 ILT Java class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 7.3.3 Provider Java class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 7.3.4 Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2637.4 Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 7.4.1 Testing and importing the MOF. . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 7.4.2 Java compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 7.4.3 Making the jar file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Contents v
  • 7. 7.4.4 Assembling the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . 274 7.4.5 Building the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 7.5 ITSO_SnmpProbe source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 7.5.1 ITSO_SnmpProbe.mof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 7.5.2 ITSO_SnmpProbeILT.Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 7.5.3 ITSO_SnmpProbe.Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 7.5.4 SnmpInterface.Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 7.5.5 Resource Model JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Chapter 8. Creating a log-file Resource Model. . . . . . . . . . . . . . . . . . . . . 305 8.1 Engine component utilization: Overview . . . . . . . . . . . . . . . . . . . . . . . . . 306 8.2 Creating the MOF files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 8.3 Compiling the MOF file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 8.4 Creating the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 8.5 Constructing the Resource Model: Events . . . . . . . . . . . . . . . . . . . . . . . 325 8.6 Constructing the Resource Model: Dependencies . . . . . . . . . . . . . . . . . 327 8.7 Constructing the Resource Model: Inserting code . . . . . . . . . . . . . . . . . 328 8.8 The flow of the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 Chapter 9. Creating a log-file Resource Model and ILT . . . . . . . . . . . . . . 333 9.1 Designing the ITSO_LogfileLite Resource Model and ILT . . . . . . . . . . . 334 9.1.1 Design overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 9.1.2 What part of ITM will we use? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 9.1.3 The detailed design of the ITSO_LogfileLite Resource Model . . . . 338 9.2 Creating the ITSO_LogfileLite Resource Model and ILT. . . . . . . . . . . . . 341 9.2.1 Setting up the development environment . . . . . . . . . . . . . . . . . . . . 341 9.2.2 Creating the MOF file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 9.2.3 Creating the ITSO_LogfileLite ILT code . . . . . . . . . . . . . . . . . . . . . 345 9.2.4 Creating the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 9.2.5 Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 9.2.6 Testing the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 9.3 ITSO_LogfileLite source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 9.3.1 ITSO_LogfileLite.mof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 9.3.2 ITSO_LogfileLite-wmi.mof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 9.3.3 ITSO_LogfileLiteILT.java. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 9.3.4 ITSO_LogfileLite.java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 9.3.5 ITSO_LogfileLite_RM.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 Chapter 10. Creating a custom script Resource Model . . . . . . . . . . . . . . 411 10.1 Designing the ITSO_ProcessNum Resource Model . . . . . . . . . . . . . . . 412 10.1.1 Design overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 10.1.2 What part of ITM will we use? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 10.1.3 The detailed design of the ITSO_ProcessNum Resource Model . 413 10.2 Creating a custom script Resource Model . . . . . . . . . . . . . . . . . . . . . . 416vi IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 8. 10.2.1 Using the wizard to create a custom script Resource Model . . . . 416 10.2.2 Extending the functions of the Resource Model . . . . . . . . . . . . . . 421 10.2.3 Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 10.2.4 Testing the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 10.3 ITSO_ProcessNum source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 10.3.1 ITSO_ProcessNum.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 10.3.2 ITSO_ProcessNum.ksh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 Chapter 11. File monitoring Resource Model example . . . . . . . . . . . . . . 447 11.1 Engine component utilization: Overview . . . . . . . . . . . . . . . . . . . . . . . . 448 11.2 Compiling DMXFile MOF into Workbench. . . . . . . . . . . . . . . . . . . . . . . 449 11.2.1 Extraction of MOF from DMXFile resource monitor . . . . . . . . . . . 449 11.2.2 Strip UNIX control characters from the MOF file . . . . . . . . . . . . . . 450 11.2.3 Extraction of dependencies from the DMXFile resource monitor . 450 11.2.4 Compiling the MOF file to the CIM repository . . . . . . . . . . . . . . . . 450 11.3 Constructing the Resource Model: Dynamic Model . . . . . . . . . . . . . . . 459 11.3.1 Constructing the Resource Model: Events . . . . . . . . . . . . . . . . . . 464 11.3.2 Constructing the Resource Model: Parameters . . . . . . . . . . . . . . 467 11.3.3 Constructing the Resource Model: Dependencies . . . . . . . . . . . . 469 11.3.4 Constructing the Resource Model: Inserting code . . . . . . . . . . . . 470 11.3.5 The flow of the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476Part 3. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 Appendix A. Testing a Java Resource Model . . . . . . . . . . . . . . . . . . . . . . 481 ITM Engine tracing and clean-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 Debugging the Init function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483 Debugging the VisitTree function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 Simulating data Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Verifying the Resource Model logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Appendix B. Additional material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 Locating the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 Using the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 System requirements for downloading the Web material . . . . . . . . . . . . . 496 How to use the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 Abbreviations and acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 Other publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 Contents vii
  • 9. How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503viii IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 10. Figures 1-1 High level architecture view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1-2 ITM data flow diagram: all platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1-3 Windows LCFD directory structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1-4 Windows ITM directory structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1-5 UNIX directory structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1-6 Java ITM on UNIX directory structure . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1-7 ITM Engine components for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1-8 ITM Engine components for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1-9 Engine sub-components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1-10 Graph of holes and occurrences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2-1 Introduction of the Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2-2 Panes in the Workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2-3 TMW_PhsyicalDiskModel general settings . . . . . . . . . . . . . . . . . . . . . . 29 2-4 Example of descriptive name in a profile . . . . . . . . . . . . . . . . . . . . . . . . 30 2-5 PhysicalDiskModel general settings . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2-6 Opening the CIM browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 2-7 PhysicalDisk resource class definitions . . . . . . . . . . . . . . . . . . . . . . . . . 33 2-8 Profile indications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2-9 TMW_SlowPhysicalDrive event element settings . . . . . . . . . . . . . . . . . 36 2-10 PhysicalDiskModel thresholds in a profile . . . . . . . . . . . . . . . . . . . . . . . 38 2-11 PhysicalDiskModel HighPercentUsage threshold profile display . . . . . . 39 2-12 PhysicalDiskModel logging element profile display . . . . . . . . . . . . . . . . 40 2-13 PhysicalDiskModel percent disk usage element profile display . . . . . . . 41 2-14 Creating a Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2-15 Selecting JavaScript or Visual Basic . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2-16 Selecting the wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 2-17 Selecting the data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 2-18 Connecting to namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 2-19 Selecting a CIM class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 2-20 Selecting properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 2-21 Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 2-22 Specifying the event trigger condition . . . . . . . . . . . . . . . . . . . . . . . . . . 55 2-23 Entering the trigger condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 2-24 Selecting the properties to log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 2-25 Cycle time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 2-26 Saving the source file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 2-27 Building the package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 2-28 Building the TEC BAROC file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60© Copyright IBM Corp. 2003. All rights reserved. ix
  • 11. 2-29 Copying the package file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 3-1 Logical components of the Resource Model . . . . . . . . . . . . . . . . . . . . . 69 3-2 Sampling of volatile metric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 3-3 Physical components in the Resource Model . . . . . . . . . . . . . . . . . . . . 74 4-1 IT management methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 4-2 Management technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 4-3 JMX MBean server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 4-4 Management agent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 4-5 ITM Engine Logical Components (Java) . . . . . . . . . . . . . . . . . . . . . . . 121 4-6 Common logical components for Windows and Java . . . . . . . . . . . . . 122 4-7 ITM Engine Logical Components (Windows) . . . . . . . . . . . . . . . . . . . . 124 4-8 Logical components for Windows COM support . . . . . . . . . . . . . . . . . 125 4-9 Logical components for Windows WMI native support . . . . . . . . . . . . 127 4-10 Logical components for Windows and Java custom scripts. . . . . . . . . 128 4-11 Logical components for Windows and Java DM Classic . . . . . . . . . . . 128 4-12 Logical components for Windows and Java ILTs. . . . . . . . . . . . . . . . . 132 5-1 Java ITM Engine logical components . . . . . . . . . . . . . . . . . . . . . . . . . 142 5-2 ITM Workbench: about selected class . . . . . . . . . . . . . . . . . . . . . . . . . 144 5-3 ITM Workbench: General Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 5-4 ITM Workbench: Dynamic Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 5-5 ITM Workbench: parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 5-6 ITSO_Sample.tar: Resource Model Tar File . . . . . . . . . . . . . . . . . . . . 170 5-7 mofcomp output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 5-8 javac output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 5-9 javac output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 5-10 jar output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 5-11 ITM Workbench: Tree view pane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 5-12 ITM Workbench: Build menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 5-13 ITM Workbench: Save As . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6-1 Design overview of ITSO_SNMP_Interface_Bps Resource Model . . . 202 6-2 ITM Engine logical components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 6-3 Installing Optional Networking Components . . . . . . . . . . . . . . . . . . . . 206 6-4 Installing the SNMP Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 6-5 Enabling SNMP Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 6-6 Installing the WMI SNMP Provider. . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 6-7 Connect to namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 6-8 Browse for Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 6-9 Browse for Namespace to localhost . . . . . . . . . . . . . . . . . . . . . . . . . . 213 6-10 Selecting a class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 6-11 Selecting properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 6-12 Collection test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 6-13 Filter condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 6-14 Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217x IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 12. 6-15 Entering the trigger condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2186-16 Using the Proc drop down selector . . . . . . . . . . . . . . . . . . . . . . . . . . . 2196-17 Resource Model Tar File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2226-18 Step to cursor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2236-19 Quick Watch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2236-20 Debugging the Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2247-1 Java: ITM logical components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2367-2 ITM Workbench: About selected class. . . . . . . . . . . . . . . . . . . . . . . . . 2387-3 ITM Workbench: General Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2637-4 ITM Workbench: Dynamic Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2647-5 ITM Workbench: Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2657-6 ITSO_SnmpProbe.tar: Resource Model Tar File . . . . . . . . . . . . . . . . . 2707-7 mofcomp output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2717-8 SnmpInterface.java: javac output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2727-9 ITSO_SnmpProbe.java: javac output. . . . . . . . . . . . . . . . . . . . . . . . . . 2727-10 ITSO_SnmpProbeILT.java: javac output . . . . . . . . . . . . . . . . . . . . . . . 2737-11 jar output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2747-12 ITM Workbench: Tree view pane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2757-13 ITM Workbench: Build menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2767-14 ITM Workbench: Save As dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2778-1 Resource Model sub-components for Windows . . . . . . . . . . . . . . . . . 3068-2 Resource Model sub-components for Java . . . . . . . . . . . . . . . . . . . . . 3078-3 Workbench new Resource Model window . . . . . . . . . . . . . . . . . . . . . . 3098-4 Select VBA or JavaScript language . . . . . . . . . . . . . . . . . . . . . . . . . . . 3098-5 Workspace selection window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3108-6 Select data source window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3118-7 Connect to namespace window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3118-8 Username/password selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3128-9 Select a Class window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3128-10 MOF compiler action select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3138-11 MOF file path and namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3148-12 MOF compiler wizard update options window . . . . . . . . . . . . . . . . . . . 3158-13 MOF compile results window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3158-14 Resource Model Wizard: Select a Class window. . . . . . . . . . . . . . . . . 3168-15 Resource Model Wizard: Select Properties window . . . . . . . . . . . . . . 3178-16 Resource Model Wizard: Filtering window . . . . . . . . . . . . . . . . . . . . . . 3188-17 Resource Model Wizard: Specify the Event Triggering Conditions . . . 3198-18 Resource Model Wizard: Select the Properties to log window . . . . . . 3208-19 Resource Model cycle time data entry panel . . . . . . . . . . . . . . . . . . . . 3208-20 IBM Tivoli Monitoring Workbench main window . . . . . . . . . . . . . . . . . 3218-21 Dynamic Model data entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3228-22 Dynamic Model data entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3238-23 Dynamic Model data entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 Figures xi
  • 13. 8-24 IBM Tivoli Monitoring Workbench main window . . . . . . . . . . . . . . . . . 325 8-25 Event construction window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 8-26 IBM Tivoli Monitoring Workbench main window . . . . . . . . . . . . . . . . . 327 8-27 IBM Tivoli Monitoring Workbench main window . . . . . . . . . . . . . . . . . 328 9-1 Design overview of ITSO_LogfileLite Resource Model . . . . . . . . . . . . 335 9-2 Windows ITM Engine Logical Components . . . . . . . . . . . . . . . . . . . . . 337 9-3 UNIX ITM Engine Logical Components . . . . . . . . . . . . . . . . . . . . . . . . 337 9-4 Flowchart of ITSO_LogfileLite decision tree script. . . . . . . . . . . . . . . . 340 9-5 Setting the CLASSPATH environment variable . . . . . . . . . . . . . . . . . . 342 9-6 The relationship of the methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 9-7 Creating a new Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 9-8 Selecting data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 9-9 Connect to namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 9-10 Launching the MOF Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 9-11 Selecting a MOF file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 9-12 Completing the compile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 9-13 Selecting the class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 9-14 Trigger condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 9-15 Property of the ITSO_LogfileLite Resource Model . . . . . . . . . . . . . . . 364 9-16 Setting the alias name of the CIM class. . . . . . . . . . . . . . . . . . . . . . . . 365 9-17 Changing the event setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 9-18 Changing the threshold setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 9-19 Adding the ITSO_LogfileLite_Pattern parameter . . . . . . . . . . . . . . . . . 368 9-20 Adding the ITSO_LogfileLite_FileName parameter . . . . . . . . . . . . . . . 368 9-21 Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 9-22 Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 9-23 Category and Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 9-24 Parameter ITSO_LogfileLite_FileName . . . . . . . . . . . . . . . . . . . . . . . . 378 9-25 Parameter ITSO_LogfileLite_Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . 379 9-26 Event ITSO_LogfileLite_EventNum_too_high . . . . . . . . . . . . . . . . . . . 380 10-1 Design overview of ITSO_ProcessNum Resource Model . . . . . . . . . . 412 10-2 ITM Engine Logical Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 10-3 Flowchart of ITSO_ProcessNum Resource Model . . . . . . . . . . . . . . . 415 10-4 Creating a new ITM Workbench project. . . . . . . . . . . . . . . . . . . . . . . . 417 10-5 Selecting data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 10-6 Importing the custom script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 10-7 Trigger condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 10-8 Saving the Resource Model file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 10-9 ITM Workbench thermometer icon. . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 10-10 Changing properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 10-11 Opening the event setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 10-12 Changing the event setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 10-13 Changing the threshold setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427xii IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 14. 10-14 Adding the parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42810-15 Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43310-16 Category and Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43510-17 Parameter of the ITSO_ProcessNum . . . . . . . . . . . . . . . . . . . . . . . . . 43610-18 Event I of the ITSO_ProcessNum . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43711-1 Resource Model sub-components for Windows . . . . . . . . . . . . . . . . . 44811-2 Resource Model sub-components for Java . . . . . . . . . . . . . . . . . . . . . 44911-3 Workbench new Resource Model window . . . . . . . . . . . . . . . . . . . . . . 45111-4 Select VBA or JavaScript language . . . . . . . . . . . . . . . . . . . . . . . . . . . 45111-5 Workspace selection window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45211-6 Select data source window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45311-7 Connect to namespace window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45311-8 Browse For Namespace window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45411-9 Username/password selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45411-10 Select a class window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45511-11 MOF compiler action select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45611-12 MOF file path and namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45711-13 MOF compiler wizard update options window . . . . . . . . . . . . . . . . . . . 45811-14 MOF compile successful results window . . . . . . . . . . . . . . . . . . . . . . . 45811-15 MOF compile error results window . . . . . . . . . . . . . . . . . . . . . . . . . . . 45911-16 Resource Model Wizard: Select a Class window. . . . . . . . . . . . . . . . . 46011-17 Resource Model wizard properties selection window . . . . . . . . . . . . . 46111-18 Resource Model wizard triggering conditions selection window . . . . . 46211-19 Resource Model wizard filtering selection window. . . . . . . . . . . . . . . . 46311-20 Resource Model cycle time data entry panel . . . . . . . . . . . . . . . . . . . . 46311-21 IBM Tivoli Monitoring Workbench main window . . . . . . . . . . . . . . . . . 46411-22 Event construction window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46511-23 Event construction window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46611-24 IBM Tivoli Monitoring Workbench main window . . . . . . . . . . . . . . . . . 46711-25 Parameter data entry window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46811-26 Parameter data entry window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46811-27 IBM Tivoli Monitoring Workbench main window . . . . . . . . . . . . . . . . . 46911-28 IBM Tivoli Monitoring Workbench main window . . . . . . . . . . . . . . . . . 470A-1 The Quadcap Embeddable Server . . . . . . . . . . . . . . . . . . . . . . . . . . . 489A-2 Opening the database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Figures xiii
  • 15. xiv IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 16. Tables 2-1 Supported Resource Model type per operating system . . . . . . . . . . . . . 47 3-1 Resource Model types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 3-2 Windows Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 3-3 UNIX Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 3-4 OS/400 Resource Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 3-5 Memory Resource Model dependencies . . . . . . . . . . . . . . . . . . . . . . . . 85 3-6 Network Interface Card Resource Model dependencies . . . . . . . . . . . . 87 3-7 Parametric event log Resource Model dependencies . . . . . . . . . . . . . . 90 3-8 Parametric Services Resource Model dependencies . . . . . . . . . . . . . . 90 3-9 Parametric TCP/IP Ports Resource Model dependencies . . . . . . . . . . . 91 3-10 Logical Disk Resource Model dependencies . . . . . . . . . . . . . . . . . . . . . 91 3-11 Physical Disk Resource Model dependencies . . . . . . . . . . . . . . . . . . . . 92 3-12 Printing Resource Model dependencies . . . . . . . . . . . . . . . . . . . . . . . . 93 3-13 Process Resource Model dependencies . . . . . . . . . . . . . . . . . . . . . . . . 94 3-14 Processor Resource Model dependencies . . . . . . . . . . . . . . . . . . . . . . 95 3-15 Services Resource Model dependencies. . . . . . . . . . . . . . . . . . . . . . . . 96 3-16 TCP/IP Resource Model dependencies . . . . . . . . . . . . . . . . . . . . . . . . . 97 3-17 Table of correlated indications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 3-18 CPU Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 3-19 Memory Resource Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 3-20 File Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 3-21 Process Resource Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 3-22 Network Interface Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 3-23 File system Resource Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 3-24 Security Resource Model and file monitoring: Part 1 . . . . . . . . . . . . . . 105 3-25 Security Resource Model and file monitoring: Part 2 . . . . . . . . . . . . . . 106 3-26 Network RPC/NFS Resource Model (Sun Solaris specific) . . . . . . . . . 107 5-1 ILT supported classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 5-2 CIM class properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 6-1 The indication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 6-2 List of elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 7-1 CIM class properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 9-1 The parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 9-2 The indication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 9-3 A list of elements of the ITSO_LogfileLite Resource Model. . . . . . . . . 338 9-4 Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 9-5 An example of the values of the properties . . . . . . . . . . . . . . . . . . . . . 344 9-6 Operations in the ITSO_LogfileLite ILT . . . . . . . . . . . . . . . . . . . . . . . . 346© Copyright IBM Corp. 2003. All rights reserved. xv
  • 17. 9-7 Operations in the ITSO_LogfileLite Provider . . . . . . . . . . . . . . . . . . . . 353 9-8 The event of ITSO_LogfileLite_EventNum_too_high. . . . . . . . . . . . . . 366 9-9 The threshold definition for Thr_EventNum_gt . . . . . . . . . . . . . . . . . . 367 9-10 Dependency files for each platform . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 9-11 Summary of the useful trace and log files . . . . . . . . . . . . . . . . . . . . . . 382 10-1 The parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 10-2 The indication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 10-3 A list of elements of the ITSO_ProcessNum Resource Model . . . . . . 414 10-4 The event of Ev_process_num_becomes_very_high . . . . . . . . . . . . . 425 10-5 The event of Ev_process_num_becomes_high . . . . . . . . . . . . . . . . . . 426 10-6 The event definition for Ev_process_num_becomes_low . . . . . . . . . . 426 10-7 The threshold definition for Ev_process_num_becomes_veryhigh . . . 427 10-8 The threshold definition for Ev_process_num_becomes_high . . . . . . 428 10-9 The threshold definition for Ev_process_num_becomes_low . . . . . . . 428 10-10 ITSO_ProcessNum Resource Model scenarios . . . . . . . . . . . . . . . . . 438 A-1 Endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 A-2 RmProfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 A-3 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 A-4 Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 A-5 Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 A-6 Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 A-7 MetricsData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 A-8 CategoriesData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493xvi IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 18. NoticesThis information was developed for products and services offered in the U.S.A.IBM may not offer the products, services, or features discussed in this document in other countries. Consultyour local IBM representative for information on the products and services currently available in your area.Any reference to an IBM product, program, or service is not intended to state or imply that only that IBMproduct, program, or service may be used. Any functionally equivalent product, program, or service thatdoes not infringe any IBM intellectual property right may be used instead. However, it is the usersresponsibility to evaluate and verify the operation of any non-IBM product, program, or service.IBM may have patents or pending patent applications covering subject matter described in this document.The furnishing of this document does not give you any license to these patents. You can send licenseinquiries, in writing, to:IBM Director of Licensing, IBM Corporation, North Castle Drive Armonk, NY 10504-1785 U.S.A.The following paragraph does not apply to the United Kingdom or any other country where such provisionsare inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDESTHIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimerof express or implied warranties in certain transactions, therefore, this statement may not apply to you.This information could include technical inaccuracies or typographical errors. Changes are periodically madeto the information herein; these changes will be incorporated in new editions of the publication. IBM maymake improvements and/or changes in the product(s) and/or the program(s) described in this publication atany time without notice.Any references in this information to non-IBM Web sites are provided for convenience only and do not in anymanner serve as an endorsement of those Web sites. The materials at those Web sites are not part of thematerials for this IBM product and use of those Web sites is at your own risk.IBM may use or distribute any of the information you supply in any way it believes appropriate withoutincurring any obligation to you.Information concerning non-IBM products was obtained from the suppliers of those products, their publishedannouncements or other publicly available sources. IBM has not tested those products and cannot confirmthe accuracy of performance, compatibility or any other claims related to non-IBM products. Questions onthe capabilities of non-IBM products should be addressed to the suppliers of those products.This information contains examples of data and reports used in daily business operations. To illustrate themas completely as possible, the examples include the names of individuals, companies, brands, and products.All of these names are fictitious and any similarity to the names and addresses used by an actual businessenterprise is entirely coincidental.COPYRIGHT LICENSE:This information contains sample application programs in source language, which illustrates programmingtechniques on various operating platforms. You may copy, modify, and distribute these sample programs inany form without payment to IBM, for the purposes of developing, using, marketing or distributing applicationprograms conforming to the application programming interface for the operating platform for which thesample programs are written. These examples have not been thoroughly tested under all conditions. IBM,therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. You may copy,modify, and distribute these sample programs in any form without payment to IBM for the purposes ofdeveloping, using, marketing, or distributing application programs conforming to IBMs applicationprogramming interfaces.© Copyright IBM Corp. 2003. All rights reserved. xvii
  • 19. TrademarksThe following terms are trademarks of the International Business Machines Corporation in the United States,other countries, or both: AIX® Notes® Tivoli® ™ OS/400® Tivoli Enterprise™ ^™ Perform™ Tivoli Enterprise Console® eServer™ Redbooks™ TME® IBM® Redbooks (logo) ™ WebSphere® ibm.com® RMF™ NetView® S/390®The following terms are trademarks of other companies:Intel, Intel Inside (logos), MMX, and Pentium are trademarks of Intel Corporation in the United States, othercountries, or both.Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in theUnited States, other countries, or both.Java and all Java-based trademarks and logos are trademarks or registered trademarks of SunMicrosystems, Inc. in the United States, other countries, or both.UNIX is a registered trademark of The Open Group in the United States and other countries.SET, SET Secure Electronic Transaction, and the SET Logo are trademarks owned by SET SecureElectronic Transaction LLC.Other company, product, and service names may be trademarks or service marks of others.xviii IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 20. Preface This IBM Redbook focuses on creating Resource Models (RMs) and Providers for the IBM® Tivoli® Monitoring Version 5.1.1 infrastructure. The ITM Workbench is used for developing, debugging, and packaging Resource Models for IBM Tivoli Monitoring. You will learn how to use the step-by-step wizards provided by the ITM Workbench to create RMs to monitor any number of your IT resources, including operating systems, databases, hardware resources, and applications. In addition, you will learn how to use the step-by-step instructions to bind groups of Resource Models into deployable PACs using the ITM Toolkit. Upon completion, you will be able to create, test, and deploy monitoring solutions, quickly and efficiently creating an autonomic environment.The team that wrote this redbook This redbook was produced by a team of specialists from around the world working at the International Technical Support Organization, Austin Center. Tony Bhe is an IT Specialist in the United States. He has eight years of experience in the IT industry with seven years of direct Tivoli Enterprise™ products experience while working for IBM. He holds a degree in Electrical Engineering from North Carolina State University in Raleigh, North Carolina. His areas of expertise include Tivoli Performance and Availability and Tivoli Configuration and Operations. He has spent the last three years working as a Tivoli Integration Test Lead, and one year prior to that as a Tivoli Services consultant for Tivoli Performance and Availability products. Kiyonobu Inayama is an IT Specialist working at IBM Japan. He has eight years of experience mainly in systems and network management, architecting solutions, and consulting for IBM customers. He also teaches IBM classes in Japan on the areas of systems and network management. His areas of expertise include Tivoli Performance and Availability Management: server monitoring, transaction performance, and network management. Kiyonobu holds a bachelors degree in Computer Science from Nagoya University, Japan. Craig Lister is a Tivoli Analyst with StGeorge Bank in Australia. He has twenty years of experience in the IT industry. His areas of expertise include ITM, DM, and TEC rule writing, and has a passion for Perl. Massimiliano Parlione is a Software Engineer in the IBM Tivoli Software lab in Rome, Italy. He has been with IBM Tivoli Software since April 2000. He worked© Copyright IBM Corp. 2003. All rights reserved. xix
  • 21. in the teams that developed and designed Tivoli Java™ Management Extensions (TMX4J), Tivoli Web Component Manager (TWCM), and ported ITM Version 5.1.1 on OS400 and OS2. Currently, he is working on the ITM 5.2 OEM Java engine. Before joining IBM, Mr. Parlione worked as an independent consultant for the Italian Research Council (CNR) and as an employee of the “Regione Marche” regional government. He received his degree (“laurea”) in Computer Science from the University of LAquila, Italy, in July 1995 and a doctorate in Computer Science from the University "La Sapienza" of Rome in April 2000. He is co-author of the Introducing IBM Tivoli Monitoring for Web Infrastructure, SG24-6618 redbook. Michael Vesich is a member of the Tivoli Services organization in North America. He has over fourteen years experience in the information systems field with nine years in software development. Prior to joining IBM in 1998, Michael worked for Kvaerner Engineering, initially as an Automation Engineer developing real-time industrial process control systems and later becoming the I.T. Director for the Merrillville facility. Since joining IBM, he has focused on the Performance and Availability product set, with a more recent role as an ITM Subject Matter Expert. He has contributed to the Tivoli Certification program, Business Partner enablement, and was the initial developer of the Tivoli Knowledge Toolkit. Thanks to the following people for their contributions to this project: Joanne Luedtke, Edson Manoel, Stephen Hochstetler, Lupe Brown, Wade Wallace, and Chris Blatchley International Technical Support Organization, Austin Center Wade Allen Software Developer, IBM Software Group Kevin P. Ferguson Software Developer, IBM Software Group Steve Gutierrez Software Developer, IBM Software Group Jason Hooper Senior Software Engineer, IBM Software Group Bill Horne Software Developer, IBM Software Group Richard F. Reed Systems Integrator Consultant, IBM Software Groupxx IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 22. Theo Winkelmann Technical Evangelist, IBM Software GroupBecome a published author Join us for a two- to six-week residency program! Help write an IBM Redbook dealing with specific products or solutions, while getting hands-on experience with leading-edge technologies. Youll team with IBM technical professionals, Business Partners and/or customers. Your efforts will help increase product acceptance and customer satisfaction. As a bonus, youll develop a network of contacts in IBM development labs, and increase your productivity and marketability. Find out more about the residency program, browse the residency index, and apply online at: ibm.com/redbooks/residencies.htmlComments welcome Your comments are important to us! We want our Redbooks™ to be as helpful as possible. Send us your comments about this or other Redbooks in one of the following ways: Use the online Contact us review redbook form found at: ibm.com/redbooks Send your comments in an Internet note to: redbook@us.ibm.com Mail your comments to: IBM Corporation, International Technical Support Organization Dept. JN9B Building 003 Internal Zip 2834 11400 Burnet Road Austin, Texas 78758-3493 Preface xxi
  • 23. xxii IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 24. Part 1Part 1 ITM fundamentals In this part, we introduce the architecture and theory behind the IBM Tivoli Monitoring Version 5.1.1 product, and provide definitions of the intricate pieces of the product, including the different types of Providers. Specifically, we cover the following topics: IBM Tivoli Monitoring Architecture IBM Tivoli Monitoring Workbench Resource Models Providers© Copyright IBM Corp. 2003. All rights reserved. 1
  • 25. 2 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 26. 1 Chapter 1. IBM Tivoli Monitoring architecture This chapter provides an overview of the IBM Tivoli Monitoring Version 5.1.1 engine architecture, as well as references to the components that support the engine. Subsequent chapters will provide specific details on the components related to the creation of custom IBM Tivoli Monitoring Version 5.1.1 instrumentation.© Copyright IBM Corp. 2003. All rights reserved. 3
  • 27. 1.1 Overview IBM Tivoli Monitoring Version 5.1.1 (ITM) is a Resource Model based monitoring infrastructure that provides Resource Models for best practice monitoring of common resources. ITM also provides System Administrators a means to extend its monitoring capabilities by providing the ability to create and import custom Resource Models and dynamically pluggable instrumentation. The focus of this redbook is on the methods used to extend the monitoring capabilities of the product through the use of IBM Tivoli Monitoring Workbench 5.1.1 (ITMWB), which is supplied with the product, and through the development of custom Java instrumentation. After the development of a custom Resource Model is complete, the package created by the ITMWB can be installed into your Tivoli Enterprise environment from the command line. Once installed into the Tivoli Enterprise environment, the new Resource Model can then be used in the same manner as the ITM provided Resource Models.1.2 High level architecture Figure 1-1 on page 5 gives a high level overview of the full data flow of IBM Tivoli Monitoring Version 5.1.1. You will note that the flow commences with either the distribution of a supplied Resource Model or the development of a custom Resource Model from ITMWB, and completes with the measured metrics being supplied to one or all of the following: IBM Tivoli Data Warehouse IBM Tivoli Web Health Console IBM Tivoli Event Console The cycle of instrumenting and reporting will repeat, with the above outputs, until the ITM Engine is stopped.4 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 28. Trend Analy sis CuCu Trend Ana lysis s t s to om m ize ize/ De /D Dis Data Warehouse Data Warehouse Profile Profile D fa e is t r tri ib ulfau bu utRollup ts lt s te e Rollup y Web Health la Web Health TMR TMR TMR TMR D isp Display Console Console Ge tD ITM ITM ata ll Tivoli Event Console In s ta HeartBeat HeartBeat Get Data Endpoint Di Unix/Linux tall Resource In s st r Model ib Resource Design Distributeut Endpoint Endpoint Model e Endpoint Windows ITM Engine Uni x/Linux Create Windows Design , Create, Deb ug NT/2000 NT/2000 Debug ITM Engine ITM Engine ITM Engine Workbench WorkbenchFigure 1-1 High level architecture view1.3 Engine features and abilities ITM eliminates the need to transfer large amounts of diagnostic data back to a central location for evaluation. On each localized endpoint, it has the ability to: Perform root-cause analysis Isolate individual faults Initiate programmed corrective actions The ITM Engine is able to initiate the following functions on the endpoint: Event analysis Chapter 1. IBM Tivoli Monitoring architecture 5
  • 29. Event correlation (Windows® only) Event aggregation Event management Data logging The engine’s ability to perform these functions locally is what frees the system administrators from the analysis of multiple data sources, including large log files, event logs, and performance metrics, to detect resource failures and bottlenecks. A further extension of the local engine’s capabilities is obtained when the data logging feature is used in conjunction with IBM Tivoli Data Warehouse. This enables system administrators to gain a trend analysis tool for any resource profile from which data logging is enabled. All instrumentation sources for ITM are provided to the engine through a Common Information Model (CIM) interface. In a Windows environment, this is provided by Microsoft®’s implementation of CIM, Windows Management Instrumentation (WMI). The UNIX® component of CIM is provided via IBM Tivoli’s own CIM implementation, which is called Touchpoint.1.4 Endpoint integration There are several aspects that make up the ITM integration with the Tivoli Endpoint. It helps to be able to identify these aspects in order to aid in problem diagnosis. First, understanding the flow of information through the endpoint to the ITM components will assist in determining which components may be at fault; is the problem high level (TMR or specifically MDist2), mid-level (the assigned Gateway), or low-level (the Endpoint or ITM Engine itself)? Second, the directory structures of the engine will define which files or paths should be investigated when a problem is believed to be on the endpoint directly.1.4.1 ITM data flow It is helpful to understand the flow of configuration information as it relates to the ITM components. Figure 1-2 on page 7 provides a high level view of the ITM Engine upon which later chapters will provide additional granularity.6 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 30. Data Flow TME 1 LCF ITM Engine 2 3 Event Analyzer Handling ITM Engine 4 TMWService (Java Class) 5 Platform Specific CIM Implementations Reference s ITM Logical Diagrams: Touchpoint (Java) -or- WMI (Windows) Provider Layer Resources (OS & Applications)Figure 1-2 ITM data flow diagram: all platforms Chapter 1. IBM Tivoli Monitoring architecture 7
  • 31. Figure 1-2 on page 7 contains five boxes numbered one through five. Each of these boxes represents a data flow and is defined in the subsequent numbered lists. Each list number represents the number in the box in Figure 1-2 on page 7. 1. Management Framework & Endpoint Management [M9] information (that is, Reference Model and Parameters) and Manageability [M12] information (that is, Dynamic Model) reach the endpoint through a conduit, currently the Tivoli Endpoint agent, LCFD. 2. ITM Engine The ITM Engine works as a façade between the LCFD and the ITM components. It receives Tmw2k profile distributions and configuration changes from the LCFD and configures the management function, the analyzer component, with the management information, Resource Model and parameters, and the Touchpoint with the manageability information, and Dynamic Model. 3. Dynamic Model The Dynamic Model is loaded in the Touchpoint. The manageability information presented in M12 MOF format will be loaded in the underlying CIMOM. 4. Analyzer The Analyzer component is actually a script engine, which means the configuration that it receives from the façade is presented in script form. In this script, the TMWService object is instantiated and initialized with information about the resource that it needs to collect metrics on. At run time, the code inside the script invokes the collect method of TMWService, which in turn accesses the Touchpoint to collect the resource metrics. 5. TMWService a. Java platform Driven by the script, TMWService Java class accesses the Touchpoint using the Touchpoint service layer (TSL) interface on Java to collect the resource metrics. b. Windows platform Driven by the script, the TMWService COM object accesses the WMI using the WMI APIs to collect the resource metrics. The metrics may be direct WMI Providers or ILT compliant Providers utilizing the Tivoli Touchpoint Java engine. The metric data collected is reported back to the Resource Model script where it is processed according to the best practices coded within the script. An event handling component is then used to allow the analyzer to communicate the result of the best practices appliance to other components.8 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 32. CIM components and the Provider layer The Common Information Model (CIM) allows the ITM Engine to handle system resources in an industry standard object oriented fashion, while the Provider layer allows for dynamically pluggable instrumentation within the ITM Engine. The concepts and technologies behind the CIM implementation and the Provider layer are discussed at length in Chapter 4, “Providers” on page 109. Resources Resources refers to the physical resources that the Provider components provide instrumentation for. Instrumentation is handled through either operating system libraries or Application Programming Interfaces (APIs), such as Java or vendor supplied APIs. Such resources include, but are not limited to, the following: System hardware Operating system Applications1.4.2 Directory structures When troubleshooting, it is important to know where to find the files you need. This section will give some insight into where log files and other ITM components are located. Windows platform Figure 1-3 on page 10 corresponds to the Framework (LCFD) components of the endpoint. The primary log file, lcfd.log, can be found in the lcfdat1 directory. This log file can prove to be very useful while diagnosing many problems. Chapter 1. IBM Tivoli Monitoring architecture 9
  • 33. Figure 1-3 Windows LCFD directory structure It is also important to note that the lcfbinw32-ix86JREDMAE directory is where Java is installed by default when you distribute a profile from the command line using the wdmdistrib command and the -J switch.10 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 34. Another directory of interest is lcfbinw32-ix86tools. This is where all the tooltype programs (perl, bash, ntprocinfo, and so on) reside.Figure 1-4 corresponds to the ITM components of the endpoint. The main ITMlog file resides in the lcfdat1LCFNEWTmw2k directory and is namedTmw2k.log. It is in here that you will find most of your ITM debugging informationwhen you run into problems.Figure 1-4 Windows ITM directory structureAnother useful file is located in lcfdat1LCFNEWAMGlogs and is namedlogging.properties. This file is a Java config file that gives you the ability to initiatelogging for the various Java modules. This is easily done by looking for linessuch as islogging=False and changing them to islogging=true, and thenrestarting the ITM Engine.You will notice another directory under the preceding directory called log files.This directory relates to the log file adapter Resource Model discussed later inthis book. It is in this file that the offsets are stored when reading log files. If theengine is stopped and Java is also stopped, you can remove this file. When the Chapter 1. IBM Tivoli Monitoring architecture 11
  • 35. engine restarts, the ITM log file adapter will start reading from the beginning of your log file. In the directory lcfdat1LCFNEWAMWlogs, you will find three other log files named ILTManagerForJava1.log, trace_ILTManagerForJava.log, and msg_ILTManagerForJava.log. These can be useful when debugging Java ILT issues. If you have enabled logging in your profile, then the directory lcfdat1LCFNEWTmw2kdb is where the log information is written on a Windows endpoint and stored in a Microsoft Access database. The lcfdat1LCFNEWTmw2kDec directory is particularly interesting. This directory is where your code, be it VBA or Java, is stored on the local endpoint. If you stop your ITM Engine by use of the wdmcmd -stop -e <endpointname> command, you are able to make changes to this script on the local endpoint. You will then be able to restart the ITM Engine and validate your changes. This can be a great time saver, as you do not have to go all the way out to the ITMWB and back through the distribution process. In the lcfdat1LCFNEWTmw2kMof directory, you will find your MOF files that you compiled from the ITMWB. There is also a directory within this tree named compiled. It houses the locally compiled MOF files. So if your MOF file is in the top directory but not in the compiled directory, then you know that you have a problem. Finally, the lcfdat1LCFNEWTmw2kUnixClassesWizGenRM directory is the storage area for any dependant jar files that you may have included in your Resource Model. Java platform on UNIX Figure 1-5 on page 13 corresponds to the Framework (LCFD) components of the endpoint. The main LCFD log file, lcfd.log, can be found in the lcfdat1 directory. This log file can prove to be very useful while diagnosing many problems. It is also important to note that lcfbinaix4-r1JREDMAE is where Java is installed by default when you distribute a profile from the command line using the wdmdistrib command and the -J switch.12 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 36. Figure 1-5 UNIX directory structureIt is in the lcfdat1LCFNEWAMWlogs directory, in Figure 1-6 on page 14,where you will find the trace_dmxengine.log, msg_dmxengine.log,trace_dmxeu.log and trace_dmxntv.log log files. The file that will be most useful Chapter 1. IBM Tivoli Monitoring architecture 13
  • 37. is trace_dmxengine.log. This file is the equivalent to the Windows endpoint Tmw2k.log. The best way to view the file, as it is XML formatted, is to open the file in a text editor and set word wrap on. Figure 1-6 Java ITM on UNIX directory structure14 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 38. Another useful file is located in lcfdat1LCFNEWAMGlogs and is named logging.properties. This file is a Java config file, which give you the ability to instigate logging for the various Java modules. This is easily done by looking for lines like islogging=False and changing it to islogging=true, and then restarting the ITM Engine. If you have enabled logging in your profile, then the lcfdat1LCFNEWTmw2kUnixdataITMLoggerdblogger directory is where the log information is written on a UNIX endpoint. The logging information is stored in an Open Source Database by Quadcap Software. The lcfdat1LCFNEWTmw2kUnixDec directory is particularly interesting. It is here that your code, be it VBA or Java, is stored on the local endpoint. If you stop your ITM Engine by use of the wdmcmd -stop -e <endpointname> command, you are able to make changes to this script on the local endpoint. After restarting the ITM Engine, you can then validate your changes. This can be a great time saver, as you do not have to go all the way out to the ITMWB and back through the distribution process. Finally, the lcfdat1LCFNEWTmw2kUnixClassesWizGenRM directory is the storage area for any dependant jar files that you may have included in your Resource Model.1.5 ITM Engine architecture Figure 1-7 on page 16 highlights the logical components that comprise the Windows platform ITM Engine. Chapter 1. IBM Tivoli Monitoring architecture 15
  • 39. Windows, ITM Engine Logical Components Analyzer Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model TMWService WMI APIs WMI (CIMOM) DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) ILT ILT JMX ILT Provider MBean Providers JNI Server Binary Resource Resource Resource Resource Resource MBean1 Library Resources (OS & Applications) Figure 1-7 ITM Engine components for Windows Figure 1-8 on page 17 highlights the logical components that comprise the Java platform ITM Engine.16 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 40. Java, ITM Engine Logical Components Analyzer Resource Resource Resource Resource Resource Model Model Model Model Model DM Classic Monitor Probes Service Object Launch (Class Loader) Custom Scripts Java Class Loader ILT ILT JMX ILT Provider MBean Providers JNI Server Native Resource Resource Resource MBean(s) Binaries Resources (OS & Applications) Figure 1-8 ITM Engine components for Java1.5.1 Engine input To get the engine to monitor your endpoint, you need to create a profile that contains at least one Resource Model and distribute it to the endpoint. A Resource Model is a way of monitoring certain properties of the endpoint to which the profile, which contains the Resource Model, is distributed. The data is derived through the Service Object API using WMI or CIM from the endpoint’s operating system. When the Resource Model is distributed to the endpoint, the following types of files are placed in the directories described in 1.4.2, “Directory structures” on page 9 and “Java platform on UNIX” on page 12: Managed Object Format (MOF) Visual Basic or JavaScript Chapter 1. IBM Tivoli Monitoring architecture 17
  • 41. Dependent jar files A Resource Model may have the following elements defined depending on the desired functionality: Visual Basic or JavaScript, as contained in the VisitTree function Events Thresholds Parameters Logging Dependencies The script component Every Resource Model requires some programatic instructions on how to deal with the metric data supplied. It needs to compare these values against your thresholds and decide when it is appropriate to generate the alerting events. The public function VisitTree contains your monitoring algorithm, which will be called cyclically, as specified in your Resource Model. Events and thresholds Each Resource Model can include one or more events which will be checked against its corresponding threshold. Each period cycle, the monitored resource is checked against the specified numeric threshold. If the threshold is exceeded, then an event will be escalated. Events can have many causative indications or only one. If there are many indications, they must be aggregated before they trigger an event. If the indication does not exceed its particular threshold, it is called a hole. Holes are used to reset indications. In other words, if an indication exceeds its threshold for three cycles in a row without any holes, then an event would be generated. If, on the second cycle, the threshold was not exceeded, then the engine would restart the threshold breech count. This examples assumes that you have configured the indications and holes for the Resource Model to be 3 and 0, respectively. Parameters While thresholds must be numeric, parameters can be multiple numeric or alpha characters. You are able to customize your Resource Models by coding the parameters in ITM Workbench as defaults or they can be entered at profile definition time.18 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 42. Dependencies When using ITM Workbench, you can include any scripts, platform dependant binary libraries, such as Dynamic Link Libraries (DLL), or Java classes and packages that may be intrinsic to your Resource Model. Anything that is included this way is automatically installed on your endpoint when the profile is distributed.1.5.2 Engine output When you have a successful distribution of your profile, the engine will start running and providing information or output. It will take the form of events, data logging, and engine trace logs for debugging. Events The engine will provide two sorts of informational events. The alerting event and, when the metric has gone back within your defined thresholds, a clearing event. It is important to note that if you indicate, in your profile, that you wish to receive clearing events, then only one alerting event will be issued. Without clearing events, an alerting event will be issued each time your thresholds are exceeded. Logging of metric data The output data attributes obtained from the operating system on your endpoints by the Resource Model is able to be retained in a database on each endpoint. Windows NT® systems must have the Microsoft Access 2000 Jet engine installed to utilize this feature. This Jet engine is available from Microsoft’s Web site as a download called MDAC. UNIX systems use an open source Java RDBMS. Any metrics that you wish to log for historical purposes must be predefined in your Resource Model by setting the appropriate fields. Logging is enabled in the profile before it is distributed to the endpoint. A maximum of 24 hours aggregated data is retained and is viewable by using the Health Console. If more data that this is needed, then ITM Data Warehouse would need to be installed. Engine trace logs As the engine carries out its monitoring work, you are able to set various levels of tracing using the following command: wdmtrceng -e endpoint logfilelocation/name trace level size where: endpoint is your endpoint name. logfilelocation/name is in the form of c:yourdirtmw2k.log. Chapter 1. IBM Tivoli Monitoring architecture 19
  • 43. trace level is from 0 to 3. size is the number of bytes to dedicate to log length. If you use log level 3, make sure that you make this a large number, as output is very verbose and the log may wrap around before you get your details.1.5.3 Engine components The ITM Engine is composed of the following: Scheduler Analyzer Event aggregator Event correlator Logger Action manager Provider layer Figure 1-9 demonstrates how the sub-components interact. Analyzer ITM5.1.1 Engine Components Interpreter Service Object Decision Tree Scheduler TEC or TBSM (COM orJava) (VBA or JS) Correlator Event Action (Windows Logger Aggregator Manager Only) CIM Implementation Providers - ILTs Providers - ILTs System Resources BackOffice Applications (CPU, Memory, Disks etc)Figure 1-9 Engine sub-components20 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 44. SchedulerAny profile, when distributed to endpoints, can be scheduled to run at specifiedtimes. As an example, an Administrator may only want a profile to run fromMonday through Friday. Maintaining this would be the scheduler’s function. Anynumber and combination of rules can be employed.Note that the time zone utilized is always local to the endpoint. Additionally, thetime that the event occurred is always the local time of the endpointAnalyzerThe Resource Model contains parameters, thresholds, and metrics. It is the jobof the analyzer to compare the measurements provided from WMI or CIM anddecide what indications are to be referred to the event aggregator.A simple example of this would be the monitoring of disk space on an endpointand with a set threshold of 80% capacity. The analyzer would compare thereading from the endpoint disk sub-system to your threshold and send thisindication to the event aggregator.Event aggregatorWhen an indication is received from the analyzer, it does not neccessarily meanthat an alert event will be generated. The aggregator must calculate thepersistence of the problem.The event aggregator collects all indications coming from all decision treescurrently running, and consolidates them based on the aggregation rules that areconfigured in the profile. The aggregation rules are controlled by the occurrencesand holes that are configured in the IBM Tivoli Monitoring profile. An occurrenceis the term used to refer to a cycle during which an indication occurs for a givenResource Model (an “above threshold” cycle). A hole is the term used to refer toa cycle during which an indication does not occur (a “below threshold” cycle). Ifthe persistence of an indication meets the configured number of occurrences, anevent is generated and sent to the event correlator. If the profile is configured tosend events to Tivoli Enterprise Console® for a particular indication, then theevent aggregator is responsible for sending the event to Tivoli EnterpriseConsole. However, all events generated by the event aggregator are sent to theevent correlator, irrespective of whether it is configured to send events to TivoliEnterprise Console.To better understand the concept of holes and occurrences please refer toFigure 1-10 on page 22.You will note in Figure 1-10 on page 22 that an event will be issued at the pointon the graph called Indication #4. The indication count is not cleared by the hole Chapter 1. IBM Tivoli Monitoring architecture 21
  • 45. after Indication #1 as it is followed by Indication #2. Only two consecutive holes clears the indication count, and, in this case generates a clearing event. In dica tion # 4 Indication #3 metric values In dica tion # 1 Ind ication #2 . . threshold . . 2 consecutive holes C learing eve nt } C ycle Time tim e Ma x # o f hole s is 1 and they are not co nse cutive Figure 1-10 Graph of holes and occurrences Event correlator There will usually be more than one Resource Model running on an endpoint. They will produce many events. The correlator uses its set of static rules to perform a correlation between the events. An example of this would be the TMW_ProcessHoggingCPU event. This is composed of the two indications, TMW_ProcessHighCPU from the Process Resource Model and TMW_HighProcesses from the Processor Resource Model. Logger The logger is responsible for collecting performance data on the endpoint and storing the data locally. The logger handles multiple Resource Models that are distributed to an endpoint and that have been defined by Workbench to output logging. It also handles the way data is collected, that is, aggregated data (minimum, maximum, or average values) or raw data. The logger is also responsible for clearing the oldest records in the database. Nightly, around midnight, a data purging process is executed, which removes all data over 24 hours old. Though only 24 hours of data can be viewed, there are times when this database has almost 48 hours of data. This situation exists just prior to the midnight purging process. By default, logging is turned off. Windows NT systems must have the Microsoft Access 2000 Jet engine installed to utilize this feature. UNIX systems use an open source Java RDBMS.22 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 46. Action managerThis component is responsible for executing corrective actions (tasks and built-inactions) when a Resource Model detects a problem. It executes the actions thatthe user has associated to a particular indication. There are a number of waysthat the action manager executes the actions. Built-in actions are implementedas methods of Resource Models and they are executed through the WMI. Tivolitasks are the classic Tivoli tasks that the user can associate with a particularindication through the IBM Tivoli Monitoring profile GUI. The action manager alsogenerates an ActionResult or a TaskResult indication that is received by theTivoli Enterprise Console adapter and then forwarded to the Tivoli EnterpriseConsole server.Provider layerThe Provider layer is not a single component, but an implementation of aservices layer that supports dynamically pluggable instrumentation. Suchinstrumentation is designed to “provide” performance data and or operablemethods to a defined system resource. The Provider technologies areobject-oriented in design and therefore represent only a specific resource. Thatis, a Provider may exist to supply performance statistics on the CPU of a host. Insuch a real-world example, such a Provider would instantiate each CPU as itsown object.Due to the complex nature of the technologies behind the Provider layer,Chapter 4, “Providers” on page 109 has been written to clarify not only theterminology and technologies, but the physical implementations as well. Chapter 1. IBM Tivoli Monitoring architecture 23
  • 47. 24 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 48. 2 Chapter 2. Workbench The Workbench is an Integrated Development Environment (IDE) for developing and modifying Resource Models for Tivoli Monitoring. This chapter details the steps, using elementary examples, used to develop and modify resource modes. A thorough understanding of the IBM Tivoli Monitoring architecture is recommended before reading the following sections. Chapter 1, “IBM Tivoli Monitoring architecture” on page 3 provides a complete overview of the IBM Tivoli Monitoring architecture. The following topics are discussed in this chapter: Introduction Using Workbench Creating Resource Models Tools and extra information© Copyright IBM Corp. 2003. All rights reserved. 25
  • 49. 2.1 Introduction The Workbench is a development environment to create and modify Resource Models. It is a software component of IBM Tivoli Monitoring that can be installed as a stand-alone component on the Windows platform. Figure 2-1 briefly shows how the Workbench works. Workbench PC TMR Server Workbench Register Build Package copy Package wdmrm .tar .tar ITM command Edit Source File BAROC BAROC wrb .baroc .baroc TEC .dmws command .dmjsws Figure 2-1 Introduction of the Workbench The Workbench keeps all customizing in a source file: .dmws for VBA-based Resource Models and .dmjsws for JavaScript-based Resource Models. As the most important output the Workbench produces a package in the format of a tar file. This package file includes all information necessary for the registration of the Resource Model, which is copied over to the TMR Server where IBM Tivoli Monitoring is installed. Then you can add it to the environment by using the wrmadd command. The Workbench also generates a few outputs: the BAROC file, the message catalog file, the script file, and so on. Note: Workbench is available through various methods. You can obtain it from the product CD-ROM or FixPack code. You can also obtain Workbench from the Tivoli Developer’s domain at the following URL: http://www-3.ibm.com/software/tivoli/info/pa/monitor/index.jsp We recommend you use the latest version of Workbench, because sample Resource Models are updated in the latest Workbench. In this redbook, we use the Workbench in the ITM5.1.1-Fixpack2 code, which has the latest sample Resource Models available.26 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 50. 2.2 Using Workbench Before creating the Resource Models, a quick review of the basics of the Workbench might be helpful. We will begin by exploring one of the simpler Resource Models shipped with IBM Tivoli Monitoring: the PhysicalDiskModel.2.2.1 The Workbench panes The Workbench is made up of three panes, as shown in Figure 2-2.Figure 2-2 Panes in the Workbench The panes are: Pane 1 The first pane contains most of the Resource Model elements that make up a particular model. These elements are ordered in a tree-like hierarchy. The root node of the tree is the name of the Resource Model and describes the model’s general settings. In this case, it is the TMW_PhysicalDiskModel. In most cases, any element in the tree can be opened by double-clicking on it. Some elements in the tree have multiple options associated with them. A Chapter 2. Workbench 27
  • 51. Right-clicking the mouse button on any element in the tree will list the associated options for that element. For example, right-clicking on the TMW_PhysicalDisk element under Dynamic Model/CIM Classes will display three options: Modify, Remove, and Collection Test. We will be illustrating the use of many of these options in Part II. Pane 2 This pane contains the decision tree script, which is based on Java or Visual Basic script code. The functions in this code are used to initialize, set configuration options, and run the decision tree logic. Pane 3 This pane is only used for models that interact with the Windows platforms (that is, CIM/WMI-based). When debugging a Resource Model, you see an aggregated event message generated by your Resource Model here. This pane is useful when debugging a Resource Model and can be used to display the aggregate status of event indications.2.2.2 Elements in Resource Models Using Workbench, you can see various elements in Resource Models. All Resource Models are made up of seven basic elements, as described below: The Dynamic Model Events Thresholds Parameters Logging Dependencies Decision tree script In Chapter 3, “Resource Models” on page 67, we will describe the elements of Resource Models in greater detail.2.2.3 Looking at the PhysicalDiskModel In this section, we describe how you can view each elements by using the PhysicalDiskModel.28 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 52. The properties of the PhysicalDiskModel To view the properties of a Resource Model, double-click on the root node object. In this case, it is the TMW_PhysicalDisk object. You can see the display depicted in Figure 2-3.Figure 2-3 TMW_PhsyicalDiskModel general settings The following are descriptions of the properties: Internal name This is the internal name of the Resource Model. Changes to this setting will automatically update the SetDefaultConfiguration function Svc.SetModelName method call in the decision tree script. See Figure 2-5 on page 31 for an example of these settings in the SetDefaultConfiguration function. The internal name can be retrieved in the VisitTree function by calling the Svc.GetModelName method. The name is composed of alphabetic characters and must start with a letter. No blanks are allowed. Descriptive name This is the name that appears in the IBM Tivoli Monitoring Version 5.1.1 profile list of Resource Models. See Figure 2-4 on page 30 for an example of the Descriptive Name in the profile. Chapter 2. Workbench 29
  • 53. Figure 2-4 Example of descriptive name in a profile Description This is the text that describes the Resource Model. This is used for documenting the Resource Model. These settings can be used to document the decision tree logic, as well as explain the threshold settings. Category internal name This name is the internal name for grouping Resource Models on the profile category display. All Resource Models that have the same category internal name will be displayed under the same category option, as seen in Figure 2-5 on page 31. Category descriptive name This is the name that is displayed in the profile category display. An example of this can be seen in the Category pull-down options in Figure 2-4.30 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 54. Cycle time This is the default cycle time for the Resource Model. This value can be changed in the profile before the profile distribution. This setting will change the Svc.SetCycleTime in the SetDefaultConfiguration function. See Figure 2-5 for the SetDefaultConfiguration function for the PhysicalDiskModel. This setting can also be retrieved in the VisitTree function using the Svc.GetCycleTime method. General info section <<GENERAL_INFO>> Svc.SetModelName "TMW_PhysicalDiskModel" Svc.SetProfileName "411749921" Svc.SetCategory "Windows" Svc.SetCycleTime 120 <<GENERAL_INFO>>Figure 2-5 PhysicalDiskModel general settingsMajor and minor version This is the internal version of the Resource Model.Supported platforms This is a list of the platforms that the Resource Model supports. The supported platforms are defined when the Resource Model is created.The properties created or modified from the general settings dialog willautomatically update the code in the SetDefaultConfiguration function, as seen inFigure 2-5.The Dynamic Model element of the PhysicalDiskModelThe PhysicalDiskModel Resource Model uses only one resource class, theTMW_PhysicalDisk class. We can look further at this class by opening the CIMbrowser supplied with the Workbench. See Figure 2-6 on page 32 for an exampleof opening the CIM browser. To open up the CIM browser, we will select theTMW_PhysicalDisk resource class under the Dynamic Model/CIM classeshierarchy. When opening up the CIM browser from the Workbench, the firstpop-up window is used to designate the CIM name space we want to open. ForWindows CIM/WMI-based models, always use root/CIMV2. ForUNIX/Linux-based Resource Models, you can use both root/CIMV2 androot/default. The next window displayed is a login window. This window alwaysdefaults to the signed-on user (just click OK). Chapter 2. Workbench 31
  • 55. Figure 2-6 Opening the CIM browser The CIM browser now displays all of the properties of the PhysicalDisk resource class defined in the PhysicalDiskModel. See Figure 2-7 on page 33. Note: The Workbench CIM browser does not automatically position the browser to the correct CIM class in the Classes window (the left pane), even though it displays all of the correct properties for the selected class. If another class is selected, all of the properties are erased from the selected properties window. It is important to cancel out of the browser in this scenario. However, if we are creating a new resource class, as will be demonstrated later, a new class will have to be selected.32 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 56. Figure 2-7 PhysicalDisk resource class definitions The following is an overview of property fields that make up the PhysicalDisk resource class settings: Class properties These are the attribute values (in CIM terminology, they are called properties) that are selected for processing. The SetDefaultConfiguration will have a Svc.DefineClass method call with all of the properties selected from this class. See Figure 2-1 on page 34 for the SetDefaultConfiguration function for the PhysicalDiskModel. The IBM Tivoli Monitoring analyzer will collect all of the properties that are in the selected list each cycle time. Collection info This is used to optionally set sort options for data that may need to be in sorted order. Filtering This is where optional filters can be placed on the collection process before the VisitTree function is called. For example, if we did not want to process any physical disks, where the PercentDiskTime property was less than 25 percent, we could add a WQL filter. The WHERE Clause field is passed to WMI as WQL code by the engine Chapter 2. Workbench 33
  • 57. to filter data that is to be returned. For more information on WQL, see 2.4.2, “Microsoft tools” on page 63. The properties created or modified from the Dynamic Model element will automatically update the code in the SetDefaultConfiguration function, as seen in Example 2-1. Example 2-1 PhysicalDiskModel Dynamic Model properties Dynamic Model section <<DATA_INFO>> Svc.DefineClass "CIM", "TMW_PhysicalDisk", "ROOTCIMV2:TMW_PhysicalDisk", "", "AvgDiskSecXfer,PercentDiskWriteTime,AvgDiskBytesXfer,DiskXfersSec,PercentDiskR eadTime,AvgDiskReadQLength,DiskReadBytesSec,DiskReadsSec,DiskBytesSec,CurrentDi skQLength,AvgDiskQLength,PercentDiskTime,AvgDiskWriteQLength,DiskWritesSec,Disk WriteBytesSec", "PhysicalDisk", "None", "", 0, 1 <<DATA_INFO>> The event element of the PhysicalDiskModel The PhysicalDiskModel has six event elements that are used by the decision tree, VisitTree, to send indications. These elements are defined in the Resource Model and define the event name along with all of the attributes of the event and the aggregation settings. Once the Resource Model is added to the Tivoli environment, the aggregation settings can be updated from a IBM Tivoli Monitoring profile, as seen in Figure 2-8 on page 35.34 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 58. Figure 2-8 Profile indications We will take a look at one of the event elements in this example. In the PhysicalDiskModel, the TMW_SlowPhysicalDrive indication is generated by the VisitTree function when the following property conditions are true: The CurrentDiskQLength property is greater than the threshold setting. The DiskBytesSec property is greater than the threshold setting. None of this logic can be found in the event element settings. This can only be derived from analyzing the VisitTree code, which we will be doing later in this chapter in Example 2-4 on page 42. The threshold values can be seen in the threshold elements discussed in the next section. The event element defines the properties that make up the event as well as the aggregation settings (holes and occurrences) that are used by the event aggregator. Figure 2-9 on page 36 is an example of the TMW_SlowPhysicalDrive event element in the Workbench. Chapter 2. Workbench 35
  • 59. Figure 2-9 TMW_SlowPhysicalDrive event element settings The following is an overview of the TMW_SlowPhysicalDrive properties: Internal name This is the internal name used for this indication. This name will be defined in the SetDefaultConfiguration function with the Svc.DefineEvent method. See Example 2-2 on page 37 for the SetDefaultConfiguration function for the PhysicalDiskModel. The internal name is referenced in the VisitTree function by the SvcSendEvent and Svc.SendEventEx methods. The SendEvent and SendEventEx methods pass indications to the event aggregator to determine what action to take. The internal name is also used as a prefix to variables passed to shell scripts. For example, if a Perl script is invoked as a response from the TMW_SlowPhysicalDrive, one of the variables that would be set in the Perl script at run time would be TMW_SlowPhysicalDrive_PercentDiskTime. Attributes These are the attributes of the event. If the event aggregator generates a TEC or TBSM event (based on holes and occurrences), these are the properties that will be passed into the slots of the TEC event and attributes of the TBSM event. These attributes are set in the VisitTree code before the SendEvent or SendEventEx methods are invoked.36 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 60. Aggregation settings This is where the aggregation keys are defined, along with the number of occurrences and holes for this indication.Notification These are the definitions for event notification. If the indication becomes an event based on the output of the event aggregator, these settings will be used to set the severity.String resources These settings are used for the attributes of the event to be sent. The descriptive name is the display name. The message is used to set the message slot for TEC events and attributes for TBSM events. In this example the message text is as follows: The physical drive @PhysicalDisk@ is too slow. @PhysicalDisk@ will be replaced with the PhysicalDisk variable set in the VisitTree routine.Actions The Actions button is used to define response actions for the event. CIM Methods and/or shell programs can be defined as response actions to the event element. If a response action is defined, it will run after event aggregation has determined that an event should be generated. For example, if TMW_SlowPhysicalDrive is set to three occurrences and zero holes and has a send_email.pl script defined as an action, then send_email.pl will run locally on the monitored machine after the third consecutive indication has occurred. Unlike compatibility mode scripts and scripts invoked by the Svc.Shell method, response actions do not have a time-out value.The properties created or modified from the event element will automaticallyupdate the SetDefaultConfiguration function, as seen in Example 2-2.Example 2-2 PhysicalDiskModel event element properties Event definition section<<EVENTS_INFO>>Svc.DefineEvent "TMW_SlowPhysicalDrive","CurrentDiskQLength,PercentDiskTime,AvgQLength,AvgReadQLength,AvgWriteQLength,DiskReadBytesSec,DiskWriteBytesSec", "PhysicalDisk"<<EVENTS_INFO>> Chapter 2. Workbench 37
  • 61. The threshold element of the PhysicalDiskModel The PhysicalDiskModel has three threshold elements that are used by the decision tree logic (that is, VisitTree) to determine if an indication should be sent. These elements are defined in the Resource Model and become part of the Resource Model tar file. Once they are added to the Tivoli environment they can be updated from an IBM Tivoli Monitoring profile, as seen in Figure 2-10. Figure 2-10 PhysicalDiskModel thresholds in a profile Figure 2-11 on page 39 is an example of the TMW_HighPercentUsage threshold element in the Workbench.38 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 62. Figure 2-11 PhysicalDiskModel HighPercentUsage threshold profile display The following is an overview of the HighPercentUsage properties: Internal name This is the internal name that is used by the VisitTree function to determine if a property has exceeded a threshold value. In the VisitTree function, the Svc.GetThreshold method is invoked to retrieve and compare this value. The threshold is defined in the SetDefaultConfiguration function by the Svc.DefineThreshold method. Remember the SetDefaultConfiguration definitions are updated automatically by the Workbench when we update the element in the elements pane (that is, pane 1). Default value This is the default value associated with the internal name. The HighQLength is 3 by default. Descriptive name This is the name that is used for the IBM Tivoli Monitoring profile display, as seen in Figure 2-10 on page 38. Description This is used for documentation purposes. The properties created or modified from the threshold element will automatically update the SetDefaultConfiguration function, as seen in Example 2-3. Example 2-3 PhysicalDiskModel threshold element properties Thresholds section <<THRESHOLDS_INFO>> Svc.DefineThreshold "HighBytesSec", 1572864.000000 Svc.DefineThreshold "HighQLength", 3.000000 Svc.DefineThreshold "HighPercentUsage", 90.000000 <<THRESHOLDS_INFO>> Chapter 2. Workbench 39
  • 63. The logging element of the PhysicalDiskModel The PhysicalDiskModel has three logging elements that are used by the decision tree logic (that is, VisitTree) to determine if an indication should be logged. Once they are added to the Tivoli environment, they can be updated from an IBM Tivoli Monitoring Version 5.1.1 profile, as seen in Figure 2-12. Figure 2-12 PhysicalDiskModel logging element profile display Figure 2-13 on page 41 is an example of the percent disk usage logging element in the Workbench.40 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 64. Figure 2-13 PhysicalDiskModel percent disk usage element profile displayThe following is an overview of the HighPercentUsage properties:Context This is the name that is passed as the first parameter of the Svc.LogInst or Svc.LogInstEx methods. This name is also the display name in the IBM Tivoli Monitoring Web Health Console.Resource This is the name that is used as the second argument of the Svc.LogInst and Svc.LogInstEx methods. This name is also what is displayed in the IBM Tivoli Monitoring Web Health Console historical data.Properties These are the properties that are to be logged under this this context/resource. The PhysicalDiskModel HighPercentUsage logging element has a key of PhysicalDisk. This can be seen in the graph in the Web Health Console.The decision tree script of the PhysicalDiskModelAs we have seen thus far, the PhysicalDiskModel is made up of four keycomponents: Dynamic Model elements, event elements, threshold elements, andlogging elements. We have been focusing on three specific elements: The TMW_SlowPhysicalDrive event element The HighQueueLength threshold element Chapter 2. Workbench 41
  • 65. The Percent Disk Usage_PhysicalDisk logging element It is the PhysicalDiskModel decision tree script code that ties these three elements together. The PhysicalDiskModel Decision Tree script is a Visual Basic script based model that uses Microsoft’s WMI to retrieve CIM data. WMI is Microsoft’s implementation of the CIM architecture on Windows machines. The VisitTree in the PhysicalDiskModel really only does three things: 1. It evaluates thresholds. 2. It generates indications. 3. It logs data. So, let us first look at how the TMW_SlowPhysicalDrive indication gets sent to the event aggregator. Note: Remember the event aggregator is not in the decision tree code. It is part of the IBM Tivoli Monitoring engine. The PhysicalDiskModel collects data from the WMI Performance Monitoring Provider (PerfProv). Most of the Windows-based Resource Models collect data from PerfProv as well. In the Dynamic Model element of the PhysicalDiskModel, all of the properties that are defined will be collected each cycle time before the VisitTree function is called. The TMW_SlowPhysicalDrive indication gets generated from the VisitTree function when the CurrentDiskQLength and the DiskBytesSec exceed their threshold values. The Percent Disk Usage_PhysicalDisk logging element gets processed on every cycle regardless of whether the threshold is met or not. We can follow the code for TMW_SlowPysicalDrive and the logging elements in Example 2-4. This code is an example of the PhysicalDiskModel code and has been modified for the purposes of this discussion.Example 2-4 PhysicalDiskModel example VisitTree1 Public Function VisitTree(Svc As Object) As Long2 Dim numAvgQLength As Long, numCurrentDiskQLength As Long, numAvgReadQLength As Long3 Dim numAvgWriteQLength As Long, bytDiskReadBytesSec As Long, bytDiskWriteBytesSec As Long4 Dim numDiskReadsSec As Long, numDiskWritesSec As Long, numDiskXfersSec As Long5 Dim numDiskBytesSec As Long, numPercentDiskTime As Long, numPercentDiskReadTime As Long6 Dim numPercentDiskWriteTime As Long, numTotalDisks As Long, flagHighPhysicalQLength As Long7 Dim flagHighPhysicalXferRate As Long, flagHighPhysicalReadRate As Long,8 flagHighPhysicalWriteRate As Long9 Dim flagHighPhysicalPercentTime As Long, i As Long10 Dim strPhysicalDisk As String1112 i = 042 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 66. 1314 numTotalDisks = Svc.GETNUMOFINST(“TMW_PhysicalDisk”)1516 Do While i < numTotalDisks17 flagHighPhysicalQLength = 018 flagHighPhysicalXferRate = 019 flagHighPhysicalReadRate = 020 flagHighPhysicalWriteRate = 021 flagHighPhysicalPercentTime = 02223 strPhysicalDisk = Svc.GetStrProperty(“TMW_PhysicalDisk”, i, “PhysicalDisk”)2425 If strPhysicalDisk <> “_Total” Then26 strPhysicalDisk = Mid$(strPhysicalDisk, 1, 1)27 bytDiskReadBytesSec = Svc.GetNumProperty(“TMW_PhysicalDisk”, i, “DiskReadBytesSec”)28 bytDiskWriteBytesSec = Svc.GetNumProperty(“TMW_PhysicalDisk”, i,39 “DiskWriteBytesSec”)30 numDiskReadsSec = Svc.GetNumProperty(“TMW_PhysicalDisk”, i, “DiskReadsSec”)31 numDiskWritesSec = Svc.GetNumProperty(“TMW_PhysicalDisk”, i, “DiskWritesSec”)32 numCurrentDiskQLength = Svc.GetNumProperty(“TMW_PhysicalDisk”, i,33 “CurrentDiskQLength”)34 numAvgQLength = Svc.GetNumProperty(“TMW_PhysicalDisk”, i, “AvgDiskQLength”)35 numAvgReadQLength = Svc.GetNumProperty(“TMW_PhysicalDisk”, i, “AvgDiskReadQLength”)36 numAvgWriteQLength = Svc.GetNumProperty(“TMW_PhysicalDisk”, i,37 “AvgDiskWriteQLength”)38 numDiskBytesSec = Svc.GetNumProperty(“TMW_PhysicalDisk”, i, “DiskBytesSec”)39 bytDiskReadBytesSec = Svc.GetNumProperty(“TMW_PhysicalDisk”, i, “DiskReadBytesSec”)40 bytDiskWriteBytesSec = Svc.GetNumProperty(“TMW_PhysicalDisk”, i,41 “DiskWriteBytesSec”)42 numPercentDiskTime = Svc.GetNumProperty(“TMW_PhysicalDisk”, i, “PercentDiskTime”)43 numPercentDiskReadTime = Svc.GetNumProperty(“TMW_PhysicalDisk”, i,44 “PercentDiskReadTime”)45 numPercentDiskWriteTime = Svc.GetNumProperty(“TMW_PhysicalDisk”, i,46 “PercentDiskWriteTime”)4748 Log instance data stuff49 Svc.LogInst “Percent Disk Usage”, “PhysicalDisk”, numPercentDiskReadTime,50 strPhysicalDisk51 Svc.LogInst “Bytes Transferred”, “PhysicalDisk”, numDiskBytesSec, strPhysicalDisk52 Svc.LogInst “Queue Length”, “PhysicalDisk”, numAvgQLength, strPhysicalDisk5354 If numCurrentDiskQLength > Svc.GetThreshold(“HighQLength”) Then55 flagHighPhysicalQLength = 156 End If5758 If numDiskBytesSec > Svc.GetThreshold(“HighBytesSec”) Then59 flagHighPhysicalXferRate = 160 End If61 Chapter 2. Workbench 43
  • 67. 62 If bytDiskReadBytesSec > Svc.GetThreshold(“HighBytesSec”) Then63 flagHighPhysicalReadRate = 164 End If6566 If bytDiskWriteBytesSec > Svc.GetThreshold(“HighBytesSec”) Then67 flagHighPhysicalWriteRate = 168 End If6970 If numPercentDiskTime > Svc.GetThreshold(“HighPercentUsage”) Then71 flagHighPhysicalPercentTime = 172 End If7374 If flagHighPhysicalQLength = 1 Then75 If flagHighPhysicalXferRate = 1 Then76 Svc.SENDEVENT “TMW_SlowPhysicalDrive”, _77 numCurrentDiskQLength, _78 numPercentDiskTime, _79 numAvgQLength, _80 numAvgReadQLength, _81 numAvgWriteQLength, _82 bytDiskReadBytesSec, _83 bytDiskWriteBytesSec, _84 strPhysicalDisk85 Else8687 Some code deleted8889 i = i + 190 Loop91 VisitTree = 092 End Function Tip: A thread exists for each Resource Model running on the engine. Each thread runs a simplified pseudo code loop: While (Engine Running) { CollectCIMData(); Call VisitTree(); Sleep(cycle time); } Let us examine the code in Example 2-4 on page 42: Line 1 This is the VisitTree function definition.44 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 68. Line 2–10These lines are the variable definitions. The variables that we are concernedwith for TMW_SlowPyhsicalDrive are numCurrentQLength,numDiskBytesSec, and numPercentDiskTime.Line 14This is the method call that returns the number of instances that have beencollected by the IBM Tivoli Monitoring Version 5.1.1 engine. In ourenvironment, there were two physical disks on our W2K machine. However,the Svc.GETNUMOFINST returned three instances (disk0, disk1, and_Total). Some of the Perfmon-provided properties will return a _Totalinstance where it is appropriate. In line 25, we will skip this instance.Line 23When the VisitTree function is called, all of the data that was collected by theIBM Tivoli Monitoring Version 5.1.1 analyzer is available to the VisitTreefunction via method calls. Individual properties can be retrieved using theSvc.GetStrProperty or the Svc.GetNumPropery methods as seen in lines26–45. In this example we are retrieving the physical disk name on eachinstance (that is, disk0, disk1, and _Total).Line 25In the shipped PhysicalDiskModel, code _Total instances is discarded. Acustomized model could make use of this instance. _Total is the total of allinstances.Line 27This is a call to the Svc.GetNumProperty method to retrieve theDiskReadBytesSec property.Line 32This is a call to the Svc.GetNumProperty method to retrieve theCurrentDiskQLength.Line 42This is a call to the Svc.GetNumProperty method to retrieve thePercentDiskTime.Line 48–52These lines are unconditional calls to the Svc.LogInst methods for the threelogging elements defined in Figure 2-12 on page 40. Chapter 2. Workbench 45
  • 69. Line 54–56 This code checks the CurrentQLength value retrieved from CIM/WMI against the static threshold definition defined in the SetDefaultConfiguration function and sets a flag. The Svc.GetThreshold method returns values stored by the Svc.DefineThreshold in the SetDefaultConfiguration function. See Example 2-3 on page 39. Line 58–60 This code checks the DiskBytesSec value retrieved from CIM/WMI against the static threshold definition defined in the SetDefaultConfiguration function and sets a flag. The Svc.GetThreshold method returns values stored by the Svc.DefineThreshold in the SetDefaultConfiguration function. See Example 2-3 on page 39. Line 74–84 If the HighPhysicalQLength and HighPhysicalXfreRate flags are set, then the Svc.SENDEVENT method is invoked, passing all the TMW_PhysicalDisk class properties retrieved in lines 27–46. Line 89–90 This line increments and loops back to get the next instance. LIne 91–92 Return back to the IBM Tivoli Monitoring Version 5.1.1 engine.2.3 Creating Resource Models The Workbench provides two methods to create Resource Models: Creating Resource Models using the wizard. Cloning existing Resource Models. We briefly explain how to use these methods in the subsequent sections.2.3.1 Creating Resource Models using the wizard Using the wizard, you can create Resource Models in various ways. In this section, we will show you a typical way to create a Resource Model by the Resource Model wizard. Let us begin by clicking on the New icon in the left side of the Workbench toolbar, as shown in Figure 2-14 on page 47.46 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 70. Figure 2-14 Creating a Resource Model1. Select JavaScript or Visual Basic, as shown in Figure 2-15.Figure 2-15 Selecting JavaScript or Visual Basic You can create your Resource Models using either JavaScript or Visual Basic. The difference between JavaScript and Visual basic is described in 3.1.3, “Types of Resource Models” on page 75. Deciding which scripting language to use depends on the following factors: – The Resource Model on UNIX supports only JavaScript, as shown in Table 2-1. If you are going to use the Resource Model on UNIX as well as Windows, the choice is easy: you have to select JavaScript.Table 2-1 Supported Resource Model type per operating system Resource Model Windows UNIX JavaScript X X Visual Basic X N/A Chapter 2. Workbench 47
  • 71. – If you will use the Resource Model only on Windows, the choice depends on your expertise level in both languages. If you are more experienced in Visual Basic, then use that language. On the other hand, if you are only experienced in JavaScript, you can use it. – If you will use the Resource Model only on Windows and are experienced in both languages, choose Visual Basic, since it is more tightly integrated with Windows and provides extra capabilities, such as debugging the Resource Model. As a second reason, JavaScript Resource Models on Windows requires additional installation of Microsoft Windows Script Host 5.6. Note: The Workbench implements the Sax interpreter, which differs slightly from other Visual Basic interpreters. See http://www.saxsoft.com/Basic/Details for more information. On the other hand, JavaScript Workbench uses Rhino. Rhino is an open-source implementation of JavaScript written entirely in Java. 2. Selecting the wizard (see Figure 2-16). Figure 2-16 Selecting the wizard There are three different ways to create a Resource Model with the Workbench: Resource Model wizard The Resource Model wizard provides a series of dialog boxes that guide us through the whole process of creating a simplified Resource Model without writing scripts or code. Step-by-step Resource Model This approach provides dialog boxes that guide us48 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 72. through the procedure in the order defined in the IBM Tivoli Monitoring User’s Guide Version 5.1.1, SH19-4569. However, when we have completed this procedure, we must write the script that governs the Resource Model. Empty Resource Model Using this approach, we can define the Resource Model elements without following a specific order. In our experience it is always better to start out using the Resource Model wizard to generate the template for the Resource Model, unless we are cloning a Resource Model. The Resource Model wizard generates a good structure for the VisitTree function. If Resource Models are developed using the Resource Model wizard, this will force a level of conformity. In this procedure, we select the Resource Model Wizard in this window in order to explain the major procedures of creating a new Resource Model.3. Selecting the data source. The next window prompts you to select the type of data source, as shown in Figure 2-17 on page 50. Chapter 2. Workbench 49
  • 73. Figure 2-17 Selecting the data source The data source types are as follows: CIM/WMI This tells the wizard whether this model will be a CIM-based Resource Model or a compatibility mode model. DM Classic Edition Collection This tells the wizard that we are creating a compatibility mode Resource Model and that we will be migrating a MCSL or CSL based collection into this Resource Model. Custom script This tells the wizard that we are creating a Resource Model based on a custom numeric or string monitor. For more information on this, see Chapter 10, “Creating a custom script Resource Model” on page 411.50 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 74. If you selected JavaScript, you can also select the supported platform for the Resource Model. If you selected VBA, the selected platform is fixed to w32ix86. This is because VBA Resource Model runs on only Windows platform.4. Selecting a class. The first window after we selected the Resource Model wizard selection asks us to sign on to the CIM browser (Figure 2-18).Figure 2-18 Connecting to namespace The next window shows all of the compiled resource classes in the root/CIMV2 name space (Figure 2-19 on page 52). You can choose a CIM/WMI class to be monitored by Resource Model. Chapter 2. Workbench 51
  • 75. Figure 2-19 Selecting a CIM class 5. Selecting the properties. The next window shows you properties in the CIM class (Figure 2-20 on page 53). The Available area displays a set of properties that the CIM Class possesses. If you choose a property and click the -> button in the center of the window, the selected property appears on the Selected area. Then you can use properties on the Selected area in further steps.52 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 76. Figure 2-20 Selecting properties6. Filtering In the next window, you can set filtering conditions to limit the data collection by using the WQL language (Figure 2-21 on page 54). WQL is an abbreviation of WMI Query Language. WQL is a kind of dialect of SQL to query WMI. In using WQL, you can use a similar syntax with SQL. For more information, see the WMI SDK on the Microsoft Web site at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi /wmi_start_page.asp Chapter 2. Workbench 53
  • 77. Figure 2-21 Filtering 7. Specifying the event trigger condition In the next window, you can specify the trigger condition for a TEC or TBSM event (Figure 2-22 on page 55). Select properties and click the -> button to enter the trigger condition. If you specify a trigger condition here, the definitions of Event and Threshold are automatically created.54 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 78. Figure 2-22 Specifying the event trigger condition Note: You can specify only one trigger condition for each property in this window. If you wants to add multiple trigger conditions for one property, you have to modify the Resource Model, including the decision tree script after completing the wizard. If you would like to learn more about implementing multiple trigger conditions (this means thresholds as well) for one property, see Chapter 10, “Creating a custom script Resource Model” on page 411. Depending on the type of property, the next window shows different options for trigger conditions (Figure 2-23 on page 56). If you select numeric property, the options become mathematical and use comparison operators such as “<“, “>”, and so on. If you select string property, the trigger condition becomes string matches, such as “Is not equal”, “Contain”, and so on. Chapter 2. Workbench 55
  • 79. Figure 2-23 Entering the trigger condition Note: These values, except for the condition option (“<“, “is equal to”, and so on) can be changed when you distribute the profile. Keep in mind you cannot change the condition option on the Tivoli Desktop. These conditions are automatically reflected in the decision tree script shown in Example 2-5. Example 2-5 Decision tree script Thresholds section <<THRESHOLDS_INFO>> Svc.DefineThreshold "Thr_Avail_le", 10000.000000 <<THRESHOLDS_INFO>> ##### omission ##### Event definition section <<EVENTS_INFO>> Svc.DefineEvent "Ev_TMW_Memory_Avail_is_equal_or_too_low", "Avail,LowerBound", "__RELPATH" <<EVENTS_INFO>> ##### omission #####56 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 80. If (curAvail <= Svc.GetThreshold("Thr_Avail_le") ) ThenSvc.SetMapNumElement(hPropTable,"LowerBound",Svc.GetThreshold("Thr_Avail_le")) Svc.SendEventEx "Ev_TMW_Memory_Avail_is_equal_or_too_low", hPropTable End If8. Logging In the next window, you can select properties to be logged (Figure 2-24). If you select properties, these properties will be logged by the ITM Engine. The logged data will be used in reporting functions, such as the Web Health Console or Tivoli Data Warehouse.Figure 2-24 Selecting the properties to log9. Cycle time The last window of the Resource Model wizard prompts you to input cycle time in seconds (Figure 2-25 on page 58). You can set the default cycle time for your Resource Model. Remember that you will be able to change the cycle time when distributing a profile to an endpoint. Chapter 2. Workbench 57
  • 81. Figure 2-25 Cycle time 10.Saving the source file Finally, the wizard will end, and you should save the source file before proceeding to the next step (Figure 2-26). You can save the source file by clicking File → Save As. Figure 2-26 Saving the source file Note: The dmws files are the Resource Model developed in Visual Basic Script. The Resource Models developed in JavaScript have the file extension of dmjsws. 11.Building the package You need to build the package to register your Resource Model into ITM. To build the package, select Build → Build Package (Figure 2-27 on page 59).58 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 82. Then you can build a tar file which includes various definition files constructing your Resource Model.Figure 2-27 Building the package As described in 3.1.2, “Physical components” on page 73, each tar file consists of various files: configuration file, decision tree script file and Dependency files. 12.Building the TEC BAROC If you intend to send events to a TEC server, you need to build TEC BAROC files and import them into a TEC rulebase. To build the BAROC files, select Build → Build TEC BAROC (Figure 2-28 on page 60). Then you can build a TEC BAROC file that reflects the definition of Event in your Resource Model. Chapter 2. Workbench 59
  • 83. Figure 2-28 Building the TEC BAROC file Note: The TEC classes in your TEC BAROC file inherits Tmw2k.baroc, which is provided by IBM Tivoli Monitoring Version 5.1.1. Therefore you need to import Tmw2k.baroc before importing the TEC BAROC file you created. For more information about TEC configurations, see The IBM Tivoli Monitoring Workbench User’s Guide Version 5.1.1, SH19-4571.2.3.2 Cloning existing Resource Models In spite of creating new Resource Models, if you already have a Resource Model, you can clone it and create a new Resource Model. IBM Tivoli Monitoring Version 5.1.1 and IBM Tivoli Monitoring family of products principally provide sample Resource Models that you can modify using Workbench. You can clone those sample Resource Models to create new ones more suitable for your environment.60 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 84. 1. Opening a Resource Model To clone a Resource Model, open the existing Resource Model by selecting File → Open. 2. Modifying Resource Model elements You need to modify some elements in the Resource Model. How you modify the Resource Model depends on how you want the Resource Model to behave. However, to create another Resource Model from an original one, you must change at least all of the following elements to avoid an internal name conflict: – Properties – Events – Thresholds2.3.3 Registering a Resource Model into ITM You will need to register your Resource Model before you can use it with IBM Tivoli Monitoring Version 5.1.1. 1. Copying the package file To register your Resource Model into IBM Tivoli Monitoring Version 5.1.1, copy the tar package file to the TMR Server using your choice of remote copy tools, such as FTP. Use the binary mode for FTP to copy the tar package file. Workbench PC TMR Server Binary tar file Figure 2-29 Copying the package file 2. Registering the Resource Model After copying the package file to your TMR server, you can register it into IBM Tivoli Monitoring Version 5.1.1. To register the package file, use the wdmrm command, as shown in Example 2-6 on page 62. Chapter 2. Workbench 61
  • 85. Example 2-6 Registering the Resource Model wdmrm -add YourRMFileName.tar2.4 Tools and extra information This section will provide useful information about various tools and techniques that will help you be successful with Resource Models.2.4.1 WorkBench command line interface IBM Tivoli Monitoring Version 5.1.1 Workbench provides a very simple CLI to use some of its functions from command prompts. This basically helps in automating Resource Model package builds from the source workspaces, and to modify some of its components without running the GUI-based tool. Before we start using the Workbench CLI, we might want to add the Workbench bin directory into the path. The command usage is: wdmwbcli resmodworkspace -bldpkg outputPackage wdmwbcli resmodworkspace -expmsgcat messagecatalog wdmwbcli resmodworkspace -expjmsgcat javamessagecatalog wdmwbcli resmodworkspace -bldtecbaroc tecbaroc wdmwbcli resmodworkspace -setdep interp depfile [outputworkspace] wdmwbcli resmodworkspace -setdectree dectreefile [outputworkspace] wdmwbcli resmodworkspace -setver major minor [outputworkspace] Where: resmodworkspace The *.dmws of the dmjsws project file outputPackage The output tar file messagecatalog The output message catalog javamessagecatalog The output Java message catalog tecbaroc The output TEC BAROC file interp The dependency interpreter type depfile The dependency file name associated with the interpreter type outputworkspace The name of the output *.dmws or *.dmjsws project file dectreefile The decision tree file major The Resource Model major version number62 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 86. minor The Resource Model minor version number The command usage is: wdmwbcli resmodworkspace -bldpkg outputPackage Builds the Resource Model tar from the source workspace. wdmwbcli resmodworkspace -expmsgcat messagecatalog Exports the Resource Model message catalog. wdmwbcli resmodworkspace -expjmsgcat javamessagecatalog Exports the Resource Model Java message catalog to use with Web Health Console. wdmwbcli resmodworkspace -bldtecbaroc tecbaroc Exports the TEC BAROC file with the definitions of all the events generated by the source Resource Model. wdmwbcli resmodworkspace -setdep interp depfile [outputworkspace] Adds the specified depfile as a Resource Model dynamic dependency for the given interp (use all to add the file for all the available interps). wdmwbcli resmodworkspace -setdectree dectreefile [outputworkspace] Sets the JavaScript or Visual Basic Code to the specified Resource Model. JavaScript files can only be set to .dmwjsws workspaces, while Visual Basic files can only be set to .dmws. wdmwbcli resmodworkspace -setver major minor [outputworkspace] Changes the version of the specified Resource Model. Examples: wdmwbcli ITSO_FileSystem.dmjsws -bldpkg ITSO_FileSystem.tar wdmwbcli ITSO_FileSystem.dmjsws -expmsgcat ITSO_FileSystem.msg2.4.2 Microsoft tools The Microsoft tools are discussed in the following sections. WMI SDK See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi _start_page.asp Chapter 2. Workbench 63
  • 87. WMI Providers See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/man aged_objects_and_providers.asp Windows NT and 2000 Resource Kit Two tools that are very effective for creating artificial load balances on a Windows 2000 endpoint are cpustres.exe and probe.exe. In the PhysicalDisk and LogicalDisk examples, we used the diskmax.bat command. This is a command that has been customized to use the probe.exe tool. Appendix B, “Additional material” on page 495 has instructions on how to download files from the Web. There is a diskmax.zip file at that site and it has all of the diskmax files that were used in the examples. Microsoft script debugger See: http://msdn.microsoft.com/downloads/default.asp?url=/downloads/topic.asp?URL=/M SDN-FILES/028/001/175/topic.xml How to use the Microsoft script debugger: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdbug/Html/sdb ug_17.asp2.4.3 Saxsoft The Workbench implements the Sax interpreter, which differs slightly from other Visual Basic interpreters. The following is the Saxsoft Web site: http://www.saxsoft.com2.4.4 Rhino JavaScript Workbench uses Rhino. Rhino is an open-source implementation of JavaScript written entirely in Java. The following are Rhino Web sites: http://www.mozilla.org/rhino/ http://www.mozilla.org/rhino/download.html The Rhino shell allows us to run scripts from files or interactively at a command line. Rhino shell Download the zip file for rhino. The zip file will contain a single JAR file, js.jar. We then need to add the JAR file to the class path.64 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 88. We can start the Rhino shell using the following command:java org.mozilla.javascript.tools.shell.MainWe can execute a JavaScript by passing the file as an argument:java org.mozilla.javascript.tools.shell.Main test.jsThere are many options for running scripts. See the associated documentationfor more details.Rhino debuggerThe Mozilla Rhino JavaScript shell includes a debugger. The debugger runs as aJava program:java org.mozilla.javascript.tools.debugger.MainThe options are the same as the shell.For more information see:http://www.mozilla.org/rhino/debugger.html Chapter 2. Workbench 65
  • 89. 66 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 90. 3 Chapter 3. Resource Models The Resource Model is the key concept of the IBM Tivoli Monitoring Version 5.1.1 product. Resource Models are used to model a business-relevant object, such as the CPU of a machine or the memory of a machine. In order to configure the various components of the IBM Tivoli Monitoring Version 5.1.1 profile, it is important to have a basic understanding of components of the Resource Model. This chapter provides details on what Resource Models are. The following topics are discussed in this chapter: Resource Model overview Resource Models© Copyright IBM Corp. 2003. All rights reserved. 67
  • 91. 3.1 Resource Model overview In order to properly utilize the Resource Model architecture implemented by IBM Tivoli Monitoring Version 5.1.1, it is important to have a solid understanding of the components, terminology, and design behind this architecture. Understanding the internals will also make it easier to understand the impact of changing the “out-of-the-box” parameters of the IBM Tivoli Monitoring Version 5.1.1 profile. The following sections will describe components included in the Resource Model from the logical and physical point of view.3.1.1 Logical components The Resource Model can be considered a combination package of monitoring criteria and monitoring conditions. It contains not only monitoring target information but also the trigger conditions, events, and actions based on the so called best practice. The ITM Engine executes multiple Resource Models distributed by the Tivoli Desktop. The Resource Model retrieves the management information through various interfaces, including CIM/WMI, and then analyzes that information. The variety of the management interface is one of the advantages of IBM Tivoli Monitoring. We generically name such management interfaces as the Provider, which will be well described in Chapter 4, “Providers” on page 109. The Resource Model has various logical components that are closely related to each other, as shown in Figure 3-1 on page 69. In this section, we briefly cover the major logical components that are characteristics of a Resource Model.68 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 92. Managed Server ITM Engine Distributing Parameters Profiles Tivoli Desktop Resource Model Threshold Indication Occurrence / Hole Threshold Send Events TEC / TBSM Indication Threshold Occurrence / Hole Cycle Time Workbench Defining Resource Model Custom Scripts Monitor Probes WMI TSL - Dynamic Model DM Classic Interface (CIMOM) (CIMOM) - Decision Tree Script - Events / Thresholds WMI - Parameters Provider ILT - Logging DLLs - Cycle Time - Dependency Operating System & Application ResourcesFigure 3-1 Logical components of the Resource Model A Resource Model contains the following major elements: Dynamic Models Events (one or more) Thresholds (one or more) Parameters (one or more) Logging A decision tree script Dependencies Dynamic Models The Dynamic Model can be considered the essential element of a Resource Model. Except for the custom script Resource Model, each Resource Model Chapter 3. Resource Models 69
  • 93. contains one Dynamic Model, where you specify the resources you are going to monitor, the properties of each resource you are going to consider, and the type of data collection you will implement. A Dynamic Model contains a set of predefined Common Information Model (CIM) classes that describe the status of each resource. A class is a list of properties relevant to the specified resource. The Workbench shows the list of available CIM classes contained in the CIM repository of WMI on your local machine. The instances of the classes are provided by WMI Providers. If the resource you need is not described by any class contained in the CIM repository, you can add it, together with its associated Provider. Thresholds Each Resource Model defines one or more thresholds. The threshold value that you specify in the Workbench dialog boxes becomes the default for that particular Resource Model. However, it can be changed before distribution from the tmw2k profile definition dialog boxes. Typically, this value represents a limit for a satisfactory resource state. If the monitored resource exceeds this limit, an indication is generated. However, in the Workbench, thresholds can also represent any other numeric criteria on which your data collection is based. These thresholds will be used to filter the indications, thus allowing the Monitoring Engine to skip processing (or ignore) indications that are ‘out-of-scope.’ A threshold is a numeric value that you specify and that is used according to the monitoring algorithm you write in the script. Events An event is a change in the status of a resource. Within IBM Tivoli Monitoring Version 5.1.1, an event notifies you that a specified resource state is abnormal or problematic. In the Workbench, a distinction is made between an indication and an event. An indication is generated when the state of a given resource meets specific criteria you have defined. However, an indication does not trigger any action; only when indications are aggregated do they become an event. The cycles during which the indication is generated are called occurrences. On the other hand, the cycles during which no indication is generated are called holes. Only events can trigger some actions, notify that there is a problem in your resource state and, if enabled, send notification to the Tivoli Enterprise Console server and Tivoli Business Systems Manager.70 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 94. Assume that there is a resource property that changes its value rapidly. Thedecision tree would be visited every cycle, and as part of this, the value of theresource property is retrieved. In Figure 3-2, the vertical dashed lines representthe moments of the queries, and the point at which the dotted lines meet thegraph are values that are the results of the inquiries. The one horizontal dashedline represents the threshold. Values above that line are considered potentialproblems and will trigger an indication.Every time the values of the resource properties exceed the thresholds, theResource Model will generate an indication. If the value of the resource propertydrops below the threshold for a particular cycle, then no indication is generated,and the event aggregator counts the non-occurrence of an indication as a hole.So, if we define an event as four occurrences and one hole when we configureour profile, then based on the indications generated in Figure 3-2, the event willbe generated when the fourth indication occurs. If we had two consecutive holes,then the occurrence count would be reset to zero and a clearing event would besent if it was configured to send a clearing event. Tip: The concept of holes can be a bit confusing if you do not realize that the number of holes specified in your profile represent the acceptable number of consecutive holes, not the accumulated number of holes over a sliding window of time. In dica tion # 4 Indication #3 metric values In dica tion # 1 Ind ication #2 . .threshold . . 2 consecutive holes C learing eve nt } C ycle Time tim e Ma x # o f hole s is 1 and they are not co nse cutiveFigure 3-2 Sampling of volatile metric Chapter 3. Resource Models 71
  • 95. Parameters While thresholds can be only numeric values, parameters can be lists of numbers or strings. Using parameters enables you to customize your Resource Model. You can define different parameters as required. The list of numbers or strings you specify for each parameter can represent the instances you want to monitor, or a limit you do not want your resource to exceed, depending on how you use this setting in your script. Within the Workbench, you can define default values for the different parameters, and these values are customizable in tmw2k profile definition dialog boxes. Logging The logging functions allows you to store data regarding the attributes of the resource you want to monitor. Data is stored in a local database and can be accessed using Health Console. Within the Workbench, you can specify what and how you want to log. However, logging is disabled by default. Decision tree script The decision tree script contains the algorithm that you write in VisualBasic or JavaScript to govern the whole monitoring process. The Workbench automatically generates either the VisualBasic or the JavaScript decision tree script part, which contains the information you have specified when you have created and configured the Resource Model. If you change one of the settings in the Workbench dialog boxes, the corresponding data is also automatically updated in the script. You cannot modify these settings directly in the script. The script has a default structure that is common to all the Resource Models. By default, the decision tree script contains three basic functions and one subroutine, but you can add some more to them. The default functions are the following: Main This is a subroutine used by Workbench (or any other Visual Basic IDE) for debugging the Resource Model. The Monitoring Engine does not call it. This subroutine performs the following functions: – Creates the TMWService.Utils – Calls the SetDefaultConfiguration function – Calls the Init function – Enters the monitoring loop (collect data, visit the decision tree script, and wait cycle time)72 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 96. This subroutine should not be modified. If you do, unpredictable results may occur. SetDefaultConfiguration The SetDefaultConfiguration initializes the object on the basis of the settings defined in the events, thresholds, and parameters dialog boxes. If you change one of the settings contained in these dialog boxes, the corresponding data is updated in this function. On the contrary, you cannot change those settings by modifying them directly in this function. The SetDefaultConfiguration function is called just once, when the Resource Model is started. Therefore, if necessary, you can write additional initialization code at the end of this function. Init Init is called after the settings defined in the SetDefaultConfiguration function have been replaced with the values coming from the profiles of Tivoli Distributed Monitoring Workbench Version 4.1. At this point, the settings are replaced with the new ones. VisitTree VisitTree contains the monitoring algorithm and is called at the beginning of each cycle time. You have to write the monitoring algorithm in VisualBasic or JavaScript, defining how to use all the values and variables previously set. This function checks the algorithm and implements it. It processes the collected data according to thresholds and parameters settings, and, if necessary, sends an event. Dependencies Sometimes, to run a Resource Model on an endpoint, you may need to ensure that all the prerequisite files for successful execution are available at the endpoint that is monitored. For example, when you want to add a new class to the CIM repository, you need to transfer a MOF file, or, if you want to use a new Provider, you need to add the DLL or ILT code that implements it. In these cases, you can add dependencies to your Resource Model and transfer them to the endpoint along with the Resource Model.3.1.2 Physical components The Workbench puts together various files composing the Resource Model to a tar package file, which contains a configuration file, a decision tree file, an MOF file, and dependency files. Figure 3-1 on page 69 shows the combination of the files composing the Resource Model. Chapter 3. Resource Models 73
  • 97. Resource Model Tar File Configuration File JavaScript -or- Visual Basic Script Logging: Dynamic Model(s): Parameter(s): Action(s): Reference Model Functions: Threshold(s): SetDefaultConfiguration(Svc) Event(s): Init(Svc) VisitTree(Svc) Message Catalogs Provider(s): MOF(s): Custom Scripts() Custom Files(s) Dependencies Files Figure 3-3 Physical components in the Resource Model Configuration file (.conf) The configuration details of the Resource Model are obtained by the Monitoring Engine from the configuration file. These configuration details include the Resource Model name, platform name, name of the decision tree file, name of the MOF file, and so on. Decision tree script file (.js or .vba) The decision tree file (Visual Basic script or JavaScript for Windows platform and JavaScript for UNIX/LINUX platforms) contains both the initialization settings for the Resource Model and the algorithm that is used by the analyzer to determine if a problem is encountered in the resources described by the Resource Model. Dependency files (optional: .java, .a, .so and so on) If the resource mode has dependencies, the registered files are distributed to the Monitoring Engine. The typical dependency files are the following: Custom Script File The custom script file used by the Resource Model is distributed by initial profile distribution to an endpoint.74 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 98. ILT / TSL Library Files The Java based Provider needs some library files, which are used in the two surfaces: ILT (Instrumentation Library Layer) and TSL (Touchpoint Service Layer). These library files are distributed during the first time of the profile distribution. MOF File(.mof) The MOF file contains the particular Resource Models class description and event definitions. The classes are derived from the corresponding base classes of the resources. The base classes for the model to resources association, and classes that describe physical resources used in the Resource Models with respect to the instance Providers, are provided in a base MOF file and resources MOF file respectively. These additional MOF files are distributed to the endpoint the first time a tmw2k profile is distributed to it.3.1.3 Types of Resource Models The Resource Model can be categorized by the type of script and the type of Provider, as shown in Table 3-1. When you create your own Resource Model, you can choose the type of Resource Model. You can also see that some of the Resource Models require additional components. Make sure you know what kind of Resource Models exist and what you need before creating the Resource Models.Table 3-1 Resource Model types Script type Provider Windows UNIX Supported Requirement Supported Requirement VBA CustomScript X N/A N/A DM Monitor X N/A N/A Prove WMI Provider X N/A N/A DLL Chapter 3. Resource Models 75
  • 99. Script type Provider Windows UNIX Supported Requirement Supported Requirement JavaScript CustomScript X Windows X JRE 1.3.X Scripting 5.6 DM Monitor X Windows X JRE 1.3.X Prove Scripting 5.6 Java ILT X Windows X JRE 1.3.X Scripting 5.6 JRE 1.3.X X means “supported”. Blank means “no requirement”. N/A means “Not Available” Categorized by the script type of the decision tree script, we have two major types of Resource Models: VBA The VBA Resource Model has a decision tree script written in Visual Basic for Applications (VBA). This Resource Model is only available on Windows platform. The VBA Resource Model is more tightly integrated with Windows and provides extra capabilities, such as debugging the Resource Model. JavaScript The JavaScript Resource Model has a decision tree script written in JavaScript. The JavaScript Resource Model supports both of UNIX and Windows. On UNIX, the JavaScript Resource Model is the only supported Resource Model type. It requires the Java Runtime Environment (JRE) on UNIX. On Windows, it requires Windows Scripting 5.6, and if you use the JavaScript Resource Model with Java ILT, you need to install JRE on Windows.3.2 Resource Models Based on the best practices that IBM Tivoli Monitoring Version 5.1.1 provides, there are three major groups of Resource Models: Windows UNIX OS/400®76 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 100. As sample Resource Models, IBM Tivoli Monitoring Version 5.1.1 also provides the following two groups: Tivoli Web Component Manager (Sample Only: For Migration Purposes) Exchange (Sample Only) In this section, we introduce what Resource Models are included in each major group. Then we will focus on explaining details of each Resource Model, especially for Windows and UNIX.3.2.1 Resource Models for each platform We briefly describe the contents of Resource Models provided by IBM Tivoli Monitoring Version 5.1.1 for each platform. Windows Table 3-2 on page 78 summarizes the Resource Models included for Windows.You can see that some of the Resource Models have limitations for the support platform or need additional requirements. They are all Visual Basic based Resource Models utilizing WMI. Chapter 3. Resource Models 77
  • 101. Table 3-2 Windows Resource Models Resource Model Description Additional Windows 2000 (Pro, Server, Adv. Serv.) requirements Windows XP (Professional) Windows NT Memory This Resource Model highlights X X X the memory problems: cache, available bytes, paging and so on. Network Interface This Resource Model highlights X N N SNMP Card the Network Interface A A Network Problems: broadcast frames, Monitoring Agent percentage usage, and so on. Parametric event This Resource Model examines X X X log the Windows Event Log for events that are specified by the user through the parameter configuration. Parametric TCP/IP This Resource Model checks X X X SNMP Ports the TCP and UDP port numbers you specify. Logical Disk This Resource Model highlights X X X diskperf the following problems: disk usage and bytes per second transferred.78 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 102. Resource Model Description Additional Windows 2000 (Pro, Server, Adv. Serv.) requirements Windows XP (Professional) Windows NT Physical Disk This Resource Model detects X X X diskperf bottlenecks specifically associated with all physical disks that are configured on the system. This model highlights the following problems: disk usage and bytes transferred per second. Processor This Resource Model detects X X X bottlenecks happening within or from the CPU. Services This Resource Model looks for X X X bottlenecks relating to the processes running on the system and highlights the high usage. TCP/IP This Resource Model looks for X X X SNMP bottlenecks found within the TCP/IP protocol. EventLog This Resource Model examines X X X the Windows Event Log for events normally require immediate attention.X means “supported”.Blank means “no requirement”.N/A means “Not Available” Chapter 3. Resource Models 79
  • 103. UNIX Table 3-3 summarizes the Resource Models for UNIX. You can see that some of the Resource Models have platform support limitations or need an SNMP agent as an additional requirement. They are all JavaScript based Resource Models. Table 3-3 UNIX Resource Models Resource Description Additional Linux (Red Hat, SuSE, Turbo) for Intel® Model requirements Linux (SuSE) for S/390® Solaris HP-UX CPU This Resource Model detects AIX® X X X X X problems with the CPU, such as high System Utilization. File The file Resource Model gives X X X X X information about files in the system. File This Resource Model measures X X X X X System how efficiently the file systems are being used. Memory This Resource Model provides X X X X X information about how the memory is used. Network The Network Interface Resource X X X X X SNMP Interface Model detects problems with the following installed network interfaces: Loopback, Ethernet, and Token-Ring.80 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 104. Resource Description Additional Linux (Red Hat, SuSE, Turbo) for Intel® Model requirements Linux (SuSE) for S/390® Solaris HP-UX AIX® Network The Network RPC-NFS Resource N X N N N RPC-NFS Model detects problems and / / / / monitors the performance of A A A A the RPC and NFS servers and clients. Process The Process Resource Model looks X X X X X for bottlenecks in running processes. Problems include: process down, too much CPU time, and zombie. Security The Security Resource Model X X X X X provides information about files and the users logged onto the system and highlights the problems: resource property change, suspicious activity, and so on.X means “supported”.Blank means “no requirement”.N/A means “Not Available”OS/400Table 3-4 on page 82 summarizes the Resource Models for OS/400. They are allJavaScript based Resource Models. Chapter 3. Resource Models 81
  • 105. Table 3-4 OS/400 Resource Models Resource Model Description OS400 ASP Disk Mirroring The ASP Disk Mirroring Resource Model, given an X input of one or more ASP numbers, gets a list of disks for each ASP, checking the mirroring status of each disk. ASP Utilization The ASP Utilization Resource Model monitors the X Auxiliary Storage Pool (ASP) Utilization for the specified ASPs and sends events if the ASP is approaching capacity. Basic CPU Utilization This Resource Model monitors the overall CPU X utilization of the system. Basic Interactive CPU This Resource Model monitors the interactive CPU X Utilization utilization of the system. Configuration Objects This Resource Model monitors the status of the X configuration objects. The user can enter one or more configuration object names and types. Database CPU Utilization The Database CPU Utilization Resource Model X checks if the system is exceeding its threshold limit for database CPU utilization. Distribution Queues The Distribution Queues Resource Model X monitors the status of the high and normal priority service levels for distribution queues. History Log This Resource Model finds specific messages in X the history log. Interactive Feature CPU This Resource Model checks if the system is X Utilization exceeding its threshold limit for Interactive Feature CPU utilization. Job Log This Resource Model checks a job’s Job Log for X specific messages. The parameters contain the message numbers and text strings to match. Job Queue This Resource Model monitors that one or more X job queues, which have jobs queued to them, are assigned to a subsystem so that the jobs can be started. Job Status This Resource Model monitors the job status. X82 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 106. Resource Model Description OS400 Management Central This Resource Model monitors all Management X Central events and forwards them to TEC. Network Attributes This Resource Model monitors the network X attributes. The user provides one or more network attribute names along with a corresponding value. Output Queues The Output Queues Resource Model checks if the X output queues and their writers are active. Parametric Object and File This Resource Model allows you to monitor native X objects and files for owner, size, and change date. Storage Pools The Storage Pools Resource Model monitors and X logs the metrics for storage pools. Subsystem This Resource Model checks the status of a list of X subsystems and sends an event if there is a subsystem that is not active. System Disk Resources This Resource Model monitors the overall system X resources for system and ASP utilization. System Value The user inputs one or more system value names X along with a corresponding value as its desired value. TCP Interface This Resource Model monitors the status of one or X more TCP interface. TCP Service This Resource Model monitors the TCP service. X X means “supported”. Blank means “no requirement”. N/A means “Not Available”3.2.2 Windows Resource Models Each of the following sections will describe the threshold logic that will generate indicators from Windows Resource Models. First of all, we explain how to read the table in the following sections: The row header contains the name of the thresholds that exist for a certain Resource Model. The left cell header contains the name of the indication that is generated. Chapter 3. Resource Models 83
  • 107. The Correlation column may contain a number, which indicates a correlation with another indication. The correlation function is available only for the Windows ITM Engine. The other cells of the table contain one of the following: T This indicates true, which means that the threshold has been reached or exceeded. F This indicates false, which means the threshold has not been reached or exceeded. Blank This means that this threshold is not used to determine this indicator. Examples: – The indication Low Logical Disk Space is generated when the threshold for Low Disk Space value is true. – The indication Slow Logical Drive is generated when both the thresholds for High Queue Length and Total disk Bytes Read Per Second are exceeded. Memory Resource Model In this model, some indications are triggered due to some calculations based upon resource properties. Therefore, we included the column Calculation, which does not reflect a threshold value that can be adjusted by a user. You can learn how the calculation works by referring the decision tree script on the Workbench. The dependencies for the memory Resource Model are shown in Table 3-5 on page 85.84 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 108. Table 3-5 Memory Resource Model dependencies Thresholds Minimum committed bytes Minimum available bytes Low cache hits percent Excessive page faults (moving average of...) Excessive paging Calculation Properties CopyReadHits MDLReadHits DataMapHits PinReadHits a Correlation Calculated Indications High paging 1 T F TMW_HighPaging Low available memory T T TMW_LowAvail b Low available causing hard paging T T T F TMW_LowAvailCausingHardPaging Low available causing many problems 2 T T T T TMW_LowAvailCausingManyProblems Low available causing soft paging and 4 page file resizing T F T T TMW_LowAvailCausingSoftPagePagefile Resize Low available memory is causing excessive soft paging T F T F TMW_LowAvailCausingSoftPaging Low available with a high working set 5 T T TMW_LowAvailHighWS c Low available memory with a small page T T file TMW_LowAvailWithSmallPageFile Low available with high cache T T d TMW_LowAvailHighCache Chapter 3. Resource Models 85
  • 109. Thresholds Minimum committed bytes Minimum available bytes Low cache hits percent Excessive page faults (moving average of...) Excessive paging Calculation Properties CopyReadHits MDLReadHits DataMapHits PinReadHits a Correlation Calculated Indications Low copy read hits T TMW_LowCopyReadHits Low data map hits T TMW_LowDataMapHits Low MDL read hits T TMW_LowMDLReadHits Low pin read hits T TMW_LowPinReadHits Memory leak in private bytes 5 T TMW_MemoryLeakInPB e Memory leak in system code T f TMW_MemoryLeakInSC Memory leak in system drivers T g TMW_MemoryLeakInSD The page file is resizing F T TMW_PageFileResizing a. Calculated field: Commit Limit - Commit Bytes. b. Working set is larger than cache but less than available memory or working set is less than cache, and cache is less than available memory (that means not enough physical RAM). c. Working set is larger than cache and larger than available memory. d. Working set is less than cache, but cache is larger than available memory. e. Process increases private bytes since last visit and is among top five consumers. f. Amount of system memory increases. g. Amount of memory in device drivers increases.86 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 110. Network Interface Card Resource ModelThe dependencies for the Network Interface Card (NIC) Resource Model areshown in Table 3-6.Table 3-6 Network Interface Card Resource Model dependencies Thresholds High percentage of bytes pers second High work item shortage High percent broadcast High percent utilization High error out ratio High output queue High current Correlation Properties Network Interface Card BroadcastFrames Redirector Server Indications High errored ratio T TMW_HighErroredRatio Network Interface Card overworked 3 T T TMW_NICOverworked Network Interface Card too slow T F TMW_NICTooSlow High broadcast frames T T TMW_HighBroadcastFrames Adjust work items F F T TMW_AdjustWorkItems Server overloaded T F T TMW_ServerOverloaded Chapter 3. Resource Models 87
  • 111. Thresholds High percentage of bytes pers second High work item shortage High percent broadcast High percent utilization High error out ratio High output queue High current Correlation Properties Network Interface Card BroadcastFrames Redirector Server Indications High current commands F F T TMW_HighCurrentCommands Redirector overloaded T F T TMW_RedirectorOverloaded Redirector affecting server F F T T T TMW_RedirectorAffectingServer Redirector overloaded affecting segment F T T T TMW_RedirectorOverloadedAffecting Segment Segment affecting redirector F F F T T TMW_SegmentAffectingRedirector Segment affecting server F F F T T TMW_SegmentAffectingServer Server overloaded affecting segment F T T T TMW_ServerOverloadedAffecting Segment88 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 112. Thresholds High percentage of bytes pers second High work item shortage High percent broadcast High percent utilization High error out ratio High output queue High current Correlation Properties Network Interface Card BroadcastFrames Redirector Server Indications Server affecting redirector F T F T T TMW_ServerAffectingRedirectorParametric event log Resource ModelThis Resource Model examines the Windows NT or Windows 2000 event log andwill send an indication if one of the user-specified events occur and is logged inthe Windows event log.The dependencies for the parametric event log Resource Model are shown inTable 3-7 on page 90. Chapter 3. Resource Models 89
  • 113. Table 3-7 Parametric event log Resource Model dependencies Thresholds Windows event logged Correlation Indications NT event log occurred T TMW_NTEventLogOccurred This Resource Model is used to examine the user-specified services for availability and any non-stable conditions. The dependencies for the Parametric Services Resource Model are shown in Table 3-8. Table 3-8 Parametric Services Resource Model dependencies Thresholds Service stopped service Service failing service Correlation Indications Parametric services failing service T TMW_ParamServicesFailingService Parametric services stopped service T TMW_ParamServicesStoppedService Parametric TCP/IP Ports Resource Model This Resource Model checks the user-specified TCP and UDP port numbers and generates events whenever these ports are in a specified state or states. The dependencies for the Parametric TCP/IP Ports Resource Model are shown in Table 3-9 on page 91.90 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 114. Table 3-9 Parametric TCP/IP Ports Resource Model dependencies Thresholds Status of the defined port Correlation Indications Parametric Port status T TMW_ParamPortStatusLogical Disk Resource ModelThe dependencies for the Logical Disk Resource Model are shown in Table 3-10.Table 3-10 Logical Disk Resource Model dependencies Thresholds High bytes per second High percent usage High queue length Low disk space Correlation Indications Write Read Total disk High read bytes per second 7 T F T T F TMW_HighLogicalDiskReadBytesSec High write bytes per second 8 F T T T F TMW_HighLogicalDiskWriteBytesSec High transfer rate 9 T T T T F TMW_HighLogicalDiskXferRate High percent disk time 1, 2, F T T TMW_HighLogicalPercentDiskTime 6, 10 Logical disk possible fragmentation 11 F T F TMW_LogicalPossibleFrag Chapter 3. Resource Models 91
  • 115. Thresholds High bytes per second High percent usage High queue length Low disk space Correlation Indications Write Read Total disk Slow logical drive 13 T T TMW_SlowLogicalDrive Low logical disk space 4 T TMW_LowLogicalDiskSpace Physical Disk Resource Model The dependencies for the Physical Disk Resource Model are shown in Table 3-11. Table 3-11 Physical Disk Resource Model dependencies Thresholds High bytes per second High percent usage High queue length Correlation Properties Write Read Total disk indications High percent disk time 6, F T T TMW_HighPhysicalPercentDiskTime 10 High transfer rate 9 T T T T F TMW_HighPhysicalDiskXferRate High read bytes per second 7 T F T T F TMW_HighPhysicalDiskReadBytesSec92 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 116. Thresholds High bytes per second High percent usage High queue length Correlation Properties Write Read Total disk indications High write bytes per second 8 F T T T F TMW_HighPhysicalDiskWriteBytesSec Physical disk possible fragmentation 11 F T F TMW_PhysicalPossibleFrag Slow physical drive 13 T T TMW_SlowPhysicalDriveIn addition to the thresholds, you may specify the number of printer queues andjobs within each printer queue that will be examined by the Resource Model.These settings influence the performance and CPU load generated by TivoliDistribute Monitoring (Advanced Edition) 4.1.The dependencies for the Printing Resource Model are shown in Table 3-12.Table 3-12 Printing Resource Model dependencies Thresholds Out of paper errors per day Not ready errors per day Out of paper errors Job errors per day Percent processor Not ready errors Correlation Job errors Indications High job errors per day T TMW_HighJobErrorsPerDay High job errors T TMW_HighJobErrors Chapter 3. Resource Models 93
  • 117. Thresholds Out of paper errors per day Not ready errors per day Out of paper errors Job errors per day Percent processor Not ready errors Correlation Job errors Indications High not ready errors per day T TMW_HighNotReadyErrorsPerDay High not ready errors T TMW_HighNotReadyErrors High out of paper errors per day T TMW_HighOutOfPaperErrorsPerDay High out of paper errors T TMW_HighOutOfPaperErrors High current percent time T TMW_HighCurrentPercentTime In addition to the thresholds, it is possible to specify the number of processes that are analyzed. The dependencies for the Process Resource Model are shown in Table 3-13. Table 3-13 Process Resource Model dependencies Thresholds High CPU use Max handles Correlation Indications Process high CPU 12 T TMW_ProcessHighCPU Process handle leak T TMW_ProcessHandleleak Processor Resource Model The dependencies for the Processor Resource Model are shown in Table 3-14.94 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 118. Table 3-14 Processor Resource Model dependencies Thresholds High interrupts per second High CPU usage user priv High CPU usage interrupt High CPU usage process High percent usage delta High CPU usage Total CPUs mod Correlation Indications Busy Hardware 5 T T T TMW_BusyHardware CPU Cannot Keep Up With HW T T F T TMW_CPUCantKeepUpWithHW HW Keeping CPU Busy T T F Fa TMW_HWKeepingCPUBusy High Processes 12 T F T TMW_HighProcesses Processor Busy T F F TMW_ProcessorBusy High Percent Usage Delta T TMW_HighPercentUsageDeltaa. The processor queue length is greater than the total number of CPUs plus the TotalCPUsModthreshold.Services Resource ModelThe services model works in a slightly different way. The threshold values have alogical value set of {0, 1}. In contrast to the usual meaning, these values areBoolean variables. Everything greater than zero is equal to true; zero meansfalse. If the value is set to 1 or a number greater than that, then the indicationsmay be triggered when the corresponding service either failed or was stopped. Inaddition to that, IBM Tivoli Monitoring Version 5.1.1 will try to restart a stoppedservice. If that fails, another event is generated and sent to TEC.The dependencies for the Services Resource Model are shown in Table 3-15 onpage 96. Chapter 3. Resource Models 95
  • 119. Table 3-15 Services Resource Model dependencies Thresholds LanmanWorkstation LanmanServer EventLog NtLmSsp Netlogon Browser Lcfd Indications Any failing service T TMW_ServicesFailingService T T T T T T Services stopped service T TMW_ServicesStoppedService T T T T T T Note: Windows NT or Windows 2000 machines that are part of a workgroup do not run the Netlogon service; starting this service will fail. Therefore, to avoid large numbers of reoccurring service events on workgroup members, you should turn off monitoring for this service by setting the Resource Model property to zero for the Netlogon service. TCP/IP Resource Model The dependencies for the TCP/IP Resource Model are shown in Table 3-16 on page 97.96 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 120. Table 3-16 TCP/IP Resource Model dependencies Thresholds High fragment ratio Low segments High segment retransmitted Moderate DG Correlation Properties SegementsRetransmitted FragmentsReceived, DatagramsReceived Datagramsreceived SegmentsReceived Indications High ping T F TMW_HighPing High fragment ratio T TMW_HighFragRatio Segments resubmitted 3 T TMW_SegmentsReXmitEventLog Resource ModelThis model works in a different way. It scans the NT event log and sendsindications when it finds an event of a specific type. It does not depend onthresholds. You can specify how many events are examined. This number willaffect the performance of IBM Tivoli Monitoring Version 5.1.1.The event log indications are: NT event log 9 (TMW_EventID9) The device [name] did not respond within the time-out period. NT event log 11 (TMW_EventID11) The driver detected a controller error on [text]. NT event log 15 (TMW_EventID15) The device [name] is not ready for access yet. Chapter 3. Resource Models 97
  • 121. NT event log 2011 (TMW_EventID2011) The servers configuration parameter ipstacksize is too small for the server to use a local device. Please increase the value of this parameter. NT event log 2511 (TMW_EventID2511) The server service was unable to recreate the share name because the directory path no longer exists. NT event log 3013 (TMW_EventID3013) The redirector has timed out a request to [text]. NT event log 7023 (TMW_EventID7023) The [name] service terminated with the following error: [text]. Correlated events Correlated events are generated from two indications, in most cases, originated in different Resource Models. Table 3-17 provides an overview of the dependencies of the correlated events. For a more detailed description of the correlated events, refer to the IBM Tivoli Monitoring Resource Model Reference Version 5.1.1, SH19-4570. Table 3-17 Table of correlated indications Generated indication Correlated indication 1 TMW_BusyDriveFromPaging TMW_HighLogicalPercentDiskTime TMW_HighPaging indication 2 TMW_BusyDriveFromLowAvail TMW_LowAvailCausingManyProblems TMW_HighLogicalPercentDiskTime 3 TMW_CongestedTCPNetwork TMW_NICOverworked TMW_SegmentsReXmit 4 TMW_CriticallyLowDiskSpace TMW_LowAvailCausingSoftPagePagefileR esize TMW_LowLogicalDiskSpace 5 TMW_CriticalMemoryLeakInWS TMW_MemoryLeakInPB TMW_LowAvailHighWS98 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 122. Generated indication Correlated indication 6 TMW_FaultyDiskSubsystem TMW_HighPhysicalPercentDiskTime TMW_BusyHardware indication TMW_HighLogicalPercentDiskTime 7 TMW_HighDiskReadBytesSec TMW_HighPhysicalDiskReadBytesSec TMW_HighLogicalDiskReadBytesSec 8 TMW_HighDiskWriteBytesSec TMW_HighLogicalDiskWriteBytesSec TMW_HighPhysicalDiskWriteBytesSec 9 TMW_HighDriveXferRate TMW_HighLogicalDiskXferRate TMW_HighPhysicalDiskXferRate 10 TMW_HighPercentDiskTime TMW_HighPhysicalPercentDiskTime TMW_HighLogicalPercentDiskTime 11 TMW_PossibleFrag TMW_LogicalPossibleFrag TMW_PhysicalPossibleFrag 12 TMW_ProcessHoggingCPU TMW_HighProcesses TMW_ProcessHighCPU 13 TMW_SlowHardDrive TMW_SlowPhysicalDrive TMW_SlowLogicalDrive3.2.3 UNIX Resource Models The tables in this section are for the UNIX/Linux Resource Models. Each table can be interpreted in the same way as the Windows reference models. Any differences or unique characteristics to a specific table will be documented with the relevant tables. CPU Resource Model This Resource Model detects problems with the central processing unit of a computer, for example, how long processes wait in the queue to be processed. The dependencies for the CPU Resource Model are shown in Table 3-18 on page 100. Chapter 3. Resource Models 99
  • 123. Table 3-18 CPU Resource Model Thresholds Percentage of CPU idle Percentage of CPU used by system Properties Low Indications High CPU overload T Low_IdleCPUUsage High CPU usage by system T High_SysCPUUsage Memory Resource Model This Resource Model provides information about how the memory is used. The dependencies for the Resource Model are shown in Table 3-19. Table 3-19 Memory Resource Model Thresholds Percentage of available Percentage of available Memory page-out rate Memory page-in rate virtual storage swap space Indications Low storage space T LowStorage Low swap space T LowSwap System thrashing T T Thrashing100 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 124. File Resource ModelThe file Resource Model gives information about files in the system. ThisResource Model does not have thresholds that certain conditions are comparedagainst. Instead, it checks for changes in files, file attributes, and so on. Weprovide the system resource that it uses to calculate which event should begenerated. The dependencies for this Resource Model are shown in Table 3-20.Table 3-20 File Resource Model Thresholds Change in file attributes Change in CRC Change in file Properties /etc/passwd /etc/group /etc/hosts Indications File changed T T T FileChanged File attributes changed T F FilesAttributeChange File not present This event is FileNotPresent generated if the file does not exist.Process Resource ModelThe Process Resource Model looks for bottlenecks that occur in runningprocesses. Problems highlighted include: A process uses too much CPU time. Too many zombie processes in the system. A process is stopped or killed. A process that was requested does not exist.This Resource Model monitors processes that are specified in the parameter list.By default, it monitors lcfd and syslogd. The dependencies for this ResourceModel are shown in Table 3-21 on page 102. Chapter 3. Resource Models 101
  • 125. Table 3-21 Process Resource Model Thresholds Max zombie processes Percent of CPU used Properties syslogd lcfd Indications High number of zombie processes T HighZombieProcesses Process consuming high CPU T ProcessHighCPU Process killed or nonexistent Sent if a process is killed ProcessKilledOrNotExisting or does not exist. Process stopped Sent for each monitored ProcessStopped process that is stopped. Network Interface Resource Model The Network Interface Resource Model detects problems with all the installed network interfaces. Events are generated when performance data, such as bytes per second in and out and sessions with errors or requests, becomes critical. The dependencies for this Resource Model are shown in Table 3-22 on page 103.102 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 126. Table 3-22 Network Interface Resource Model Thresholds Percent of packet Output packets Input packets Interface status Interface collision in error in error Properties Token Ring, Ethernet, UP&NOTRUNNING or LOOPBACK UP&RUNNING UNKNOWN Down Indications High percentage packet T Ta T T collision HighPacktsCollision High output packets in error T T T T HighOutErrorPacks High input packets in error T T T T HighInputErPacks Interface not enabled T T InterfaceNotEnabled Interface not operational T T InterfaceNotOperat Unknown interface status T T IntStatUnknown Network Interface Card not F supported IntNotSupporteda. Ethernet interface only.File system Resource ModelThis Resource Model measures how efficiently the file systems are being used.The dependencies for this Resource Model are shown in Table 3-23 onpage 104. Chapter 3. Resource Models 103
  • 127. Table 3-23 File system Resource Model Thresholds Percentage of File System Space Available Percentage of file system space used Percentage of available I-nodes Percentage of I-nodes used Available space (KB) Indications Fragmented file system T F FragmentedFileSystem Low percent space available T T LowPercSpcAvail Low space available T LowKAvail Low percentage of available I-nodes T LowPercInodesAvail Security Resource Model The Security Resource Model provides information about files and the users logged onto the system. It highlights the following items or changes that might indicate security breaches: Property changes, such as the owner, group, or attributes, for certain files The number of logons onto the system by the same user A suspect superuser An account that is not valid for root The dependencies for the Resource Model are shown in Table 3-24 on page 105 and Table 3-25 on page 106.104 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 128. Table 3-24 Security Resource Model and file monitoring: Part 1 Thresholds Alternative groups Instrumentation Special groups Custom logins Defined users Special users Properties Null password Supergroups Superusers Duplicated UID -1 UID 0 Indications root root Duplicated account F F T DuplicatedAccount F F T High log-in number for user F T HighLoggingNumber Suspect super group T F F SuspectSuperGroup Account not valid for root F T NotRegularRootAccount F F T Null password Ta PasswordNull Suspect superuser T F F SuspectSuperUsera. This indicator will also happen for a group with a null password, but only for HP-UX 10 and Solaris2 systems. Chapter 3. Resource Models 105
  • 129. Table 3-25 Security Resource Model and file monitoring: Part 2 Thresholds Files to be monitored Alternative owners Alternative groups File owner File group File mode Properties File Exists Matches Matches Matches Member Member Indications Illegal owner F T F T IllegalOwner Illegal group F T F T T IllegalGroup Wrong file mode T F WrongMode Nonexistent file F FileNoteExisting Network RPC/NFS Resource Model The Network RPC/NFS Resource Model detects problems and monitors the performance of the RPC and NFS servers and clients. This Resource Model should only be distributed to Solaris machines. The dependencies for this Resource Model are shown in Table 3-26 on page 107.106 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 130. Table 3-26 Network RPC/NFS Resource Model (Sun Solaris specific) Thresholds Percent of Sever RPC duplicate requests Percent of NFS svr readlink operations Percent of Client RPC retranmissions Percent of NFS svr getattr operations Percent of client RPC calls in timeout Percent of NFS svr write operations Percent of NFS server read ops Percent of client RPC badxids Percent of bad RPC calls Indications High NFS server read operations T HighNFSSrvRead High duplicate RPC server calls T HighPercDupReqs High retransmitted calls T HighPercRetrans High network traffic T T NetworkBusy High NFS buffer size T T HighNFSBufferSize High NFS server get-attribute T operations HighNFSSrvGetattr High RPC bad calls T HighPercRPCBadCalls Slow network T T NetworkSlow High NFS server readlink operations T HighNFSSrvReadLink High timeout and badxids T HighTimeoutsAnd_Badxids Chapter 3. Resource Models 107
  • 131. 108 Indications Thresholds HighNFSSrvWrites High timeout and badxids HighTimeoutsAnd_Badxids High NFS server write operations Percent of NFS server read ops Percent of Sever RPC duplicate requestsIBM Tivoli Monitoring: Creating Resource Models and Providers Percent of Client RPC retranmissions Percent of NFS svr getattr operations Percent of bad RPC calls Percent of NFS svr readlink operations Percent of client RPC badxids T Percent of client RPC calls in timeout T Percent of NFS svr write operations
  • 132. 4 Chapter 4. Providers IBM Tivoli Monitoring is able to gather data not only from CIM data sources but also from Tivoli Distributed Monitoring (Classic Edition) monitors and custom scripts (Compatibility Mode). In this way, ITM provides a set of data sources, or Providers, that support not only the enhanced ITM architecture, but also a migration path for those already supported by Tivoli Distributed Monitoring (Classic Edition). To fully leverage the new technologies, new work should be performed in the native environment, where the monitored data is collected from the underlying CIM implementation. This chapter provides a background on the technologies supported by the ITM architecture as well as discussions on the methods by which Tivoli has implemented these technologies. The following topics are discussed in this chapter: Overview and terminology Industry technologies (WBEM, CIM, and JMX specifications) Tivoli implementations© Copyright IBM Corp. 2003. All rights reserved. 109
  • 133. 4.1 Overview Various management technologies exist in the Information Technology industry today. This has resulted in a vast array of management methods. In Figure 4-1, four methods chosen due to their relevance to the ITM Provider discussion, are compared. IT Management Methods Tivoli Physical Monitoring Network Desktop Fault, Fault, Management ITM Engine Configuration, Configuration, Application Performance Performance Managed Resource MOF MIB MIF Definition Service Layer & CIM SNMP DMI Infrastructure (M12, WMI) Physical Managed Desktop Managed Network Devices Resource Systems Objects Figure 4-1 IT management methods Physical: The physical management techniques vary per industry or technology. Many of the current standards in the IT industry are legacy specifications originally implemented as a point solution to manage specific types of devices in a specific way. – Management Application: This layer refers to how management will be applied, such as specified instrumentation or uses. Some methods may refer to physical software, as the flexibility of the technology may not be limited to specific topics. – Managed Resource Definition: This layer exists to define the objects in a manner that is applicable to the service layer. – Service Layer & Infrastructure: This layer determines the management technique is applied and interacts with the physical managed objects.110 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 134. – Physical Managed Objects: In the Information Technologies arena, these objects can vary from routers and servers, to individual disk drives and application modules.Tivoli ITM: The implementation of IBM Tivoli Monitoring includes technologiesbased on open industry standards and apply methods designed to bettermodel the physical devices, compared to previous monitoring solutions.– ITM Engine: The ITM Engine provides the infrastructure to support numerous applications for management. It exists in two forms: a Windows version and a Java-based cross-platform version. Each addresses the same product requirements but within the context of the platform as well as supporting platform dependent technologies. This is best explained in “Java-based ITM Engine overview” on page 120.– MOF: The Managed Object Format, as described in 4.2.3, “Managed Object Format (MOF)” on page 114.– CIM (M12 & WMI): The Common Information Model implementation is described in “Java-based ITM Engine overview” on page 120 and “Windows-based ITM Engine overview” on page 123, respectively.– Managed Resource: The physical items against which data Providers are executing to obtain metrics.Network: This method is primarily implemented for network availability andperformance applications, such as network segment and device monitoring.– Fault, Configuration, Performance: This list indicates the various information types that the network method applies to. This data, following the MIB format, is available through SNMP requests.– MIB: The Management Information Base is a schema that defines the hierarchical order of a set of management objects, each with its own unique identifier, and is accessible through the SNMP protocol.– SNMP: The Simple Network Management Protocol specification for sending and receiving MIB data. This is typically implemented by a manager that generates the information requests and an agent that receives, processes, and responds to requests.– Network Devices: Though the most common uses for the network management methods are with devices such as routers, switches, and firewalls, most vendors provide software services for workstation and server operating systems as well.Desktop: This method is most commonly implemented within configurationmanagement applications, such as inventory.– Fault, Configuration, Performance: This list indicates the various information types that the desktop method applies to. This data, following the MIF format, is available through DMI requests. Chapter 4. Providers 111
  • 135. – MIF: The Management Information Framework is a schema that defines the standard manageable attributes of workstation and server products. – DMI: The Desktop Management Interface is a standard way for sending management information across a network to a central site. – Desktop Systems: Though desktop systems are the most common use for the DMI implementation, it has become increasingly useful for server management in “lights out” data centers.4.2 Industry technologies To improve the positioning and capabilities of products, numerous companies are forming organizations together to drive the direction of these technologies as a joint effort. One such group is the Distributed Management Task Force, Inc. (DMTF). The DMTF is the industry organization that is leading the development, adoption, and unification of management standards and initiatives for desktop, enterprise, and Internet environments. Working with key technology vendors and affiliated standards groups, the DMTF is enabling a more integrated, cost-effective, and less crisis-driven approach to management through interoperable management solutions. IBM is a board member of the DMTF and has incorporated many of the specifications created by the organization within the ITM product suite. The diagram show in Figure 4-2 on page 113 helps explain the relationships of the applicable technologies.112 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 136. Management Technologies Application Management Application WBEM JMX Technologies CIM WMI Layer MOF MOF Interface Provider COM MBean Layer Managed Resources Figure 4-2 Management technologies4.2.1 Web-Based Enterprise Management (WBEM) WBEM is a set of management and Internet standard technologies developed by the DMTF to unify the management of enterprise computing environments. WBEM provides the ability for the industry to deliver a well-integrated set of standard-based management tools leveraging Internet technologies. Included in the WBEM initiative is a data model, an encoding specification, and a transport mechanism, We will not discuss WBEM further except for the Common Information Model (CIM) data model and its applicable technologies. Additional information on the WBEM initiatives can be obtained from the DMTF at: http://dmtf.org/standards/standard_wbem.php4.2.2 The Common Information Model (CIM) The DMTF CIM is a specified approach to the management of systems and networks that applies the basic object-oriented structuring and conceptualization techniques. The specification formally introduces the language and methodologies for describing object-oriented enterprise management data within an extensible schema. The CIM schema enables applications from different Chapter 4. Providers 113
  • 137. developers on different platforms to describe management data in a standard format so that it can be shared among a variety of management applications. Associations Unlike many common object models, CIM does not allow ordinary classes to contain references to other classes. Instead, CIM uses a special kind of class called an association to link instances of classes together. An association class is a class that has at least two references and the association qualifier. Classes that are not associations may not have any references. Reference properties may not be arrays. Therefore, there is one instance of an association class for every pair of classes that is associated (assuming a binary association). CIM Object Manager (CIMOM) The CIMOM is the core component to the implementation of the CIM specification. The CIMOM manages the CIM schema, instantiation, communication, and operation of the physical Providers that represent the CIM classes stored within the namespace of the local host. This local storage location represents the schema and is typically implemented as either a file system, a registry, or a binary database.4.2.3 Managed Object Format (MOF) The management information is described in a language based on Interface Definition Language (IDL) called the Managed Object Format (MOF). This document uses the term MOF Specification to refer to a collection of management information described in a manner conformant to the MOF syntax. The MOF syntax is a way to describe object definitions in a text format. It establishes the syntax for writing definitions. The main components of a MOF specification are textual descriptions of classes, associations, properties, references, methods, and instance declarations and their associated qualifiers. Comments within the MOF are permitted and advised. In addition to specifying the managed objects, a MOF specification can be processed using a compiler. To assist the process of compilation, a MOF specification consists of a series of compiler directives. MOF usage The managed object descriptions in a MOF specification can be validated against an active namespace. Such validation is typically implemented in an entity acting in the role of a server. This section describes the behavior of an implementation when introducing a MOF specification into a namespace. Typically, such a process validates both the syntactic correctness of a MOF specification, as well as the semantic correctness of such a specification against114 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 138. a particular Implementation. A MOF specification can be validated for the syntactic correctness through the use of a MOF compiler. Class declarations A class declaration is treated as an instruction to create a new class.The ability to add classes or modify classes within a namespace from a MOF specification is determined by the CIMOM implementation. Different vendors may or may not support this capability. Any class referenced within another class must exist at the time the MOF specification makes that reference, that is, forward references are not allowed. Instance declarations Classes must be defined before they are used to declare instances. However, if a class definition is already resident within the namespace, that class declaration need not appear in a MOF specification that introduces the instances of that class. Any instance declaration is treated as an instruction to create a new instance where the objects key values do not already exist, or an instruction to modify an existing instance where an object with identical key values already exists.4.2.4 CIM Provider layer The CIM Provider layer consists of the software implementation of the CIM class that the CIM represents. This software implementation performs the actual instrumentation and management as defined by the MOF specification. The operations can consist of methods that retrieve or set properties of the physical resource through software, hardware, or other application interfaces. The Provider layer can vary a great deal regarding how it is implemented; Java classes, COM objects, and platform specific binaries are examples. The common tie between all Provider types is that they implement an interface for the CIMOM on which they were designed to execute.4.2.5 Windows Management Interface (WMI) Windows Management Instrumentation (WMI) is a component of the Microsoft Windows operating system that provides management information and control in an enterprise environment. By applying industry standards, managers can use WMI to query and set information on desktop systems, applications, networks, and other enterprise components. Developers can use WMI to create event monitoring applications that alert users when important incidents occur. Chapter 4. Providers 115
  • 139. WMI offers a variety of programming interfaces such as C++, open database connectivity (ODBC), Visual Basic, or HTML, that developers can use to customize management applications. System administrators can use WMI by using scripts to automate administration tasks. WMI can integrate with Windows components, such as Active Directory, to allow for a consistent management interface. A management application communicates with WMI through a variety of interfaces, such as Visual Basic, C++, ODBC, and Microsoft ActiveX. All of the WMI interfaces in turn are based on the Component Object Model (COM). WMI retrieves information about an enterprise from different sources, such as hardware, the registry, or other user-defined sources. Like a management application, WMI communicates with a data source using a COM interface. After WMI retrieves information about an enterprise, WMI stores the data using the Common Information Model (CIM). The WMI architecture consists of the following components: Managed objects and Provider WMI infrastructure WMI management applications Managed objects and Providers A managed object is a logical or physical enterprise component, such as a hard drive, network router, database system, or operating system component. A managed object communicates with WMI through a Provider. In the case of WMI, a Provider is a COM object that monitors a managed object for WMI. Similar to a driver, a Provider supplies WMI with data from a managed object. A Provider also handles messages from WMI to the managed object. For example, the Microsoft Windows Platform SDK ships with a Registry Provider, which accesses information on the system registry. WMI passes information from the Providers to the WMI infrastructure. WMI infrastructure The WMI infrastructure is a Windows operating system component that moves and stores information about managed objects. The WMI infrastructure consists of two components: the Windows Management service, and the WMI repository. The Windows Management service acts as an intermediary between the Providers, management applications, and the WMI repository, placing information from a Provider into the WMI repository. The Windows Management service also accesses the WMI repository in response to queries and instructions from management applications. Finally, the Windows Management service can pass information directly between a Provider and a management application. In116 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 140. contrast, the WMI repository acts as a storage area for information passed in by the various Providers. WMI management applications A management application is an application that interacts with the WMI infrastructure. A management application can query the Windows Management service for information regarding a managed object. Alternately, a management application can instruct the Windows Management service to send instructions to a managed object.4.2.6 Java Management Extensions (JMX) JMX defines a standard instrumentation model: MBeans, for use in Java programs and by Java management applications. JMX also specifies a set of complementary services that work with MBean instrumentation to monitor and manage Java-based applications. These services range from simple monitors and timers to a powerful relation service that can be used to create user-defined associations between MBeans in named roles and a mechanism for dynamically loading new instrumentation/services at run time. JMX architecture The Java™ Management Extensions (JMX) Instrumentation and Agent Specification Version 1.0 defines an architecture and services for application and network management. JMX provides a standard mechanism for management of Java-based resources and management through the Java platform. Figure 4-3 illustrates the JMX architecture. Figure 4-3 JMX MBean server Chapter 4. Providers 117
  • 141. The architecture is divided into the following three levels: Instrumentation MBean Agent Instrumentation JMX instrumentation provides mechanisms for describing and accessing JMX Manageable Resources. JMX Manageable Resources are those aspects of a domain that provide some management interface to the user or administrator. JMX Manageable Resources can be developed as pure Java applications or application components or they can be Java wrappers around native resources. MBeans are the concrete representations of JMX Manageable Resources. MBeans come in two basic types: standard and dynamic. The JMX Specification provides a detailed description of these basic types and their subtypes. MBean An MBean (or Managed Bean) is a Java object that implements a specific interface and conforms to certain design patterns. These requirements formalize the representation of the resource’s management interface in the MBean. The management interface of a resource is the set of all necessary information and controls that a management application needs to operate on the resource. MBeans are either standard or dynamic. Standard MBeans are Java objects that conform to certain design patterns derived from the JavaBeans™ component model. Dynamic MBeans conform to a specific interface that offers more flexibility at run time. Agent The Agent Level of the architecture is responsible for combining JMX instrumentation and services as well as providing a uniform interface to the components of the Distributed Services layer. Conceptually, a JMX Agent is composed of an MBeanServer instance, a set of MBeans representing managed resources, a minimum number of agent services implemented as MBeans, and at least one protocol adapter or connector server. The agent may be part of a daemon process running on a machine or it may be embedded within the application being managed. Distributed services In the first version of the JMX specification, this level of the architecture is unspecified. However, its role is clear: it connects the JMX Agent to the external world of management consoles and applications.118 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 142. JMX-based management Run-time management of resources is illustrated in Figure 4-4. Figure 4-4 Management agent Events or attribute changes in the managed resources trigger higher level events in the monitor(s) listening/watching for those events/changes. These higher level events are sent to a decision maker. This decision maker may be a human sitting at a management console, or another software component. The decision maker is responsible for taking an appropriate action in response to the event. Those actions are then turned into control directives that act on the managed resources. In the JMX model, managed resources are MBeans. The JMX monitors are service MBeans that are part of the JMX agent level. JMX does not specify any standard decision makers. However, in the case where the decision maker is a software component, it would also be a service MBean registered with the MBeanServer. Control directives are carried out by invoking methods or setting attributes on specific MBeans via the MBeanServer interface.4.3 Tivoli implementations The Tivoli implementation of the previously discussed technologies can best be addressed first by presenting the engine components and any platform specific implementation issues. Second, the legacy support capabilities of the engine will be addressed. Third, the technologies required to support a CIM-based Provider Chapter 4. Providers 119
  • 143. is discussed. Finally, a brief discussion on the implementation of Java Management Bean technology is presented.4.3.1 ITM Engine components The ITM Engine consists of multiple logical components, which have been implemented with two different approaches to resolve specific needs. The original approach was to create the engine for the Windows platform to make use of the WMI infrastructure. The later approach was that of the Java-based engine. The Java engine provides a key capability that is not obtainable from the Windows engine, cross-platform operation. It is this capability that drives the development efforts of the newer product releases. This is confirmed when one considers the Windows engine enhancement to provide support to Java ILTs. We will therefore present the engine logical components by discussing the unique features of the Java platform, then the Windows platform, and finally the components common to both. Note: For a physical component discussion, please refer to Chapter 1, “IBM Tivoli Monitoring architecture” on page 3. Java-based ITM Engine overview The Java-based ITM Engine is a cross platform implementation of the original Windows design. The Java engine provides cross-platform capabilities that cannot be offered by the Windows engine, as well as a simplified ILT Provider interface. These features include: Ability to operate on multiple platforms, including various flavors of UNIX and OS/400. Ability to load and execute Java-base ILT classes, which in-turn provides cross-platform monitoring solutions. This can reduce development and maintenance costs. All of the logical components within the Java engine are both common to both engines. Therefore, we will introduce these components here to better explain the commonalities. Figure 4-5 on page 121 provides a diagram of the logical components of the Java version of the ITM Engine. This diagram will be referenced throughout this chapter as a thumbnail image. Attention: Thumbnail images have been implemented within sub-topics for quick reference to the logical components utilized within the area of discussion. It is recommended that the larger diagrams be referenced when conducting an in-depth analysis.120 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 144. ITM Engine Logical Components (Java) Analyzer Resource Resource Resource Resource Resource Model Model Model Model Model DM Classic Monitor Probes Service Object Launch (Class Loader) Custom Scripts Java Class Loader ILT ILT JMX ILT Provider MBean Providers JNI Server Native Resource Resource Resource MBean(s) Binaries Resources (OS & Applications)Figure 4-5 ITM Engine Logical Components (Java)Common componentsThe logical components common to both engines are those focused on theintegration with the TME® infrastructure as well as those that handle the JavaILT operation. The diagrams in Figure 4-6 on page 122 highlight only thecomponents within the Windows and Java engines that are common. For greaterengine detail, please refer to Figure 4-5 and Figure 4-7 on page 124. Chapter 4. Providers 121
  • 145. ITM Engine Logical Components (Windows) ITM Engine Logical Components (Java) Analyzer Analyzer Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model Model Model Model Model Model TMWService Service Object WMI APIs WMI (CIMOM) DM Classic Monitor Probes DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Launch (Class Loader) Custom Scripts Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) Java Class Loader ILT ILT ILT JMX ILT ILT JMX ILT Provider Provider MBean MBean Providers Providers JNI Server JNI Server Binary Native Resource Resource Resource Resource Resource MBean1 Resource Resource Resource MBean(s) Library Binaries Resources (OS & Applications) Resources (OS & Applications)Figure 4-6 Common logical components for Windows and Java The logical components shared between the Java and Windows engines are: Resource Models: The Resource Models are packages containing a variety of files required for configuration and that provide the desired functionality, the details of which can be referenced in Chapter 3, “Resource Models” on page 67. Analyzer: The analyzer performs the core functionality for the ITM Engine. TMWService (Service Object): The service object is implemented in two ways; one for each of the engine types. For Windows, the TMWService is an COM object, where as in Java it is a class. Both are instantiated by the Analyzer and passed to the Resource Model script functions for reference by the model to specific methods. DM Classic & Custom Script Support: Both of these logical components are actually implemented through the use of the shell method of the service object and any associated dependency files within the Resource Model. Launch (Class Loader): The ITM Engine actually provides three levels of class loading, two of which are relevant to the loading of ILTs. – Common: This class loader handles classes packed in jar files placed into the “%LCF_DATDIR%LCFNEWITMPACS” path. This loader is dynamic, meaning that classes packed as “*.jar” files can be added dynamically to the path. – Category-Specific: This class loader handles classes packed in jar files placed into the “%LCF_DATDIR%LCFNEWITMPACS<category>” and the “%LCF_DATDIR%LCFNEWTmw2kUnixClasses<category>” path.122 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 146. This loader is also dynamic and can dynamically add jar-packed classes to the path. Instrumentation Library Type (ILT) Providers: This component represents the actual Java classes responsible for interfacing the TSL to the instrumentation mechanism, typically additional classes. Three types of instrumentation classes are represented: – Providers: This component refers to the actual Java class that performs the actual instrumentation. In this component, this work is performed strictly through Java code. – JNI & Native binary libraries: The use of Java Native Interface methods can be implemented within the Provider class to reference C/C++ libraries compiled for specific platforms. This method is much less portable than is the straight Java code. – JMX ILT: This refers to the implementation of an MBean agent to load MBeans from management enabled Java applications that provide the MBean server. Within the ITM Engine, an MBean loader has been provided, so it is not required to learn ILT to be able to gather metrics from MBean enabled applications.Resources: Resources are anything that the metrics are provided for by the ILT.An ILT can be designed to interface with an operating system and pollconfiguration or performance data. An ILT can also be designed using applicationAPIs to poll metrics internal to the application. Along the same design theory, anILT can be implemented that “connects” to MBeans within Java-basedapplications, which is typical with Web-based solutions such as WebSphere®, topoll configuration and metric data.Windows-based ITM Engine overviewThe Windows-based ITM Engine is a platform specific implementation.Therefore, the most significant difference is that the TSL has not beenimplemented within the Windows engine, as the WMI provides all CIMOMfunctionality. Additional differences include enhancements over previousproducts and a few capabilities that cannot be offered by the Java engine. Thesefeatures include: The ability to instantiate COM objects within the Resource Model script. The ability to reference WMI registered Providers through direct WMI API calls, internal to the engine components.Product enhancements were implemented to support the Java ILT components.Due to the nature of the platform specific engine and WMI APIs, the supportingof the ILTs requires complexities not found in the Java based engine. The firstcomponent to address these integration issue is the registration of the ILT Chapter 4. Providers 123
  • 147. Manager as a WMI Provider DLL. This ensures that the ILTs will operate through the engine as a native WMI Provider, which offers consistent performance through the engine and allows WMI to control the Provider. The ILT Manager embeds a Java Virtual Machine that in turn hosts the Java ILTs. This supports the Java requirements of the TSL components and the custom ILT classes. Figure 4-7 provides a diagram of the relationship between the logical components of the Windows version of the ITM Engine. This diagram will be referenced throughout this chapter as a thumbnail image. As stated earlier, the thumbnail images are for general reference for the localized topics. ITM Engine Logical Components (Windows) Analyzer Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model TMWService WMI APIs WMI (CIMOM) DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) ILT ILT JMX ILT Provider MBean Providers JNI Server Binary Resource Resource Resource Resource Resource MBean1 Library Resources (OS & Applications) Figure 4-7 ITM Engine Logical Components (Windows) Windows ITM Engine COM support The ITM Engine for the Windows platform utilizes the Microsoft Script Host to process the VBScript and JScript within Resource Models. It is the script host that permits the declaration of Component Object Model (COM) objects within the Resource Models. An example of implementing a COM object within a Resource Model is provided in Chapter 11, “File monitoring Resource Model example” on page 447.124 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 148. For a comprehensive explanation of the Microsoft Windows Script Hostcapabilities, refer to:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsorigettingstarted.aspFigure 4-8 highlights only the components within the Windows engine that isutilized for COM references within VBScript-based Resource Models. For greaterengine detail, please refer to 4.3.1, “ITM Engine components” on page 120. ITM Engine Logical Components (Windows) Analyzer Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model TMWService WMI APIs WMI (CIMOM) DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) ILT ILT JMX ILT Provider MBean Providers JNI Server Binary Resource Resource Resource Resource Resource MBean1 Library Resources (OS & Applications)Figure 4-8 Logical components for Windows COM supportWindows ITM Engine native WMI supportThe ITM Engine for the Windows platform is integrated at the API level with theWMI components of the OS. This was done because WMI is the formalimplementation of the WBEM specification by Microsoft. The WMI Providers areaccessible through the Dynamic Data CIM declarations within the ResourceModel and can be browsed through the ITM Workbench.In order to provide cross engine Java ILT class support, a class loader has beenincluded within the Windows ITM Engine. This is implemented as a Java VirtualMachine (JVM) registered to WMI as a native Provider. This allows for consistentinterfacing between the ITM Engine and WMI. The JVM based class loaderhandles the loading and execution of the Java based ILTs distributed withinResource Models. This integration method allows the Windows ITM Engine toexecute the same Java ILT classes as the pure Java ITM Engine. Chapter 4. Providers 125
  • 149. Note: Any coding done in the Java classes that may be specific to an operating system may not be portable. This is an issue that should be considered when coding the Java classes. For example, if JNI is used to access platform specific binary libraries, a corresponding Windows binary will be required to support the JNI references. Though the Java ILT class and Provider class can be written in a platform independent manner, the differences between the Microsoft CIM implementation through WMI and the Tivoli implementation through the M12 specification mandate that different MOF files be created. The following requirements for the Windows MOF should be noted: Add the “Dynamic” qualifier to the CIM class. Use “M12JavaProvider” and not “com.tivoli.dmunix.ep.touchpoint.cimom.ifc.M12JavaProvider” as the Provider for the class instances and properties. Specify the “CIMV2” namespace using a “pragma” statement. For an example of a Windows MOF implementation, please reference Chapter 9, “Creating a log-file Resource Model and ILT” on page 333. Attention: The utility xmof was created by Tivoli ITM developers to handle the conversion of a TSL compatible MOF to a Windows compatible MOF, but it is not widely available yet. It has been provided at the download site for this redbook. For a detailed example of the usage of the utility and the implementation of the Windows MOF requirements, please refer to Chapter 9, “Creating a log-file Resource Model and ILT” on page 333. Additional information is also available from the Microsoft Developer Network at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/kmarch/hh/k march/wmi_2fjb.asp Figure 4-9 on page 127 highlights only the components within the Windows engine that are utilized for WMI integration and native support. For greater engine detail, please refer to 4.3.1, “ITM Engine components” on page 120.126 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 150. ITM Engine Logical Components (Windows) Analyzer Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model TMWService WMI APIs WMI (CIMOM) DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) ILT ILT JMX ILT Provider MBean Providers JNI Server Binary Resource Resource Resource Resource Resource MBean1 Library Resources (OS & Applications) Figure 4-9 Logical components for Windows WMI native support4.3.2 Legacy support The ITM product provides functionality to support pre-existing DM Classic collections and custom scripts. This functionality can also be used to implement a new functionality that a developer may not feel is appropriate or cost effective to create an ILT for. This functionality is performed through the use of the shell method within the service object. For a more detailed explanation of its use, please refer to Appendix A, “Service Object Method Library”, of the IBM Tivoli Monitoring Workbench Users Guide Version 5.1.1, SH19-4571. Both legacy types will require additional dependencies within the Resource Model that will vary depending on the functionality required. These dependencies will be specified by the model developer and added through the use of the Workbench during the creation of the model. We have provided an example, available in Chapter 10, “Creating a custom script Resource Model” on page 411, demonstrating the use of the shell method that should help explain the dependency issues as well. Custom scripts The diagrams in Figure 4-10 on page 128 highlight only the components within the Windows and Java engines that are utilized for legacy support of the custom scripts. For greater engine detail, please refer to 4.3.1, “ITM Engine components” on page 120. Chapter 4. Providers 127
  • 151. ITM Engine Logical Components (Windows) ITM Engine Logical Components (Java) Analyzer Analyzer Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model Model Model Model Model Model TMWService Service Object WMI APIs WMI (CIMOM) DM Classic Monitor Probes DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Launch (Class Loader) Custom Scripts Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) Java Class Loader ILT ILT ILT JMX ILT ILT JMX ILT Provider Provider MBean MBean Providers Providers JNI Server JNI Server Binary Native Resource Resource Resource Resource Resource MBean1 Resource Resource Resource MBean(s) Library Binaries Resources (OS & Applications) Resources (OS & Applications)Figure 4-10 Logical components for Windows and Java custom scripts DM Classic The diagrams in Figure 4-11 highlight only the components within the Windows and Java engines that are utilized for legacy support of DM Classic collections. For greater engine detail, please refer to 4.3.1, “ITM Engine components” on page 120. ITM Engine Logical Components (Windows) ITM Engine Logical Components (Java) Analyzer Analyzer Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model Model Model Model Model Model TMWService Service Object WMI APIs WMI (CIMOM) DM Classic Monitor Probes DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Launch (Class Loader) Custom Scripts Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) Java Class Loader ILT ILT ILT JMX ILT ILT JMX ILT Provider Provider MBean MBean Providers Providers JNI Server JNI Server Binary Native Resource Resource Resource Resource Resource MBean1 Resource Resource Resource MBean(s) Library Binaries Resources (OS & Applications) Resources (OS & Applications)Figure 4-11 Logical components for Windows and Java DM Classic128 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 152. 4.3.3 Touchpoint Service Layer The Touchpoint Service Layer (TSL), formally referred to as the Manageability (M12) Model Specification, is Tivoli’s implementation of the CIM specification for Java engine only. The basic premise of the manageability model is that the manageability of a resource can be defined independently of the tool that manages it. This implies that the manageability of a resource is neutral both to the scale of the management tool, and the approach the tool takes to management. The same characteristics of a resource are appropriate for a low-end workgroup, or a high-end ASP solution. The model is implemented through a series of interface layers to segregate specific functionality. Management (M9) is the act of managing. It is the active process of monitoring, altering, and making decisions about a resource. Manageability (M12) defines what is manageable about a resource. It is a static definition of the properties of a resource that support management. The M12 model incorporates the WBEM initiatives through the use of the Common Information Model (CIM) meta schema for its modeling language.4.3.4 CIM object definition The M12 model uses the Common Information Model (CIM) meta schema for its modeling language. It has several characteristics that make it a good fit for the information the M12 model needs to express: UML compatible model IDL like syntax XML form of notation Easily extendable The CIM meta schema defines an information model that represents management information. An information model is a set of rules that define a method for structuring information. The tabular structure used by relational databases is an example of an information model. The rules of the model may be expressed as formal grammar, graphically, or through other means. CIM takes an object-oriented approach to structuring data; therefore, the meta schema contains rules for building an object model. The CIM object model has many characteristics in common with other object models, such as those supported by C++ or Java, but it also has many unique characteristics. Among the unique or unusual characteristics used by the M12 model are qualifiers and associations. Chapter 4. Providers 129
  • 153. Qualifiers The CIM meta model provides a mechanism for associating meta data with elements of the model. The meta data describes characteristics of the model element with which it is associated. This mechanism is a qualifier. Qualifiers allow the meta schema to be extended in a limited and controlled fashion. Qualifiers associate name-value pairs with part of the object model. For example, a property that specifies distance could have a units qualifier with the value "yards". The meta model defines a set of standard qualifiers. Some of these qualifiers are used by the meta model to control its own behavior, while others provide standard definitions for common user requirements. In addition, users of the model may define additional qualifiers as needed. Qualifiers provide a more flexible and controllable mechanism for adding semantics to an object model than other mechanisms, such as overloading property or class names. The M12 model defines a set of qualifiers that provide the "words" in the language a resource uses to communicate its management characteristics to a management tool. The CIM specification provides specific key words or “qualifiers” that can be utilized within the MOF file to more clearly define the class being described. Standard CIM qualifiers Key: Property qualifier that identifies the key property for the resource. This is used in a similar way to an index in a data table. Provider: Class/Property qualifier that identifies the library (class) that implements an Instance/Property interface in order to provide data about the resource. Description: Class/Property qualifier that describes the resource/property. Non-standard CIM qualifiers M12_Instrumentation(“type.ILT class|mapping string|operation”): In the M12 model, this qualifier is used to instruct the TSL about which ILT Manager (type) and which ILT (ILT class) are able to perform the specified operation and to pass data to them. – type: This is always Java. – ILT Class: This is the Java class that implements the ILT, and it must be specified with the complete package (with no .class extension). – mapping string: This is a string whose meaning is known to the ILT.130 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 154. Note: ILT implementations may choose to process the mapping string, such as for parameter substitution. Such substitutions use the parameters passed into the ILT call. For example, a mapping string passed into a get call has the instance identity and the target property available. – operation: The allowed operations are: • Enum: Only when the qualifier is associated with the class • Get: When the qualifier is associated with the class and property • Invoke: When the qualifier is associated with the class and method It is required that all classes have an M12_Instrumentation qualifier for the Enum operation. It is also required that an M12_Instrumentation qualifier for the Get be present for the following: Property level: It means that the property will be collected singularly (reference “getProperty” on page 132). Class Level: It means that all the properties that do not have any M12_Instrumentation qualifier associated will be collected within the same request (reference “getMultipleProperties” on page 132). It is also required that an M12_Instrumentation qualifier for the Invoke operation be present for every method. As an alternative, when the instrumentation string is the same for every method, a single M12_Instrumentation qualifier for the Invoke operation can be set at the class level.4.3.5 Tivoli ILT Provider Interface The term ILT Provider Interface refers specifically to the ILTInterface Java class that must be implemented by a custom ILT. This implementation ensures the appropriate methods will be supported to provide interfacing functionality from the TSL to the custom ILT. Essentially, the Launcher within the ITM Engine will load the custom ILT class, then make the ILTInterface class method calls to the custom ILT class. This will become more clear in Chapter 5, “Engineering a Java ILT” on page 137. The diagrams in Figure 4-12 on page 132 highlight only the components within the Windows and Java engines that are utilized for supporting ILTs. For greater engine detail, please refer to 4.3.1, “ITM Engine components” on page 120. Chapter 4. Providers 131
  • 155. ITM Engine Logical Components (Windows) ITM Engine Logical Components (Java) Analyzer Analyzer Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model Model Model Model Model Model TMWService Service Object WMI APIs WMI (CIMOM) DM Classic Monitor Probes DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Launch (Class Loader) Custom Scripts Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) Java Class Loader ILT ILT ILT JMX ILT ILT JMX ILT Provider Provider MBean MBean Providers Providers JNI Server JNI Server Binary Native Resource Resource Resource Resource Resource MBean1 Resource Resource Resource MBean(s) Library Binaries Resources (OS & Applications) Resources (OS & Applications)Figure 4-12 Logical components for Windows and Java ILTs The ILTInterface class includes numerous methods to provide a comprehensive interface from the TSL to the pluggable ILT. These methods must be supported by the ILT, as they are invoked by the TSL. That is, once the ILT class has been loaded, the TSL invokes the interface methods within the custom ILT class. enumerateInstances The enumerateInstances method returns all M12ObjectIdentity objects that identify all the instances belonging to the class specified in the classPath. getProperty The getProperty method gets the value (in String format) of the specified property for the identified object. getMultipleProperties The getMultipleProperties method gets the value (in String format) of the specified properties for the identified object. invokeMethod The invokeMethod method invokes the specified method on the CIM instance belonging to the class specified in the classPath] setProperty The setProperty method is not invoked yet by the ITM Engine.132 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 156. create The create method is not invoked yet by the ITM Engine. destroy The destroy method is not invoked yet by the ITM Engine.4.3.6 Tivoli Management Extensions for Java (TMX4J) TMX4J is Tivolis implementation of the Java Management Extensions (JMX) Specification. It implements all of the specified JMX interfaces and classes but has yet to be tested for complete conformance by the JMX Technology Compatibility Kit. Changes have been made to the ITM Engine between the 4.1 and the 5.1 product sets. The only JMX support embedded within the engine is that of an ILT wrapper, provided to load the MBeans to gather metrics only. Thus, custom integration does not require knowing the intricacies of the ILT Provider type, only knowing MBean technology. This may provide a more familiar environment for developers of Web-based e-commerce systems such as WebSphere Application Server It should be noted that the TMX4J is available through the IBM AlphaWorks web site at http://www.alphaworks.ibm.com/tech/TMX4J. There is no cost to download the Tivoli implementation package and acquiring the package is recommended to obtain greater detail on this subject. Chapter 4. Providers 133
  • 157. 134 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 158. Part 2Part 2 Practical examples In this part, we provide practical examples of how to create an IBM Tivoli Monitoring Version 5.1.1 solution for the following common problems: Monitoring with SNMP Monitoring log files Monitoring/Utilizing custom scripts File change monitoring (such as Web site or operating system crucial files) These specific solutions are not intended to be an out-of-the-box, all encompassing answer for each problem covered, but are intended to provide a basis that can be expanded and/or customized to suit your specific needs. They are also examples that can be used to create a new custom instrumentation for many problems that face IT administrators today.© Copyright IBM Corp. 2003. All rights reserved. 135
  • 159. 136 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 160. 5 Chapter 5. Engineering a Java ILT This chapter provides an in-depth discussion of the components required to engineer and implement a custom Provider of the type ILT for the Java platform. Specifically, these items are addressed as if they were implemented within the included “ITSO_Sample” Resource Model. The model can also be used as a template for creating your own ILT centric model. It should be noted, due to the complexities and intricacies of software development, this chapter in no way attempts to explain the syntax, use of, or nuances of the Java language, the Java development environment, or object oriented development terminology and methods. Therefore, it is highly recommended that these skill sets be developed prior to beginning work on a custom Provider. There are many available resources from IBM and Sun that can assist with gaining these skills.© Copyright IBM Corp. 2003. All rights reserved. 137
  • 161. 5.1 Terminology Many of the concepts and technologies discussed within this example are new to Tivoli Administrators. Therefore, we will define a few key terms as they are referenced throughout this chapter. Provider: As discussed in Chapter 4, “Providers” on page 109, this will refer to the conceptual component that operates as an instrument and “provides” operational metrics to the ITM Engine. ILT: The use of ILT refers to a specific Provider type. This type meets the requirements of the M12 specification discussed in Chapter 4, “Providers” on page 109 and is simply more specific than simply stating the Provider. ILT class: This is in reference to the Java class, written for the included example, that implements the ILTInterface class. Provider class: This is in reference to the Java class, written for the included example, that is instantiated within the ILT class and actually performs the metering of resources.5.2 Planning and design Though the purpose of this exercise is to demonstrate a custom ILT, the deployment of it to the Tivoli environment will require a complete Resource Model. Thus, during the planning phase of this Resource Model, the initial goal was defined as providing an ILT example that included a demonstration of how to create a base ILT, the required CIM definition, and provide Administrator configurable parameters that would be passed to the ILT. Though the planning and design phase followed a traditional top-down methodology, the development of the model was performed from the bottom up. The Managed Object Format (MOF) file was created first to define the CIM class, followed by the supporting ILT and Provider Java classes, and finally the Resource Model wrapper was created through the ITM Workbench. The planning section describes the components and details using the top-down approach. This is done to provide familiar terms and component references, then drill down into greater detail after topic introductions. The components addressed through this method include the Resource Model, CIM class, ILT class, and Provider class.138 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 162. 5.2.1 Resource Model The requirements for this Resource Model are straight forward: Demonstrate the use of JavaScript within a Resource Model. Provide a parameter that will be used by the ILT and can be configured by Administrators through the Tivoli Desktop. Keep the Resource Model within the primary scope of this redbook and focus on instrumentation (not logging, events, or attributes). Ensure a good demonstration of “supportability” through easily traceable and consistent naming conventions throughout the Resource Model, CIM, and ILT. Implement base functionality that would permit a large number of readers to use the sample as a template. Provide a complete template by demonstrating the use of all supported ILT data types. Based on these requirements, it was determined that the model would be created initially through the ITM Workbench Resource Model Wizard under the name ITSO_Sample and in the standard model category for the redbook, ITSO_RMs.5.2.2 CIM class Based on the requirements determined from the planning of the Resource Model, it was obvious that a new CIM class had to be developed to provide the required information to the Resource Model. There are four specific requirements for the CIM definition that were determined: The CIM class must demonstrate the use of the Tivoli M12 qualifiers. The CIM class must include descriptor elements to support user-friendly CIM namespace browsing. The CIM class must include at least one property of each of the supported data types. The properties must follow a naming convention, defined as ITSO_SampleVar_<var_type>, to keep within the defined “supportability” requirement. A high-level CIM class definition was determined as follows: class ITSO_Sample – ITSO_SampleVar_inst: The property designated as the class instance key – ITSO_SampleVar_str: Property of the type string Chapter 5. Engineering a Java ILT 139
  • 163. – ITSO_SampleVar_bln: Property of the type boolean – ITSO_SampleVar_si8: Property of the type 8-bit signed integer – ITSO_SampleVar_si16: Property of the type 16-bit signed integer – ITSO_SampleVar_si32: Property of the type 32-bit signed integer – ITSO_SampleVar_si64: Property of the type 64-bit signed integer – ITSO_SampleVar_ui8: Property of the type 8-bit unsigned integer – ITSO_SampleVar_ui16: Property of the type 16-bit unsigned integer – ITSO_SampleVar_ui32: Property of the type 32-bit unsigned integer – ITSO_SampleVar_r32: Property of the type 32-bit real – ITSO_SampleVar_r64: Property of the type 64-bit real5.2.3 ILT class The ILT class exists to provide the dynamically pluggable interface between the TSL and the actual instrumentation Provider. Therefore, the ILT for this sample must meet the following requirements: The ILT class must follow the defined “supportability” requirement and should use the name ITSO_SampleIlt to be clearly associated with the CIM class and Provider it will be “binding”. Implement tracing functionality to better follow the “supportability” requirement. The ILT class must implement the required M12 functionality to: – Support the ILTInterface specification. (All required methods for this interface are implemented within the ITSO_SampleIlt.) – Demonstrate the retrieval of instance identification, parameters being passed from the Resource Model, and the values of the properties. (Only relevant methods will be coded for the ITSO_SampleIlt.) The ILT class should provide any internal private methods as needed to support the custom functionality.5.2.4 Provider class The Provider class exists to perform the physical instrumentation or provide interfacing to native binary libraries via Java Native Interface (JNI) calls. In the case of this sample, the Provider must meet the following requirements: The Provider class must follow the defined “supportability” requirement and should use the name “ITSO_Sample” to be clearly associated with the ILT class it will be instantiated by.140 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 164. The Provider class must implement tracing functionality to better follow the “supportability” requirement. The Provider class must include methods to handle each of the following: – Object creation: Performed by the method “ITSO_Sample”. – Instance initialization and discovery. – Methods to service each property of the CIM class by providing either a static or dynamic value. Note that providing a method to service the property does not mandate each property have its own set of service methods.5.2.5 Component reference In review of the aforementioned design requirements, the ITM Engine Logical Components diagram can be revisited. The components of the engine that will be utilized by the planned Resource Model within this chapter can be seen in Figure 5-1 on page 142. Those components that will not be used within the ITSO_Sample are presented in gray to de-emphasize their significance. Chapter 5. Engineering a Java ILT 141
  • 165. Java, ITM Engine Logical Components Analyzer Resource Resource Resource Resource Resource Model Model Model Model Model DM Classic Monitor Probes Service Object Launch Custom Scripts (Class Loader) ILT ILT JMX ILT MBean Providers JNI Server Native Resource Resource Resource MBean(s) Binaries Resources (OS & Applications) Figure 5-1 Java ITM Engine logical components5.3 Implementing The implementation phase of the design includes a variety of efforts as well as a variety of tools. As mentioned in 5.2.5, “Component reference” on page 141, the implementation was handled in a bottom-up fashion due to each layer being dependent on the layer below. Therefore, the four components to be created below are presented in the order of development: The Managed Object Format (MOF) file ITSO_Sample.mof was developed with a text editor, but compiled and imported with mofcomp. The Java class for the ILT ITSO_SampleIlt.java was developed with a text editor and the IBM JDK 1.3.1. The Provider class, ITSO_Sample.java, was developed with a text editor and the IBM JDK 1.3.1.142 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 166. The Resource Model ITSO_Sample.dmjsws was developed with the ITM Workbench.5.3.1 Managed Object Format (MOF) In the ITSO_Sample, we have implemented only the core requirements for the object definition. This was to ensure the sample was easy to understand as well as easily customizable. In many cases, additional descriptors may be required to ensure the object behaves in a precise and predictable manner. Commenting MOF files The use of comments within the MOF file is acceptable and, as demonstrated, quite helpful in the maintenance and enhancement of custom classes. This is reflected with the creation of a document history section within the header comments of the MOF file shown in Example 5-1. Example 5-1 ITSO_Sample.mof //---------------------------------------------------------------------------- // // ITSO_Sample.mof // // Description: // This file is a textual definition of the ITSO_Sample CIM class. // // History: // Date Author Description // -------- ------------------ ------------------------------------------ // 04/15/03 ITSO Redbook Team Original file. // //---------------------------------------------------------------------------- CIM qualifiers The number of qualifiers implemented was kept to a minimum, again to meet the functional requirements while maintaining a clean and easy to understand design. The qualifiers used are presented in the order in which they appear in the MOF file. For additional detail on the purpose of each qualifier, please refer to Chapter 4, “Providers” on page 109. Description The Description qualifier is used throughout the ITSO_Sample class definition and is highly recommended as a best practice for both classes and class properties. This is because the description information can be viewed by CIM browsing utilities once the MOF file is compiled into a localized CIM repository. A Chapter 5. Engineering a Java ILT 143
  • 167. sample of the Description qualifier as used for the class description itself is shown in Example 5-2. Example 5-2 ITSO_Sample.java: description qualifier [ Description ("ITSO Sample: This sample was created to provide to help " "clarify the creation of a custom ILT and Provider. There " "are many details that have not been included, incuding " "additional M12 qualifiers within the MOF. However, the " "core functionality does provide a complete model from " "which to work."), In this case, the MOF file was loaded into the Windows CIM repository during development and was “browsed” through the ITM Workbench. The Description qualifiers are viewable from the Dynamic Model dialog box’s Show Description feature. Notice in Figure 5-2 that the description for the class and the class properties are all displayed. This is extremely useful when a CIM class will be implemented by multiple Resource Model developers. Figure 5-2 ITM Workbench: about selected class Provider The Provider qualifier is used within the ITSO_Sample class definition to define the library (class) that will implement an instance interface to the sample Provider class. As the ITM Java engine has the TSL embedded, we will be using the M12JavaProvider in Example 5-3. Example 5-3 ITSO_Sample.java: Provider qualifier provider("com.tivoli.dmunix.ep.touchpoint.cimom.ifc.M12JavaProvider"),144 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 168. M12_Instrumentation The M12_Instrumentation was implemented within the ITSO_Sample class only and not at the class property level. The M12 specification requires that all classes have an Enum operation. This tells the class loader which class (in this case, ITSO_SampleIlt) to associate with the enumeration functionality of the instrumentation. We have additionally provided a Get operation for the class to specify which class will be associated with all non-specified properties, that is, it is possible to associate specific properties within the class to specific classes on an individual basis, which will allow the singular collection of the property data through the class method getProperty. In our ITSO_Sample class, this was not a concern, and collection was routed through getMultipleProperties method by providing the default Get operation within the M12 qualifier shown in Example 5-4. Example 5-4 ITSO_Sample.java: M12_Instrumentatoin qualifier M12_Instrumentation { "Java.com.ibm.tivoli.monitoring.ITSO_Sample.ITSO_SampleIlt | | ENUM", "Java.com.ibm.tivoli.monitoring.ITSO_Sample.ITSO_SampleIlt | | GET"} ] Key The key property qualifier is used within the ITSO_Sample class itself to define the property ITSO_SampleVar_inst as the primary key or index to the class. In the case of the sample, this key represents the instance of the class. A sample of the Description qualifier is shown in Example 5-5. Example 5-5 TSO_Sample.java: key qualifier class ITSO_Sample { // Attribute, Instance Count. [ Description("The ITSO_SampleVar_inst property defines the instance of " "the provider." ), key ] sint32 ITSO_SampleVar_inst;5.3.2 ILT Java class The ILT class, ITSO_SampleILT, is the interface between the TSL of the ITM Engine and the custom Provider. The actual interfacing is handled through the implementation of the M12 Public Operations as defined by the ILTInterface class. There are a variety of design strategies that can be implemented within the required methods; however, the end goal to support multiple instances remains the same. Chapter 5. Engineering a Java ILT 145
  • 169. To parallel a real-world example, if the CIM class has been designed to represent a Network Interface, the ILT class would be created to handle the initialization of the Provider class(es) and incoming data requests from the ITM Engine through the supported ILTInterface methods, determine which CIM properties need to be acquired from the Provider through M12 method calls, and perform the acquisition through the appropriate Provider instances. Specifically, in the case of the Network Interface reference, the ILT would receive the instance and property requests through the ILTInterface methods as specified through the M12 qualifiers in the MOF, then perform the acquisition through the appropriate Provider instance for any defined properties such as link up or down, bytes per second sent and received, and interface type for the Ethernet0 instance. Commenting Java files Comments have been implemented within the Java file, as demonstrated in Example 5-6. As with the MOF file, comments are quite helpful in the maintenance and enhancement of custom classes and are always a best practice in the software development arena.Example 5-6 ITSO_SampleIlt.java: comment header//------------------------------------------------------------------------------//// ITSO_SampleIlt.java//// Description:// This file is the ITSO_Sample Instrumentation Library Type (ILT)// implementation. This is the class instantiated by the "touchpoint"// layer. This class will execute methods in the "ITSO_Sample.java" file,// which is the physical "provider" and performs the actual data// acquisition.//// Various classes are referenced throughout this file. ILT Supported// Classes, which are documented, in the IBM Tivoli Monitoring Workbench User’s Guide// Version 5.1.1, SH19-4571, include:// M12ClassPath// M12IdentityElement// M12ObjectIdentity// M12PreportySet// M12Exception// ParameterSet// ParameterSetList//// History:// Date Author Description// -------- ------------------ ------------------------------------------// 04/15/03 ITSO Redbook Team Original file.//146 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 170. //------------------------------------------------------------------------------ Java package The naming standard implemented by Tivoli PAC developers is that the Java package for the ILT be in the path com.ibm.tivoli.monitoring. This naming convention was implemented for the ITSO_Sample and can be seen in both the ILT and Provider classes. This ensures that all required classes for the ILT are handled by the same ITM Engine loader, providing consistent class access. The package declaration within both immediately follows the comment header and can be seen in Example 5-7. Example 5-7 ITSO_SampleIlt.java: package declaration //---------------------------------------------------------------------------- package com.ibm.tivoli.monitoring.ITSO_Sample; Java imports Various Java classes were utilized within the sample. These classes were declared through the standard Java import statement, as shown in Example 5-8. Example 5-8 ITSO_SampleIlt.java: import declarations import com.ibm.tivoli.monitoring.ITSO_Sample.ITSO_Sample; import com.tivoli.dmunix.ep.touchpoint.base.*; import com.tivoli.javautils.Trace; import java.util.Enumeration; import java.util.Vector; The first import, com.ibm.tivoli.monitoring.ITSO_Sample.ITSO_Sample, allows for the referencing of the Provider class ITSO_Sample. This class is defined in the file ITSO_Sample.java and is defined as part of the same package as the ILT class. The relevant jar file for this import is ITSO_Sample.jar, of which this file is a part. The second import, com.tivoli.dmunix.ep.touchpoint.base.*, supports the ILT Interface class as well as the M12 ILT Public Operations, which are well documented in Appendix D “Instrumentation Library Type Interface (ILT)”, in the IBM Tivoli Monitoring Workbench Users Guide Version 5.1.1, SH19-4571. The relevant jar file for this import is dm_m12.jar. The third import, com.tivoli.javautils.Trace, supports writing to the trace_dmxengine.log file via the Trace class. The relevant jar file for this import is javautils.jar. Chapter 5. Engineering a Java ILT 147
  • 171. The fourth import, java.util.Enumeration, supports the Enumeration class, which supports the creating of a series of elements. This is viewable in the declaration of the enumerateInstances method. The fifth import, java.util.Vector, supports the Vector class which allows for dynamically sized lists through the use of Java “pointers”. In the case of our sample, it provides the means to obtain the list of parameters passed from the ITM Engine. ILT interface implementation The ITSO_Sample class implements the ILTInterface class interface, as demonstrated in Example 5-9. Example 5-9 TSO_SampleIlt.java: class implementation public class ITSO_SampleIlt implements ILTInterface Supporting class methods A creator method, ITSO_SampleIlt, was included in the class, as seen in Example 5-10. This method is automatically executed at the instantiation of the ILT sample by the ITM Engine. Its purpose is to perform any class initialization work required.Example 5-10 ITSO_SampleIlt.java: creatorpublic ITSO_SampleIlt() { pitso_sample = new ITSO_Sample(); trace = Trace.getTraceInstance(); } ILT public operations (methods) To correctly support the interfacing of our ILT with the M12 specification, all public operations (methods) should be implemented. Not all ILTs may require operational code within the methods. Again, in an attempt to create an easily understandable template, all methods were put in place to support the interface and commented, though code has only been written in methods that mandated specific functionality. Methods that were not mandated for this sample had tracing calls added to permit detailed debugging of Resource Models through the trace_dmxengine.log file.148 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 172. getProperty This operation, shown in Example 5-11, was implemented with the intent that if an M12_Instrumentation qualifier was added to any property within the MOF file, those individual properties would be obtained through this method. As the M12_Instrumentation qualifier was not added to individual properties within the ITSO_Sample.mof, this method is not utilized by the engine. We will however, provide an explanation, as it would be the most likely implemented function in custom ILTs.Example 5-11 ITSO_SampleIlt.java: getProperty methodpublic String getProperty( M12ObjectIdentity m12objectidentity, String sPropertyName, String sMapping, ParameterSet parameterset ) throws M12Exception { try { M12IdentityElement m12identityelement = m12objectidentity.getScopingPath()[0]; M12PropertySet m12propertyset = m12identityelement.getIdentity(); // Determine which instance is being checked by the // Management Layer. String sKey = m12propertyset.getProperty("ITSO_SampleVar_inst"); trace.log(3, "ITSO_SampleIlt", "getProperty: called for ITSO_SampleVar_inst " + sKey); // Get the attributes being checked by the Management Layer. // Get the current attribute values. String sValue = getITSOAttribute(sKey, sPropertyName); trace.log(3, "ITSO_SampleIlt", "getITSOAttribute: " + sPropertyName + " = " + sValue); return sValue; } catch(Exception exception) { trace.exception("ITSO_SampleIlt", "getProperty", exception); M12Exception m12exception = new M12Exception(exception); throw m12exception; } } Chapter 5. Engineering a Java ILT 149
  • 173. getMultipleProperties This operation, shown in Example 5-12, was implemented to support the handling of multiple properties, as the MOF file has a class level M12_Instrumentation qualifier. This class level qualifier designates the ITSO_SampleILT class as the handler of all properties without individual instrumentation statements.Example 5-12 ITSO_SampleIlt.java: getMultipleProperties methodpublic M12PropertySet getMultipleProperties( M12ObjectIdentity m12objectidentity, Vector vPropertyList, String sMapping, ParameterSet parameterset ) throws M12Exception { try { M12IdentityElement m12identityelement = m12objectidentity.getScopingPath()[0]; M12PropertySet m12propertyset = m12identityelement.getIdentity(); // Determine which instance is being checked by the // Management Layer. String sKey = m12propertyset.getProperty("ITSO_SampleVar_inst"); M12PropertySet m12propertyset1 = new M12PropertySet(); trace.log(3, "ITSO_SampleIlt", "getMultipleProperty: called for ITSO_SampleVar_inst " + sKey); for(int i = 0; i < vPropertyList.size(); i++) { // Get the property being checked by the Management Layer. String sProperty = (String)vPropertyList.elementAt(i); // Get the current attribute values. String sValue = getITSOAttribute(sKey, sProperty); m12propertyset1.setProperty(sProperty, sValue); } trace.log(3, "ITSO_SampleIlt", "getMultipleProperty: returning " + WriteBuffer(m12propertyset1)); return m12propertyset1; } catch(Exception exception) { trace.exception("ITSO_SampleIlt", "getMultipleProperty", exception); M12Exception m12exception = new M12Exception(exception); throw m12exception;150 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 174. } } enumerateInstances This operation, shown in Example 5-13, was implemented to support the enumeration of instances of the CIM class, that is, this function will determine how many instances of the monitored object exist and will handle the appropriate configuration of those instances as well as return the count.Example 5-13 ITSO_SampleIlt.java: enumerateInstances methodpublic Enumeration enumerateInstances( M12ClassPath m12classpath, String sMapping, ParameterSet parameterset ) throws M12Exception { try { // Variable Declaration. StringBuffer stringbuffer = new StringBuffer(); Vector vector = new Vector(); //------------------------------------------------------------------ // Get the parameters from the caller. // We are obtaining the parameters prior to declaring instances so // we can configure an instance for each parameter. //------------------------------------------------------------------ Enumeration enumeration = parameterset.parametersNames(); Vector vParam = (Vector)parameterset.getParam("ITSO_ArrayGUI"); if(vParam == null) { trace.log(1, "ITSO_SampleIlt", "enumerateInstances: no parameters found"); return null; } // Process the ITSO_ArrayGUI parameter. String asITSOArrayGui[] = new String[vParam.size()]; for(int iIndex = 0; iIndex < vParam.size(); iIndex++) { // Get the string array element from the vector element. asITSOArrayGui[iIndex] = (String)vParam.elementAt(iIndex); trace.log( 3, "ITSO_SampleIlt", "enumerateInstances: asITSOArrayGui[" + iIndex + "] = " + asITSOArrayGui[iIndex]); } //------------------------------------------------------------------ // Acquire a vector (pointer) from the calling ILT Manager. Chapter 5. Engineering a Java ILT 151
  • 175. // This section handles the registration of instances of this // Instrumentation. //------------------------------------------------------------------ int aiInst[] = pitso_sample.getITSO_Instances( asITSOArrayGui ); if(aiInst == null) { trace.log(1, "ITSO_SampleIlt", "enumerateInstances: no instances found"); return null; } for(int jIndex = 0; jIndex < aiInst.length; jIndex++) { trace.log( 3, "ITSO_SampleIlt", "enumerateInstances: aiInst[" + jIndex + "] = " + aiInst[jIndex]); M12PropertySet m12propertyset = new M12PropertySet(); m12propertyset.setProperty( "ITSO_SampleVar_inst", String.valueOf(aiInst[jIndex]) ); M12IdentityElement m12identityelement = new M12IdentityElement( m12classpath.getClassName(), m12classpath.getNameSpace(), m12propertyset); vector.add( new M12ObjectIdentity( new M12IdentityElement[] { m12identityelement } ) ); } return vector.elements(); } catch(Exception exception) { trace.exception("ITSO_SampleIlt", "enumerateInstances", exception); M12Exception m12exception = new M12Exception(exception); throw m12exception; } } setProperty This method was implemented for explanatory purposes only, as it is included in the M12 specification, but is not yet supported. Therefore, only tracing elements were included within the code and it will not be presented here. invokeMethod This method actually provides two interfaces. Both were implemented for explanatory purposes only, as they are included in the M12 specification. These methods are supported; however, due to time constraints, the invocation of class methods was not pursued for this sample. Therefore, only tracing elements were included within the code and it will not be presented here.152 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 176. createThis method was implemented for explanatory purposes only, as it is included inthe M12 specification, but is not yet supported. Therefore, only tracing elementswere included within the code and it will not be presented here.destroyThis method was implemented for explanatory purposes only, as it is included inthe M12 specification, but is not yet supported. Therefore, only tracing elementswere included within the code and it will not be presented here.ILT supported classesThe implementation of the M12 interfacing for this ILT requires that various ILTsupport classes be used. Table 5-1 discusses the various classes and their rolewithin the sample.Table 5-1 ILT supported classes ILT supported classes Implementation notes M12ClassPath This identifies the class whose instances have to be enumerated or whose method is to be invoked. M12ObjectIdentity This is implemented as a passed parameter to the ILT Public Operation methods and is used to identify the instance of the resource. M12IdentityElement This is implemented within ILT Public Operation methods and is used to identify the instance of the resource. This is obtained through the M12ObjectIdentity. M12PropertySet This is implemented within ILT Public Operation methods and is used to retrieve property values for the instance. This is obtained through the M12IdentityElement. M12Exception This is implemented through ILT Public Operation methods to define the exception type thrown. ParameterSet This is implemented through implemented ILT Public Operation methods and is used to receive parameters passed by the client. ParameterSetList This class was not utilized in this sample. Chapter 5. Engineering a Java ILT 153
  • 177. Custom methods These methods are not part of the required ILT interfacing and are only used from a utility perspective. They allow for cleaner code as well as a single point of management for common functions. getITSOAttribute This method, shown in Example 5-14, was developed as a centrally manageable function to handle the actual calling of the methods within the Provider instances. The function is passed the reference to the instance key and the class property, both specified in the CIM definition.Example 5-14 ITSO_SampleIlt.java: getITSOAttribute methodprivate String getITSOAttribute( String sValue, String sProperty ) throws Exception { //---------------------------------------------------------------------- // // MOF Declared Types // // There is an "if" structure for each of the variable types that this // sample supports. // //---------------------------------------------------------------------- int iIndex = (new Integer(sValue)).intValue(); //---------------------------------------------------------------------- // string ITSO_SampleVar_str //---------------------------------------------------------------------- if(sProperty.equals("ITSO_SampleVar_str")) { String sReturn = new String( pitso_sample.getITSO_SampleVar_str(iIndex) ); return sReturn; } //---------------------------------------------------------------------- // boolean ITSO_SampleVar_bln //---------------------------------------------------------------------- if(sProperty.equals("ITSO_SampleVar_bln")) { Boolean blnVar = new Boolean(pitso_sample.getITSO_SampleVar_bln(iIndex)); return blnVar.toString(); }154 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 178. //----------------------------------------------------------------------// sint8 ITSO_SampleVar_si8// sint16 ITSO_SampleVar_si16// sint32 ITSO_SampleVar_si32// sint64 ITSO_SampleVar_si64//----------------------------------------------------------------------if( (sProperty.equals("ITSO_SampleVar_si8")) || (sProperty.equals("ITSO_SampleVar_si16")) || (sProperty.equals("ITSO_SampleVar_si32")) || (sProperty.equals("ITSO_SampleVar_si64")) ){ Integer intVar = new Integer(pitso_sample.getITSO_SampleVar_si(iIndex)); return intVar.toString();}//----------------------------------------------------------------------// uint8 ITSO_SampleVar_ui8// uint16 ITSO_SampleVar_ui16// uint32 ITSO_SampleVar_ui32//----------------------------------------------------------------------if( (sProperty.equals("ITSO_SampleVar_ui8")) || (sProperty.equals("ITSO_SampleVar_ui16")) || (sProperty.equals("ITSO_SampleVar_ui32")) ){ Integer intVar = new Integer(pitso_sample.getITSO_SampleVar_ui(iIndex)); return intVar.toString();}//----------------------------------------------------------------------// real32 ITSO_SampleVar_r32// real64 ITSO_SampleVar_r64//----------------------------------------------------------------------if( (sProperty.equals("ITSO_SampleVar_r32")) || (sProperty.equals("ITSO_SampleVar_r64")) ){ Double dblVar = new Double(pitso_sample.getITSO_SampleVar_r(iIndex)); return dblVar.toString();}//----------------------------------------------------------------------// Unknown property.//----------------------------------------------------------------------else{ throw new Exception(sProperty + ": unknown property");} Chapter 5. Engineering a Java ILT 155
  • 179. } WriteBuffer This is essentially a utility method that was created for the purpose of easily dumping values from a passed M12PropertySet class to a String object that is returned to the caller.5.3.3 Provider Java class The Provider class ITSO_Sample handles class instance initialization, management, and initialization of any private data members relevant to the class instance, and methods to provide values for specific CIM properties to the instantiating ILT class. Therefore, this class is a completely custom class designed around a specific use as designed by the CIM. Its functionality has been segregated from the aforementioned ILT class, ITSO_SampleILT, as it is designed to be instantiated for each CIM object reference. If the CIM class has been designed to represent a Network Interface Card (NIC), the Provider would be created to acquire information on the NIC. In such a case, there may be multiple NICs in the host that this Resource Model is running on. Thus, the Provider would be designed to handle these instances through the initialization method and would have internal data members (properties) or additional classes that are instance specific. With any development situation, there are numerous ways to handle such issues. The complexities associated with more advanced instance handling could make this sample quite difficult for the beginning ILT developer to follow. Additionally, making the sample excessively “instance oriented” may make it difficult to implement for more basic purposes. Thus, the ITSO_Sample has therefore been simplified to provide the capabilities of referencing instances as a starting point for custom development through simple indexing or “key” values in the CIM class. This Provider class has been created to “provide” hardcoded numeric values and slightly dynamic strings. The code within the methods can be as advanced as required to fulfill the needs of the ILT. Optionally, as is the case with many of the resources models shipped with ITM, the methods can utilize the JNI API and implement platform specific binary libraries. Such libraries are typically developed in C or C++ and are done so for performance reasons. Such development is typically outside the scope of most administrator’s job functions. The use of JNI is well suited for access to platform dependent binary libraries using APIs not available in Java. For example, in the case of file permissions, UNIX platforms typically implement them in the familiar rwx-rwx-rwx format while156 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 180. the Windows platform handles file permissions in a different way. Therefore, Java offers the least common denominator among the supported platforms. However, since ITM is monitoring a specific platform, that which the model is running on, it is required to access some low level features related to the specific monitored platform. Here, JNI support the platform integration by using a library to access C/C++ code that performs API calls that are operating system specific. Commenting Java files Comments have been implemented within the Java file, as demonstrated by the file header shown in Example 5-15. As with the previous files, comments are quite helpful in the maintenance and enhancement of custom classes and are always a best practice in the software development arena.Example 5-15 ITSO_Sample.java: comment header//------------------------------------------------------------------------------//// ITSO_Sample.java//// Description:// This file is the ITSO_Sample Provider to the ILT. This can perform the// actual the actual data acquisition, call other classes, or via JNI// perform calls to "native" binaries.//// History:// Date Author Description// -------- ------------------ ------------------------------------------// 04/15/03 ITSO Redbook Team Original file.////------------------------------------------------------------------------------ Java package The same package naming convention, com.ibm.tivoli.monitoring, was implemented for the ITSO_SampleILT class and has been implemented within this class. This ensures that all required classes for the ILT are handled by the same ITM Engine loader, providing consistent class access. The package declaration within this class immediately follows the comment header and can be seen in Example 5-16. Example 5-16 ITSO_Sample.java: package declaration //---------------------------------------------------------------------------- package com.ibm.tivoli.monitoring.ITSO_Sample; Chapter 5. Engineering a Java ILT 157
  • 181. Java imports Various Java classes were utilized within the sample Provider. These classes were declared through the standard Java import statement shown in Example 5-17. Example 5-17 ITSO_Sample.java: import statements import com.tivoli.javautils.Trace; import java.util.*; Custom methods These methods exist to represent the CIM object ITSO_Sample from a software perspective, not from a physical attribute perspective. This means that a method exists within the Provider class to handle class instance initialization, and access to any private data members relevant to each class instance. These routines are completely custom to the class and will most likely not exist in your Provider implementation. They will realistically be replaced with more appropriate “get” property methods (as required by your Provider specification), but will still be referenced from within your ILT class. ITSO_Sample This is the class creator that supports the initialization of the Provider class instance. In the case of this Provider, only one instance is created by the ITSO_SampleILT. This creator method performs no specialized functions other than to initialize the Trace class, as shown in Example 5-18.Example 5-18 ITSO_Sample.java: Creator methodpublic ITSO_Sample() { trace = Trace.getTraceInstance(); } getITSO_Instances This method, as shown in Example 5-19 on page 159, retrieves an array of values of the variable ITSO_SampleVar_instr which, being designated as the class key, are used for instance referencing by the M12 layer. The ITSO_SampleILT class method enumerateInstances call this getITSO_Instances method to obtain this instance array and register the values to the M12PropertySet class via the setProperty method.158 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 182. Example 5-19 ITSO_Sample.java: getITSO_Instance method public synchronized int[] getITSO_Instances( String asParams[] ) { // The instances will be referenced by number to keep it simple. trace.log(3, "ITSO_Sample", "getITSO_Instances asParams.length=" + asParams.length); int[] aiInst = new int[asParams.length]; for(int iIndex = 0; iIndex < asParams.length; iIndex++) { // Get the string array element from the vector element. trace.log(3, "ITSO_Sample", "getITSO_Instances iIndex=" + iIndex); aiInst[iIndex] = iIndex; trace.log(3, "ITSO_Sample", "getITSO_Instances aiInst[" + iIndex + "]" + aiInst[iIndex]); } return aiInst; } getITSO_SampleVar_str This method, as shown in Example 5-20, provides a “retrieval” of the value for the string variable ITSO_SampleVar_str for the instance passed. The ITSO_SampleILT class method getITSOAttribute determines which variables are to be obtained through this method.Example 5-20 ITSO_Sample.java: getITSO_SampleVar_str method public static synchronized String getITSO_SampleVar_str(int iIndex) { // Add logic to check the correct instance (index) of the resource. // For this example, to demonstrate differences based on instances, // we are building a string that includes the index number. String sReturn = "iIndex_" + iIndex; return sReturn; } getITSO_SampleVar_si This method, as shown in Example 5-21 on page 160, provides a “retrieval” of the value for all of the signed integer variables designated ITSO_SampleVar_si for the instance passed. The ITSO_SampleILT class method getITSOAttribute determines which variables are to be obtained through this method. Chapter 5. Engineering a Java ILT 159
  • 183. Example 5-21 ITSO_Sample.java: getITSO_SampleVar_si method public static synchronized int getITSO_SampleVar_si(int iIndex) { // Add logic to check the correct instance (index) of the resource. return -1; } getITSO_SampleVar_ui This method, shown in Example 5-22, provides a “retrieval” of the value for all of the unsigned integer variables designated ITSO_SampleVar_ui for the instance passed. The ITSO_SampleILT class method getITSOAttribute determines which variables are to be obtained through this method.Example 5-22 ITSO_Sample.java: getITSO_SampleVar_ui method public static synchronized int getITSO_SampleVar_ui(int iIndex) { // Add logic to check the correct instance (index) of the resource. return 1; } getITSO_SampleVar_r This method, shown in Example 5-23, provides a “retrieval” of the value for all of the real or floating point variables designated ITSO_SampleVar_r for the instance passed. The ITSO_SampleILT class method getITSOAttribute determines which variables are to be obtained through this method.Example 5-23 ITSO_Sample.java: getITSO_SampleVar_r method public static synchronized double getITSO_SampleVar_r(int iIndex) { // Add logic to check the correct instance (index) of the resource. return 3.14; } getITSO_SampleVar_bln This method, shown in Example 5-24 on page 161, provides a “retrieval” of the value for all of the boolean variables designated ITSO_SampleVar_bln for the instance passed. The ITSO_SampleILT class method getITSOAttribute determines which variables are to be obtained through this method.160 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 184. Example 5-24 ITSO_Sample.java: getITSO_SampleVar_bln method public static synchronized boolean getITSO_SampleVar_bln(int iIndex) { // Add logic to check the correct instance (index) of the resource. return true; }5.3.4 Resource Model Resource Models are the encapsulation of various ITM Engine configuration files, logic scripting files, and dependency files. In this discussion, each of these items will be discussed as they were implemented within this model. General settings These items were configured through the ITM Workbench General Setting dialog box, as shown in Figure 5-3.Figure 5-3 ITM Workbench: General Settings When the General Settings configuration was completed, the ITM Workbench engine automatically added the service class method calls to SetModelName, SetProfileName, and SetCycleTime along with their associated parameters to the JavaScript function SetDefaultConfiguration, as demonstrated in Example 5-25 on page 162. Chapter 5. Engineering a Java ILT 161
  • 185. Example 5-25 ITSO_Sample.dmjsws: General info // General info section //<<GENERAL_INFO>> Svc.SetModelName ("ITSO_Sample"); Svc.SetProfileName ("1324421"); Svc.SetCycleTime (60); //<<GENERAL_INFO>> Dynamic Model The Dynamic Model components of a Resource Model allow for the acquisition of data through various methods. The method of interfacing to an ILT is through the CIMOM. In this example, the CIM class ITSO_Sample was selected from the namespace rootdefault, as shown in Figure 5-4..Figure 5-4 ITM Workbench: Dynamic Model An alias was then defined, ITSO_Sample, for use by the various Service calls within the JavaScript. The use of an alias simplifies the service method parameters. Additionally, the CIM class properties shown in Table 5-2 on page 163 were selected for use within the JavaScript within the Resource Model.162 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 186. Table 5-2 CIM class properties Class property Property type ITSO_SampleVar_inst Numeric ITSO_SampleVar_str String ITSO_SampleVar_bln Numeric ITSO_SampleVar_si8 Numeric ITSO_SampleVar_si16 Numeric ITSO_SampleVar_si32 Numeric ITSO_SampleVar_si64 Numeric ITSO_SampleVar_ui8 Numeric ITSO_SampleVar_ui16 Numeric ITSO_SampleVar_ui32 Numeric ITSO_SampleVar_r32 Numeric ITSO_SampleVar_r64 NumericWhen the Dynamic Data CIM selection was completed, the ITM Workbenchengine automatically added the service class method call to DefineClass and theassociated parameters to the JavaScript function SetDefaultConfiguration asshown in Example 5-26. Notice that the all numeric properties are passed as asingle parameter as is the string property.Example 5-26 ITSO_Sample.dmjsws: Dynamic info // Dynamic Model section //<<DATA_INFO>> Svc.DefineClass ("CIM", "ITSO_Sample", "ROOTDEFAULT:ITSO_Sample", "","ITSO_SampleVar_ui16,ITSO_SampleVar_si16,ITSO_SampleVar_r64,ITSO_SampleVar_r32,ITSO_SampleVar_bln,ITSO_SampleVar_si8,ITSO_SampleVar_ui32,ITSO_SampleVar_si64,ITSO_SampleVar_inst,ITSO_SampleVar_si32,ITSO_SampleVar_ui8","ITSO_SampleVar_str", "None", "", 0, 1); //<<DATA_INFO>>ParametersFor this example, as shown in Figure 5-5 on page 164, a single parameter wasused to demonstrate how a parameter list provided to a Tivoli Administrator couldbe used to alter the operation of the ILT. In this case, the parameterITSO_ArrayGUI was created as the type String List with the default valuesadded: Mike, Craig, and Kiyo. Chapter 5. Engineering a Java ILT 163
  • 187. Figure 5-5 ITM Workbench: parameters When the parameter was added through the Workbench GUI, the ITM Workbench engine automatically added the service class method call DefineStrParameter and the associated parameters to the JavaScript function SetDefaultConfiguration, as shown in Example 5-27. Example 5-27 ITSO_Sample.dmjsws: Parameters // Parameters section //<<PARAMETERS_INFO>> Svc.DefineStrParameter ("ITSO_ArrayGUI", "Mike,Craig,Kiyo"); //<<PARAMETERS_INFO>> Note: It is possible to make dynamic lists not available to an Administrator via the Tivoli Desktop. This can be useful to allow a Resource Model to dynamically change its operation. To implement a hidden parameter, add a call to the Svc.DefineStrParameter method within the SetDefaultConfiguration function of the Resource Model by directly coding it in the script. Do not add it through the tree-view by right-clicking. Adding it through the tree-view makes it visible to the Administrators, while directly coding it does not. Thus, adding the call to the JavaScript will enable the parameter, but will not provide the GUI requirement, thus hiding it from the Administrator. Dependencies The dependencies for this Resource Model include a MOF file containing the class definition and a jar file containing the ILT and Provider classes. This example was created specifically for the Java platforms supported by ITM. Since the platforms supported by this model were enabled in the Resource Model’s General Settings, both the ITSO_Sample.mof and the ITSO_Sample.jar files were added to the All dependency tab.164 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 188. Note: If this model were ported to Windows, a few items need to be considered. First, there is a JRE dependency in the ITM Engine that executes the Java ILT and Provider code. Therefore, a Windows JRE must be installed on the client. Second, the Windows platform has slightly different MOF requirements. Therefore, the MOF file used in this example would have to be added under every supported operating system so that the Windows specific MOF file can be included under the Windows leaf. JavaScript The script within the Resource Model was originally created through the ITM Workbench Resource Model Wizard. This provided a good “shell” script that was modified for our needs. This section will discuss only the changes made to the JavaScript. SetDefaultConfiguration In this Resource Model function, shown in Example 5-28, the customization was primarily done through the aforementioned ITM Workbench engine-generated script. The only note-worthy additions beyond those changes were two calls to the service objects Trace methods. This permitted tracing of the Resource Model within the trace_dmxengine.log file, in an effort to allow end users to better understand the model’s operation.Example 5-28 ITSO_Sample.dmjsws: SetDefaultConfiguration functionfunction SetDefaultConfiguration (Svc){ Svc.Trace (0, "ITSO_Sample: SetDefaultConfiguration - start" ); // General info section //<<GENERAL_INFO>> Svc.SetModelName ("ITSO_Sample"); Svc.SetProfileName ("105510562"); Svc.SetCycleTime (60); //<<GENERAL_INFO>> // Thresholds section //<<THRESHOLDS_INFO>> //<<THRESHOLDS_INFO>> // Parameters section //<<PARAMETERS_INFO>> Svc.DefineStrParameter ("ITSO_ArrayGUI", "Mike,Craig,Kiyo"); //<<PARAMETERS_INFO>> // Note:In the DefineClass method, we create an ALIAS of "ITSO_Sample" //to the actual CIM Namespace declaration for our class. Chapter 5. Engineering a Java ILT 165
  • 189. //This will be referenced by the AssociateParameterToClass //method later. // // Dynamic Model section //<<DATA_INFO>> Svc.DefineClass ("CIM", "ITSO_Sample", "ROOTDEFAULT:ITSO_Sample", "","ITSO_SampleVar_ui16,ITSO_SampleVar_si16,ITSO_SampleVar_r64,ITSO_SampleVar_r32,ITSO_SampleVar_ui32,ITSO_SampleVar_si8,ITSO_SampleVar_bln,ITSO_SampleVar_si64,ITSO_SampleVar_ui8,ITSO_SampleVar_si32,ITSO_SampleVar_inst", "ITSO_SampleVar_str", "None", "", 0, 1); //<<DATA_INFO>> // Event definition section //<<EVENTS_INFO>> //<<EVENTS_INFO>> // Logging definition section //<<LOGGING_INFO>> //<<LOGGING_INFO>> // Place your additional intializing code below Svc.Trace (0, "ITSO_Sample: SetDefaultConfiguration - end" ); return (0);} Init The Init function, shown in Example 5-29 on page 167, provides the initialization requirements for the Resource Model. In the case of the ITSO_Sample, very little initialization was required. In addition to the trace file logging we provided, we performed our variable initialization for the function, followed by our requirements. In the requirements, we did have to address the passing of configuration parameters to the ILT. In the case of the Resource Model parameter ITSO_ArrayGUI, which is passed from the ITM Engine during the initial Resource Model configuration to the ILT, we had to verify that it does contain at least one string value. Without any string values, our ILT would not be able to initialize. Therefore, within the initialization function, we obtain the dimension of, or number of values within, the array ITSO_ArrayGUI. The obtained dimension is validated to ensure it is greater than zero. If the dimension is acceptable, our next core function is the call to the AssociateParameterToClass method, which will register the Resource Model parameter within the ITM Engine and allow our instantiated ILT class to look up and obtain the parameter and its contents. If the dimension is not acceptable, that is, it is equal to zero, we return with the error code value 801. The error codes used by the ITM Engine are available in Chapter 6, “Resource Model Troubleshooting, of the IBM Tivoli Monitoring Workbench Users Guide Version 5.1.1, SH19-4571 and should always be used within the Resource Model.166 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 190. Example 5-29 ITSO_Sample.dmjsws: Init functionfunction Init(Svc){ Svc.Trace (0, "ITSO_Sample: Init - start" ); // Variable Initialization var dimension = 0; var t=0; // Process the parameter lists. // (2) Have been implemented to show various methods of use. // - ITSO_StringListGUI is an RM Parameter made available to the Tivoli // Admins via the Desktop. // dimension= Svc.GetStrParameterCount("ITSO_ArrayGUI"); if (dimension > 0 ) { Svc.Trace (0, "ITSO_Sample: Init - dimension =" + dimension); // Note: This is the reference to the alias "ITSO_Sample" created in // the DefineClass method. Svc.AssociateParameterToClass ("ITSO_ArrayGUI","ITSO_Sample"); } else { Svc.Trace (0, "ITSO_Sample: ITSO_ArrayGUI parameter is empty"); return(801); // Return an error if the Resource Model is dependant // on the paramater to function. "Unable to start." } Svc.Trace (0, "ITSO_Sample: Init - end" ); return (0);} VisitTree The VisitTree function, shown in Example 5-30 on page 168, was customized to perform the actual monitoring algorithm. In the case of the ITSO_Sample, the algorithm consists of simply polling each of the CIM class properties. The purpose of such simple logic is to demonstrate the retrieval of the data from the ILT class and to provide logging to the ITM Engine log file. The logging provides a method for tracing the functionality of the entire model and ILT during regular operation. Typical logic in the VisitTree function may include, but is not limited to, posting events, performing calculations and data comparisons, as well as logging data Chapter 5. Engineering a Java ILT 167
  • 191. retrieved from the ILT to the local database for collection and roll-up to the Tivoli Data Warehouse product.Example 5-30 ITSO_Sample.dmjsws: VisitTree functionfunction VisitTree(Svc){ // Variable Declaration var curITSO_SampleVar_inst; var curITSO_SampleVar_str; var curITSO_SampleVar_bln; var curITSO_SampleVar_ui8; var curITSO_SampleVar_ui16; var curITSO_SampleVar_ui32; var curITSO_SampleVar_si8; var curITSO_SampleVar_si16; var curITSO_SampleVar_si32; var curITSO_SampleVar_si64; var curITSO_SampleVar_r32; var curITSO_SampleVar_r64; var iInstanceCount; var idx; var sTraceOut; // Determine how many instances of the ITSO_Sample CIM Class exist. iInstanceCount = Svc.GetNumOfInst("ITSO_Sample"); Svc.Trace(0,"ITSO_Sample: VisitTree: iInstanceCount = "+ iInstanceCount ); for ( idx = 0; idx < iInstanceCount; idx++) { // Variable type demonstration:String curITSO_SampleVar_str = Svc.GetStrProperty("ITSO_Sample", idx, "ITSO_SampleVar_str"); sTraceOut = "GetNumProperty: curITSO_SampleVar_str = " + curITSO_SampleVar_str; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Boolean curITSO_SampleVar_bln= Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_bln"); sTraceOut = "GetNumProperty: curITSO_SampleVar_bln = " + curITSO_SampleVar_bln; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Unsigned Integer 8 curITSO_SampleVar_ui8 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_ui8"); sTraceOut = "GetNumProperty: curITSO_SampleVar_ui8 = " + curITSO_SampleVar_ui8 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Unsigned Integer 16 curITSO_SampleVar_ui16 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_ui16"); sTraceOut = "GetNumProperty: curITSO_SampleVar_ui16 = " + curITSO_SampleVar_ui16 ; Svc.Trace( 0, sTraceOut );168 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 192. // Variable type demonstration:Unsigned Integer 32 curITSO_SampleVar_ui32 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_ui32"); sTraceOut = "GetNumProperty: curITSO_SampleVar_ui32 = " + curITSO_SampleVar_ui32 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Signed Integer 8 curITSO_SampleVar_si8 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_si8"); sTraceOut = "GetNumProperty: curITSO_SampleVar_si8 = " + curITSO_SampleVar_si8 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Signed Integer 16 curITSO_SampleVar_si16 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_si16"); sTraceOut = "GetNumProperty: curITSO_SampleVar_si16 = " + curITSO_SampleVar_si16 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Signed Integer 32 curITSO_SampleVar_si32 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_si32"); sTraceOut = "GetNumProperty: curITSO_SampleVar_si32 = " + curITSO_SampleVar_si32 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Signed Integer 64 curITSO_SampleVar_si64 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_si64"); sTraceOut = "GetNumProperty: curITSO_SampleVar_si64 = " + curITSO_SampleVar_si64 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Real 32 curITSO_SampleVar_r32 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_r32"); sTraceOut = "GetNumProperty: curITSO_SampleVar_r32 = " + curITSO_SampleVar_r32 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration:Real 64 curITSO_SampleVar_r64 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_r64"); sTraceOut = "GetNumProperty: curITSO_SampleVar_r64 = " + curITSO_SampleVar_r64 ; Svc.Trace( 0, sTraceOut ); } return (0);}5.4 Packaging The various components discussed within this chapter must be packaged into a Resource Model tar file. The Resource Model Tar File relationship diagram, shown in Figure 5-6 on page 170, shows all the components of a typical Chapter 5. Engineering a Java ILT 169
  • 193. Resource Model, with those not used within the ITSO_Sample presented in light gray to de-emphasize their significance. Resource Model Tar File Configuration File JavaScript -or- Visual Basic Script Logging: Dynamic Model(s): Parameter(s): CIM Class "ITSO_Sample" ITSO_ArrayGUI Action(s): Reference Model Functions: Threshold(s): SetDefaultConfiguration(Svc) Event(s): Init(Svc) VisitTree(Svc) Message Catalogs Provider(s): MOF(s): "ITSO_Sample.jar" "ITSO_Sample.mof" Custom Scripts() Custom Files(s) Dependencies Files Figure 5-6 ITSO_Sample.tar: Resource Model Tar File5.4.1 Testing and importing the MOF The ITSO_Sample.mof file is compiled with the mofcomp utility, as shown in Example 5-31. Example 5-31 mofcomp CLI mofcomp -N:rootdefault ITSO_Sample.mof The actual output from this process is shown in Figure 5-7 on page 171.170 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 194. Figure 5-7 mofcomp output5.4.2 Java compilation The ITSO_Sample.java file is compiled by using the javac tool included with the JDK, as shown in Example 5-32. Example 5-32 javac CLI javac -classpath c:ITSO_Sample;dm_m12.jar;javautils.jar ITSO_Sample.java -d c:ITSO_Sample The actual output from this Java compiler process is shown in Figure 5-8 on page 172. Chapter 5. Engineering a Java ILT 171
  • 195. Figure 5-8 javac output Next, the ITSO_SampleILT.java file is compiled by using the javac tool included with the JDK, as shown in Example 5-33. Example 5-33 javac CLI javac -classpath c:ITSO_Sample;dm_m12.jar;javautils.jar ITSO_SampleIlt.java -d c:ITSO_Sample The actual output from this process is shown in Figure 5-9. Figure 5-9 javac output172 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 196. 5.4.3 Making the jar file The ITSO_Sample.jar Java package file is built by using the jar tool included with the JDK, as shown in Example 5-34. Example 5-34 jar CLI jar -cvf ITSO_Sample.jar com/ The actual output from this process is shown in Figure 5-10. Figure 5-10 jar output5.4.4 Assembling the Resource Model Upon completing the testing of ITSO_Sample.mof and the building of ITSO_Sample.jar, the two files must be added to the ITSO_Sample.dmjsws Resource Model file. This is done through the ITM Workbench, as shown in Figure 5-11 on page 174. Chapter 5. Engineering a Java ILT 173
  • 197. Figure 5-11 ITM Workbench: Tree view pane5.4.5 Building the Resource Model The Resource Model needs to be built through the ITM Workbench menu. Select Build → Build Package, as shown in Figure 5-12 on page 175. This will open the Save As dialog box, as shown in Figure 5-13 on page 175.174 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 198. Figure 5-12 ITM Workbench: Build menuFigure 5-13 ITM Workbench: Save As Chapter 5. Engineering a Java ILT 175
  • 199. 5.5 ITSO_Sample template The files in this section were created for the purpose of providing an easy to follow Provider template. This template can be used to create custom ILT Providers to integrate with applications and operating systems.5.5.1 ITSO_Sample.mof The complete MOF file used for the ITSO Sample Resource Model is shown in Example 5-35.Example 5-35 ITSO_Sample.mof//------------------------------------------------------------------------------//// ITSO_Sample.mof//// Description:// This file is a textual definition of the ITSO_Sample CIM class.//// History:// Date Author Description// -------- ------------------ ------------------------------------------// 04/15/03 ITSO Redbook Team Original file.////------------------------------------------------------------------------------[ Description ("ITSO Sample - This sample was created to provide to help " "clarify the creation of a custom ILT and Provider. There " "are many details that have not been included, incuding " "additional M12 qualifiers within the MOF. However, the " "core functionality does provide a complete model from " "which to work."), provider("com.tivoli.dmunix.ep.touchpoint.cimom.ifc.M12JavaProvider"), M12_Instrumentation { "Java.com.ibm.tivoli.monitoring.ITSO_Sample.ITSO_SampleIlt | | ENUM", "Java.com.ibm.tivoli.monitoring.ITSO_Sample.ITSO_SampleIlt | | GET"}]class ITSO_Sample{ // Attribute, Instance Count. [ Description("The ITSO_SampleVar_inst property defines the instance of " "the provider." ), key ] sint32 ITSO_SampleVar_inst; // Attribute, String. [ Description("The ITSO_SampleVar_str property demonstrates the use of" "a string data type." ) ]176 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 200. string ITSO_SampleVar_str;// Attribute, Boolean.[ Description("The ITSO_SampleVar_bln property demonstrates the use of" "a boolean data type." ) ]boolean ITSO_SampleVar_bln;// Attribute, Signed Integer 8-bit.[ Description("The ITSO_SampleVar_si8 property demonstrates the use of" "an 8-bit signed integer data type." ) ]sint8 ITSO_SampleVar_si8;// Attribute, Signed Integer 16-bit.[ Description("The ITSO_SampleVar_str property demonstrates the use of" "a 16-bit signed integer data type." ) ]sint16 ITSO_SampleVar_si16;// Attribute, Signed Integer 32-bit.[ Description("The ITSO_SampleVar_str property demonstrates the use of" "a 32-bit signed integer data type." ) ]sint32 ITSO_SampleVar_si32;// Attribute, Signed Integer 64-bit.[ Description("The ITSO_SampleVar_str property demonstrates the use of" "a 64-bit signed integer data type." ) ]sint64 ITSO_SampleVar_si64;// Attribute, Unsigned Integer 8-bit.[ Description("The ITSO_SampleVar_str property demonstrates the use of" "an 8-bit unsigned integer data type." ) ]uint8 ITSO_SampleVar_ui8;// Attribute, Unsigned Integer 16-bit.[ Description("The ITSO_SampleVar_str property demonstrates the use of" "a 16-bit unsigned integer data type." ) ]uint16 ITSO_SampleVar_ui16;// Attribute, Unsigned Integer 32-bit.[ Description("The ITSO_SampleVar_str property demonstrates the use of" "a 32-bit unsigned integer data type." ) ]uint32 ITSO_SampleVar_ui32;// Attribute, Floating Point 32-bit.[ Description("The ITSO_SampleVar_str property demonstrates the use of" "a 32-bit floating point data type." ) ]real32 ITSO_SampleVar_r32;// Attribute, Floating Point 64-bit.[ Description("The ITSO_SampleVar_str property demonstrates the use of" Chapter 5. Engineering a Java ILT 177
  • 201. "a 64-bit floating point data type." ) ] real64 ITSO_SampleVar_r64;};5.5.2 ITSO_SampleIlt.java The complete ILT class for the ITSO_Sample Resource Model is shown in Example 5-36.Example 5-36 ITSO_SampleIlt.java//------------------------------------------------------------------------------//// ITSO_SampleILT.java//// Description:// This file is the ITSO_Sample Instrumentation Library Type (ILT)// implementation. This is the class instantiated by the "touchpoint"// layer. This class will execute methods in the "ITSO_Sample.java" file,// which is the physical "provider" and performs the actual data// acquisition.//// Various classes are referenced throughout this file. ILT Supported// Classes, which are documented, in the IBM Tivoli Monitoring Workbench Users Guide// Version 5.1.1, SH19-4571, include:// M12ClassPath// M12IdentityElement// M12ObjectIdentity// M12PreportySet// M12Exception// ParameterSet// ParameterSetList//// History:// Date Author Description// -------- ------------------ ------------------------------------------// 04/15/03 ITSO Redbook Team Original file.////------------------------------------------------------------------------------package com.ibm.tivoli.monitoring.ITSO_Sample;import com.ibm.tivoli.monitoring.ITSO_Sample.ITSO_Sample;import com.tivoli.dmunix.ep.touchpoint.base.*; // "dm_m12.jar"import com.tivoli.javautils.Trace; // "javautils.jar"import java.util.Enumeration;import java.util.Vector;public class ITSO_SampleIlt implements ILTInterface178 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 202. { //-------------------------------------------------------------------------- // Instantiate the required class. //-------------------------------------------------------------------------- private ITSO_Sample pitso_sample; private Trace trace; //-------------------------------------------------------------------------- // ITSO_SampleIlt class - Creator method. //-------------------------------------------------------------------------- public ITSO_SampleIlt() { pitso_sample = new ITSO_Sample(); trace = Trace.getTraceInstance(); } //-------------------------------------------------------------------------- // Instrumentation Library Type (ILT) // - Public Operations // // Note: This is documented in the IBM Tivoli Monitoring Workbench Users Guide Version // 5.1.1, SH19-4571. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // getProperty // // Supported: YES // // Syntax: // public java.lang.String getProperty( M12ObjectIdentity targetInstance, // java.lang.String propertyName, // java.lang.String mappingString, // ParameterSet parms ) // throws M12Exception // // Parameters: // targetInstance: M12ObjectIdentity that identifies the instance of // the resource to be accessed. // propertyName: The property whose value is required. // mappingString: Any string that has been specified in the // M12_Instrumentation qualifier for the GET operation // type for this property. // parms: A ParameterSet object filled by the client with // parameters associated to this property. // Chapter 5. Engineering a Java ILT 179
  • 203. // Description: // Gets the value (in String format) of the specified property for the // identified object. // // Returns: // String: The value for property propertyName. Property values have // to be CIM standard types and ILT converts them to string // format according to the CIM standards. // // Exceptions Thrown: // M12Exception //-------------------------------------------------------------------------- public String getProperty( M12ObjectIdentity m12objectidentity, String sPropertyName, String sMapping, ParameterSet parameterset ) throws M12Exception { try { M12IdentityElement m12identityelement = m12objectidentity.getScopingPath()[0]; M12PropertySet m12propertyset = m12identityelement.getIdentity(); // Determine which instance is being checked by the // Management Layer. String sKey = m12propertyset.getProperty("ITSO_SampleVar_inst"); trace.log(3, "ITSO_SampleIlt", "getProperty: called for ITSO_SampleVar_inst " + sKey); // Get the attributes being checked by the Management Layer. // Get the current attribute values. String sValue = getITSOAttribute(sKey, sPropertyName); trace.log(3, "ITSO_SampleIlt", "getITSOAttribute: " + sPropertyName + " = " + sValue); return sValue; } catch(Exception exception) { trace.exception("ITSO_SampleIlt", "getProperty", exception); M12Exception m12exception = new M12Exception(exception); throw m12exception; } } //-------------------------------------------------------------------------- // // getMultipleProperties //180 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 204. // Supported: YES//// Syntax:// public M12PropertySet getMultipleProperties(// M12ObjectIdentity targetInstance,// java.util.Vector propertyList,// java.lang.String mappingString,// ParameterSet parms )// throws M12Exception//// Parameters:// targetInstance: M12ObjectIdentity that identifies the instance of// the resource to be accessed.// propertyList: The list of properties whose value is required.// mappingString: Any string that has been specified in the// M12_Instrumentation qualifier for the GET operation// type for the class which the specified instance// belongs to.// parms: A ParameterSet object filled by the client with// parameters associated to the class which the// specified instance belongs to.//// Description:// Gets the value (in String format) of the specified properties for the// identified object.//// Returns:// M12PropertySet: the values of the requested properties.//// Exceptions Thrown:// M12Exception////--------------------------------------------------------------------------public M12PropertySet getMultipleProperties( M12ObjectIdentity m12objectidentity, Vector vPropertyList, String sMapping, ParameterSet parameterset ) throws M12Exception{ try { M12IdentityElement m12identityelement = m12objectidentity.getScopingPath()[0]; M12PropertySet m12propertyset = m12identityelement.getIdentity(); // Determine which instance is being checked by the // Management Layer. String sKey = m12propertyset.getProperty("ITSO_SampleVar_inst"); Chapter 5. Engineering a Java ILT 181
  • 205. M12PropertySet m12propertyset1 = new M12PropertySet(); trace.log(3, "ITSO_SampleIlt", "getMultipleProperty: called for ITSO_SampleVar_inst " + sKey); for(int i = 0; i < vPropertyList.size(); i++) { // Get the property being checked by the Management Layer. String sProperty = (String)vPropertyList.elementAt(i); // Get the current attribute values. String sValue = getITSOAttribute(sKey, sProperty); m12propertyset1.setProperty(sProperty, sValue); } trace.log(3, "ITSO_SampleIlt", "getMultipleProperty: returning " + WriteBuffer(m12propertyset1)); return m12propertyset1; } catch(Exception exception) { trace.exception("ITSO_SampleIlt", "getMultipleProperty", exception); M12Exception m12exception = new M12Exception(exception); throw m12exception; } } //-------------------------------------------------------------------------- // // enumerateInstances // // Supported: YES // // Syntax: // public java.util.Enumeration enumerateInstances( // M12ClassPath classPath, // java.lang.String mappingString, // ParameterSet parms ) // throws M12Exception // // Parameters: // classPath: The M12ClassPath identifying the class whose instances // have to be enumerated. // mappingString: Any string that has been specified in the // M12_Instrumentation qualifier for the ENUM operation // type for this class. // parms: A ParameterSet object filled by the client with // parameters for ILT. //182 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 206. // Description// Returns all M12ObjectIdentity objects that identify all the instances// belonging to the class specified in the classPath.//// Returns:// Enumeration of instances identity (M12ObjectIdentity).//// Exceptions Thrown:// M12Exception////--------------------------------------------------------------------------public Enumeration enumerateInstances( M12ClassPath m12classpath, String sMapping, ParameterSet parameterset ) throws M12Exception{ try { // Variable Declaration. StringBuffer stringbuffer = new StringBuffer(); Vector vector = new Vector(); //------------------------------------------------------------------ // Get the parameters from the caller. // We are obtaining theparameters prior to declaring instances so // we can configure an instance for each parameter. //------------------------------------------------------------------ Enumeration enumeration = parameterset.parametersNames(); Vector vParam = (Vector)parameterset.getParam("ITSO_ArrayGUI"); if(vParam == null) { trace.log(1, "ITSO_SampleIlt", "enumerateInstances: no parameters found"); return null; } // Process the ITSO_ArrayGUI parameter. String asITSOArrayGui[] = new String[vParam.size()]; for(int iIndex = 0; iIndex < vParam.size(); iIndex++) { // Get the string array element from the vector element. asITSOArrayGui[iIndex] = (String)vParam.elementAt(iIndex); trace.log( 3, "ITSO_SampleIlt", "enumerateInstances: asITSOArrayGui[" + iIndex + "] = " + asITSOArrayGui[iIndex]); } //------------------------------------------------------------------ // Acquire a vector (pointer) from the calling ILT Manager. // This section handles the registration of instances of this Chapter 5. Engineering a Java ILT 183
  • 207. // Instrumentation. //------------------------------------------------------------------ int aiInst[] = pitso_sample.getITSO_Instances( asITSOArrayGui ); if(aiInst == null) { trace.log(1, "ITSO_SampleIlt", "enumerateInstances: no instances found"); return null; } for(int jIndex = 0; jIndex < aiInst.length; jIndex++) { trace.log( 3, "ITSO_SampleIlt", "enumerateInstances: aiInst[" + jIndex + "] = " + aiInst[jIndex]); M12PropertySet m12propertyset = new M12PropertySet(); m12propertyset.setProperty( "ITSO_SampleVar_inst", String.valueOf(aiInst[jIndex]) ); M12IdentityElement m12identityelement = new M12IdentityElement( m12classpath.getClassName(), m12classpath.getNameSpace(), m12propertyset); vector.add( new M12ObjectIdentity( new M12IdentityElement[] { m12identityelement } ) ); } return vector.elements(); } catch(Exception exception) { trace.exception("ITSO_SampleIlt", "enumerateInstances", exception); M12Exception m12exception = new M12Exception(exception); throw m12exception; } } //-------------------------------------------------------------------------- // // setProperty // // Supported: NO // // Syntax: // public java.lang.String setProperty( M12ObjectIdentity targetInstance, // java.lang.String propertyName, // java.lang.String propertyValue, // java.lang.String mappingString, // ParameterSet parms ) // throws M12Exception //184 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 208. // Parameters:// targetInstance: M12ObjectIdentity that identifies the instance of the// resource to be accessed.// propertyName: The property whose value is to be set.// propertyValue: The property value to be set.// mappingString: Any string that has been specified in the// M12_Instrumentation qualifier for the SET operation// type for this property.// parms: A ParameterSet object filled by the client with// parameters associated to this property.//// Description:// Sets the value (in String format) of the specified property for the// identified object.//// Returns:// String: the new value of the specified property.//// Exceptions Thrown:// M12Exception////--------------------------------------------------------------------------public String setProperty( M12ObjectIdentity m12objectidentity, String sName, String sValue, String sMapping, ParameterSet parameterset ) throws M12Exception{ trace.log(3, "ITSO_SampleIlt", "setProperty: " + "sName=" + sName + ", sValue=" + sValue + ", sMapping=" + sMapping ); return null;}//--------------------------------------------------------------------------//// invokeMethod//// Supported: YES//// Syntax:// public java.lang.String invokeMethod( M12ClassPath classPath,// java.lang.String methodName,// java.lang.String mappingString,// ParameterSet parms,// ParameterSet inParms,// ParameterSet outParms ) Chapter 5. Engineering a Java ILT 185
  • 209. // throws M12Exception // // Parameters: // classPath: The M12ClassPath that identifies the class // whose method has to be called. // methodName: The name of the method to be called. // mappingString: Any string that has been specified in the // M12_Instrumentation qualifier for the INVOKE // operation type for this method. // parms: A ParameterSet object filled by the client with // parameters for this method. // inParms: A ParameterSet object filled by the client with // parameters to be passed to the method. // outParms: A ParameterSet object created by the client and // filled by the method with output results. // // Description: // Invokes the specified method on the CIM instance belonging to // the class specified in the classPath. // // Returns: // String: The result of the method. Result values have to be CIM // standard types and ILT converts them to string format // according to the CIM standards. // // Exceptions Thrown: // M12Exception // //-------------------------------------------------------------------------- public String invokeMethod( M12ClassPath m12classpath, String sMethodName, String sMapping, ParameterSet parameterset, ParameterSet parameterset1, ParameterSet parameterset2 ) throws M12Exception { trace.log(3, "ITSO_SampleIlt", "invokeMethod(1): " + "sMethodName=" + sMethodName + ", sMapping=" + sMapping ); return null; } //-------------------------------------------------------------------------- // // invokeMethod // // Supported: YES186 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 210. //// Syntax:// public java.lang.String invokeMethod( M12ObjectIdentity targetInstance,// java.lang.String methodName,// java.lang.String mappingString,// ParameterSet parms,// ParameterSet inParms,// ParameterSet outParms)// throws M12Exception//// Parameters:// targetInstance: M12ObjectIdentity that identifies the instance// whose method has to be called.// methodName: The name of the method to be called.// mappingString: Any string that has been specified in the// M12_Instrumentation qualifier for the INVOKE// operation type for this method.// parms: A ParameterSet object filled by the client with// parameters for this method.// inParms: A ParameterSet object filled by the client with// parameters to be passed to the method.// outParms: A ParameterSet object created by the client and// filled by the method with output results.//// Description:// Invokes the specified method on the identified CIM instance.//// Returns:// String: The result of the method. Result values have to be CIM// standard types and ILT converts them to string format// according to the CIM standards.//// Exceptions Thrown:// M12Exception////--------------------------------------------------------------------------public String invokeMethod( M12ObjectIdentity m12objectidentity, String sMethodName, String sMapping, ParameterSet parameterset, ParameterSet parameterset1, ParameterSet parameterset2 ) throws M12Exception{ trace.log(3, "ITSO_SampleIlt", "invokeMethod(2): " + "sMethodName=" + sMethodName + ", sMapping=" + sMapping ); return null;} Chapter 5. Engineering a Java ILT 187
  • 211. //-------------------------------------------------------------------------- // // create // // Supported: NO // // Syntax: // public void create( M12ObjectIdentity targetInstance, // java.lang.String mappingString, // ParameterSet parms ) // throws M12Exception // // Parameters: // targetInstance: M12ObjectIdentity that identifies the instance // of the resource to be created. // mappingString: Any string that has been specified in the // M12_Instrumentation qualifier for the CREATE // operation type for the class whose instance to // be created will belong to. // parms: A ParameterSet object filled by the client // with parameters for the ILT. // // Description // Creates an instance of the resource that will be identified by // the specified targetInstance. // // Returns: // void // // Exceptions Thrown: // M12Exception // //-------------------------------------------------------------------------- public void create( M12ObjectIdentity m12objectidentity, String sMapping, ParameterSet parameterset ) throws M12Exception { trace.log(3, "ITSO_SampleIlt", "create: sMapping=" + sMapping ); } //-------------------------------------------------------------------------- // // destroy // // Supported: NO188 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 212. //// Syntax:// public void destroy( M12ObjectIdentity targetInstance,// java.lang.String mappingString,// ParameterSet parms )// throws M12Exception//// Parameters :// targetInstance: M12ObjectIdentity that identifies the instance// of the resource to be deleted.// mappingString: Any string that has been specified in the// M12_Instrumentation qualifier for the CREATE// operation type for the class whose instance to// be deleted belongs to.// parms: A ParameterSet object filled by the client// with parameters for the ILT.//// Description:// Deletes an instance of the resource identified by the specified// targetInstance.//// Returns:// void//// Exceptions Thrown:// M12Exception////--------------------------------------------------------------------------public void destroy( M12ObjectIdentity m12objectidentity, String sMapping, ParameterSet parameterset ) throws M12Exception{ trace.log(3, "ITSO_SampleIlt", "destroy: sMapping=" + sMapping );}//--------------------------------------------------------------------------//// Custom Class Methods//// The following methods are custom methods created to provide better// programatic structure.////--------------------------------------------------------------------------//--------------------------------------------------------------------------//// GetAttributeTypes// Chapter 5. Engineering a Java ILT 189
  • 213. // This method is internal to the class and is designed to segregate the // ILT Operations from our own supporting methods. It is simply to provide // cleaner & easier to maintain code. // //-------------------------------------------------------------------------- private String getITSOAttribute( String sValue, String sProperty ) throws Exception { //---------------------------------------------------------------------- // // MOF Declared Types // // There is an "if" structure for each of the variable types that this // sample supports. // //---------------------------------------------------------------------- int iIndex = (new Integer(sValue)).intValue(); //---------------------------------------------------------------------- // string ITSO_SampleVar_str //---------------------------------------------------------------------- if(sProperty.equals("ITSO_SampleVar_str")) { String sReturn = new String( pitso_sample.getITSO_SampleVar_str(iIndex) ); return sReturn; } //---------------------------------------------------------------------- // boolean ITSO_SampleVar_bln //---------------------------------------------------------------------- if(sProperty.equals("ITSO_SampleVar_bln")) { Boolean blnVar = new Boolean(pitso_sample.getITSO_SampleVar_bln(iIndex)); return blnVar.toString(); } //---------------------------------------------------------------------- // sint8 ITSO_SampleVar_si8 // sint16 ITSO_SampleVar_si16 // sint32 ITSO_SampleVar_si32 // sint64 ITSO_SampleVar_si64 //---------------------------------------------------------------------- if( (sProperty.equals("ITSO_SampleVar_si8")) || (sProperty.equals("ITSO_SampleVar_si16")) || (sProperty.equals("ITSO_SampleVar_si32")) ||190 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 214. (sProperty.equals("ITSO_SampleVar_si64")) ) { Integer intVar = new Integer(pitso_sample.getITSO_SampleVar_si(iIndex)); return intVar.toString(); } //---------------------------------------------------------------------- // uint8 ITSO_SampleVar_ui8 // uint16 ITSO_SampleVar_ui16 // uint32 ITSO_SampleVar_ui32 //---------------------------------------------------------------------- if( (sProperty.equals("ITSO_SampleVar_ui8")) || (sProperty.equals("ITSO_SampleVar_ui16")) || (sProperty.equals("ITSO_SampleVar_ui32")) ) { Integer intVar = new Integer(pitso_sample.getITSO_SampleVar_ui(iIndex)); return intVar.toString(); } //---------------------------------------------------------------------- // real32 ITSO_SampleVar_r32 // real64 ITSO_SampleVar_r64 //---------------------------------------------------------------------- if( (sProperty.equals("ITSO_SampleVar_r32")) || (sProperty.equals("ITSO_SampleVar_r64")) ) { Double dblVar = new Double(pitso_sample.getITSO_SampleVar_r(iIndex)); return dblVar.toString(); } //---------------------------------------------------------------------- // Unknown property. //---------------------------------------------------------------------- else { throw new Exception(sProperty + ": unknown property"); }}//--------------------------------------------------------------------------//// WriteBuffer//// This method is internal to the class and is designed to write the// variable returned from the ILT Operations to the output string. It is Chapter 5. Engineering a Java ILT 191
  • 215. // strictly to support better logging. // //-------------------------------------------------------------------------- private String WriteBuffer( M12PropertySet m12propertyset ) { Enumeration enumeration = m12propertyset.propertyNames(); StringBuffer stringbuffer = new StringBuffer(); String sElement; String sProperty; for(; enumeration.hasMoreElements(); stringbuffer.append(sElement + " = " + sProperty + " ")) { sElement = (String)enumeration.nextElement(); sProperty = m12propertyset.getProperty(sElement); } return stringbuffer.toString(); }}5.5.3 ITSO_Sample.java The complete Provider class for the ITSO_Sample Resource Model is shown in Example 5-37.Example 5-37 ITSO_Sample.java//------------------------------------------------------------------------------//// ITSO_Sample.java//// Description:// This file is the ITSO_Sample Provider to the ILT. This can perform the// actual the actual data acquisition, call other classes, or via JNI// perform calls to "native" binaries.//// History:// Date Author Description// -------- ------------------ ------------------------------------------// 04/15/03 ITSO Redbook Team Original file.////------------------------------------------------------------------------------package com.ibm.tivoli.monitoring.ITSO_Sample;import com.tivoli.javautils.Trace;import java.util.*;192 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 216. public class ITSO_Sample{ // Declare local members. private Trace trace; private Map ITSO_SampleMap; //-------------------------------------------------------------------------- // ITSO_Sample class - Creator method. //-------------------------------------------------------------------------- public ITSO_Sample() { trace = Trace.getTraceInstance(); } //-------------------------------------------------------------------------- // ITSO_Sample: This method should configure an instance for each item in // the array. //-------------------------------------------------------------------------- public synchronized int[] getITSO_Instances( String asParams[] ) { // The instances will be referenced by number to keep it simple. trace.log(3, "ITSO_Sample", "getITSO_Instances asParams.length=" + asParams.length); int[] aiInst = new int[asParams.length]; for(int iIndex = 0; iIndex < asParams.length; iIndex++) { // Get the string array element from the vector element. trace.log(3, "ITSO_Sample", "getITSO_Instances iIndex=" + iIndex); aiInst[iIndex] = iIndex; trace.log(3, "ITSO_Sample", "getITSO_Instances aiInst[" + iIndex + "]" + aiInst[iIndex]); } return aiInst; } //---------------------------------------------------------------------- // getITSO_SampleVar_String // // Implement the code or reference to the code that will "provide" the // value requested. // // This method spceifically returns a "dummy" value for the String. It // does not actually perform any lookups or references to system data. //---------------------------------------------------------------------- public static synchronized String getITSO_SampleVar_str(int iIndex) { Chapter 5. Engineering a Java ILT 193
  • 217. // Add logic to check the correct instance (index) of the resource. // For this example, to demonstrate differences based on instances, // we are building a string that includes the index number. String sReturn = "iIndex_" + iIndex; return sReturn; } //---------------------------------------------------------------------- // getITSO_SampleVar_SignedInt // // Implement the code or reference to the code that will "provide" the // value requested. // // This method spceifically returns a "dummy" value for the Signed Int. // It does not actually perform any lookups or references to system // data. //---------------------------------------------------------------------- public static synchronized int getITSO_SampleVar_si(int iIndex) { // Add logic to check the correct instance (index) of the resource. return -1; } //---------------------------------------------------------------------- // getITSO_SampleVar_UnsignedInt // // Implement the code or reference to the code that will "provide" the // value requested. // // This method spceifically returns a "dummy" value for the Unsigned // Int. It does not actually perform any lookups or references to // system data. //---------------------------------------------------------------------- public static synchronized int getITSO_SampleVar_ui(int iIndex) { // Add logic to check the correct instance (index) of the resource. return 1; } //---------------------------------------------------------------------- // getITSO_SampleVar_Real // // Implement the code or reference to the code that will "provide" the // value requested. //194 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 218. // This method spceifically returns a "dummy" value for the Floating // Point. It does not actually perform any lookups or references to // system data. //---------------------------------------------------------------------- public static synchronized double getITSO_SampleVar_r(int iIndex) { // Add logic to check the correct instance (index) of the resource. return 3.14; } //---------------------------------------------------------------------- // getITSO_SampleVar_Boolean // // Implement the code or reference to the code that will "provide" the // value requested. // // This method spceifically returns a "dummy" value for the Floating // Point. It does not actually perform any lookups or references to // system data. //---------------------------------------------------------------------- public static synchronized boolean getITSO_SampleVar_bln(int iIndex) { // Add logic to check the correct instance (index) of the resource. return true; }}5.5.4 Resource Model JavaScript The complete JavaScript, as implemented within the ITSO_Sample Resource Model file, is shown in Example 5-38Example 5-38 ITSO_Sample.dmjsws JavaScript//// IBM Tivoli Monitoring// Decision Tree script//// History:// Date Author Description// -------- ------------------ ------------------------------------------// 04/15/03 ITSO Redbook Team Original file.////// This function is used to define the settings of the Resource Model Chapter 5. Engineering a Java ILT 195
  • 219. // It is called only once, when the Resource Model is started.// Dont modify remarks containing tags like <<....>> ... <<...>>// You can write additional initializing code in this function if required.function SetDefaultConfiguration (Svc){ Svc.Trace (0, "ITSO_Sample: SetDefaultConfiguration - start" ); // General info section //<<GENERAL_INFO>> Svc.SetModelName ("ITSO_Sample"); Svc.SetProfileName ("460108578"); Svc.SetCycleTime (60); //<<GENERAL_INFO>> // Thresholds section //<<THRESHOLDS_INFO>> //<<THRESHOLDS_INFO>> // Parameters section //<<PARAMETERS_INFO>> Svc.DefineStrParameter ("ITSO_ArrayGUI", "Mike,Craig,Kiyo"); //<<PARAMETERS_INFO>> // Note: In the DefineClass method, we create an ALIAS of "ITSO_Sample" // of the actual CIM Namespace declaration for our class. // This will be referenced by the AssociateParameterToClass // method later. // // Dynamic Model section //<<DATA_INFO>> Svc.DefineClass ("CIM", "ITSO_Sample", "ROOTDEFAULT:ITSO_Sample", "","ITSO_SampleVar_ui16,ITSO_SampleVar_si16,ITSO_SampleVar_r64,ITSO_SampleVar_r32,ITSO_SampleVar_ui32,ITSO_SampleVar_si8,ITSO_SampleVar_bln,ITSO_SampleVar_si64,ITSO_SampleVar_ui8,ITSO_SampleVar_si32,ITSO_SampleVar_inst", "ITSO_SampleVar_str", "None", "", 0, 1); //<<DATA_INFO>> // Event definition section //<<EVENTS_INFO>> //<<EVENTS_INFO>> // Logging definition section //<<LOGGING_INFO>> //<<LOGGING_INFO>> // Place your additional intializing code below Svc.Trace (0, "ITSO_Sample: SetDefaultConfiguration - end" ); return (0);}196 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 220. // This function is called by the DM For Windows Analyzer after that// the Resource Model default settings have been overridden// It is called only once, when the Resource Model is started.// You can write additional initializing code in this function if required// to use the thresholds and parameters valuesfunction Init(Svc){ Svc.Trace (0, "ITSO_Sample: Init - start" ); // Variable Initialization var dimension = 0; var t=0; // Process the parameter lists. // (2) Have been implemented to show various methods of use. // - ITSO_StringListGUI is an RM Parameter made available to the Tivoli Admins // via the Desktop. // dimension= Svc.GetStrParameterCount("ITSO_ArrayGUI"); if (dimension > 0 ) { Svc.Trace (0, "ITSO_Sample: Init - dimension =" + dimension); // Note: This is the reference to the alias "ITSO_Sample" created in the // DefineClass method. Svc.AssociateParameterToClass ("ITSO_ArrayGUI","ITSO_Sample"); } else { Svc.Trace (0, "ITSO_Sample: ITSO_ArrayGUI parameter is empty"); return(801); // Return an error if the Resource Model is dependant // on the paramater to function. "Unable to start." } Svc.Trace (0, "ITSO_Sample: Init - end" ); return (0);}// This function contains the monitoring algorithm// It is called cyclically after a cycle time has elapsed// Implement the the monitoring code herefunction VisitTree(Svc){ // Variable Declaration var curITSO_SampleVar_inst; var curITSO_SampleVar_str; Chapter 5. Engineering a Java ILT 197
  • 221. var curITSO_SampleVar_bln; var curITSO_SampleVar_ui8; var curITSO_SampleVar_ui16; var curITSO_SampleVar_ui32; var curITSO_SampleVar_si8; var curITSO_SampleVar_si16; var curITSO_SampleVar_si32; var curITSO_SampleVar_si64; var curITSO_SampleVar_r32; var curITSO_SampleVar_r64; var iInstanceCount; var idx; var sTraceOut; // Determine how many instances of the ITSO_Sample CIM Class exist. iInstanceCount = Svc.GetNumOfInst("ITSO_Sample"); Svc.Trace(0,"ITSO_Sample: VisitTree: iInstanceCount = "+ iInstanceCount ); for ( idx = 0; idx < iInstanceCount; idx++) { // Variable type demonstration: String curITSO_SampleVar_str = Svc.GetStrProperty("ITSO_Sample", idx, "ITSO_SampleVar_str"); sTraceOut = "GetNumProperty: curITSO_SampleVar_str = " + curITSO_SampleVar_str; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Boolean curITSO_SampleVar_bln= Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_bln"); sTraceOut = "GetNumProperty: curITSO_SampleVar_bln = " + curITSO_SampleVar_bln; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Unsigned Integer 8 curITSO_SampleVar_ui8 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_ui8"); sTraceOut = "GetNumProperty: curITSO_SampleVar_ui8 = " + curITSO_SampleVar_ui8 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Unsigned Integer 16 curITSO_SampleVar_ui16 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_ui16"); sTraceOut = "GetNumProperty: curITSO_SampleVar_ui16 = " + curITSO_SampleVar_ui16 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Unsigned Integer 32 curITSO_SampleVar_ui32 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_ui32"); sTraceOut = "GetNumProperty: curITSO_SampleVar_ui32 = " + curITSO_SampleVar_ui32 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Signed Integer 8 curITSO_SampleVar_si8 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_si8"); sTraceOut = "GetNumProperty: curITSO_SampleVar_si8 = " + curITSO_SampleVar_si8 ; Svc.Trace( 0, sTraceOut );198 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 222. // Variable type demonstration: Signed Integer 16 curITSO_SampleVar_si16 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_si16"); sTraceOut = "GetNumProperty: curITSO_SampleVar_si16 = " + curITSO_SampleVar_si16 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Signed Integer 32 curITSO_SampleVar_si32 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_si32"); sTraceOut = "GetNumProperty: curITSO_SampleVar_si32 = " + curITSO_SampleVar_si32 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Signed Integer 64 curITSO_SampleVar_si64 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_si64"); sTraceOut = "GetNumProperty: curITSO_SampleVar_si64 = " + curITSO_SampleVar_si64 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Real 32 curITSO_SampleVar_r32 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_r32"); sTraceOut = "GetNumProperty: curITSO_SampleVar_r32 = " + curITSO_SampleVar_r32 ; Svc.Trace( 0, sTraceOut ); // Variable type demonstration: Real 64 curITSO_SampleVar_r64 = Svc.GetNumProperty("ITSO_Sample", idx, "ITSO_SampleVar_r64"); sTraceOut = "GetNumProperty: curITSO_SampleVar_r64 = " + curITSO_SampleVar_r64 ; Svc.Trace( 0, sTraceOut ); } return (0);} Chapter 5. Engineering a Java ILT 199
  • 223. 200 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 224. 6 Chapter 6. Creating an SNMP Resource Model for Windows In this chapter, we cover the basics on how to create a Resource Model from a new Windows Management Instrumentation (WMI) Provider, specifically using the WMI SNMP Provider. We link the new management classes into the WMI Repository and create a Resource Model underpinning the new management classes and data feeds. The scope of this example is limited to IBM Tivoli Monitoring operating on a Microsoft Windows NT-based operating system within the COM+ architecture (Windows XP, Windows 2000, and Windows NT). Though this is Windows-centric, the concept of SNMP is open to all platforms. The same concepts apply to IBM Tivoli Monitoring when it is running cross-platform within the Java components of the IBM Tivoli Monitoring architecture (refer to Chapter 7, “Creating an SNMP Resource Model for Java” on page 231 for more details). This chapter describes the following: Designing the ITSO_SNMP_Interface_Bps Resource Model Creating the ITSO_SNMP_Interface_Bps Resource Model ITSO_SNMP_Interface_Bps source code© Copyright IBM Corp. 2003. All rights reserved. 201
  • 225. 6.1 Designing the Resource Model In this scenario, we will demonstrate how to create a new Resource Model, ITSO_SNMP_Interface_Bps, that will take data from SNMP sources and report on key performance metrics, such as the interface traffic density on Windows 2000 machines.6.1.1 Design overview The Resource Model utilizes the WMI SNMP Provider to monitor the MIB variable through WMI. The overview of ITSO_SNMP_Interface_Bps Resource Model is shown in Figure 6-1. Monitored Server W MI SNMP Service MIB-II System ITSO_SNMP_Interface_Bps MIB-II Interfaces Resource Model MIB-II IP MIB-II TCP MIB-II UDP W MI ITM Engine SNMP Provider Endpoint Figure 6-1 Design overview of ITSO_SNMP_Interface_Bps Resource Model The WMI SNMP Provider is an extension of WMI provided by Microsoft. The WMI SNMP Provider allows us to access MIB variables provided by Microsoft Windows SNMP Service through the WMI interface. Currently, SNMP is one of the most widely used network management protocols. It has a huge advantage in the network management realm, which means you can follow best practices for network management by using SNMP. Moreover, you can also integrate the best practices of network management into ITM using the WMI SNMP Provider. Microsoft Windows SNMP Service supports the RFC1213 MIB-II, which has general attributes related to the network level information of the device. The MIB-II specification is made of several groups including System, Interfaces, and IP. In this scenario, we will utilize the ifInOctets MIB variable and the ifOutOctets MIB variable included in the Interfaces group of MIB-II to monitor the performance of interfaces. Both of them are the COUNTER type MIB variables, which is the total number of octets (8 bits) received on the interface. As long as202 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 226. the system runs, the ifInOctets MIB variable and the ifOutOctets MIB variable continuously grow. This makes for easy comparisons within the Resource Model. The ITSO_SNMP_Interface_Bps Resource Model checks the difference between the current value of the MIB variable and previous one. If the delta between the current variable and previous one becomes more than the threshold attribute you specify, the ITSO_SNMP_Interface_Bps Resource Model recognizes the interface has the traffic problem. For your convenience, ITSO_SNMP_Interface_Bps calculate octets measurement into bits (you can specify the threshold in bits per second (bps)). Note: For more information about the WMI or the WMI SNMP Provider, see the following link: http://www.microsoft.com/technet/default.asp6.1.2 What part of ITM will we use? In review of the aforementioned design requirements, the ITM Engine Logical Components diagram can be revisited. The components of the engine that will be utilized by this example can be seen in Figure 6-2 on page 204. Those components that will not be used within the ITSO_SNMP_Interface_Bps are presented in light gray to de-emphasize their significance. It is based on the WMI SNMP Provider, which can run only on the Windows platform. Chapter 6. Creating an SNMP Resource Model for Windows 203
  • 227. Windows, ITM Engine Logical Components Analyzer Resource Resource Resource Resource Resource Resource Resource Model Model Model Model Model Model Model TMWService WMI APIs WMI (CIMOM) DM Classic Monitor Probes COM Objects ILT Manager for Java (WMI Provider DLL) Custom Scripts WMI Provider DLLs Java Virtual Machine (JVM) Launch (Class Loader) ILT ILT JMX ILT MBean Providers JNI Server Binary Resource Resource Resource Resource Resource MBean1 Library Resources (OS & Applications) Figure 6-2 ITM Engine logical components6.1.3 Detailed design Resource Model Before you create a Resource Model, we recommend that you have a clear idea of your design. For example, let us describe the detailed design of the ITSO_SNMP_Interface_Bps Resource Model. External design First, we define the threshold as external inputs of the Resource Model as shown in Table 6-1. You can change values of the threshold when distributing your profile. Table 6-1 The indication Indications Default Thr_ifOutOctets_in Increased by 100000 Thr_ifInOctets_in Increased by 100000204 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 228. Internal design To create the Resource Model smoothly, we recommend that you make a list of elements of your Resource Model, as shown in Table 6-2. Table 6-2 List of elements Elements Contents Internal Name ITSO_SNMP_Interface_Bps Descriptive Name ITSO_SNMP_Interface_Bps Monitor Category Internal Name ITSO_RMs Category Descriptive Name ITSO Resource Models Dynamic Model SNMP_RFC1213_MIB_ifTable Events Ev_SNMP_RFC1213_MIB_ifTable_ifOut Octets_grows_too_much Ev_SNMP_RFC1213_MIB_ifTable_ifInO ctets_grows_too_much Thresholds Thr_ifOutOctets_in Thr_ifInOctets_in Parameters none Logging none Dependency none6.2 Creating the Resource Model This section describes how to create the ITSO_SNMP_Interface_Bps Resource Model by using the following procedures: 1. Installing SNMP and WMI SNMP on the managed machine 2. Creating a new SNMP Resource Model 3. Testing the Resource Model6.2.1 Installing SNMP and WMI SNMP on the managed machine Usually, Windows servers do not have the SNMP service and WMI SNMP Provider installed. We installed these components with the following steps. Chapter 6. Creating an SNMP Resource Model for Windows 205
  • 229. Installing the SNMP Service First, install the SNMP Service. 1. Install the SNMP Service by right-clicking the My Network Places icon and then selecting Properties. 2. In the Network and Dial-up Connections window, select Advanced Settings… → Optional Networking Components in the top menu, as shown in Figure 6-3. Figure 6-3 Installing Optional Networking Components 3. In the Windows Optional Network Components Wizard window, select Management and Monitoring Tools and click on Details…. 4. Select Simple Network Management Protocol in the Management and Monitoring Tools window, as illustrated in Figure 6-4 on page 207, and click OK.206 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 230. Figure 6-4 Installing the SNMP Service5. Click Next in the Windows Optional Network Components Wizard window and, when asked for additional files, locate them under SNMP_Source_Files_From_CD directory on your Windows 2000 licensed media.6. Close the Network and Dial-up Connections windowConfiguring the SNMP agentAfter installing the SNMP Service, you need to edit the SNMP configuration touse it with WMI.7. Select Start → Settings → Control Panel → Administrative Tools → Services.8. Locate the SNMP Service service.9. Right-click on SNMP Service and select Properties.10.In the SNMP Service Properties (Local Computer) window, click on the Traps tab. Chapter 6. Creating an SNMP Resource Model for Windows 207
  • 231. 11.Add public as a community name by typing the word public into the Community name field and click Add to list. 12.Click Add... and enter the machines IP address into the Host name, IP or IPX address: field and click Add. When you are done with adding the IP address, your configuration should be similar to Figure 6-5, but with your IP address in the Trap destinations field. Figure 6-5 Enabling SNMP Services 13.Click OK to continue in the SNMP Service Properties (Local Computer) window. 14.Close the Services window and the Administrative Tools. Installing WMI SNMP This step is only required on the machine that will run the IBM Tivoli Monitoring engine and the Resource Model and on the machine that will run the Workbench. For your reference, here are some instructions on how to activate the Provider for Windows XP and Windows NT. Remember, SNMP Providers cannot be installed on or run on Windows 9x platforms.208 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 232. Windows XP a. Use the following instructions to install the SNMP Provider: b. From the Control Panel, select Add/Remove Programs. c. Select Add/Remove Windows Components and then, in the Windows Components Wizard, select Management and Monitoring Tools. d. Select Simple Network Management Protocol and WMI SNMP Provider and then click OK. e. Follow the steps in the wizard to complete the installation. Windows NT version 4.0: Install the SNMP Provider when installing the WMI core or from the Internet (use http://www.microsoft.com/downloads). Windows 2000 For Windows 2000 machines, you need to follow these steps. a. Expand wbemsnmp.ex_ from the Windows 2000 CD by using a command prompt, as shown in Example 6-1. If you execute the expand command successfully, you will see the results shown in Example 6-1.Example 6-1 Expanding the wbemsnmp.exe commandC:temp>expand "Your_CDROM_Drive:I386WBEMSNMP.EX_" wbemsnmp.exeMicrosoft (R) File Expansion Utility Version 5.00.2134.1Copyright (C) Microsoft Corp 1990-1999. All rights reserved.Expanding Your_CDROM_Drive:I386WBEMSNMP.EX_ to wbemsnmp.exe.Your_CDROM_Drive:I386WBEMSNMP.EX_: 817605 bytes expanded to 861490 bytes, 5% increase. b. Run wbemsnmp.exe by double-clicking the extracted file. This will display the WMI SNMP Provider Installation Wizard, as shown in Figure 6-6 on page 210. Chapter 6. Creating an SNMP Resource Model for Windows 209
  • 233. Figure 6-6 Installing the WMI SNMP Provider c. Click Next to install the WMI SNMP Provider. d. Click Finish to complete and close the installation of the WMI SNMP Provider. e. Next, load SNMP MIB classes into the WMI Provider. As a Provider, the WMI SNMP Provider acts as a bridge between SNMP data and WMI classes. Therefore, you must have classes in WMI that represent different aspects of an SNMP-enabled device. To do so, you must use the SNMP information module compiler (smi2smir) to compile SNMP management information from the SNMP format into the equivalent CIM schema definitions. You can then direct the output of the information compiler into an SNMP schema database called the SNMP Module Information Repository (SMIR) or to several different kinds of MOF files. The compiler runs in command-line mode, using one MIB file as input. The following command loads a specified MIB file into the SMIR: smi2smir /a <MIB file> f. Load the mib_ii.mib file into the SMIR, which is located in the Your_System_Drive:winntsystem32 directory by executing the following command from a MS-DOS command prompt, as shown in Example 6-2.210 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 234. Example 6-2 Loading the mib_ii.mib file into the SMIR C:WINNTsystem32>c:winntsystem32wbemsnmpsmi2smir /a c:winntsystem32mib_ii.mib smi2smir : Version 1.50.1085.0000 : MIB definitions compiled from "mib_ii.mib" smi2smir : Syntax Check successful on "mib_ii.mib" smi2smir : Semantic Check successful on "mib_ii.mib" smi2smir : Loaded "mib_ii.mib" successfully into the SMIR Note: You can obtain a list of MIBs that ship with the Windows 2000 implementation of SNMP by referring to the Microsoft TechNet at: http://www.microsoft.com/technet/default.asp6.2.2 Creating the new SNMP Resource Model During this section we will create a new Resource Model which will consume data from the new Provider and the new CIM Name space. Creating a new Resource Model 1. Open the IBM Tivoli Monitoring WorkBench by clicking Start → Programs → IBM Tivoli Monitoring 5.1.1 → WorkBench → WorkBench. 2. Initialize the Resource Model Wizard by pressing Ctrl-N, or by selecting File → New from the menu bar. 3. In the New window, select VBA Resource Model, because the WMI SNMP Provider we are working with is only applicable to Microsoft Servers. Click on OK in this window. 4. In the New Resource Model Workspace window, select the default selection (Resource Model Wizard) and click on OK. 5. In the Resource Model Wizard: Select Data Source Type window, select the default CIM/WMI option by clicking on Next>. 6. In the Connect to Name Space: window, click the lock icon in the left side of the window, as shown in Figure 6-7 on page 211. Figure 6-7 Connect to namespace Chapter 6. Creating an SNMP Resource Model for Windows 211
  • 235. 7. In the Browse for NameSpace window, ensure that you connect to the root namespace by ensuring that the Starting Namespace: field has the word root in it. Figure 6-8 shows you a similar window. Validate that your machine name is displayed in the Machine Name: field. When you are done validating both fields, click Connect. Figure 6-8 Browse for Namespace 8. In the WMI Tivoli DM WorkBench Login window, select OK to authenticate the current credential set (make sure you are logged on as Administrator or an equivalent user ID). Select OK. 9. As shown in Figure 6-9 on page 213, expand the root namespace by clicking + (plus sign) next to root. Expand the snmp namespace by clicking + next to snmp. Select localhost by clicking on it, and then click OK.212 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 236. Figure 6-9 Browse for Namespace to localhost10.Click OK in the Browse For Namespace window. Click OK in the WMI Tivoli DM WorkBench Login window.11.This will open the localhost snmp namespace on your machine. You will now see the window Resource Model Wizard: Select a class on your machine. Select the SNMP_RFC1213_MIB_ifTable class by doing the following steps: a. Expand the SnmpMacro class by clicking +. b. Expand the SnmpObjectType class by clicking +. c. Click on SNMP_RFC1213_MIB_ifTable. Validate that you see classes similar to the ones in Figure 6-10 on page 214. Chapter 6. Creating an SNMP Resource Model for Windows 213
  • 237. Figure 6-10 Selecting a class d. Once you validate your input, click Next. 12.In the Resource Model Wizard: Select Properties window, select the following properties by selecting the property and then clicking on the -> button. The properties that you need to select are: – ifDescr – ifIndex – ifSpeed – ifInOctets – ifOutOctets You should see a window similar to Figure 6-11 on page 215.214 IBM Tivoli Monitoring: Creating Resource Models and Providers
  • 238. Figure 6-11 Selecting properties13.When done, click the Collection Test button in the Resource Model Wizard: Select Properties window. Validate that you see results similar to Figure 6-12 on page 216. Chapter 6. Creating an SNMP Resource Model for Windows 215
  • 239. Figure 6-12 Collection test 14.Click Close in the Collected Instances window, and click Next in the Resource Model Wizard: Select Properties window. 15.The next wind