Example StackStorm Integration Use Case: Custom Action Responding to Disk Space Usage

Last updated on 08 March, 2022

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 LogicMonitor 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 StackStorm’s Rules documentation.

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 the 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