Introduction to Snippet Dynamic Applications

Download this manual as a PDF file

This section describes how to define collection objects and snippet code for Snippet Dynamic Applications. This section does not cover elements of Dynamic Application development that are common to all Dynamic Application types.

You should be familiar with the common elements and concepts of Dynamic Applications before reading this section. Snippet code is written using the Python programming language. You must be familiar with the syntax, programming techniques, and data structures of the Python language before developing Snippet Dynamic Applications.

Use the following menu options to navigate the SL1 user interface:

  • To view a pop-out list of menu options, click the menu icon ().
  • To view a page containing all of the menu options, click the Advanced menu icon ().

What is a Snippet Dynamic Application?

A Snippet Dynamic Application is a Dynamic Application that performs collection by executing one or more discrete blocks of Python code, called Snippets. Snippets provide the logic for the collection and manipulation of data. SL1 passes credential and other configuration information to the snippet, and at the end of execution, the snippet must pass collected data back to SL1. The Dynamic Application developer defines snippet code that collects data and processes data. Snippet Dynamic Applications allow for data collection that cannot be implemented using other Dynamic Application types. For example, you could use a Snippet Dynamic Application if you need SL1 to collect data from a proprietary system that does not support the other types of Dynamic Applications or if you need SL1 to perform complex data manipulation before collected values are stored.

There are five types of Snippet Dynamic Applications:

  • Snippet Configuration. Snippet Configuration Dynamic Applications use custom-written Python code to collect configuration data from a device. If a Snippet Configuration Dynamic Application is aligned to multiple devices, the snippet code is executed separately for each device.
  • Snippet Journal. Snippet Journal Dynamic Applications use custom-written Python code to collect log data from a device.
  • Snippet Performance. Snippet Performance Dynamic Applications use custom-written Python code to collect performance data from a device. If a Snippet Performance Dynamic Application is aligned to multiple devices, the snippet code is executed separately for each device.
  • Bulk Snippet Configuration. Bulk Snippet Configuration Dynamic Applications use custom-written Python code to collect configuration data from multiple component devices. The configuration of a Bulk Snippet Configuration Dynamic Application specifies the maximum number of devices for which data can be collected during a single execution of the snippet code. If a Snippet Configuration Dynamic Application is aligned to multiple devices, SL1 will automatically calculate the number of times the snippet code must be executed (based on the maximum number of devices) and will automatically assign multiple devices to each execution.
  • Bulk Snippet Performance. Bulk Snippet Performance Dynamic Applications use custom-written Python code to collect performance data from multiple component devices. The configuration of a Bulk Snippet Performance Dynamic Application specifies the maximum number of devices for which data can be collected during a single execution of the snippet code. If a Snippet Performance Dynamic Application is aligned to multiple devices, SL1 will automatically calculate the number of times the snippet code must be executed (based on the maximum number of devices) and will automatically assign multiple devices to each execution.

Common Dynamic Application Elements

