X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=blobdiff_plain;f=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fnotify_by_slack;fp=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fnotify_by_slack;h=0000000000000000000000000000000000000000;hp=1b16a0d2d8040a90eb315528164b5d712ec7ef95;hb=1a64deeb894dc95e2645a75771732c6cc53a79ad;hpb=fa25ffd4583cc362075cd5e1b4130f33306103f0 diff --git a/modules/private/monitoring/plugins/notify_by_slack b/modules/private/monitoring/plugins/notify_by_slack deleted file mode 100755 index 1b16a0d..0000000 --- a/modules/private/monitoring/plugins/notify_by_slack +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -SLACK_CHANNEL="$1" -SLACK_USERNAME="Naemon" -SLACK_URL="$2" -SLACK_USERICON="https://assets.immae.eu/monitoring.png" - -if [ "$SERVICESTATE" = "CRITICAL" ]; then - ICON=":exclamation:" - COLOR="#DA0505" -elif [ "$SERVICESTATE" = "WARNING" ]; then - ICON=":warning:" - COLOR="#F1E903" -elif [ "$SERVICESTATE" = "OK" ]; then - ICON=":white_check_mark:" - COLOR="#36a64f" -elif [ "$SERVICESTATE" = "UNKNOWN" ]; then - ICON=":question:" - COLOR="#000000" -else - ICON=":white_medium_square:" - COLOR="#ffffff" -fi - -payload=$(echo "{}" | jq -r \ - --arg "icon_url" "$SLACK_USERICON" \ - --arg "channel" "$SLACK_CHANNEL" \ - --arg "username" "$SLACK_USERNAME" \ - --arg "text" "${ICON} ${SERVICEDESC} on ${HOST} is ${SERVICESTATE}" \ - --arg "color" "$COLOR" \ - --arg "host" "$HOST" \ - --arg "desc" "$SERVICEDESC" \ - --arg "state" "$SERVICESTATE" \ - --arg "output" "$SERVICEOUTPUT" \ - '.icon_url = $icon_url | - .channel = $channel | - .username = $username | - .text = $text | - .attachments = [{fallback:"", color:$color,fields: [{},{},{},{}]}] | - .attachments[0].fields[0] = {title:"Host",value:$host,short:true} | - .attachments[0].fields[1] = {title:"Service description",value:$desc,short:true} | - .attachments[0].fields[2] = {title:"Status",value:$state,short:true} | - .attachments[0].fields[3] = {title:"Message",value:$output,short:false} - ') - -curl -X POST --data "payload=$payload" $SLACK_URL