Skip to content

Commit

Permalink
Yriser 0.0.3 - Santa Fe
Browse files Browse the repository at this point in the history
  • Loading branch information
czantoine committed Sep 22, 2023
1 parent 90e7398 commit 96cd362
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 6 deletions.
Binary file modified docs/img/hight-level-architecture.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/tutorials/command.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ Only CLI Input without JSON.

> Do not disable output without CSV (command -u) for the JSON outputs
## Slack

Send report result to Slack

``` shell
./yriser.sh -w <webhook_token>
```

## AWS

### AWS - Display help documentation
Expand Down
Binary file added docs/tutorials/img/report-slack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion docs/tutorials/reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,12 @@ Multiple Tag:
"NUMBER": null
}
]
```
```

## Slack

Send a notification on Slack when the audit is complete.

![Send report result to Slack](img/report-slack.png)

See Slack [documentation to create a weebhook](https://api.slack.com/messaging/webhooks)
2 changes: 1 addition & 1 deletion file/logo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ __ __ _
\ \/ /____(_)_______ _____
\ / ___/ / ___/ _ \/ ___/
/ / / / (__ ) __/ /
/_/_/ /_/____/\___/_/ v0.0.2 - Lisa
/_/_/ /_/____/\___/_/ v0.0.3 - Santa Fe
An Open-Source FinOps Tool for Efficient Tag Management

67 changes: 66 additions & 1 deletion report_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -462,4 +462,69 @@ if [ "$cli_output_json" = "yes" ]; then
echo " - JSON: $(pwd)/output/json/$OUTPUT_FILE.json"
fi

rm -rf output/.txt 2> /dev/null
rm -rf output/.txt 2> /dev/null

# Slack message
if [ "$WEBHOOK_URL" != "" ]; then
MESSAGE='{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hi there 👋\n\n*Yriser*, FinOps tool to perform AWS tagging best practices, tagging strategy, continuous adjustments in cloud optimization 🛣️\n\n I have just finished the scan on your AWS Account *'"$ACCOUNT"'* ('"$REGION"') with a total *'"$TOTAL_RESOURCES"' ressources scanning*. "
},
"accessory": {
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/124205798?s=200&v=4",
"alt_text": "cute cat"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "🏷️ '"$TAG_CPT"' Total Tags\n✅ '"$NUMBER_OF_OK"' Correctly tagged ('"$TAG_CORRECT_PER"'%)\n📊 '"$NUMBER_OF_ERRORS"' Errors ('"$NUMBER_OF_ERRORS_PER"'%)\n🛑 '"$NUMBER_OF_ERRORS_CAL"' Ressources with other tags ('"$NUMBER_OF_ERRORS_CAL_PER"'%)\n❌ '"$number_RESOURCETAGMAPPINGLIST_without_tag"' Without tag ('"$number_RESOURCETAGMAPPINGLIST_without_tag_PER"'%)",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Used parameters `-'"$SOURCE_FILE"' -'"$OUTPUT_FILE"' -'"$OUTPUT_CSV"'`"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Version '"$VERSION"' | Join us"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Yris :slack:",
"emoji": true
},
"value": "click_me_123",
"url": "https://join.slack.com/t/yrisgroupe/shared_invite/zt-1q51z8dmv-GC0XzUSclzBnUQ0tpKhznw",
"action_id": "button-action"
}
}
]
}'

curl -X POST -H 'Content-type: application/json' --data "$MESSAGE" "$WEBHOOK_URL" &> /dev/null
echo ""
fi
17 changes: 14 additions & 3 deletions yriser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright: Apache License 2.0
# Yriser - https://github.com/yris-ops/yriser

export VERSION="0.0.2-Lisa-15August2023"
export VERSION="0.0.3-SantaFe-22September2023"
REGION_LIST="allregions"
show_banner=true
specific_aws_profile=true
Expand All @@ -26,7 +26,8 @@ Command line options:
-w, show config file
-o, only cli output whiout html
-u, only cli output whiout csv
-u, only cli output whiout json
-j, only cli output whiout json
-w, send report result to slack
Yriser Available Cloud Providers:
-a, show AWS Provider help
Expand Down Expand Up @@ -110,7 +111,13 @@ S3()
echo "Upload into the bucket: $AWS_S3_NAME, done"
}

while getopts "h/a/v/b/c/o/u/j/y/r:/p:/s:" option; do
# Send Slack message
Slack()
{
export WEBHOOK_URL="$WEBHOOK_URL"
}

while getopts "h/a/v/b/c/o/u/j/y/r:/p:/s:/w:" option; do
case $option in
h) # display help
echo "$COMMAND_LINE_OPTIONS_HELP"
Expand Down Expand Up @@ -147,6 +154,10 @@ while getopts "h/a/v/b/c/o/u/j/y/r:/p:/s:" option; do
AWS_S3_NAME+="$OPTARG"
s3_aws_profile=true
;;
w) # send report result to slack
WEBHOOK_URL+="$OPTARG"
Slack
;;
\?) # incorrect option
echo "Error: Invalid option"
exit;;
Expand Down

0 comments on commit 96cd362

Please sign in to comment.