-
Notifications
You must be signed in to change notification settings - Fork 826
Expand file tree
/
Copy pathServers.cshtml
More file actions
193 lines (187 loc) · 9.76 KB
/
Servers.cshtml
File metadata and controls
193 lines (187 loc) · 9.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
@model ServersModel
@{
var standalone = Model.StandaloneInstances;
}
@functions
{
string ConnectionsCell(SQLInstance i)
{
var props = i.ServerProperties.SafeData(true);
<td>
<a href="@Url.Action(nameof(SQLController.Connections), new {node = i.Name})">@props.ConnectionCount.ToComma()</a> <span class="text-muted">/ @props.SessionCount.ToComma()</span>
</td>
return null;
}
}
<div class="js-refresh" data-name="sql">
@if (Model.Clusters.Any())
{
<table class="table table-striped table-hover text-nowrap table-super-condensed table-responsive">
@foreach (var c in Model.Clusters.Where(clu => clu.Nodes.Any()))
{
<tbody>
<tr class="category-row">
<th colspan="12">
<h5>
<a href="~/sql/servers#/cluster/@c.Name" data-refresh="5">@c.IconSpan() @c.Name</a> <span class="text-muted small">(@c.QuorumType.AsString(EnumFormat.Description) - @c.QuorumState.AsString(EnumFormat.Description))</span>
@if (c.Description.HasValue()) { <span class="text-muted small">(@c.Description)</span> }
<span class="pull-right small"> @Poll.Now(c.Nodes)</span>
</h5>
</th>
</tr>
<tr>
<th>Node</th>
<th>State</th>
<th>CPU</th>
<th class="text-muted">(Last Hour)</th>
<th>Memory</th>
<th>Availability</th>
<th>Databases</th>
<th title="Connections / Sessions">Conns <span class="text-muted">/ Sess</span></th>
<th>Batches<span class="text-muted">/sec</span></th>
<th>Last Commit</th>
<th title="Quorum Votes in the Cluster">Votes</th>
<th>As of</th>
</tr>
</tbody>
<tbody>
@foreach (var n in c.Nodes)
{
var cAgs = n.AvailabilityGroups.SafeData(true);
<tr class="@n.RowClass()@(n.IsAllAGsPrimary ? " info" : null)">
<td>@n.IconSpan() <a href="~/sql/instance?node=@n.Name.UrlEncode()">@n.Name</a></td>
<td title="Votes: @n.ClusterVotes.ToString()">@n.AGClusterMember.State.AsString(EnumFormat.Description)</td>
<td><a href="~/sql/active?node=@n.Name.UrlEncode()">@(n.CurrentCPUPercent.HasValue ? n.CurrentCPUPercent.ToString() + "%" : "")</a></td>
<td><img src="~/graph/sql/cpu/spark?node=@n.Name" width="100" height="16" /></td>
<partial Name="Partials.MemoryCell" Model="new PartialsMemoryCellModel(n, 2)" />
<td>@Health.OfAGs(cAgs)</td>
<td><a href="@Url.Action(nameof(SQLController.Databases), "SQL", new { node = n.Name })">@Health.Description(cAgs.Where(ag => ag.LocalReplica != null).SelectMany(ag => ag.LocalReplica.Databases))</a></td>
@ConnectionsCell(n)
<td>@(n.BatchesPerSec?.ToComma())</td>
<td>@(cAgs.Where(ag => ag.LocalReplica != null).Max(ag => ag.LocalReplica.Databases.Max(db => db.LastCommitTime))?.ToRelativeTimeSpan())</td>
<td>@n.ClusterVotes.ToComma()</td>
<td>@n.LastFetch.ToPollSpan()</td>
</tr>
}
</tbody>
}
</table>
}
@if (Model.AzureServers.Any())
{
<table class="table table-striped table-hover text-nowrap table-super-condensed table-responsive">
@foreach (var s in Model.AzureServers)
{
<thead>
<tr class="category-row">
<th colspan="12">
<h5>
@s.IconSpan() @s.Name
@if (s.Description.HasValue())
{<span class="text-muted small">(@s.Description)</span>}
<span class="pull-right small"> @Poll.Now(s)</span>
</h5>
</th>
</tr>
<tr>
<th>Database</th>
<th>SKU</th>
<th>CPU</th>
<th class="text-muted">(Last Hour)</th>
<th>DTUs</th>
<th class="text-muted">(Last Hour)</th>
<th>Memory</th>
<th title="Connections / Sessions">Conns <span class="text-muted">/ Sess</span></th>
<th>Batches<span class="text-muted">/sec</span></th>
<th>As of</th>
</tr>
</thead>
<tbody>
@if (!s.Instances.ContainsData)
{
<tr>
<td colspan="10">
</td>
</tr>
}
@foreach (var i in s.Instances.SafeData(true))
{
<tr class="@i.RowClass()">
<td title="@i.Description (Edition: @i.Edition, Elastic Pool: @(i.ElasticPoolName ?? "None"))">@i.IconSpan() <a href="~/sql/instance?node=@i.Name.UrlEncode()">@i.Name</a></td>
<td title="DTU Limit: @(i.CurrentDTULimit?.ToString("n0") ?? "Unknown")">@i.SKU</td>
<td><a href="~/sql/active?node=@i.Name.UrlEncode()">@(i.CurrentCPUPercent.HasValue ? i.CurrentCPUPercent.ToString() + "%" : "")</a></td>
<td><img src="~/graph/sql/cpu/spark?node=@i.Name&time=@DateTime.UtcNow.ToString("yyyy-MM-dd")" width="100" height="16" alt="SQL CPU for @i.Name Last Hour" /></td>
<td title="DTU Limit: @(i.CurrentDTULimit?.ToString("n0") ?? "Unknown")">@(i.CurrentDTUPercent.HasValue ? i.CurrentDTUPercent.ToString() + "%" : "")</td>
<td><img src="~/graph/sql/dtu/spark?node=@i.Name&time=@DateTime.UtcNow.ToString("yyyy-MM-dd")" width="100" height="16" alt="DTU Usage for @i.Name Last Hour" /></td>
<partial Name="Partials.MemoryCell" Model="@new PartialsMemoryCellModel(i, 2)" />
@ConnectionsCell(i)
<td>@(i.BatchesPerSec?.ToComma())</td>
<td>@i.LastFetch.ToPollSpan(mini: false)</td>
</tr>
}
</tbody>
}
</table>
}
@if (standalone.Any())
{
<table class="table table-striped table-hover text-nowrap table-super-condensed table-responsive">
<tbody>
<tr class="category-row">
<th colspan="8">
<h5>
@standalone.GetWorstStatus().IconSpan() @standalone.Count.ToComma() Standalone
<span class="pull-right small"> @Poll.Now(standalone)</span>
</h5>
</th>
</tr>
<tr>
<th>Node</th>
<th>CPU</th>
<th class="text-muted">(Last Hour)</th>
<th>Memory</th>
<th>Databases</th>
<th title="Connections / Sessions">Conns <span class="text-muted">/ Sess</span></th>
<th>Batches<span class="text-muted">/sec</span></th>
<th>As of</th>
</tr>
</tbody>
<tbody>
@foreach (var i in standalone)
{
var dbs = i.Databases.SafeData(true);
<tr class="@i.RowClass()">
<td title="@i.Description">@i.IconSpan() <a href="~/sql/instance?node=@i.Name.UrlEncode()">@i.Name</a></td>
<td><a href="~/sql/active?node=@i.Name.UrlEncode()">@(i.CurrentCPUPercent.HasValue ? i.CurrentCPUPercent.ToString() + "%" : "")</a></td>
<td><img src="~/graph/sql/cpu/spark?node=@i.Name&time=@DateTime.UtcNow.ToString("yyyy-MM-dd")" width="100" height="16" alt="SQL CPU for @i.Name Last Hour" /></td>
<partial Name="Partials.MemoryCell" Model="@new PartialsMemoryCellModel(i, 2)" />
<td title="@dbs.Count.Pluralize("Database"):
@string.Concat(dbs.GroupBy(db => db.OverallStateDescription).Select(g => $" {g.Key}: {g.Count().Pluralize("Database")}\n"))">
@Health.Description(dbs)
</td>
@ConnectionsCell(i)
<td>@(i.BatchesPerSec?.ToComma())</td>
<td>@i.LastFetch.ToPollSpan(mini: false)</td>
</tr>
}
</tbody>
</table>
}
<div class="ag-container refresh-group row small" data-name="ag-summary">
@foreach (var c in Model.Clusters)
{
foreach (var ag in c.AvailabilityGroups)
{
<partial name="Servers.AvailabilityGroup" model="ag" />
}
}
</div>
@if (Model.CurrentCluster != null)
{
<div class="hidden">
<div class="js-refresh" data-name="sql-@Model.CurrentCluster.Name">
<partial name="Servers.ClusterDetail" model="Model" />
</div>
</div>
}
</div>