Sun N1 System Manager 1.3 Discovery and Administration Guide

Setting Up Event Notifications

The N1 System Manager provides the ability to set up email or SNMP event notifications when events occur, either within the N1 System Manager itself or when specific events occur on managed servers. You can set up customized event notification rules for as many different scenarios as you need. Setting up default notifications for events can be done using the n1smconfig utility at install time. See Configuring the N1 System Manager in Sun N1 System Manager 1.3 Installation and Configuration Guide for more information about installing and configuring the N1 System Manager.

You can create additional event notifications at the command line. Use the create notification command to create event notification rules based on events that occur or that might occur, about which you are interested. Subscribe to a topic to create an event notification. For example, to receive notifications for discrete sensor events, subscribe to the Ereport.Physical.ThresholdExceeded topic. This topic covers events for both discrete sensors and bi-state sensors. For a list of topics, and to see the mapping of event categories to actual events, see create notification in Sun N1 System Manager 1.3 Command Line Reference Manual.

For setting up event notifications using SNMP traps, use the SNMP MIB located at /opt/sun/n1gc/etc/SUN-N1SM-TRAP-MIB.mib. For more information about SNMP MIBs, see Monitoring MIBs.

A notification rule can be used to send a notification of each type of event to a selected destination, using either email or SNMP as the communication medium. For example, you can create a notification rule so that each time a new managed server is discovered by the management server, you receive a message on your pager to indicate that the event has happened:


create notification notification destination destination topic topic 
type type [description description]

See create notification in Sun N1 System Manager 1.3 Command Line Reference Manual for more details of the terms used in this command syntax.

Viewing and Modifying Event Notifications

Use the show notification and set notification commands to view and modify event notification details. Type help show notification or help set notification at the N1–ok command line for syntax and parameter details.

ProcedureTo View Event Notifications

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

  2. Type the following command:


    N1-ok> show notification all
    

    The event notifications for which you have read privileges appear in the output. See show notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details.

ProcedureTo View Event Notification Details

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

  2. Type the following command:


    N1-ok> show notification notification
    

    The specified event notification details appear in the output. See show notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details.


Example 6–19 Viewing Event Notification Details

This example shows how to use the show notification command to display the details about a notification.


N1-ok> show notification notif33
Name:          notif33
Event Topic:   EReport.Physical.ThresholdExceeded
Notifier Type: Email
Destination:   nobody@sun.com
State:         enabled

ProcedureTo Modify an Event Notification

This procedure describes how to change the name, description, or destination of an event notification.

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

  2. Type the following command:


    N1-ok> set notification notification name name description description
     destination destination
    

    The specified event notification attributes are set to the new values specified. See set notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details.


Example 6–20 Modifying an Event Notification Name

This example shows how to use the set notification command with the name option to change a notification name from notif22 to notif23.


N1-ok> set notification notif22 name notif23

Creating, Testing, and Deleting Event Notifications

Use the create notification or delete notification commands to create and delete event notifications.

Use the start notification command with the test keyword to test an even notification.

Type help create notification or help delete notification at the N1–ok command line for syntax and parameter details.

ProcedureTo Create and Test an Event Notification

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

  2. Type the following command:


    N1-ok> create notification notification topic topic
    type type destination destination
    

    The event notification is created and enabled. See create notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details and valid topics.

  3. Type the following command:


    N1-ok> start notification notification test
    

    A test notification message is sent. See start notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details.

    You can also create a notification that is triggered by a script. See To Create a Notification That is Triggered by a Script for details.


Example 6–21 Creating an Email Notification for Server Groups Being Created

This example shows how to create an event notification to be sent by email if a server group is created. Note that an SMTP email server must first be configured using the n1smconfig utility as described in Configuring the N1 System Manager in Sun N1 System Manager 1.3 Installation and Configuration Guide.

The event notification is called notif2. The recipient's email address is nobody@sun.com


