Customizing trap types

JViews TGO provides a concept of alarm based on RFC 1157 - A Simple Network Management Protocol (SNMP) called a trap. A trap represents something unusual that occurs in an object. Traps, like alarms, are represented graphically using the alarm balloon and alarm count decorations. For more information, refer to Trap states in the Business objects and data sources documentation.

How to create new trap types (using the API)

In the following example, a new trap named “Alert”, based on “RFC 2455 C Definitions of Managed Objects for APPN”, is created with the following properties:
  • A unique name, used to identify the trap type in the Trap alarm system.
  • A severity, used to define the priority of the new trap type in the Trap type enumeration.
The new trap type is positioned before the ColdStart type in the IltTrap.Type enumeration.
IltTrap.Type alertType = new IltTrap.Type("Alert", 
IltTrap.Type.ColdStart.getSeverity() / 2);

How to create new trap types (using CSS)

You can also create new trap types by using global CSS settings.
Settings {
   alarm: true;
}
Alarm{
   traps[0]: @+trap0;
}
Subobject#trap0 {
  class: 'ilog.tgo.model.IltTrap.Type';
  name: "Alert";
  severity: 230;
}

How to customize trap types

Traps, like alarms, are represented in the business objects using the following graphical cues:
  • A color associated with the object base.
  • An alarm count displayed on the object base.
  • A colored alarm balloon displaying another alarm count.
  • A colored outline displayed around the object base.
For information on how these graphical cues are used in JViews TGO, refer to Alarm states in the Business objects and data sources documentation.
When a new trap type is created, the properties used to customize the graphical cues need to be defined. These properties are:
  • A short description used by the alarm count.
  • An expanded description used in the alarm balloon when the CSS property alarmBalloonCollapsed is false.
  • A set of colors to be defined subsequently.
These properties are set as part of the JViews TGO look and feel, which can be customized using SetValue or global CSS settings.
The properties that affect the trap types are:
  • Trap.Type.<type name>.Color
  • Trap.Type.<type name>.BrightColor
  • Trap.Type.<type name>.DarkColor
  • Trap.Type.<type name>.Abbreviation
  • Trap.Type.<type name>.Description
  • Trap.Type.<type name>.Icon
For the trap type created in How to create new trap types (using the API), the following properties will have to be defined:
  • Trap.Type.Alert.Color
  • Trap.Type.Alert.BrightColor
  • Trap.Type.Alert.DarkColor
  • Trap.Type.Alert.Abbreviation
  • Trap.Type.Alert.Description
  • Trap.Type.Alert.Icon (This property is optional.)
The following example shows how to customize the new trap type using the API.
// Define the colors
Color myAlarmColor = new Color(127, 255, 212);
// aquamarine
Color myAlarmBrightColor = myAlarmColor.brighter();
Color myAlarmDarkColor = myAlarmColor.darker(); 

IltSettings.SetValue("Trap.Type.Alert.Color", myAlarmColor);
IltSettings.SetValue("Trap.Type.Alert.BrightColor", myAlarmBrightColor);
IltSettings.SetValue("Trap.Type.Alert.DarkColor", myAlarmDarkColor);
IltSettings.SetValue("Trap.Type.Alert.Abbreviation", "i");
IltSettings.SetValue("Trap.Type.Alert.Description", "Informational");
You can then retrieve these values using GetValue.
The following example shows how to customize the new trap type using global CSS settings. You must specify the full trap type name, for example " Trap.Type.Alert " when matching the " name " attribute. The CSS properties to be customized are color , darkColor , brightColor , abbreviation , description , icon ):
setting."ilog.tgo.model.IltTrap.Type"[name="Trap.Type.Alert"] {
  color: orange;
  darkColor: green;
  brightColor: yellow;
  abbreviation: "a";
  description: "Alert";
  icon: '@|image("icon1.png")';  
}

How to customize existing trap types

You can customize the representation of the existing trap types, for example, Trap.Type.LinkFailure or Trap.Type.ColdStart .
To do so, you use the same properties as listed in How to customize trap types:
  • Trap.Type.<type name>.Color
  • Trap.Type.<type name>.BrightColor
  • Trap.Type.<type name>.DarkColor
  • Trap.Type.<type name>.Abbreviation
  • Trap.Type.<type name>.Description
  • Trap.Type.<type name>.Icon (This property is optional.)
The following example shows how to customize the trap type Trap.Type.ColdStart using the API.
// Define the colors
Color myAlarmColor = Color.magenta;
Color myAlarmBrightColor = myAlarmColor.brighter();
Color myAlarmDarkColor = myAlarmColor.darker(); 

IltSettings.SetValue("Trap.Type.ColdStart.Color", myAlarmColor);
IltSettings.SetValue("Trap.Type.ColdStart.BrightColor", myAlarmBrightColor);
IltSettings.SetValue("Trap.Type.ColdStart.DarkColor", myAlarmDarkColor);
IltSettings.SetValue("Trap.Type.ColdStart.Abbreviation", "CH");
IltSettings.SetValue("Trap.Type.ColdStart.Description", "Critical High");
The following example shows how to customize the trap type Trap.Type.ColdStart using global CSS settings (you must specify the full trap type name, " Trap.Type.ColdStart ", when matching the " name " attribute. The CSS properties to be customized are color , darkColor , brightColor , abbreviation , description , icon ):
setting."ilog.tgo.model.IltTrap.Type"[name="Trap.Type.ColdStart"] {
  color: yellow;
  darkColor: blue;
  brightColor: green;
  abbreviation: CS;
  description: "ColdStart";
  icon: '@|image("icon1.png")';
}