Slack Notifier - S3 Image Upload

I’m currently struggeling with setting up the Slack notifier with S3 storage for images.
My config looks like this:
[external_image_storage.s3]
;bucket = grafana-stroage-scs
;region = us-east-2
;path =
;access_key = AAAAAAAAAAAA
;secret_key = AAAAAAAAAAAAAAAAAAAAAAAAAA

And the slack config see attach picture.

Logs:
t=2018-05-04T05:23:27+0000 lvl=info msg=“Executing slack notification” logger=alerting.notifier.slack ruleId=6 notification=“Mobile Lab Bot Radio”
t=2018-05-04T05:23:27+0000 lvl=info msg=“Executing slack notification” logger=alerting.notifier.slack ruleId=3 notification=“Mobile Lab Bot All Checks”
t=2018-05-04T05:23:27+0000 lvl=info msg=“Executing slack notification” logger=alerting.notifier.slack ruleId=6 notification=“Mobile Lab Bot All”
t=2018-05-04T05:23:27+0000 lvl=info msg=“Executing slack notification” logger=alerting.notifier.slack ruleId=6 notification=“Mobile Lab Bot All Checks”
t=2018-05-04T05:24:10+0000 lvl=info msg=“New state change” logger=alerting.resultHandler alertId=6 newState=ok prev state=alerting
t=2018-05-04T05:24:10+0000 lvl=info msg=Rendering logger=png-renderer path=“d-solo/qxpAAYMiz/checks?panelId=14”
t=2018-05-04T05:24:13+0000 lvl=info msg=uploaded logger=alerting.notifier url=

Do I miss something in the configuration?

Hi,

Please read grafana documentation about comments in ini files which you have in your config!

Marcus

i got a problem ,could you please help me .thanks a lot .How to import echarts javascript,occur not found instantiating

It’s still not sending the pictures config now looks like this:

[external_image_storage.s3]
bucket = grafana-stroage-scs
region = us-east-2
;path =
access_key = AAAAAAAAAAAA
secret_key = AAAAAAAAAAAAAAAAAAAAAAAAAA

Please don’t hijack topics like this.

Thanks

What does your Grafana server log say now when trying to generate image/upload it to s3? Turning on debugging in Grafana may help to get more information.

t=2018-05-04T12:52:40+0000 lvl=info msg=“New state change” logger=alerting.resultHandler alertId=5 newState=alerting prev state=ok
t=2018-05-04T12:52:40+0000 lvl=info msg=Rendering logger=png-renderer path=“d-solo/qxpAAYMiz/checks?panelId=13”
t=2018-05-04T12:52:41+0000 lvl=dbug msg="[phantom] Loading a web page: http://grafana.staged-by-discourse.com/d-solo/qxpAAYMiz/checks?panelId=13&render=1 status: success 30000" logger=png-renderer
t=2018-05-04T12:52:41+0000 lvl=dbug msg=“Image rendered” logger=png-renderer path=/var/lib/grafana/png/vmQGbcB36HgBRufB8S7m.png
t=2018-05-04T12:52:41+0000 lvl=info msg=uploaded logger=alerting.notifier url=
t=2018-05-04T12:52:41+0000 lvl=dbug msg=“Sending notification” logger=alerting.notifier type=slack id=3 isDefault=false
t=2018-05-04T12:52:41+0000 lvl=dbug msg=“Sending notification” logger=alerting.notifier type=slack id=4 isDefault=true
t=2018-05-04T12:52:41+0000 lvl=dbug msg=“Sending notification” logger=alerting.notifier type=slack id=1 isDefault=false
t=2018-05-04T12:52:41+0000 lvl=info msg=“Executing slack notification” logger=alerting.notifier.slack ruleId=5 notification=“Mobile Lab Bot Radio”
t=2018-05-04T12:52:41+0000 lvl=dbug msg=“Sending webhook” logger=notifications.webhook url=https://hooks.slack.com/services/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 http method=
t=2018-05-04T12:52:41+0000 lvl=info msg=“Executing slack notification” logger=alerting.notifier.slack ruleId=5 notification=“Mobile Lab Bot All Checks”
t=2018-05-04T12:52:41+0000 lvl=dbug msg=“Sending webhook” logger=notifications.webhook url=https://hooks.slack.com/services/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 http method=
t=2018-05-04T12:52:41+0000 lvl=info msg=“Executing slack notification” logger=alerting.notifier.slack ruleId=5 notification=“Mobile Lab Bot All”
t=2018-05-04T12:52:41+0000 lvl=dbug msg=“Sending webhook” logger=notifications.webhook url=https://hooks.slack.com/services/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 http method=
t=2018-05-04T12:52:42+0000 lvl=dbug msg=“Job Execution completed” logger=alerting.engine timeMs=55.468 alertId=5 name=“LTE - ICMP / HTTPS” firing=true attemptID=1
t=2018-05-04T12:52:44+0000 lvl=dbug msg=“Scheduling update” logger=alerting.scheduler ruleCount=6
t=2018-05-04T12:52:54+0000 lvl=dbug msg=“Scheduling update” logger=alerting.scheduler ruleCount=6

Seems like you’re still using local storage.

Have you configured the following?

[external_image_storage]
provider = s3

Hi. I have a similar issue with S3…
No matter what I do, I’m not able to upload images to S3

Here’s my config:

  • GF_EXTERNAL_IMAGE_STORAGE_PROVIDER=s3
  • GF_EXTERNAL_IMAGE_STORAGE_S3_BUCKET=https://xxx-xxx-xx-xxx-xx-xxxx.s3.amazonaws.com
  • GF_EXTERNAL_IMAGE_STORAGE_S3_REGION=eu-west-1
  • GF_EXTERNAL_IMAGE_STORAGE_S3_ACCESS_KEY=XXXX
  • GF_EXTERNAL_IMAGE_STORAGE_S3_SECRET_KEY=XXXX

Here’s the log message:

msg=“Failed to upload alert panel image.” logger=alerting.notifier error=“InvalidBucketName: The specified bucket is not valid.\n\tstatus code: 400, request id: B318F7C37297CD69, host id: 3vyLxO9rjxTgcF4JvIqVECNB/kRzvipalfxkyxXIpudRmzZMu1uCSALiZd9+HpB2jQ126SlcaLY=”

The bucket name is correct and the region also. I event tried to use another url like:
https://s3-eu-west-1.amazonaws.com/xxx-xxx-xx-xxx-xx-xxxx

The bucket is public, the EC2 has the following permissions:

  • s3:GetObject
  • s3:ListBucket
  • s3:PutObject
  • s3:PutObjectAcl

What am I doing wrong?

Thanks

Hi,

I think you’re looking for using bucket_url, see documentation.

Marcus

1 Like

Thanks Marcus.
Replacing “bucket” with “bucker_url” did the trick.