N1-ok> create notification notif2 destination nobody@sun.com
Lifecycle.Logical.CreateGroup type email

The show notification command can be used to verify that the event notification has been created.


N1-ok> show notification
Name    Event Topic                         Destination       State
notif2  Lifecycle.Logical.CreateGroup       nobody@sun.com    enabled 

The event can be invoked by creating a false group, as a test.


N1-ok> create group test

An email should be sent if the notification was created successfully. Otherwise, the following error message is displayed:


Notification test failed.

Verify if the SMTP server is configured correctly and is reachable, and if the email address used in the notification rule is valid.



Example 6–22 Creating an SNMP Notification for Hardware Health Thresholds Being Exceeded

This example shows how to create an event notification to be sent by SNMP if a hardware health threshold is exceeded. The event notification is called notif3. The recipient SNMP address is sun.com


N1-ok> create notification notif3 destination sun.com
topic EReport.Physical.ThresholdExceeded type snmp

The topic, which is the type of event to trigger the notification, is Ereport.Physical.ThresholdExceeded

The show notification command can be used to verify that the event notification has been created.


N1-ok> show notification
Name    Event Topic                         Destination  State
notif3  EReport.Physical.ThresholdExceeded  sun.com      enabled

You can specify the event notification you want to see by using show notification command with the notification attribute value.


N1-ok> show notification notif3
Name    Event Topic                         Destination  State
notif3  EReport.Physical.ThresholdExceeded  sun.com      enabled


Example 6–23 Creating an Email Notification for Hardware State Changes

This example shows how to create an event notification to be sent by email if a server's hardware state changes. Hardware state changes include power state changes, such as a power supply failure. Note that an SMTP email server must first be configured using the n1smconfig utility as described in Configuring the N1 System Manager in Sun N1 System Manager 1.3 Installation and Configuration Guide.

The event notification is called notif44. The recipient's email address is nobody@sun.com


N1-ok> create notification notif44 destination nobody@sun.com
EReport.Physical.ThresholdExceeded type email

The show notification command can be used to verify that the event notification has been created.


N1-ok> show notification
Name    Event Topic                         Destination       State
notif44 EReport.Physical.ThresholdExceeded  nobody@sun.com    enabled 

Verify if the SMTP server is configured correctly and is reachable, and if the email address used in the notification rule is valid.


ProcedureTo Create a Notification That is Triggered by a Script

You can create a notification rule for an event that triggers the execution of a Borne shell script on the management server. The Borne shell script must be executable by the root user.

The script should be written to direct its output (stdout/stderr) to a log file.

The fields of the event are passed into the script as environment variables:

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

  2. Type the following command:


    N1-ok> create notification notification destination destination topic topic
    type script
    

    The event notification is created and enabled. The destination must be a fully qualified path to a custom Bourne shell script used to manage the notification. The script must be executable by the root user. See create notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details and valid topics.

    If the script is executed as a result of an event triggered internally by the N1 System Manager, the script is executed as root.

    If the script is executed as a result of an event triggered by a user, the script is executed by the user that triggered the event.

  3. Type the following command:


    N1-ok> start notification notification test
    

    A test notification message is sent. See start notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details.

ProcedureTo Delete an Event Notification

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

  2. Type the following command:


    N1-ok> delete notification notification
    

    The event notification is deleted.

Starting and Stopping Event Notifications

Event notifications are enabled, or started, by default at creation. Use the start notification command to enable an event notification that has been disabled. Type help start notification at the N1–ok command line for syntax and parameter details.

ProcedureTo Start an Event Notification

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

  2. Type the following command:


    N1-ok> start notification notification
    

    The event notification is enabled. See start notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details.

ProcedureTo Stop an Event Notification

Steps
  1. Log in to the N1 System Manager.

    See To Access the N1 System Manager Command Line for details.

  2. Type the following command:


    N1-ok> stop notification notification
    

    The event notification is disabled. See stop notification in Sun N1 System Manager 1.3 Command Line Reference Manual for details.