Commit 01acff6d authored by ale's avatar ale

Add a link to vhost grafana dashboards

parent 4e7b43f7
Pipeline #1136 passed with stages
in 52 seconds
......@@ -952,14 +952,15 @@ var _templatesIndexHtml = []byte(`{{template "header" "float services"}}
{{range $i, $p := $svc.PublicEndpoints}}
{{if gt $i 0}}<br>{{end}}
{{$p.Name}}
<span class="muted">
<a href="{{$p.URL}}" target="_blank">
<span class="oi oi-globe" title="view site"></span>
</a>
<a href="{{$p.LogsURL}}">
<span class="oi oi-spreadsheet" title="http logs"></span>
</a>
</span>
<a href="{{$p.URL}}" target="_blank">
<span class="oi oi-globe" title="view site"></span>
</a>
<a href="{{$p.QpsGraphURL}}">
<span class="oi oi-graph" title="traffic"></span>
</a>
<a href="{{$p.LogsURL}}">
<span class="oi oi-spreadsheet" title="http logs"></span>
</a>
{{end}}
</td>
......@@ -1012,7 +1013,7 @@ func templatesIndexHtml() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "templates/index.html", size: 2081, mode: os.FileMode(436), modTime: time.Unix(1533928534, 0)}
info := bindataFileInfo{name: "templates/index.html", size: 2135, mode: os.FileMode(436), modTime: time.Unix(1533976440, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
......@@ -38,7 +38,7 @@ func getenv(k, dflt string) string {
// Config for the application.
type Config struct {
Domain string `yaml:"domain"`
PublicDomains []string `yaml:"public_domains"`
PublicDomain string `yaml:"public_domain"`
LogoImagePath string `yaml:"logo_image"`
HTTP *serverutil.ServerConfig `yaml:"http_server"`
}
......
......@@ -12,11 +12,12 @@ type MonitoringEndpoint struct {
}
func (m MonitoringEndpoint) TargetStatusURL() string {
return fmt.Sprintf("https://monitor.%s/graph?expr=ok{job=%s}", config.Domain, m.JobName)
return fmt.Sprintf("https://monitor.%s/graph?expr=ok{job=%s}", config.PublicDomain, m.JobName)
}
func (m MonitoringEndpoint) ServiceDashboardURL() string {
return fmt.Sprintf("https://grafana.%s/service-dashboard?service=%s", config.Domain, m.JobName)
//return fmt.Sprintf("https://grafana.%s/d/xfV2rd7ik/service-overview?refresh=5s&orgId=1&from=now-3h&to=now&var-service=%s&var-vhosts=%s", config.PublicDomain, m.JobName, serviceName, vhostName)
return fmt.Sprintf("https://grafana.%s/service-dashboard?service=%s", config.PublicDomain, m.JobName)
}
type PublicEndpoint struct {
......@@ -27,12 +28,20 @@ type PublicEndpoint struct {
EnableSSOProxy bool `yaml:"enable_sso_proxy,omitempty"`
}
func (p PublicEndpoint) FQDN() string {
return fmt.Sprintf("%s.%s", p.Name, config.PublicDomain)
}
func (p PublicEndpoint) URL() string {
return fmt.Sprintf("https://%s.%s/", p.Name, config.PublicDomains[0])
return fmt.Sprintf("https://%s/", p.FQDN())
}
func (p PublicEndpoint) LogsURL() string {
return fmt.Sprintf("https://logs.%s/kibana/bla/bla/?vhost=%s.%s", config.Domain, p.Name, config.PublicDomains[0])
return fmt.Sprintf("https://logs.%s/kibana/bla/bla/?vhost=%s", config.PublicDomain, p.FQDN())
}
func (p PublicEndpoint) QpsGraphURL() string {
return fmt.Sprintf("https://grafana.%s/d/xCSUMFnmz/http?orgId=1&var-vhost=%s:443", config.PublicDomain, p.FQDN())
}
// Boolean fields that default to true are problematic, so we use
......
......@@ -6,11 +6,11 @@ import (
)
var sriMap = map[string]string{
"/static/js/jquery.slim.min.js": "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo",
"/static/css/bootstrap.min.css": "sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B",
"/static/css/open-iconic-bootstrap.min.css": "sha384-wWci3BOzr88l+HNsAtr3+e5bk9qh5KfjU6gl/rbzfTYdsAVHBEbxB33veLYmFg/a",
"/static/css/style.css": "sha384-OLBgp1GsljhM2TJ+sbHjaiH9txEUvgdDTAzHv2P24donTt6/529l+9Ua0vFImLlb",
"/static/js/bootstrap.bundle.min.js": "sha384-CS0nxkpPy+xUkNGhObAISrkg/xjb3USVCwy+0/NMzd5VxgY4CMCyTkItmy5n0voC",
"/static/js/jquery.slim.min.js": "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo",
"/static/css/bootstrap.min.css": "sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B",
}
// SRIScript returns a <script> tag with resource integrity attributes.
......
......@@ -39,14 +39,15 @@
{{range $i, $p := $svc.PublicEndpoints}}
{{if gt $i 0}}<br>{{end}}
{{$p.Name}}
<span class="muted">
<a href="{{$p.URL}}" target="_blank">
<span class="oi oi-globe" title="view site"></span>
</a>
<a href="{{$p.LogsURL}}">
<span class="oi oi-spreadsheet" title="http logs"></span>
</a>
</span>
<a href="{{$p.URL}}" target="_blank">
<span class="oi oi-globe" title="view site"></span>
</a>
<a href="{{$p.QpsGraphURL}}">
<span class="oi oi-graph" title="traffic"></span>
</a>
<a href="{{$p.LogsURL}}">
<span class="oi oi-spreadsheet" title="http logs"></span>
</a>
{{end}}
</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment