SlackAction

SlackAction

This action posts the status change to a Slack channel It uses Slack Webhooks. Also compatible with Mattermost, which is an open source alternative to Slack. To create a webhook URL refer the following :

Add the webhook URL to dirac.cfg at Operations/[]/ResourceStatus/Config/Slack

Example

Operations/
Defaults/
ResourceStatus/
Config/

Slack = https://hooks.slack.com/services/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 Mattermost = https://mattermost.web.cern.ch/hooks/axy94k3m1pg5xeyaw3qqb3x8bo

Even if using Mattermost,the URL is still to be placed at Operations/[]/ResourceStatus/Config/Slack and not Operations/[]/ResourceStatus/Config/Mattermost

class DIRAC.ResourceStatusSystem.PolicySystem.Actions.SlackAction.SlackAction(name, decisionParams, enforcementResult, singlePolicyResults, clients=None, url=None)

Bases: BaseAction

Action that sends a brief Slack Message.

__init__(name, decisionParams, enforcementResult, singlePolicyResults, clients=None, url=None)
run()

Checks it has the parameters it needs and tries to send an sms to the users that apply.

sendSlackMessage(message)

Sends a slack message to self.url

Parameters:

message (str) – text message to send