Designing and Managing Behavior Models
-
Using Polls - Writing a Poll Condition - Examples of Poll Conditions -
This section presents a number of sample poll conditions and explains how the poll conditions work.
if (system.sysLocation eq "Building 6" and
system.sysObjectID == 1.3.6.1.4.1.9.1) {
AssignPropertyGroup("Cisco6");
}
This poll condition checks to see whether a device is located in Building 6 and whether it is a Cisco product. If the device meets these conditions, it is assigned the property group Cisco6.
if (ifEntry.ifType present and
ifEntry.ifSpeed present and
ifEntry.ifInOctets present and
ifEntry.ifInUcastPkts present and
ifEntry.ifInNUcastPkts present and
ifEntry.ifInDiscards present and
ifEntry.ifInErrors present and
ifEntry.ifOutOctets present and
ifEntry.ifOutUcastPkts present and
ifEntry.ifOutNUcastPkts present and
ifEntry.ifOutDiscards present and
ifEntry.ifOutErrors present) {
FireTrigger("ifData");
}
This poll condition is true as long as the poll is able to read the values of these interface variables from an agent's MIB.
This type of poll condition is useful if you want to gather MIB data that you'll use later in generating a report. For example, if a poll fires an ifData trigger after this poll condition is evaluated, that trigger will contain a list of variable bindings that contains the name and value of each of these attributes. If that trigger causes an alarm transition that has associated with it a Log to File action, these names and values will be written to a log file. That log file can then be used as input to a reporting tool.
if ((delta(ifEntry.ifInErrors) + delta(ifEntry.ifInDiscards) +
delta(ifEntry.ifOutErrors) + delta(ifEntry.ifOutDiscards) - 0.05 *
(delta(ifEntry.ifInErrors) + delta(ifEntry.ifInDiscards) +
delta(ifEntry.ifOutErrors) + delta(ifEntry.ifOutDiscards) +
delta(ifEntry.ifInUcastPkts)+ delta(ifEntry.ifInNUcastPkts) +
delta(ifEntry.ifOutUcastPkts) + delta(ifEntry.ifOutNUcastPkts))
> 0) == 1) {
FireTrigger("highErrorRate");
}
This poll condition is true if the percentage of discarded packets on an interface is greater than five percent during a given polling interval. This is a good example of how to use the delta function.
if (ifEntry.ifType in (37)) {
FireTrigger("typeATM");
}
This poll condition evaluates to true if an interface's ifType attribute equals 37. In other words, the condition is true if the interface is an ATM interface. Obviously, this type of poll condition is useful for classifying interfaces.
if (((delta(ifEntry.ifInOctets) + delta(ifEntry.ifOutOctets) -
0.00125 * elapsed * ifEntry.ifSpeed > 0) &&
(ifEntry.ifType in (6,7,8,9,11,12,13,15,26,27))) == 1 or
((delta( ifEntry.ifInOctets ) + delta(ifEntry.ifOutOctets) -
0.09375 * elapsed * ifEntry.ifSpeed > 0) &&
!( ifEntry.ifType in (6,7,8,9,11,12,13,15,24,26,27))) == 1) {
FireTrigger("highLoad");
}
This poll condition uses the delta, elapsed, and in functions. It determines whether, during the last poll interval, the traffic on an interface on a broadcast network was greater than 1 percent or whether the traffic on an interface on a point-to-point network was greater than 75 percent.
Previous: Using the Pop-Up Menu for Perl | Next: Documenting a Poll |
Please send comments or corrections to Information Development | This file was last updated on 10 October 2000 |