forked from Netflix/Hystrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
129 lines (107 loc) · 4.01 KB
/
index.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hystrix Dashboard</title>
<!-- Our custom CSS -->
<link rel="stylesheet" type="text/css" href="./index.css" />
<!-- Javascript to monitor and display -->
<script src="./js/jquery.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script>
var streams = [];
function addStream() {
if($('#stream').val().length > 0) {
var s = {
name: $('#title').val(),
stream: $('#stream').val(),
auth: $('#authorization').val(),
delay: $('#delay').val()
};
streams.push(s);
$('#streams').html('<table>' + _.reduce(streams, function(html, s) {
return html + '<tr><td>' + s.name + '</td><td>' + s.stream + '</td></tr>';
}, '') + '</table>');
$('#message').html("");
} else {
$('#message').html("The 'stream' value is required.");
}
}
function monitorStreams() {
if (streams.length) {
location.href= './monitor/monitor.html?streams=' + encodeURIComponent(JSON.stringify(streams));
} else {
$('#message').html("Add Streams to monitor, before starting to monitor.");
}
}
$(document).ready(function() {
$('#stream').keypress(function(e) {
if(e.which == 13) {
monitorStreams();
}
});
});
$(document).ready(function(){
$('#eurekaURL').on('input',function(e){
url = window.location.pathname + "eureka?url=" + $('#eurekaURL').val()
$.get(url,function( data ) {
$(data.children).find("application").each(function(index,item){
appName = $(item).find("name")[0].innerHTML
ip = null;
$($(item).find("instance")).each(function(i,d){
ip = $(d).find("ipAddr")[0].innerHTML;
});
$('#eurekaApp').append($("<option></option>")
.attr("value",ip)
.text(appName));
$('#eurekaApp').on('change click',function(item){
var $this = $(this),
$value = $this.val();
streamType = $('input[name=streamType]:checked').val()
$('#stream').val("http://" + $value + ":8080/" + streamType + "?cluster=default");
});
});
});
});
});
</script>
</head>
<body>
<div style="width:800px;margin:0 auto;">
<center>
<img width="264" height="233" src="./images/hystrix-logo.png">
<br>
<br>
<h2>Hystrix Dashboard</h2>
Eureka URL: <input id="eurekaURL" name="eurekaURL" class="eurekaURL" type="text" size="42" placeholder="http://hostname:8080/eureka/v2/apps"> <br>
Eureka Application:
<select id="eurekaApp" name="eurekaApp" class="eurekaApp">
<option selected disabled>Choose here</option>
</select>
Stream Type:
Hystrix <input type="radio" name="streamType" value="hystrix.stream">
Turbine <input type="radio" name="streamType" value="turbine.stream" checked> <br><br>
<input id="stream" type="textfield" size="120" placeholder="http://hostname:port/turbine/turbine.stream"></input>
<br><br>
<i>Cluster via Turbine (default cluster):</i> http://turbine-hostname:port/turbine.stream
<br>
<i>Cluster via Turbine (custom cluster):</i> http://turbine-hostname:port/turbine.stream?cluster=[clusterName]
<br>
<i>Single Hystrix App:</i> http://hystrix-app:port/hystrix.stream
<br><br>
Delay: <input id="delay" type="textfield" size="10" placeholder="2000"></input>ms
Title: <input id="title" type="textfield" size="60" placeholder="Example Hystrix App"></input><br><br>
Authorization: <input id="authorization" type="textfield" size="60" placeholder="Basic Zm9vOmJhcg=="></input><br>
<br>
<button onclick="addStream()">Add Stream</button>
<br><br>
<ol id='streams'></ol>
<br><br>
<button onclick="monitorStreams()">Monitor Streams</button>
<br><br>
<div id="message" style="color:red"></div>
</center>
</div>
</body>
</html>