Snippet Dynamic Applications have the following elements in common with other Dynamic Application types:

  • Archetypes. Defines what type of data is being collected and how it will be displayed in SL1. Snippet Dynamic Applications can be any of the three archetypes: Performance, Configuration, and Journal.
  • Properties. Allows for version control, release notes, collection, and retention settings.
  • Collection Objects. Define the individual data points that will be retrieved by the Dynamic Application. These data points are called collection objects. Defines what type of data is being collected (gauge, counter, etc) and how it is grouped. Collection objects for Snippet Dynamic Applications have settings that are unique to Snippet Dynamic Applications. These settings are described in the Collection Objects section in the Performance and Configuration Snippets section.
  • Presentations. For Performance Dynamic Applications, defines how collected values will be displayed by SL1.
  • Thresholds. Can be used to define a default threshold value that can be included in alerts. The threshold appears in the Device Thresholds page for each device that is aligned with the Dynamic Application. The threshold can be edited in the Device Thresholds page for each device without affecting the behavior of the Dynamic Application for other devices.
  • Alerts. Evaluates collected data. If the collected data meets the conditions defined in the alert, the alert can insert a message into device logs and trigger events.
  • Credentials. Defines how authentication should occur for each Dynamic Application on each device. Snippet Dynamic Applications can use any credential type for authentication; however, the snippet code must be written to use the credential information passed to the snippet by SL1.
  • Caching. When SL1 requests information from a device during Dynamic Application collection, SL1 can optionally cache the response from the device. If a response is cached, other Dynamic Applications that use the same protocol can use the cached response to retrieve values for collection objects. Caching responses reduces the number of requests performed by SL1 and speeds up collection. For information about how to cache responses and consume cached responses in a Snippet Dynamic Application, see the Caching and Cache Consuming Snippets section.
  • Collector Affinity. SL1 enables you to specify which Data Collectors are allowed to collect data from a device for a Dynamic Application. This ensures that a group of collection jobs that cannot be split up among multiple Data Collectors—for instance, Dynamic Applications that produce and consume cache—will run on a single Data Collector.
  • Dynamic Component Mapping. Dynamic Component Mapping allows SL1 to use Dynamic Application data that has been collected from a single management system, such as a VMware ESX server, and to create multiple device records for the entities managed by that single management system. The settings for configuring Dynamic Component Mapping in a configuration or performance Snippet Dynamic Application are the same as the Dynamic Component Mapping settings for other Dynamic Application protocols. Journal Snippet Dynamic Applications cannot be configured to use Dynamic Component Mapping.
  • Relationships. Dynamic Applications can be configured to automatically create relationships between devices. For example, the Dynamic Applications in the VMware vSphere and NetApp PowerPacks are configured to create relationships between VMware Datastore component devices and their associated NetApp Volume component devices. Relationships created by Dynamic Applications are used and visualized by the platform in the same manner as relationships created by topology collection, Dynamic Component Mapping, and manually in the user interface. The settings that allow you to create relationships in a configuration Snippet Dynamic Application are the same as the relationship settings for other Dynamic Application protocols.

Execution Environments

One way in which Snippet Dynamic Applications are unique from most other types of Dynamic Applications is that they can be aligned with a specific execution environment.

In the SL1 user interface, an execution environment is a list of one or more ScienceLogic libraries. When a Dynamic Application snippet, Run Book Automation snippet, or credential test is executed, the execution environment defines a virtual Python environment that is deployed on-demand and includes all of the ScienceLogic libraries aligned with it for use during snippet execution.

When you create a Snippet Dynamic Application, you must select an execution environment to align with that Dynamic Application. All of the snippets contained in the Dynamic Application will then use that execution environment whenever the Dynamic Application runs. If you do not specify an execution environment, SL1 will align the Dynamic Application with the default System environment. For more information about selecting an execution environment for a Dynamic Application, see the section on Dynamic Application Settings.

You can create and manage execution environments on the Environment Manager page (System > Customize > ScienceLogic Libraries > Actions > Execution Environments). For more information about creating and managing execution environments, see the section on Managing Execution Environments.

Prerequisites

This section describes how to define collection objects and snippet code for Snippet Dynamic Applications. This section does not cover elements of Dynamic Application development that are common to all Dynamic Application types.

You should be familiar with the common elements and concepts of Dynamic Applications before reading this section. Snippet code is written using the Python programming language. You must be familiar with the syntax, programming techniques, and data structures of the Python language before developing Snippet Dynamic Applications.

About this Section

This section includes the following sections:

  • Performance & Configuration Snippets. Describes how to configure collection objects and how to create snippets in performance and configuration Snippet Dynamic Applications and bulk performance and bulk configuration Snippet Dynamic Applications.
  • Journal Snippets. Describes how to configure collection objects in journal Snippet Dynamic Applications; how to create Snippets in journal Snippet Dynamic Applications; and how to create presentation objects in journal Snippet Dynamic Applications.
  • Caching and Cache Consuming Snippets. Describes how to write a Snippet that caches results and how to write a Snippet that consumes cached results.
  • Excluded Modules and Platform Wrappers. Describes which python modules cannot be used in Snippets and includes information about specific functions that can be used in Snippets.

This section also includes walk-throughs of four example Snippet Dynamic Applications.