Support Center Home


StackStorm Integration

Integrating LogicMonitor with StackStorm allows you to monitor alerts and send them to StackStorm. If the triggered alert matches a Rule in StackStorm, the Rule triggers an Action or Workflow. The action or workflow can be configured to send requests back to LogicMonitor or to run a custom script on the device where StackStorm is installed. For example, if you receive an alert that a resource’s memory is low, you could configure StackStorm to automatically run a script and delete the cache of the impacted resource.

Integrating LogicMonitor with StackStorm involves installing the LogicMonitor Pack from the StackStorm Exchange and then configuring the StackStorm Integration in LogicMonitor. Before you can configure the StackStorm Integration, you must create a StackStorm API Key that is used for authentication.

See https://stackstorm.com for more information about StackStorm.

Requirements

To integrate LogicMonitor with StackStorm, you must install StackStorm on a device with one of the following:

  • RedHat
  • CentOS
  • Ubuntu

For instructions on installing StackStorm, see the following documentation from StackStorm:
Installation

You must configure the network of the device on which StackStorm is installed so that network traffic can reach port 5000.

Installing the LogicMonitor Pack

  1. Log in to StackStorm.
  2. Download and install the LogicMonitor Pack from the StackStorm Exchange using the following command:
st2 pack install logicmonitor

Note: You can access the LogicMonitor Pack from the StackStorm Exchange.

  1. Copy the /opt/stackstorm/packs/logicmonitor/logicmonitor.yaml.example file to the following directory:
  2. /opt/stackstorm/configs/
  1. Rename the /opt/stackstorm/configs/logicmonitor.yaml.example file to logicmonitor.yaml and populate the file with the following appropriate values:
    • Company name of LogicMonitor portal
    • LogicMonitor API Access ID
    • LogicMonitor API Access Key

Recommendation: The LogicMonitor API Access Key is a secret value and should be stored as a dynamic configuration value. See the following documentation from StackStorm for more information about appropriate values and how to store secret values securely: Dynamic Configuration Value

  1. Register the pack using the following command:
st2 pack register logicmonitor

Note: If you make additional changes to the LogicMonitor Pack, you must re-register the pack using the provided command.

Creating a StackStorm API Key for Authentication

  1. Open Terminal on the device that has StackStorm installed.
  2. Execute the following command:
st2 apikey create -k -m '{"used_by": "my integration"}'

This key is used to configure the StackStorm Integration in your LogicMonitor portal.

Configuring the StackStorm Integration

  1. In LogicMonitor, navigate to Settings > Integrations and click Add.
  2. From the Start New Integration pane, click StackStorm.
  3. Enter a name and description for the StackStorm integration.
  4. Add the URL for your StackStorm environment.
  5. Add the StackStorm API key you previously created.
  6. Configure the Alert Data field as needed. See Tokens Available in LogicModule Alert Messages for a list of possible tokens.

Note: Do not remove or modify the “apiKey” property.

  1. Click Save.

Example Use Case: Custom Action Responding to Disk Space Usage

The following example discusses how the StackStorm integration can be used to automate actions to respond to disk space usage in your environment. This example discusses how to set up a Rule to execute an Action in StackStorm and then how to configure a LogicMontor alert for the StackStorm Rule.

If disk space usage meets the specified threshold in your alert in LogicMonitor, the Rule you configure in StackStorm triggers the associated action to respond to the disk space usage.

Note: This example requires that a LogicMonitor Collector is installed on the device where StackStorm is installed.

StackStorm Rule and Action Setup

After StackStorm is installed on a device, you can establish a Rule in StackStorm that filters for the percentUsed alert. You can specify that the Rule executes an Action to run a customized script. For more information about creating Rules and how to execute Actions based on Rules, see the following documentation from StackStorm:
Rules

Note: The percentUsed alert is configured in your LogicMonitor portal.

LogicMonitor Alert Configuration for StackStorm Rule

You can route alerts from LogicMonitor to StackStorm. This involves configuring a DataSource in your LogicMonitor portal and setting up the percentUsed alert. This enables the Rule you created in StackStorm to execute its associated Action.

Setting up the percentUsed alert involves importing the SNMP_Filesystem_Usage DataSource from LogicMonitor Exchange. This DataSource contains the percentUsed DataPoint.

Keep in mind the following when creating this DataSource:

  • The DataSource must be applied to the Collector or device on which StackStorm is installed.
  • The Alert threshold for the percentUsed DataPoint impacts the rule setup.

See Creating a DataSource.

Note: This example requires you to append the following to the snmp.conf file located on the device with the Collector installed:
extend diskstats /bin/cat /proc/diskstats
This enables LogicMonitor to gather the disk-space usage data from the device.

Routing an alert to StackStorm requires setting up an Escalation Chain with your StackStorm integration as the recipient in your LogicMonitor portal. This enables you to add an Alert Rule with this Escalation Chain, which routes the percentUsed DataPoint to StackStorm. See Escalation Chains and Alert Rules.

StackStorm Alert Response

LogicMonitor triggers an alert when the total disk space on the device on which StackStorm is installed reaches the alert threshold you configured in your LogicMonitor portal. This alert is routed to StackStorm, and StackStorm triggers an Action to respond to the alert based on the Rule you configured in StackStorm.

You can observe StackStorm receiving and responding to the alert, and then measure the disk space on the device before and after the Action executes.

In This Article