Compare commits

...
21 changed files with 728 additions and 490 deletions

No files matched your search

+8 -3
View File
@@ -108,9 +108,7 @@ System.register(['lodash'], function (_export, _context) {
switch (response.status) {
case 200:
var cookie = (document.cookie.match(/^(?:.*;)?TSESSIONID=([^;]+)(?:.*)?$/) || [, null])[1];
console.log(cookie);
console.log(document.cookie);
console.log(this.getCookie('TSESSIONID'));
this.fetching.status = 'success';
this.fetching.title = 'Login successful';
@@ -126,6 +124,13 @@ System.register(['lodash'], function (_export, _context) {
if (r.readyState != 4 || r.status != 200) return;
alert("Success: " + r.getResponseHeader('Set-Cookie'));
}
}, {
key: 'getCookie',
value: function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
}, {
key: '_getURI',
value: function _getURI(jsonData) {
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["../../src/components/auths.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAO,O;;;;;;;;;;;;;;;;;;;;;2BAEM,S;AAEX,2BAAY,UAAZ,EAAwB,UAAxB,EAAoC,QAApC,EAA6C;AAAA;;AAC3C,eAAK,UAAL,GAAkB,UAAlB;AACA,eAAK,QAAL,GAAgB,QAAhB;AACA,eAAK,UAAL,GAAkB,UAAlB;AACD;;;;gCAEK,U,EAAW;AACf,iBAAK,QAAL,GAAgB,EAAhB;AACA,iBAAK,QAAL,CAAc,IAAd,GAAqB,KAArB;AACA,iBAAK,QAAL,CAAc,IAAd,GAAqB,IAArB;AACA,iBAAK,QAAL,CAAc,MAAd,GAAuB,SAAvB;AACA,iBAAK,QAAL,CAAc,KAAd,GAAsB,mBAAtB;;AAEA;AACA;AACA;;AAEA,gBAAI,MAAM,KAAK,OAAL,CAAa,WAAW,QAAxB,CAAV;;AAEA,gBAAG,WAAW,QAAX,CAAoB,UAAvB,EAAkC;AAChC,kBAAI,KAAK,aAAL,IAAsB,KAAK,iBAA/B,EAAiD;AAC/C,oBAAI,WAAW,EAAC,UAAU,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,CAAb;AACA,wBAAQ,GAAR,CAAY,MAAZ;AACA,wBAAQ,GAAR,CAAY,SAAS,MAArB;;AAEA,qBAAK,QAAL,CAAc,MAAd,GAAuB,SAAvB;AACA,qBAAK,QAAL,CAAc,KAAd,GAAsB,kBAAtB;AACA,qBAAK,UAAL,CAAgB,QAAhB,CAAyB,eAAzB,EAA0C,CAAC,SAAD,EAAY,EAAZ,CAA1C;AACA;AACF;AACE,qBAAK,QAAL,CAAc,MAAd,GAAuB,SAAvB;AACA,qBAAK,QAAL,CAAc,KAAd,GAAsB,SAAS,UAA/B;AACA,qBAAK,UAAL,CAAgB,QAAhB,CAAyB,eAAzB,EAA0C,CAAC,SAAS,MAAT,GAAgB,IAAhB,GAAqB,SAAS,UAA/B,EAA0C,EAA1C,CAA1C;AACA;AAdJ;;AAiBA,gBAAI,EAAE,UAAF,IAAgB,CAAhB,IAAqB,EAAE,MAAF,IAAY,GAArC,EAA0C;AAC1C,kBAAM,cAAc,EAAE,iBAAF,CAAoB,YAApB,CAApB;AACD;;;kCAEO,Q,EAAS;AACf,mBAAO,aAAW,SAAS,UAApB,GAA+B,GAA/B,GAAmC,SAAS,SAA5C,GAAsD,QAA7D;AACD;;;yCAEa,CAEb","file":"auths.js","sourcesContent":["import _ from 'lodash';\n\nexport class AuthsCtrl {\n\n constructor(backendSrv, $rootScope, $timeout){\n this.$rootScope = $rootScope;\n this.$timeout = $timeout;\n this.backendSrv = backendSrv;\n }\n\n login(datasource){\n this.fetching = {};\n this.fetching.done = false;\n this.fetching.show = true;\n this.fetching.status = 'warning';\n this.fetching.title = 'Fetching auths...';\n\n //this.$rootScope.appEvent('alert-success', ['Authorization Cookie Received', '']);\n //this.$rootScope.appEvent('alert-error', ['Authorization Failed', '']);\n //this.$rootScope.appEvent('alert-warning', ['Fetching Authorizations', '']);\n\n var uri = this._getURI(datasource.jsonData);\n\n if(datasource.jsonData.basicAuths){\n if( this.basicAuthUser && this.basicAuthPassword){\n var authBlob = {username: this.basicAuthUser, password: this.basicAuthPassword};\n this.doPostLogin(uri, authBlob);\n } else {\n this.$rootScope.appEvent('alert-warning', [datasource.name, 'requires User/Password']);\n this.fetching.status = 'warning';\n this.fetching.title = 'User/Password required';\n\n return;\n }\n } else {\n this.doGetLogin(uri);\n }\n\n }\n\n doPostLogin(uri, authBlob){\n this.doXHR('POST', uri, authBlob);\n }\n\n doGetLogin(uri){\n this.doXHR('GET', uri)\n }\n\n doXHR(verb, uri, data){\n if( !data){\n data = \"\";\n }\n var r = new XMLHttpRequest();\n r.open(verb, uri, true);\n r.withCredentials = true;\n r.setRequestHeader('Content-Type', 'application/json');\n r.onreadystatechange = function () {\n this.handleLoginResult(r);\n }.bind(this);\n r.send(JSON.stringify(data));\n }\n\n handleLoginResult(response){\n // wait for readyState to be '4 => done'\n if (response.readyState != 4) return;\n\n this.fetching.done = true;\n\n switch(response.status){\n case 200:\n var cookie = (document.cookie.match(/^(?:.*;)?TSESSIONID=([^;]+)(?:.*)?$/)||[,null])[1]\n console.log(cookie);\n console.log(document.cookie);\n \n this.fetching.status = 'success';\n this.fetching.title = 'Login successful';\n this.$rootScope.appEvent('alert-success', ['Success', '']);\n break;\n default:\n this.fetching.status = 'warning';\n this.fetching.title = response.statusText;\n this.$rootScope.appEvent('alert-warning', [response.status+': '+response.statusText,'']);\n break;\n }\n\n if (r.readyState != 4 || r.status != 200) return;\n alert(\"Success: \" + r.Line truncated
{"version":3,"sources":["../../src/components/auths.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAO,O;;;;;;;;;;;;;;;;;;;;;2BAEM,S;AAEX,2BAAY,UAAZ,EAAwB,UAAxB,EAAoC,QAApC,EAA6C;AAAA;;AAC3C,eAAK,UAAL,GAAkB,UAAlB;AACA,eAAK,QAAL,GAAgB,QAAhB;AACA,eAAK,UAAL,GAAkB,UAAlB;AACD;;;;gCAEK,U,EAAW;AACf,iBAAK,QAAL,GAAgB,EAAhB;AACA,iBAAK,QAAL,CAAc,IAAd,GAAqB,KAArB;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ent":["import _ from 'lodash';\n\nexport class AuthsCtrl {\n\n constructor(backendSrv, $rootScope, $timeout){\n this.$rootScope = $rootScope;\n this.$timeout = $timeout;\n this.backendSrv = backendSrv;\n }\n\n login(datasource){\n this.fetching = {};\n this.fetching.done = false;\n this.fetching.show = true;\n this.fetching.status = 'warning';\n this.fetching.title = 'Fetching auths...';\n\n //this.$rootScope.appEvent('alert-success', ['Authorization Cookie Received', '']);\n //this.$rootScope.appEvent('alert-error', ['Authorization Failed', '']);\n //this.$rootScope.appEvent('alert-warning', ['Fetching Authorizations', '']);\n\n var uri = this._getURI(datasource.jsonData);\n\n if(datasource.jsonData.basicAuths){\n if( this.basicAuthUser && this.basicAuthPassword){\n var authBlob = {username: this.basicAuthUser, password: this.basicAuthPassword};\n this.doPostLogin(uri, authBlob);\n } else {\n this.$rootScope.appEvent('alert-warning', [datasource.name, 'requires User/Password']);\n this.fetching.status = 'warning';\n this.fetching.title = 'User/Password required';\n\n return;\n }\n } else {\n this.doGetLogin(uri);\n }\n\n }\n\n doPostLogin(uri, authBlob){\n this.doXHR('POST', uri, authBlob);\n }\n\n doGetLogin(uri){\n this.doXHR('GET', uri)\n }\n\n doXHR(verb, uri, data){\n if( !data){\n data = \"\";\n }\n var r = new XMLHttpRequest();\n r.open(verb, uri, true);\n r.withCredentials = true;\n r.setRequestHeader('Content-Type', 'application/json');\n r.onreadystatechange = function () {\n this.handleLoginResult(r);\n }.bind(this);\n r.send(JSON.stringify(data));\n }\n\n handleLoginResult(response){\n // wait for readyState to be '4 => done'\n if (response.readyState != 4) return;\n\n this.fetching.done = true;\n\n switch(response.status){\n case 200:\n console.log(this.getCookie('TSESSIONID'))\n\n this.fetching.status = 'success';\n this.fetching.title = 'Login successful';\n this.$rootScope.appEvent('alert-success', ['Success', '']);\n break;\n default:\n this.fetching.status = 'warning';\n this.fetching.title = response.statusText;\n this.$rootScope.appEvent('alert-warning', [response.status+': '+response.statusText,'']);\n break;\n }\n\n if (r.readyState != 4 || r.status != 200) return;\n alert(\"Success: \" + r.getResponseHeader('Set-CookiLine truncated
+67
View File
@@ -0,0 +1,67 @@
<div class="page-header">
<h1>Websocket Test</h1>
</div>
<div ng-hide="ctrl.websocketSupported" >
<h4>WebSockets are not suppported in this browser.</h4>
</div>
<div class="gf-box" ng-show="ctrl.websocketSupported">
<div class="gf-box-header">
<div class="gf-form-inline">
<div class="gf-form max-width-30">
<span class="gf-label width-7 p-y-1 p-x-1">Metric</span>
<div class="gf-form-select-wrapper gf-form-select-wrapper--has-help-icon max-width-24">
<input type="text" class="gf-form-input"
spellcheck='false'
data-min-length=0
data-items=100
ng-model="metricName"
placeholder="sys.">
<info-popover mode="right-absolute">
Type a Metric name<br>
</info-popover>
<div ng-hide="ctrl.fetching" class="gf-row">
<button type="submit" class="btn btn-success" ng-click="ctrl.start(metricName)">
Start
</button>
</div>
<div ng-show="ctrl.fetching" class="gf-row">
<button type="submit" class="btn btn-warning" ng-click="ctrl.stop(metricName)">
Stop
</button>
</div>
</div>
</div>
</div>
</div>
<div class="gf-box-body">
<div class="grafana-options-table">
<p>{{ctrl.metric_count}}</p>
<table>
<tr>
<th>Metric</th>
<th>Tags</th>
<th>Values</th>
</tr>
<tr>
<td>{{ctrl.metric['metric']}}</td>
<!--td class="p-x-1" ng-repeat="tag in ctrl.metric.tags">
{{tag.key}} = {{tag.value}}
</td -->
<td>{{ctrl.metric.timestamp}} -> {{ctrl.metric.value}}</td>
</tr>
</table>
</div>
</div>
</div>
+164
View File
@@ -0,0 +1,164 @@
'use strict';
System.register(['plugins/timely-app/components/authspage'], function (_export, _context) {
"use strict";
var AuthsPageCtrl, _createClass, WebsocketCtrl;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
return {
setters: [function (_pluginsTimelyAppComponentsAuthspage) {
AuthsPageCtrl = _pluginsTimelyAppComponentsAuthspage.AuthsPageCtrl;
}],
execute: function () {
_createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
_export('WebsocketCtrl', WebsocketCtrl = function () {
function WebsocketCtrl($scope, $timeout, backendSrv, datasourceSrv) {
_classCallCheck(this, WebsocketCtrl);
this.$scope = $scope;
this.$timeout = $timeout;
var actrl = new AuthsPageCtrl(backendSrv, datasourceSrv);
var datasources = actrl.getTimelyDatasources();
this.datasource = datasources[0].jsonData;
this.websocketSupported = false;
if (window.WebSocket) {
this.websocketSupported = true;
}
this.metric_count = 0;
this.metric = { 'metric': 'empty',
'tags': [],
'timestamp': 0,
'value': 0.0
};
this.fetching = false;
}
_createClass(WebsocketCtrl, [{
key: 'start',
value: function start(metric) {
this.fetching = true;
var addr = this._getWebsocketAddress();
this.sock = new WebSocket(addr);
this.sock.onmessage = this._handleMessage.bind(this);
this.sock.onopen = this._handleOpen.bind(this);
this.sock.onclose = this._handleClose.bind(this);
}
}, {
key: 'stop',
value: function stop(metric) {
this.fetching = false;
this.sock.close();
}
}, {
key: '_handleMessage',
value: function _handleMessage(message) {
//console.log('handleMessage');
var metric = JSON.parse(message.data);
this.metric.metric = metric.metric;
this.metric.timestamp = metric.timestamp;
this.metric.value = metric.value;
this.metric.tags = metric.tags;
this.metric_count = this.metric_count + 1;
this.$scope.$digest();
//if( this.metrics.length >= 16){
// this.metrics.shift();
//}
//this.$scope.$apply( function(){
// this.metrics.push(metric);
// this.metric_count = this.metric_count + 1;
// }.bind(this));
}
}, {
key: '_handleOpen',
value: function _handleOpen() {
var create = {
"operation": "create",
"subscriptionId": "12345"
};
this.sock.send(JSON.stringify(create));
var m1 = {
"operation": "add",
"subscriptionId": "12345",
"metric": "sys.cpu.user"
};
this.sock.send(JSON.stringify(m1));
// var m2 = {
// "operation" : "add",
// "subscriptionId" : "12345",
// "metric" : "timely.keys.metric.inserted"
// }
// this.sock.send(JSON.stringify(m2));
}
}, {
key: '_handleClose',
value: function _handleClose() {
console.log("Websocket Closed");
}
}, {
key: '_getWebsocketAddress',
value: function _getWebsocketAddress() {
return "wss://" + this.datasource.timelyHost + ":" + this.datasource.wsPort + "/websocket";
}
}]);
return WebsocketCtrl;
}());
_export('WebsocketCtrl', WebsocketCtrl);
WebsocketCtrl.templateUrl = 'components/websocket.html';
// example metric message
//{
// "metric" : "sys.cpu.user",
// "timestamp":1469028728091,
// "value":1.0,
// "tags":
// [
// {
// "key":"rack",
// "value":"r1"
// },{
// "key":"tag3",
// "value":"value3"
// },{
// "key":"tag4",
// "value":"value4"
// }
// ],
// "subscriptionId":"<unique id>"
//}
}
};
});
//# sourceMappingURL=websocket.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../src/components/websocket.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AACQ,mB,wCAAA,a;;;;;;;;;;;;;;;;;;;;;+BAGK,a;AAEX,+BAAY,MAAZ,EAAoB,QAApB,EAA8B,UAA9B,EAA0C,aAA1C,EAAyD;AAAA;;AACvD,eAAK,MAAL,GAAc,MAAd;AACA,eAAK,QAAL,GAAgB,QAAhB;;AAEA,cAAI,QAAQ,IAAI,aAAJ,CAAkB,UAAlB,EAA8B,aAA9B,CAAZ;;AAEA,cAAI,cAAc,MAAM,oBAAN,EAAlB;AACA,eAAK,UAAL,GAAkB,YAAY,CAAZ,EAAe,QAAjC;;AAEA,eAAK,kBAAL,GAA0B,KAA1B;AACA,cAAI,OAAO,SAAX,EAAsB;AAClB,iBAAK,kBAAL,GAA0B,IAA1B;AACH;AACD,eAAK,YAAL,GAAoB,CAApB;AACA,eAAK,MAAL,GAAc,EAAE,UAAU,OAAZ;AACE,oBAAO,EADT;AAEE,yBAAa,CAFf;AAGE,qBAAS;AAHX,WAAd;;AAMA,e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;AACA;AACA;AACA;AACA;AACA;AACG;;;yCAEa;AACZ,oBAAQ,GAAR,CAAY,kBAAZ;AACD;;;iDAEqB;AACpB,mBAAO,WAAW,KAAK,UAAL,CAAgB,UAA3B,GAAwC,GAAxC,GAA8C,KAAK,UAAL,CAAgB,MAA9D,GAAuE,YAA9E;AACD;;;;;;;;AAGH,oBAAc,WAAd,GAA4B,2BAA5B;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"websocket.js","sourcesContent":["\nimport {AuthsPageCtrl} from 'plugins/timely-app/components/authspage'\n\n\nexport class WebsocketCtrl {\n\n constructor($scope, $timeout, backendSrv, datasourceSrv) {\n this.$scope = $scope;\n this.$timeout = $timeout;\n\n var actrl = new AuthsPageCtrl(backendSrv, datasourceSrv);\n\n var datasources = actrl.getTimelyDatasources();\n this.datasource = datasources[0].jsonData;\n\n this.websocketSupported = false;\n if( window.WebSocket ){\n this.websocketSupported = true;\n }\n this.metric_count = 0;\n this.metric = { 'metric': 'empty',\n 'tags':[],\n 'timestamp': 0,\n 'value': 0.0\n };\n\n this.fetching = false;\n }\n\n start(metric){\n this.fetching = true;\n var addr = this._getWebsocketAddress();\n this.sock = new WebSocket(addr);\n this.sock.onmessage = this._handleMessage.bind(this);\n this.sock.onopen = this._handleOpen.bind(this);\n this.sock.onclose = this._handleClose.bind(this);\n }\n\n stop(metric) {\n this.fetching = false;\n this.sock.close();\n }\n\n _handleMessage(message){\n //console.log('handleMessage');\n var metric = JSON.parse(message.data);\n\n this.metric.metric = metric.metric;\n this.metric.timestamp = metric.timestamp;\n this.metric.value = metric.value;\n this.metric.tags = metric.tags;\n this.metric_count = this.metric_count+1;\n this.$scope.$digest();\n //if( this.metrics.length >= 16){\n // this.metrics.shift();\n //}\n //this.$scope.$apply( function(){\n // this.metrics.push(metric);\n // this.metric_count = this.metric_count + 1;\n // }.bind(this));\n }\n\n _handleOpen(){\n var create = {\n \"operation\" : \"create\",\n \"subscriptionId\" : \"12345\"\n }\n this.sock.send(JSON.stringify(create));\n\n var m1 = {\n \"operation\" : \"add\",\n \"subscriptionId\" : \"12345\",\n \"metric\" : \"sys.cpu.user\"\n }\n this.sock.send(JSON.stringify(m1));\n\n// var m2 = {\n// \"operation\" : \"add\",\n// \"subscriptionId\" : \"12345\",\n// \"metric\" : \"timely.keys.metric.inserted\"\n// }\n// this.sock.send(JSON.stringify(m2));\n }\n\n _handleClose(){\n console.log(\"Websocket Closed\")\n }\n\n _getWebsocketAddress(){\n return \"wss://\" + this.datasource.timelyHost + \":\" + this.datasource.wsPort + \"/websocket\";\n }\n\n}\nWebsocketCtrl.templateUrl = 'components/websocket.html';\n\n\n// example metric message\n//{\n// \"metric\" : \"sys.cpu.user\",\n// \"timestamp\":1469028728091,\n// \"value\":1.0,\n// \"tags\":\n// [\n// {\n// \"key\":\"rack\",\n// \"value\":\"r1\"\n// },{\n// \"key\":\"tag3\",\n// \"value\":\"value3\"\n// },{\n// \"key\":\"tag4\",\n// \"value\":\"value4\"\n// }\n// ],\n// \"subscriptionId\":\"<unique id>\"\n//}\n"]}
@@ -1,15 +1,39 @@
{
"__inputs": [
{
"name": "DS_NAME",
"name": "DS_TIMELY",
"label": "Timely",
"description": "",
"type": "datasource",
"pluginId": "timely-datasource"
"pluginId": "timely-datasource",
"pluginName": "Timely"
}
],
"__requires": [
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "3.1.1"
},
{
"type": "datasource",
"id": "timely-datasource",
"name": "Timely",
"version": "1.0.0"
}
],
"id": null,
"title": "Timely Standalone Demo",
"originalTitle": "Timely Standalone Demo",
"tags": ["imported"],
"tags": [
"imported"
],
"style": "dark",
"timezone": "browser",
"editable": true,
@@ -24,7 +48,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_NAME}",
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
@@ -99,6 +123,7 @@
"tooltip": {
"msResolution": true,
"shared": false,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
@@ -134,7 +159,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_NAME}",
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
@@ -146,6 +171,94 @@
},
"id": 2,
"isNew": true,
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"aggregator": "max",
"alias": "$tag_host $tag_instance",
"currentTagKey": "",
"currentTagValue": "",
"disableDownsampling": false,
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu.user",
"refId": "A",
"tags": {
"host": ".*",
"instance": ".*"
}
}
],
"timeFrom": null,
"timeShift": null,
"title": "CPU User by Instance",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 5,
"isNew": true,
"legend": {
"alignAsTable": true,
"avg": false,
@@ -179,7 +292,7 @@
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"metric": "sys.cpu.user",
"refId": "A",
"tags": {
"host": ".*"
@@ -190,8 +303,9 @@
"timeShift": null,
"title": "CPU User by Host",
"tooltip": {
"msResolution": false,
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
@@ -220,7 +334,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_NAME}",
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
@@ -265,7 +379,7 @@
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"metric": "sys.cpu.user",
"refId": "A",
"tags": {
"rack": ".*"
@@ -276,8 +390,9 @@
"timeShift": null,
"title": "CPU User by Rack",
"tooltip": {
"msResolution": false,
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
@@ -306,7 +421,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_NAME}",
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
@@ -351,7 +466,7 @@
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"metric": "sys.cpu.user",
"refId": "A",
"tags": {}
}
@@ -360,8 +475,9 @@
"timeShift": null,
"title": "Cumulative CPU",
"tooltip": {
"msResolution": false,
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
@@ -429,6 +545,7 @@
},
"refresh": "5s",
"schemaVersion": 12,
"version": 1,
"links": []
}
"version": 0,
"links": [],
"gnetId": null
}
+6 -2
View File
@@ -1,9 +1,9 @@
'use strict';
System.register(['./components/config', './components/metrics', './components/authspage'], function (_export, _context) {
System.register(['./components/config', './components/metrics', './components/authspage', './components/websocket'], function (_export, _context) {
"use strict";
var TimelyAppConfigCtrl, MetricsPageCtrl, AuthsPageCtrl;
var TimelyAppConfigCtrl, MetricsPageCtrl, AuthsPageCtrl, WebsocketCtrl;
return {
setters: [function (_componentsConfig) {
TimelyAppConfigCtrl = _componentsConfig.TimelyAppConfigCtrl;
@@ -11,6 +11,8 @@ System.register(['./components/config', './components/metrics', './components/au
MetricsPageCtrl = _componentsMetrics.MetricsPageCtrl;
}, function (_componentsAuthspage) {
AuthsPageCtrl = _componentsAuthspage.AuthsPageCtrl;
}, function (_componentsWebsocket) {
WebsocketCtrl = _componentsWebsocket.WebsocketCtrl;
}],
execute: function () {
_export('ConfigCtrl', TimelyAppConfigCtrl);
@@ -18,6 +20,8 @@ System.register(['./components/config', './components/metrics', './components/au
_export('MetricsPageCtrl', MetricsPageCtrl);
_export('AuthsPageCtrl', AuthsPageCtrl);
_export('WebsocketPageCtrl', WebsocketCtrl);
}
};
});
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["../src/module.js"],"names":[],"mappings":";;;;;;;;AAAQ,yB,qBAAA,mB;;AACA,qB,sBAAA,e;;AACA,mB,wBAAA,a;;;4BAGN,mB;;iCACA,e;;+BACA,a","file":"module.js","sourcesContent":["import {TimelyAppConfigCtrl} from './components/config';\nimport {MetricsPageCtrl} from './components/metrics';\nimport {AuthsPageCtrl} from './components/authspage';\n\nexport {\n TimelyAppConfigCtrl as ConfigCtrl,\n MetricsPageCtrl,\n AuthsPageCtrl\n};\n"]}
{"version":3,"sources":["../src/module.js"],"names":[],"mappings":";;;;;;;;AAAQ,yB,qBAAA,mB;;AACA,qB,sBAAA,e;;AACA,mB,wBAAA,a;;AACA,mB,wBAAA,a;;;4BAGN,mB;;iCACA,e;;+BACA,a;;mCACA,a","file":"module.js","sourcesContent":["import {TimelyAppConfigCtrl} from './components/config';\nimport {MetricsPageCtrl} from './components/metrics';\nimport {AuthsPageCtrl} from './components/authspage';\nimport {WebsocketCtrl} from './components/websocket';\n\nexport {\n TimelyAppConfigCtrl as ConfigCtrl,\n MetricsPageCtrl,\n AuthsPageCtrl,\n WebsocketCtrl as WebsocketPageCtrl\n};\n"]}
+3 -1
View File
@@ -30,7 +30,9 @@
"includes": [
{"type": "datasource", "name": "Timely"},
{ "type": "page", "name": "Login", "component": "AuthsPageCtrl", "role": "Viewer", "addToNav": true},
{ "type": "page", "name": "Metrics", "component": "MetricsPageCtrl", "role": "Viewer", "addToNav": true}
{ "type": "page", "name": "Metrics", "component": "MetricsPageCtrl", "role": "Viewer", "addToNav": true},
{ "type": "page", "name": "WebSocket", "component": "WebsocketPageCtrl", "role": "Viewer", "addToNav": true}
],
"dependencies": {
+3 -1
View File
@@ -30,7 +30,9 @@
"includes": [
{"type": "datasource", "name": "Timely"},
{ "type": "page", "name": "Login", "component": "AuthsPageCtrl", "role": "Viewer", "addToNav": true},
{ "type": "page", "name": "Metrics", "component": "MetricsPageCtrl", "role": "Viewer", "addToNav": true}
{ "type": "page", "name": "Metrics", "component": "MetricsPageCtrl", "role": "Viewer", "addToNav": true},
{ "type": "page", "name": "WebSocket", "component": "WebsocketPageCtrl", "role": "Viewer", "addToNav": true}
],
"dependencies": {
+8 -4
View File
@@ -68,10 +68,8 @@ export class AuthsCtrl {
switch(response.status){
case 200:
var cookie = (document.cookie.match(/^(?:.*;)?TSESSIONID=([^;]+)(?:.*)?$/)||[,null])[1]
console.log(cookie);
console.log(document.cookie);
console.log(this.getCookie('TSESSIONID'))
this.fetching.status = 'success';
this.fetching.title = 'Login successful';
this.$rootScope.appEvent('alert-success', ['Success', '']);
@@ -87,6 +85,12 @@ export class AuthsCtrl {
alert("Success: " + r.getResponseHeader('Set-Cookie'));
}
getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
_getURI(jsonData){
return 'https://'+jsonData.timelyHost+':'+jsonData.httpsPort+'/login'
}
@@ -0,0 +1,67 @@
<div class="page-header">
<h1>Websocket Test</h1>
</div>
<div ng-hide="ctrl.websocketSupported" >
<h4>WebSockets are not suppported in this browser.</h4>
</div>
<div class="gf-box" ng-show="ctrl.websocketSupported">
<div class="gf-box-header">
<div class="gf-form-inline">
<div class="gf-form max-width-30">
<span class="gf-label width-7 p-y-1 p-x-1">Metric</span>
<div class="gf-form-select-wrapper gf-form-select-wrapper--has-help-icon max-width-24">
<input type="text" class="gf-form-input"
spellcheck='false'
data-min-length=0
data-items=100
ng-model="metricName"
placeholder="sys.">
<info-popover mode="right-absolute">
Type a Metric name<br>
</info-popover>
<div ng-hide="ctrl.fetching" class="gf-row">
<button type="submit" class="btn btn-success" ng-click="ctrl.start(metricName)">
Start
</button>
</div>
<div ng-show="ctrl.fetching" class="gf-row">
<button type="submit" class="btn btn-warning" ng-click="ctrl.stop(metricName)">
Stop
</button>
</div>
</div>
</div>
</div>
</div>
<div class="gf-box-body">
<div class="grafana-options-table">
<p>{{ctrl.metric_count}}</p>
<table>
<tr>
<th>Metric</th>
<th>Tags</th>
<th>Values</th>
</tr>
<tr>
<td>{{ctrl.metric['metric']}}</td>
<!--td class="p-x-1" ng-repeat="tag in ctrl.metric.tags">
{{tag.key}} = {{tag.value}}
</td -->
<td>{{ctrl.metric.timestamp}} -> {{ctrl.metric.value}}</td>
</tr>
</table>
</div>
</div>
</div>
@@ -0,0 +1,116 @@
import {AuthsPageCtrl} from 'plugins/timely-app/components/authspage'
export class WebsocketCtrl {
constructor($scope, $timeout, backendSrv, datasourceSrv) {
this.$scope = $scope;
this.$timeout = $timeout;
var actrl = new AuthsPageCtrl(backendSrv, datasourceSrv);
var datasources = actrl.getTimelyDatasources();
this.datasource = datasources[0].jsonData;
this.websocketSupported = false;
if( window.WebSocket ){
this.websocketSupported = true;
}
this.metric_count = 0;
this.metric = { 'metric': 'empty',
'tags':[],
'timestamp': 0,
'value': 0.0
};
this.fetching = false;
}
start(metric){
this.fetching = true;
var addr = this._getWebsocketAddress();
this.sock = new WebSocket(addr);
this.sock.onmessage = this._handleMessage.bind(this);
this.sock.onopen = this._handleOpen.bind(this);
this.sock.onclose = this._handleClose.bind(this);
}
stop(metric) {
this.fetching = false;
this.sock.close();
}
_handleMessage(message){
//console.log('handleMessage');
var metric = JSON.parse(message.data);
this.metric.metric = metric.metric;
this.metric.timestamp = metric.timestamp;
this.metric.value = metric.value;
this.metric.tags = metric.tags;
this.metric_count = this.metric_count+1;
this.$scope.$digest();
//if( this.metrics.length >= 16){
// this.metrics.shift();
//}
//this.$scope.$apply( function(){
// this.metrics.push(metric);
// this.metric_count = this.metric_count + 1;
// }.bind(this));
}
_handleOpen(){
var create = {
"operation" : "create",
"subscriptionId" : "12345"
}
this.sock.send(JSON.stringify(create));
var m1 = {
"operation" : "add",
"subscriptionId" : "12345",
"metric" : "sys.cpu.user"
}
this.sock.send(JSON.stringify(m1));
// var m2 = {
// "operation" : "add",
// "subscriptionId" : "12345",
// "metric" : "timely.keys.metric.inserted"
// }
// this.sock.send(JSON.stringify(m2));
}
_handleClose(){
console.log("Websocket Closed")
}
_getWebsocketAddress(){
return "wss://" + this.datasource.timelyHost + ":" + this.datasource.wsPort + "/websocket";
}
}
WebsocketCtrl.templateUrl = 'components/websocket.html';
// example metric message
//{
// "metric" : "sys.cpu.user",
// "timestamp":1469028728091,
// "value":1.0,
// "tags":
// [
// {
// "key":"rack",
// "value":"r1"
// },{
// "key":"tag3",
// "value":"value3"
// },{
// "key":"tag4",
// "value":"value4"
// }
// ],
// "subscriptionId":"<unique id>"
//}
@@ -1,15 +1,39 @@
{
"__inputs": [
{
"name": "DS_NAME",
"name": "DS_TIMELY",
"label": "Timely",
"description": "",
"type": "datasource",
"pluginId": "timely-datasource"
"pluginId": "timely-datasource",
"pluginName": "Timely"
}
],
"__requires": [
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "3.1.1"
},
{
"type": "datasource",
"id": "timely-datasource",
"name": "Timely",
"version": "1.0.0"
}
],
"id": null,
"title": "Timely Standalone Demo",
"originalTitle": "Timely Standalone Demo",
"tags": ["imported"],
"tags": [
"imported"
],
"style": "dark",
"timezone": "browser",
"editable": true,
@@ -24,7 +48,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_NAME}",
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
@@ -99,6 +123,7 @@
"tooltip": {
"msResolution": true,
"shared": false,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
@@ -134,7 +159,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_NAME}",
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
@@ -146,6 +171,94 @@
},
"id": 2,
"isNew": true,
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"aggregator": "max",
"alias": "$tag_host $tag_instance",
"currentTagKey": "",
"currentTagValue": "",
"disableDownsampling": false,
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu.user",
"refId": "A",
"tags": {
"host": ".*",
"instance": ".*"
}
}
],
"timeFrom": null,
"timeShift": null,
"title": "CPU User by Instance",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 5,
"isNew": true,
"legend": {
"alignAsTable": true,
"avg": false,
@@ -179,7 +292,7 @@
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"metric": "sys.cpu.user",
"refId": "A",
"tags": {
"host": ".*"
@@ -190,8 +303,9 @@
"timeShift": null,
"title": "CPU User by Host",
"tooltip": {
"msResolution": false,
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
@@ -220,7 +334,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_NAME}",
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
@@ -265,7 +379,7 @@
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"metric": "sys.cpu.user",
"refId": "A",
"tags": {
"rack": ".*"
@@ -276,8 +390,9 @@
"timeShift": null,
"title": "CPU User by Rack",
"tooltip": {
"msResolution": false,
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
@@ -306,7 +421,7 @@
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_NAME}",
"datasource": "${DS_TIMELY}",
"editable": true,
"error": false,
"fill": 1,
@@ -351,7 +466,7 @@
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"metric": "sys.cpu.user",
"refId": "A",
"tags": {}
}
@@ -360,8 +475,9 @@
"timeShift": null,
"title": "Cumulative CPU",
"tooltip": {
"msResolution": false,
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
@@ -429,6 +545,7 @@
},
"refresh": "5s",
"schemaVersion": 12,
"version": 1,
"links": []
}
"version": 0,
"links": [],
"gnetId": null
}
+3 -1
View File
@@ -1,9 +1,11 @@
import {TimelyAppConfigCtrl} from './components/config';
import {MetricsPageCtrl} from './components/metrics';
import {AuthsPageCtrl} from './components/authspage';
import {WebsocketCtrl} from './components/websocket';
export {
TimelyAppConfigCtrl as ConfigCtrl,
MetricsPageCtrl,
AuthsPageCtrl
AuthsPageCtrl,
WebsocketCtrl as WebsocketPageCtrl
};
+2 -2
View File
@@ -9,9 +9,9 @@ RUN yum -y update && \
yum -y install java-1.8.0-openjdk-devel maven openssl apr && \
mkdir -p /timely/bin
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el7_2.x86_64
ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk
EXPOSE 9804 54321 54322
EXPOSE 9804 54321 54322 54323
ENV TIMELY_VERSION 0.0.3-SNAPSHOT
+3 -3
View File
@@ -27,7 +27,7 @@
#################################### Server ####################################
[server]
# Protocol (http or https)
protocol = https
protocol = http
# The ip address to bind to, empty will bind to all interfaces
;http_addr =
@@ -55,8 +55,8 @@ http_port = 3000
;enable_gzip = false
# https certs & key file
cert_file = /etc/grafana/pki/timely-cert.pem
cert_key = /etc/grafana/pki/timely-key.pem
;cert_file = /etc/grafana/pki/timely-cert.pem
;cert_key = /etc/grafana/pki/timely-key.pem
#################################### Database ####################################
[database]
-429
View File
@@ -1,429 +0,0 @@
{"dashboard":
{
"id": null,
"title": "StandaloneTest",
"originalTitle": "StandaloneTest",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": "Timely",
"editable": true,
"error": false,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)",
"thresholdLine": false
},
"id": 1,
"legend": {
"alignAsTable": true,
"avg": false,
"current": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": true,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"aggregator": "sum",
"disableDownsampling": false,
"downsampleAggregator": "avg",
"downsampleFillPolicy": "none",
"downsampleInterval": "",
"errors": {},
"isCounter": false,
"metric": "timely.metrics.received",
"refId": "A",
"shouldComputeRate": false
},
{
"aggregator": "sum",
"disableDownsampling": false,
"downsampleAggregator": "avg",
"downsampleFillPolicy": "none",
"downsampleInterval": "",
"errors": {},
"metric": "timely.keys.meta.inserted",
"refId": "B"
},
{
"aggregator": "sum",
"disableDownsampling": false,
"downsampleAggregator": "avg",
"downsampleFillPolicy": "none",
"downsampleInterval": "",
"errors": {},
"metric": "timely.keys.metric.inserted",
"refId": "C"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Timely Status",
"tooltip": {
"msResolution": true,
"shared": false,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": "Keys",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"logBase": 1,
"max": null,
"min": null,
"show": false
}
]
}
],
"title": "Row"
},
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": "Timely",
"editable": true,
"error": false,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 2,
"isNew": true,
"legend": {
"alignAsTable": true,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"aggregator": "max",
"alias": "$tag_host",
"currentTagKey": "",
"currentTagValue": "",
"disableDownsampling": false,
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"refId": "A",
"tags": {
"host": ".*"
}
}
],
"timeFrom": null,
"timeShift": null,
"title": "CPU User by Host",
"tooltip": {
"msResolution": false,
"shared": true,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"datasource": "Timely",
"editable": true,
"error": false,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 3,
"isNew": true,
"legend": {
"alignAsTable": true,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"aggregator": "max",
"alias": "$tag_rack",
"currentTagKey": "",
"currentTagValue": "",
"disableDownsampling": false,
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"refId": "A",
"tags": {
"rack": ".*"
}
}
],
"timeFrom": null,
"timeShift": null,
"title": "CPU User by Rack",
"tooltip": {
"msResolution": false,
"shared": true,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"datasource": "Timely",
"editable": true,
"error": false,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 4,
"isNew": true,
"legend": {
"alignAsTable": true,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"aggregator": "max",
"alias": "",
"currentTagKey": "",
"currentTagValue": "",
"disableDownsampling": false,
"downsampleAggregator": "max",
"downsampleFillPolicy": "none",
"downsampleInterval": "1s",
"metric": "sys.cpu0.user",
"refId": "A",
"tags": {}
}
],
"timeFrom": null,
"timeShift": null,
"title": "Cumulative CPU",
"tooltip": {
"msResolution": false,
"shared": true,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"title": "New row"
}
],
"time": {
"from": "now-15m",
"to": "now"
},
"timepicker": {
"now": true,
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"templating": {
"list": []
},
"annotations": {
"list": []
},
"refresh": "5s",
"schemaVersion": 12,
"version": 1,
"links": []
}
}
+6 -7
View File
@@ -23,17 +23,16 @@ timely.metrics.report.tags.ignored=
timely.meta.cache.expiration.minutes=60
timely.meta.cache.initial.capacity=2000
timely.meta.cache.max.capacity=10000
timely.ssl.certificate.file=/timely-server-src/bin/docker/grafana/pki/timely-cert.pem
timely.ssl.key.file=/timely-server-src/bin/docker/grafana/pki/timely-pkcs8-key.pem
timely.ssl.key.pass=timely
timely.ssl.use.generated.keypair=false
timely.ssl.trust.store.file=/timely-server-src/bin/docker/grafana/pki/timely-ca.pem
#timely.ssl.certificate.file=/timely-server-src/bin/docker/grafana/pki/timely-cert.pem
#timely.ssl.key.file=/timely-server-src/bin/docker/grafana/pki/timely-pkcs8-key.pem
#timely.ssl.key.pass=timely
timely.ssl.use.generated.keypair=true
#timely.ssl.trust.store.file=/timely-server-src/bin/docker/grafana/pki/timely-ca.pem
timely.ssl.use.openssl=true
#timely.ssl.use.ciphers=
timely.session.max.age=86400
timely.http.host=localhost
timely.allow.anonymous.access=true
timely.web.socket.timeout=60
timely.ws.subscription.lag=120
timely.http.redirect.path=/secure-me
timely.ws.subscription.lag=1
timely.hsts.max.age=608400
-1
View File
@@ -35,5 +35,4 @@ timely.http.host=
timely.allow.anonymous.access=false
timely.web.socket.timeout=60
timely.ws.subscription.lag=120
timely.http.redirect.path=/secure-me
timely.hsts.max.age=608400
+1
View File
@@ -7,6 +7,7 @@ services:
- "9804:9804" # standalone zookeeper
- "54321:54321" # timely put
- "54322:54322" # timely query
- "54323:54323" # timely ws
volumes:
- ${PWD}/:/timely-server-src
command: /timely-server-src/bin/docker/deploy-startup-standalone.sh