-
-
Save NGURE-TIM/96d8d757ae579578ffd139401847bf1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WEBHOOK_URL="https://hooks.slack.com/services/XXXXXX/XXXXXX/XXXXXXX" | |
| IP=$1 | |
| MSG=$2 | |
| DATE=$3 | |
| TIME=$4 | |
| SEVERITY=$5 | |
| SERVICETAG=$6 | |
| RESOLUTION=$7 | |
| CATEGORY=$8 | |
| ASSETTAG=$9 | |
| MODEL=${10} | |
| SEVERITY_ICON=$(case "$SEVERITY" in | |
| Critical) echo ":x:";; | |
| Warning) echo ":warning:";; | |
| esac) | |
| PAYLOAD=`cat << EOS | |
| payload={ | |
| "channel": "#ome-test", | |
| "username": "Dell OpenManage Enterprise", | |
| "icon_emoji": ":dellome:", | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "You have a new alert:\n*<https://10.6.31.15/core/console/console.html#/core/diagnostics/log|$MSG>*" | |
| } | |
| }, | |
| { | |
| "type": "section", | |
| "fields": [ | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Device IP Address:*\n<https://$IP|$IP>" | |
| }, | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Time:*\n$DATE $TIME" | |
| }, | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Severity:*\n$SEVERITY_ICON $SEVERITY" | |
| }, | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Service tag:*\n$SERVICETAG" | |
| }, | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Recommended Resolution:*\n$RESOLUTION" | |
| }, | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Alert Category Name:*\n$CATEGORY" | |
| }, | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Asset tag:*\n$ASSETTAG" | |
| }, | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Model Name:*\n$MODEL" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| EOS` | |
| curl -X POST --data-urlencode "$PAYLOAD" $WEBHOOK_URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment