Merge remote-tracking branch 'upstream/master' into adjust_interval_variable_with_min_step

pull/9226/head
Alin Sinpalean 8 years ago
commit 25a6ed8718
  1. 2
      conf/defaults.ini
  2. 3
      conf/sample.ini
  3. 6
      docs/sources/installation/configuration.md
  4. 14
      pkg/components/imguploader/imguploader.go
  5. 12
      pkg/components/imguploader/s3uploader.go
  6. 25
      public/app/features/alerting/partials/alert_list.html
  7. 2
      public/app/features/dashboard/export/export_modal.html

@ -477,6 +477,8 @@ provider =
[external_image_storage.s3]
bucket_url =
bucket =
region =
access_key =
secret_key =

@ -422,7 +422,8 @@
;provider =
[external_image_storage.s3]
;bucket_url =
;bucket =
;region =
;access_key =
;secret_key =

@ -651,12 +651,16 @@ These options control how images should be made public so they can be shared on
You can choose between (s3, webdav, gcs). If left empty Grafana will ignore the upload action.
## [external_image_storage.s3]
### bucket
Bucket name for S3. e.g. grafana.snapshot
### region
Region name for S3. e.g. 'us-east-1', 'cn-north-1', etc
### bucket_url
(for backward compatibility, only works when no bucket or region are configured)
Bucket URL for S3. AWS region can be specified within URL or defaults to 'us-east-1', e.g.
- http://grafana.s3.amazonaws.com/
- https://grafana.s3-ap-southeast-2.amazonaws.com/
- https://grafana.s3-cn-north-1.amazonaws.com.cn
### access_key
Access key. e.g. AAAAAAAAAAAAAAAAAAAA

@ -28,15 +28,21 @@ func NewImageUploader() (ImageUploader, error) {
return nil, err
}
bucket := s3sec.Key("bucket").MustString("")
region := s3sec.Key("region").MustString("")
bucketUrl := s3sec.Key("bucket_url").MustString("")
accessKey := s3sec.Key("access_key").MustString("")
secretKey := s3sec.Key("secret_key").MustString("")
info, err := getRegionAndBucketFromUrl(bucketUrl)
if err != nil {
return nil, err
if bucket == "" || region == "" {
info, err := getRegionAndBucketFromUrl(bucketUrl)
if err != nil {
return nil, err
}
bucket = info.bucket
region = info.region
}
return NewS3Uploader(info.region, info.bucket, "public-read", accessKey, secretKey), nil
return NewS3Uploader(region, bucket, "public-read", accessKey, secretKey), nil
case "webdav":
webdavSec, err := setting.Cfg.GetSection("external_image_storage.webdav")
if err != nil {

@ -9,6 +9,7 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/grafana/grafana/pkg/log"
@ -54,8 +55,10 @@ func (u *S3Uploader) Upload(ctx context.Context, imageDiskPath string) (string,
Credentials: creds,
}
s3_endpoint, _ := endpoints.DefaultResolver().EndpointFor("s3", u.region)
key := util.GetRandomString(20) + ".png"
log.Debug("Uploading image to s3", "bucket = ", u.bucket, ", key = ", key)
image_url := s3_endpoint.URL + "/" + u.bucket + "/" + key
log.Debug("Uploading image to s3", "url = ", image_url)
file, err := os.Open(imageDiskPath)
if err != nil {
@ -78,10 +81,5 @@ func (u *S3Uploader) Upload(ctx context.Context, imageDiskPath string) (string,
if err != nil {
return "", err
}
if u.region == "us-east-1" {
return "https://" + u.bucket + ".s3.amazonaws.com/" + key, nil
} else {
return "https://" + u.bucket + ".s3-" + u.region + ".amazonaws.com/" + key, nil
}
return image_url, nil
}

@ -1,18 +1,18 @@
<navbar model="ctrl.navModel"></navbar>
<div class="page-container" >
<div class="page-header">
<h1>Alert List</h1>
<div class="page-header">
<h1>Alert List</h1>
<a class="btn btn-inverse" ng-click="ctrl.openHowTo()">
<i class="fa fa-info-circle"></i>
How to add an alert
</a>
<i class="fa fa-info-circle"></i>
How to add an alert
</a>
<a class="btn btn-inverse" href="alerting/notifications" >
<i class="fa fa-cog"></i>
Configure notifications
</a>
</div>
<i class="fa fa-cog"></i>
Configure notifications
</a>
</div>
<div class="gf-form-group">
<div class="gf-form-inline">
@ -34,9 +34,10 @@
<div class="card-item-header">
<div class="card-item-type">
<a class="card-item-cog" bs-tooltip="'Pausing an alert rule prevents it from executing'" ng-click="ctrl.pauseAlertRule(alert.id)">
<i class="fa fa-pause"></i>
</a>
<a class="card-item-cog" href="dashboard/{{alert.dashboardUri}}?panelId={{alert.panelId}}&fullscreen&edit&tab=alert" bs-tooltip="'Edit alert rule'">
<i ng-show="alert.state !== 'paused'" class="fa fa-pause"></i>
<i ng-show="alert.state === 'paused'" class="fa fa-play"></i>
</a>
<a class="card-item-cog" href="dashboard/{{alert.dashboardUri}}?panelId={{alert.panelId}}&fullscreen&edit&tab=alert" bs-tooltip="'Edit alert rule'">
<i class="icon-gf icon-gf-settings"></i>
</a>
</div>

@ -11,7 +11,7 @@
<div>
<p class="share-modal-info-text">
Export the dashboard to a JSON file. The exporter will templatize the
dashboard's data sources to make it easy for other's to to import and reuse.
dashboard's data sources to make it easy for others to import and reuse.
You can share dashboards on <a class="external-link" href="https://grafana.com">Grafana.com</a>
</p>

Loading…
Cancel
Save