Sign in to my dashboard Create an account
Menu

ONTAP REST APIs: Automate Notification of High-Severity Events

Mahalakshmi G
Mahalakshmi G
559 views

A priority for IT organizations is the ability to manage various levels of severity. “Severity” differs for every organization, depending on the use case. An event can be of high severity — for example, an emergency, alert, or error message — or it could be of low severity, as with  a notice or informational message. Most customers want the flexibility to choose and automate which events and severity they should get notified for. ONTAP® REST APIs simplifies the event management with modernized and consolidate direct REST endpoints and Python Client Libraries, which enables users to get notified of preferred events automatically.

Events

NetApp® ONTAP® software has various types of messages for all the storage actions and operations it performs (for example, callhome.vol.space.crit, sm.syncmirror.out.of.sync). There are also predefined filters (for example, default-trap-events, important-events) that can alert you about severe events. You can also customize your own filters that uses the predefined messages and severity levels available in ONTAP. Before proceeding further, let’s clarify some of this terminology:
  • Filters are defined to select which events to process.
  • Destinations define where you want  the events to be sent.
  • Notifications tie a filter to a destination.
Learn how to automate notification of high-severity events with ONTAP REST APIs Figure 1:  Configure Events using CLI and ONTAP REST APIs

Here’s an example. If you want to set an email alert for any disk failure, you would perform these steps:
  • Step 1: Event configuration for email/SMTP destination
    • Configure details such as mail server, mail-from details.
  • Step 2: Creating a filter — name, message name, severity levels
    • Filter with <message-name> <disk.*>
  • Step 3: Specifying where to send any filter events
    • Create a destination with details such as name, filter, type, mail-id.


After completing these steps, you get notifications at the destination according to the filters applied.

By using the modernized, consolidated ONTAP REST calls, you can manage events in an easier, simpler way than before. For example, you can make a single POST call to create a filter with all rules applied, rather than executing separate commands in the CLI.

The following mapping shows how each command is simplified to a direct REST call.
ONTAP® CLI ONTAP® REST APIs
  • event config show
GET     /support/ems
  • event notification destination create
  • event notification create


POST   /support/ems/destinations
  • event log show
GET   /support/ems/events
  • event  filter  create  -filter-name  <<filtername>>
  • event  filter  rule add  -filter-name  <<filtername>>


POST   /support/ems/filters


Take a look at our sample script that covers three common event management use cases with REST APIs:
  • Viewing the event logs
  • Retrieving event management system messages with specific severity
  • Creating event configuration, a new filter, a new destination, and getting notified for your customized filter and destination. Please find below a code snippet for creation of destination using REST APIs.

Code Snippet

# Key Value arguments for destination creation dataobj = {} dataobj = {"destination": destination, "filters": [{"name": filter_name}], "name": destination_name, "type": dest_type} url = "https://{}/api/support/ems/destinations/".format(cluster)response = requests.post(url,headers=headers_inc,json=dataobj,verify=False)

To learn more: If you have questions about the ONTAP REST APIs, post them to the API channel on thePub (netapppub.slack.com), or visit the ONTAP REST API NetApp Knowledgebase page.

Mahalakshmi G

Mahalakshmi works as Technical Marketing Engineer for OnCommand System Manager. As she is part of Product Management, she loves solving real-world customer issues. She also has a deep passion for automation coding. Apart from work, Mahalakshmi is keen on music and enjoys traveling to new places.

View all Posts by Mahalakshmi G

Next Steps

Drift chat loading