consul-templaterb 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -0
- data/lib/consul/async/version.rb +1 -1
- data/samples/all_services.txt.erb +52 -0
- data/samples/consul-ui/js/service.js +2 -3
- data/samples/consul-ui/js/utils.js +7 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0660de439be86195cbc03b72cddeb6f0f0c29d8118687c1c6dab05fc63d48a40
|
4
|
+
data.tar.gz: 00a7db6827d322cbdb11148e5bf96a532306a7dbfdebc3df44c097dc8c6b38e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2d8d2f30722f75bcf69b4b5d8076358dae1ea420c5bd38a541c6d70afaad90b413cda8234b798791a595108a7f0a2b62b5ba6becfd9523832cb3de326174d71
|
7
|
+
data.tar.gz: 73b881286ce0b45b27dd9bcf485b86d5af0091d37cdc995845ef77d0edefbab657a0197651dd63592e9f529f026f7e468b3d03f724bcdb046430ac1340e301dc
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## (UNRELEASED)
|
4
4
|
|
5
|
+
## 1.6.1 (December 4, 2018)
|
6
|
+
|
7
|
+
BUG FIXES:
|
8
|
+
|
9
|
+
* In consul-ui, display the port only when port is set
|
10
|
+
|
5
11
|
## 1.6.0 (November 23, 2018)
|
6
12
|
|
7
13
|
BUG FIXES:
|
@@ -15,6 +21,7 @@ NEW FEATURES:
|
|
15
21
|
* `status` to compute aggregated status of a service taking into account all checks
|
16
22
|
* `weights` to deal with weights added in Consul 1.2.3
|
17
23
|
* `current_weight` to deal with weight computed using the current status
|
24
|
+
* Added new option `-g` for disabling GZIP compression
|
18
25
|
|
19
26
|
## 1.5.9 (November 17, 2018)
|
20
27
|
|
data/README.md
CHANGED
@@ -232,6 +232,7 @@ examples:
|
|
232
232
|
8. [Generate HaProxy Configuration](samples/ha_proxy.cfg.erb)
|
233
233
|
9. [Export Consul Statistics to Prometheus](samples/metrics.erb) : count all services, their state,
|
234
234
|
datacenters and nodes and export it to prometheus easily to trigger alerts.
|
235
|
+
10. [List all services/Nodes with their statuses for all datacenters](samples/all_services.txt.erb)
|
235
236
|
|
236
237
|
If you want to test it quickly, you might try with (assuming your consul agent is listening on
|
237
238
|
`http://localhost:8500`):
|
data/lib/consul/async/version.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
__________________________________________________________________
|
2
|
+
| DC | Services |______________Instances________________| Nodes |
|
3
|
+
| | | Passing | Warning | Critic | Total | |
|
4
|
+
|-------+----------+---------+---------+---------+---------+-------|
|
5
|
+
<%
|
6
|
+
# This template list all instances on all DCs
|
7
|
+
# And aggregates a list of Services, Services Instances/status
|
8
|
+
# And nodes.
|
9
|
+
require 'set'
|
10
|
+
num_services={}
|
11
|
+
num_instances={}
|
12
|
+
all_states = ['passing', 'warning', 'critical', 'total']
|
13
|
+
distinct_services=Set.new
|
14
|
+
datacenters().each do |dc|
|
15
|
+
num_services[dc] = 0
|
16
|
+
num_instances[dc] = {
|
17
|
+
'passing' => 0,
|
18
|
+
'warning' => 0,
|
19
|
+
'critical' => 0,
|
20
|
+
'total' => 0
|
21
|
+
}
|
22
|
+
services(dc:dc).each do |service_name, tags|
|
23
|
+
distinct_services.add(service_name)
|
24
|
+
num_services[dc]+=1
|
25
|
+
service(service_name, dc:dc).each do |snode|
|
26
|
+
num_instances[dc][snode.status]+=1
|
27
|
+
num_instances[dc]['total']+=1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
num_instances_total={
|
32
|
+
'passing' => 0,
|
33
|
+
'warning' => 0,
|
34
|
+
'critical' => 0,
|
35
|
+
'total' => 0
|
36
|
+
}
|
37
|
+
num_nodes_total=0
|
38
|
+
num_services.each do |dc, num_services_for_dc|
|
39
|
+
all_states.each do |s|
|
40
|
+
num_instances_total[s] += num_instances[dc][s]
|
41
|
+
end
|
42
|
+
num_nodes=nodes(dc:dc).count
|
43
|
+
num_nodes_total+=num_nodes
|
44
|
+
%>| <%= dc.rjust(5) %> | <%= num_services_for_dc.to_s.rjust(8) %> |<% all_states.each do |status|
|
45
|
+
%> <%= num_instances[dc][status].to_s.rjust(7) %> |<% end %> <%= num_nodes.to_s.rjust(5) %> |
|
46
|
+
<%
|
47
|
+
end
|
48
|
+
%>|-------+----------+---------+---------+---------+---------+-------|
|
49
|
+
| TOTAL | <%= distinct_services.count.to_s.rjust(8) %> |<% all_states.each do |status|
|
50
|
+
%> <%= num_instances_total[status].to_s.rjust(7) %> |<%
|
51
|
+
end %> <%= num_nodes_total.to_s.rjust(5) %> |
|
52
|
+
'_______|__________|_________|_________|_________|_________|_______'
|
@@ -83,8 +83,7 @@ class ConsulService {
|
|
83
83
|
var service = this.data.services[serviceName];
|
84
84
|
var serviceStatus = buildServiceStatus(service);
|
85
85
|
|
86
|
-
var listItem = document.createElement('
|
87
|
-
listItem.setAttribute('type','button');
|
86
|
+
var listItem = document.createElement('li');
|
88
87
|
listItem.setAttribute('onfocus','consulService.onClickServiceName(this)');
|
89
88
|
listItem.setAttribute('onclick','consulService.onClickServiceName(this)');
|
90
89
|
listItem.setAttribute('value',serviceName);
|
@@ -229,7 +228,7 @@ class ConsulService {
|
|
229
228
|
$(this.selectedService).removeClass('active');
|
230
229
|
}
|
231
230
|
var serviceName = $(source).find(".service-name").html()
|
232
|
-
this.selectedService = source.closest(
|
231
|
+
this.selectedService = source.closest('li');
|
233
232
|
$(this.selectedService).addClass('active');
|
234
233
|
|
235
234
|
this.displayService(this.data.services[serviceName]);
|
@@ -40,11 +40,16 @@ function serviceTitleGenerator(instance) {
|
|
40
40
|
|
41
41
|
var instanceLink = document.createElement('a');
|
42
42
|
instanceLink.setAttribute('class', 'instance-name');
|
43
|
+
var appendPort = "";
|
44
|
+
if (instance.port > 0) {
|
45
|
+
appendPort = ':' + instance.port;
|
46
|
+
}
|
43
47
|
if (protocol != null) {
|
44
|
-
instanceLink.setAttribute('href', protocol + instance.addr +
|
48
|
+
instanceLink.setAttribute('href', protocol + instance.addr + appendPort);
|
45
49
|
instanceLink.setAttribute('target', '_blank');
|
46
50
|
}
|
47
|
-
|
51
|
+
|
52
|
+
instanceLink.appendChild(document.createTextNode(instance.name + appendPort));
|
48
53
|
htmlTitle.appendChild(instanceLink);
|
49
54
|
|
50
55
|
return htmlTitle;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consul-templaterb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SRE Core Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-http-request
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- lib/consul/async/utilities.rb
|
171
171
|
- lib/consul/async/vault_endpoint.rb
|
172
172
|
- lib/consul/async/version.rb
|
173
|
+
- samples/all_services.txt.erb
|
173
174
|
- samples/checks.html.erb
|
174
175
|
- samples/common/footer.html.erb
|
175
176
|
- samples/common/header.html.erb
|