Setting up disk usage threshold via Instana REST API

Disk used `fs.{name}.used` is a percentage exposed as decimal (0-1), and needs to be configured through the API (see below). `RULE_ID` must be provided as a unique rule name, and will be available to "custom issues", in order to create a custom issue that can be alerted on.



#!/usr/bin/env bash

set -eo pipefail

RULE_ID="myRule"

BASE_URL="https://{unit}-{tenant}.instana.io"

# needs the "Configuration of custom alerts" permission
API_TOKEN="tokenGoesHere"

FILESYSTEM_NAME="/dev/sda1"

curl -X PUT \
"$BASE_URL/api/rules/$RULE_ID" \
-H "Authorization: apiToken $API_TOKEN" \
-H "Content-Type: application/json" \
-v \
-d '{
"id": "'"$RULE_ID"'",
"name": "Rule for filesystem usage",
"entityType": "host",
"metricName": "fs.'"$FILESYSTEM_NAME"'.used",
"rollup": 1000,
"window": 60000,
"aggregation": "avg",
"conditionOperator": ">=",
"conditionValue": 10
}'


Have more questions? Submit a request

Comments