Skip to content
Permalink
Browse files

Added Checks for nodes in Consul-UI

  • Loading branch information...
pierresouchay committed Feb 27, 2019
1 parent e79425c commit e610d7760f3fe675dc907096076ee52e35307fef
@@ -9,6 +9,7 @@ IMPROVEMENTS:
* Do not report timestamps in metrics.erb as it is toxic for Prometheus
* in metrics.erb, add all net_info statistics to observe consul-templaterb itself
* new flag -l <error|info|debug> to control verbosity of messages
* Now diplays Checks of a Node in Consul-UI

## 1.9.9 (January 18, 2019)

@@ -53,6 +53,8 @@
node_data = {
Node: node_node_data,
Service: node_services_data,
# Only put Checks on a Node
checks: snode["Checks"].select{|c| c['ServiceID'].empty? }.map{|c| {output: c['Output'], notes: c['Notes'], name: c['Name'], checkid: c['CheckID'], status: c['Status']}},
}
service_per_node[snode['Node']['Node']] = node_data
@@ -98,6 +98,11 @@ class ConsulNodes {
contentHead.appendChild(nodeAddressGenator(instance['Node']['Address']));
contentHead.appendChild(nodeMetaGenator(instance['Node']['Meta']));
content.appendChild(contentHead);
var nodesChecks = document.createElement('div');
nodesChecks.setAttribute('class','nodes-checks');
nodesChecks.appendChild(checksStatusGenerator(instance, instance['Node']['Name']));
content.appendChild(nodesChecks);

content.appendChild(servicesGenerator(instance['Service']));
content.appendChild(tagsGenerator(getTagsNode(instance)));

@@ -259,7 +259,7 @@ class ConsulService {
serviceHtml.appendChild(tagsGenerator(instance.tags));
serviceHtml.appendChild(serviceMetaGenerator(instance.sMeta));
serviceHtml.appendChild(connectGenerator(instance))
serviceHtml.appendChild(checksStatusGenerator(instance));
serviceHtml.appendChild(checksStatusGenerator(instance, instance.name));
serviceHtml.setAttribute('status', state);
$("#instances-list").append(serviceHtml);
}
@@ -227,7 +227,7 @@ function servicesGenerator(instanceServices) {
return services;
}

function checksStatusGenerator(instance) {
function checksStatusGenerator(instance, prefix) {
var instanceChecks = instance.checks;
var checks = document.createElement('div');
checks.className = 'checks';
@@ -236,7 +236,7 @@ function checksStatusGenerator(instance) {

for (var checkKey in instanceChecks) {
var checkInstance = instanceChecks[checkKey];
var checkId = instance.name + '::' + checkInstance.checkid;
var checkId = prefix + '::' + checkInstance.checkid;
var btn = 'btn-' + toCSSClass(instanceChecks[checkKey]['status'])
var check = document.createElement('div');

0 comments on commit e610d77

Please sign in to comment.
You can’t perform that action at this time.