mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Store sensitive settings encrypted for Sensu notifier (#27131)
* encrypt password * update docs
This commit is contained in:
parent
1502722129
commit
ed6f0663c2
@ -466,13 +466,13 @@ The following sections detail the supported settings and secure settings for eac
|
|||||||
|
|
||||||
#### Alert notification `sensu`
|
#### Alert notification `sensu`
|
||||||
|
|
||||||
| Name |
|
| Name | Secure setting |
|
||||||
| -------- |
|
| -------- | - |
|
||||||
| url |
|
| url | |
|
||||||
| source |
|
| source | |
|
||||||
| handler |
|
| handler | |
|
||||||
| username |
|
| username | |
|
||||||
| password |
|
| password | yes |
|
||||||
|
|
||||||
#### Alert notification `prometheus-alertmanager`
|
#### Alert notification `prometheus-alertmanager`
|
||||||
|
|
||||||
|
@ -19,27 +19,39 @@ func init() {
|
|||||||
Heading: "Sensu settings",
|
Heading: "Sensu settings",
|
||||||
Factory: NewSensuNotifier,
|
Factory: NewSensuNotifier,
|
||||||
OptionsTemplate: `
|
OptionsTemplate: `
|
||||||
<h3 class="page-heading">Sensu settings</h3>
|
<h3 class="page-heading">Sensu settings</h3>
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<span class="gf-form-label width-10">Url</span>
|
<span class="gf-form-label width-10">Url</span>
|
||||||
<input type="text" required class="gf-form-input max-width-26" ng-model="ctrl.model.settings.url" placeholder="http://sensu-api.local:4567/results"></input>
|
<input type="text" required class="gf-form-input max-width-26" ng-model="ctrl.model.settings.url" placeholder="http://sensu-api.local:4567/results"></input>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<span class="gf-form-label width-10">Source</span>
|
<span class="gf-form-label width-10">Source</span>
|
||||||
<input type="text" class="gf-form-input max-width-14" ng-model="ctrl.model.settings.source" bs-tooltip="'If empty rule id will be used'" data-placement="right"></input>
|
<input type="text" class="gf-form-input max-width-14" ng-model="ctrl.model.settings.source" bs-tooltip="'If empty rule id will be used'" data-placement="right"></input>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<span class="gf-form-label width-10">Handler</span>
|
<span class="gf-form-label width-10">Handler</span>
|
||||||
<input type="text" class="gf-form-input max-width-14" ng-model="ctrl.model.settings.handler" placeholder="default"></input>
|
<input type="text" class="gf-form-input max-width-14" ng-model="ctrl.model.settings.handler" placeholder="default"></input>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<span class="gf-form-label width-10">Username</span>
|
<span class="gf-form-label width-10">Username</span>
|
||||||
<input type="text" class="gf-form-input max-width-14" ng-model="ctrl.model.settings.username"></input>
|
<input type="text" class="gf-form-input max-width-14" ng-model="ctrl.model.settings.username"></input>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<span class="gf-form-label width-10">Password</span>
|
<label class="gf-form-label width-10">Password</label>
|
||||||
<input type="text" class="gf-form-input max-width-14" ng-model="ctrl.model.settings.password"></input>
|
<div class="gf-form gf-form--grow" ng-if="!ctrl.model.secureFields.password">
|
||||||
</div>
|
<input type="text"
|
||||||
|
required
|
||||||
|
class="gf-form-input max-width-14"
|
||||||
|
ng-init="ctrl.model.secureSettings.password = ctrl.model.settings.password || null; ctrl.model.settings.password = null;"
|
||||||
|
ng-model="ctrl.model.secureSettings.password"
|
||||||
|
data-placement="right">
|
||||||
|
</input>
|
||||||
|
</div>
|
||||||
|
<div class="gf-form" ng-if="ctrl.model.secureFields.password">
|
||||||
|
<input type="text" class="gf-form-input max-width-14" disabled="disabled" value="configured" />
|
||||||
|
<a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.model.secureFields.password = false">reset</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
`,
|
`,
|
||||||
Options: []alerting.NotifierOption{
|
Options: []alerting.NotifierOption{
|
||||||
{
|
{
|
||||||
@ -92,7 +104,7 @@ func NewSensuNotifier(model *models.AlertNotification) (alerting.Notifier, error
|
|||||||
URL: url,
|
URL: url,
|
||||||
User: model.Settings.Get("username").MustString(),
|
User: model.Settings.Get("username").MustString(),
|
||||||
Source: model.Settings.Get("source").MustString(),
|
Source: model.Settings.Get("source").MustString(),
|
||||||
Password: model.Settings.Get("password").MustString(),
|
Password: model.DecryptedValue("password", model.Settings.Get("password").MustString()),
|
||||||
Handler: model.Settings.Get("handler").MustString(),
|
Handler: model.Settings.Get("handler").MustString(),
|
||||||
log: log.New("alerting.notifier.sensu"),
|
log: log.New("alerting.notifier.sensu"),
|
||||||
}, nil
|
}, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user