Designing and Managing Behavior Models - Defining Property Groups and Properties - Using the Node List Window - Using the AssignPropertyGroup() Function -
Previous: Using the Node List Window     Next: Using the Set Attribute Alarm Action

Using the AssignPropertyGroup() Function

In addition to being able to assign property groups to nodes manually using the NerveCenter user interface, you can use the AssignPropertyGroup() function in a behavior model to change a node's property group dynamically. This function can appear in a poll condition, a trap mask trigger function, or a Perl subroutine.

The syntax for this function is shown below:


   AssignPropertyGroup("PropertyGroupName")

The property group whose name is passed to the function must already exist.

For further information about how to use this function in a poll condition, a trigger function, or a Perl subroutine -- and for information on when it's appropriate to use the function in each of these contexts -- see the sections listed below:

In a Poll Condition

Suppose you want to change the property group assignment for all of your Cisco routers in Building 6. You can collect the names or IP addresses of all these nodes and change their property groups manually using the NerveCenter user interface. However, this can be an error prone process. All you have is your list of routers to make sure that you assign the new property group to exactly the right set of nodes. Alternatively, you can create a poll that will detect whether a polled node is a Cisco router located in Building 6 and will assign the new property group only to nodes that meet these criteria.

 
  To define a poll condition that changes the property group of each Cisco router in Building 6, you would:

  1. Display the Poll Condition page in the Poll Definition window.

    Poll Condition Page

    pollCondition.gif

    Click the thumbnail above to view full-sized image.

  2. Create the condition that determines whether you want to call AssignPropertyGroup():
       if ((system.sysLocation eq "Building 6") &&
    (system.sysObjectID == 1.3.6.1.4.1.9.1))
  3. Add a block including a call to AssignPropertyGroup() to the preceding condition:
       if ((system.sysLocation eq "Building 6") &&
    (system.sysObjectID == 1.3.6.1.4.1.9.1)) {
    AssignPropertyGroup("Cisco6");
    }

    This example assumes that the new property group is named Cisco6.

  4. Select the Save button to save your poll.

Remember that before NerveCenter will use this poll, there must be an enabled alarm in which the poll can cause a state transition.

In a Trigger Function

Here's a simple example of when you might use the AssignPropertyGroup() function in a trap mask trigger function. Suppose that you want to use NerveCenter's Authentication behavior model to monitor your network for excessive SNMP authentication failures. This model includes a trap mask and two polls and looks for three authentication failures on a single node within a ten minute period.

You could enable the behavior model by assigning to the nodes you want to monitor a property group that contains the property snmp and turning on the Authentication alarm. But let's say that you don't want to monitor nodes that have never experienced an authentication failure, because the model does involve some polling. To monitor only nodes whose agents have sent authentication failure traps, you can initially assign your nodes a property group that doesn't contain the property snmp. You can then define a trap mask that looks for authentication failure traps and changes the property group of the nodes from which it receives these traps. Let's assume that the new property group is called Mib-II and contains the property snmp.

 
  To define a trap mask that changes the property group of each node that issues an authentication failure trap, you would:

  1. Create a trap mask that looks for a generic trap 4.
  2. Indicate that the trap mask will use a trigger function instead of a simple trigger.
  3. Display the Trigger Function page in the Mask Definition window.

    Trigger Function Page

    triggerFunction.gif

  4. Type in your call to AssignPropertyGroup():
       AssignPropertyGroup("Mib-II");

    You can make this property-group assignment conditional, based on the value of a variable binding if you need to. In the present case, such a condition isn't necessary.

  5. Also type in a call to FireTrigger();
       FireTrigger("TrigggerName");

    Remember that before NerveCenter will use this mask, there must be an enabled alarm in which the mask can cause a state transition.

  6. Save your trap mask.

In a Perl Subroutine

Another place from which you can call the AssignPropertyGroup() function is a Perl Subroutine alarm-transition action. This is the appropriate context for using this function if you want to perform your property-group assignment conditionally, based on information that is available from with a Perl subroutine, but not elsewhere. For example, a Perl subroutine associated with an alarm transition has access to the name of the property group of the node that triggered the transition. You could use this information to change a node's property group only if:

For a complete list of the information that is available to a Perl subroutine, see the section NerveCenter Variables.

 
  The procedure below explains how to add to an alarm transition a Perl Subroutine action that assigns the property group Gateway to the node associated with the trigger that caused the transition. The property group is assigned only if the node's current property group is Mib-II.

  1. Use the Perl Subroutine Definition window to create your Perl subroutine.

    The subroutine should look something like this:


       if ($NodePropertyGrp eq "Mib-II") {
    AssignPropertyGroup("Gateway");
    }
  2. In the Alarm Definition window, open the Transition Definition dialog by double-clicking on the transition to which you want to add the Perl Subroutine action.

    Transition Definition Dialog

    transitionDefinition.gif

  3. Select the New Action button.

    NerveCenter displays the new-action popup menu.

  4. Select the Perl Subroutine action.

    NerveCenter displays the Perl Subroutine Action dialog box.

    Perl Subroutine Action Dialog Box

    perlSubAction.gif

  5. Select the name of the subroutine you created in step 1 from the Name list box.
  6. Select the OK button in the Perl Subroutine Action dialog.

    The dialog is dismissed, and the newly defined action appears in the Actions list in the Transition Definition dialog.

  7. Select the OK button in the Transition Definition dialog.
  8. Select the Save button in the Alarm Definition window.


Previous: Using the Node List Window Next: Using the Set Attribute Alarm Action
Please send comments or corrections to Information Development
This file was last updated on 10 October 2000