Platform.sh User Documentation

Health notifications

Try for 30 days
Flexible, version-controlled infrastructure provisioning and development-to-production workflows
Activate your trial

Platform.sh can notify you when various events happen on your project, in any environment. At this time the only notification provided is a low disk space warning, but others may be added in the future.

To add or modify an integration for a project, you need to be a project admin.

Default low-disk email notifications Anchor to this heading

When you create a new project, Platform.sh creates a default low-disk email notification for all project admins.

Available notifications Anchor to this heading

Low-disk warning Anchor to this heading

Platform.sh monitors disk space usage on all applications and services in your cluster.

  • When available disk space drops below 20% or 4ย GB, whichever is smaller, a warning notification is generated.
  • When available disk space drops below 10% or 2ย GB, whichever is smaller, a critical notification is generated.
  • When available disk space returns above 20% or 4ย GB, whichever is smaller, an all-clear notification is generated.

Notifications are generated every 5 minutes, so there may be a brief delay between when the threshold is crossed and when the notification is triggered.

Configuring notifications Anchor to this heading

Health notifications can be set up via the Platform.sh CLI, through a number of different channels.

Email notifications Anchor to this heading

A notification can trigger an email to be sent, from an address of your choosing to one or more addresses of your choosing.

You can view an email notification by running platform integration:get.

platform integration:get
+--------------+---------------+
| Property     | Value         |
+--------------+---------------+
| id           | abcdefghijklm |
| type         | health.email  |
| role         |               |
| from_address |               |
| recipients   | - '#admins'   |
+--------------+---------------+

To edit the recipients that receive the default email notification, use the integration:update command.

platform integration:update abcdefghijklm --recipients you@example.com

The recipients field may be any valid email address, or one of the following special values.

  • #admins maps to all project admins and up.
  • #viewers maps to everyone with access to the project.

To add a new email notification, register a health.email integration as follows:

platform integration:add --type health.email --recipients them@example.com --recipients others@example.com

You must specify one or more recipients, each as its own switch.

The default from-address points to the “Platform.sh Bot”.

You can also configure a custom --from-address. The --from-address is whatever address you want the email to appear to be from. It is completely fine to use the same email address for both from-address and recipients. Note that depending on the configuration of the recipient mail server (including SPF and DKIM DNS entries) when using a custom from-address, the email can be marked as spam or lost.

Slack notifications Anchor to this heading

A notification can trigger a message to be posted to a Slack channel via a Slack app.

1. Optional: Create a Slack app Anchor to this heading

  1. Open the Slack API website and go to Your apps.
  2. Click Create an App.
  3. Choose if you want to build your app from scratch, or via an app manifest.
  4. Give your app a name.
  5. Select a workspace to install your app in.
  1. Click Create App.

2. Enable notifications Anchor to this heading

  1. Open the Slack API website and go to Your apps.

  2. Go to Features > OAuth & Permissions in the sidebar.

  3. Scroll down to the Scopes area and select User Token Scopes.

  4. Click Add an OAuth Scope to add the chat:write scope.

    Slack app scopes

  5. Go to Settings > Install app in the sidebar.

  1. Using the User OAuth Token, run the following command:

    platform integration:add --type health.slack --token USER_OAUTH_TOKEN --channel CHANNEL_NAME --project PROJECT_ID

    For example, if you want your Slack app to post messages in the project-notifications channel, write the channel name in the command as you would reference it within Slack:

    platform integration:add --type health.slack ... --channel '#project-notifications' ...
  2. When the integration is successfully configured, Platform.sh then sends an initial message to the channel.

PagerDuty notifications Anchor to this heading

A notification can trigger a message to be sent via PagerDuty, if you are using that service. First, create a new PagerDuty “integration” that uses the Events API v2. Copy the “Integration Key” as known as the “routing key” for the integration.

Now register a health.pagerduty integration as follows:

platform integration:add --type health.pagerduty --routing-key YOUR_ROUTING_KEY

Any notification will now trigger an alert in PagerDuty.

Validate the integration Anchor to this heading

You can then verify that your integration is functioning properly using the CLI command

platform integration:validate

Is this page helpful?