From 0e5cd2efbad0fed721386a59b1e390d48e31229b Mon Sep 17 00:00:00 2001 From: Tom Zhang Date: Wed, 24 Aug 2016 13:08:46 +0930 Subject: [PATCH 01/30] enable expanding MACRO in trigger descriptions --- src/datasource-zabbix/zabbixAPI.service.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/datasource-zabbix/zabbixAPI.service.js b/src/datasource-zabbix/zabbixAPI.service.js index df8bcf4..fda4a29 100644 --- a/src/datasource-zabbix/zabbixAPI.service.js +++ b/src/datasource-zabbix/zabbixAPI.service.js @@ -327,6 +327,7 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) { applicationids: applicationids, expandDescription: true, expandData: true, + expandComment: true, monitored: true, skipDependent: true, //only_true: true, From 614ee123b1c4e831fca6d953b49d2a967aae025d Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Thu, 15 Sep 2016 12:34:31 +0300 Subject: [PATCH 02/30] Update contribution guidelines. --- .github/CONTRIBUTING.md | 19 +++++++++++++++++++ CONTRIBUTING.md | 1 - 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .github/CONTRIBUTING.md delete mode 100644 CONTRIBUTING.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..e2c2034 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,19 @@ +##Contributing to Grafana-Zabbix + +#### I'm submitting a ... +- [ ] Bug report +- [ ] Feature request +- [ ] Question / Support request + +#### For bug report please include this information: +- What Grafana version are you using? +- What Zabbix version are you using? +- What zabbix plugin version are you using? +- What OS are you running grafana on? +- What did you do? +- What was the expected result? +- What happened instead? + +**IMPORTANT** If it relates to metric data visualization would be great to get: +- An image or text representation of your metric query +- The raw query and response for the network request (check this in chrome dev tools network tab, here you can see metric requests and other request, please include the request body and request response) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index be343e6..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1 +0,0 @@ -# Contributing to Grafana-Zabbix \ No newline at end of file From a997dc9ac374ee50b8f2a670650eaef8e1d665dd Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Thu, 15 Sep 2016 12:37:06 +0300 Subject: [PATCH 03/30] Add issue template. --- .github/{CONTRIBUTING.md => ISSUE_TEMPLATE.md} | 2 -- 1 file changed, 2 deletions(-) rename .github/{CONTRIBUTING.md => ISSUE_TEMPLATE.md} (95%) diff --git a/.github/CONTRIBUTING.md b/.github/ISSUE_TEMPLATE.md similarity index 95% rename from .github/CONTRIBUTING.md rename to .github/ISSUE_TEMPLATE.md index e2c2034..1e848bf 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,5 +1,3 @@ -##Contributing to Grafana-Zabbix - #### I'm submitting a ... - [ ] Bug report - [ ] Feature request From 5a1a2278798813ebc549f92b547454c7f57caaa4 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Thu, 15 Sep 2016 12:48:05 +0300 Subject: [PATCH 04/30] Write contribution guidelines. --- .github/CONTRIBUTING.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/CONTRIBUTING.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..4242942 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,15 @@ +## How to contribute to Grafana-Zabbix + +#### **Did you find a bug?** + +* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/alexanderzobnin/grafana-zabbix/issues). + +* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/alexanderzobnin/grafana-zabbix/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible. + +#### **Did you write a patch that fixes a bug?** + +* Open a new GitHub pull request with the patch. + +* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. + +Thanks! :heart: :heart: :heart: From 74503655bd55956af37e52227b80f1e8ced3fa7e Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Thu, 15 Sep 2016 22:14:26 +0300 Subject: [PATCH 05/30] Fixed missed lodash indexBy() after upgrade to 4.x. --- src/datasource-zabbix/datasource.js | 2 +- src/datasource-zabbix/queryProcessor.service.js | 2 +- src/datasource-zabbix/zabbixCache.service.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index 932920d..7f04e80 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -378,7 +378,7 @@ export class ZabbixAPIDatasource { return self.zabbixAPI .getEvents(objectids, timeFrom, timeTo, showOkEvents) .then(events => { - var indexedTriggers = _.indexBy(triggers, 'triggerid'); + var indexedTriggers = _.groupBy(triggers, 'triggerid'); // Hide acknowledged events if option enabled if (annotation.hideAcknowledged) { diff --git a/src/datasource-zabbix/queryProcessor.service.js b/src/datasource-zabbix/queryProcessor.service.js index 557b2f1..6931468 100644 --- a/src/datasource-zabbix/queryProcessor.service.js +++ b/src/datasource-zabbix/queryProcessor.service.js @@ -230,7 +230,7 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) { // Group history by itemid var grouped_history = _.groupBy(history, 'itemid'); - var hosts = _.indexBy(_.flatten(_.map(items, 'hosts')), 'hostid'); + var hosts = _.groupBy(_.flatten(_.map(items, 'hosts')), 'hostid'); return _.map(grouped_history, function(hist, itemid) { var item = _.find(items, {'itemid': itemid}); diff --git a/src/datasource-zabbix/zabbixCache.service.js b/src/datasource-zabbix/zabbixCache.service.js index e4c9868..9970568 100644 --- a/src/datasource-zabbix/zabbixCache.service.js +++ b/src/datasource-zabbix/zabbixCache.service.js @@ -117,7 +117,7 @@ angular.module('grafana.services').factory('ZabbixCachingProxy', function($q, $i var deferred = this.$q.defer(); var historyStorage = this.storage.history; var full_history; - var expired = _.filter(_.indexBy(items, 'itemid'), function(item, itemid) { + var expired = _.filter(_.groupBy(items, 'itemid'), function(item, itemid) { return !historyStorage[itemid]; }); if (expired.length) { From 70503a0647bdaab5e4252f0d874241f77b3bb976 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 17 Sep 2016 21:25:26 +0300 Subject: [PATCH 06/30] Fixed lodash migration issues after upgrade to 4.x. Moved: _.contains -> _.includes _.object -> _.zipObject _.first - replaced by native slice() --- src/datasource-zabbix/datasource.js | 10 +++++----- src/datasource-zabbix/utils.js | 2 +- src/panel-triggers/module.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index 7f04e80..2e914a4 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -158,7 +158,7 @@ export class ZabbixAPIDatasource { // Find trendValue() function and get specified trend value var trendFunctions = _.map(metricFunctions.getCategories()['Trends'], 'name'); var trendValueFunc = _.find(target.functions, func => { - return _.contains(trendFunctions, func.def.name); + return _.includes(trendFunctions, func.def.name); }); var valueType = trendValueFunc ? trendValueFunc.params[0] : "avg"; @@ -196,7 +196,7 @@ export class ZabbixAPIDatasource { let aggFuncNames = _.map(metricFunctions.getCategories()['Aggregate'], 'name'); let lastAgg = _.findLast(target.functions, func => { - return _.contains(aggFuncNames, func.def.name); + return _.includes(aggFuncNames, func.def.name); }); timeseries_data = [ @@ -307,7 +307,7 @@ export class ZabbixAPIDatasource { } parts.push(part); }); - let template = _.object(['group', 'host', 'app', 'item'], parts); + let template = _.zipObject(['group', 'host', 'app', 'item'], parts); // Get items if (parts.length === 4) { @@ -414,7 +414,7 @@ export class ZabbixAPIDatasource { function bindFunctionDefs(functionDefs, category) { var aggregationFunctions = _.map(metricFunctions.getCategories()[category], 'name'); var aggFuncDefs = _.filter(functionDefs, function(func) { - return _.contains(aggregationFunctions, func.def.name); + return _.includes(aggregationFunctions, func.def.name); }); return _.map(aggFuncDefs, function(func) { @@ -426,7 +426,7 @@ function bindFunctionDefs(functionDefs, category) { function filterFunctionDefs(funcs, category) { let filteredFuncs = _.map(metricFunctions.getCategories()[category]); return _.filter(funcs, func => { - return _.contains(filteredFuncs, func.def.name); + return _.includes(filteredFuncs, func.def.name); }); } diff --git a/src/datasource-zabbix/utils.js b/src/datasource-zabbix/utils.js index 5925da0..1f05572 100644 --- a/src/datasource-zabbix/utils.js +++ b/src/datasource-zabbix/utils.js @@ -35,7 +35,7 @@ export function isTemplateVariable(str, templateVariables) { var variables = _.map(templateVariables, variable => { return '$' + variable.name; }); - return _.contains(variables, str); + return _.includes(variables, str); } else { return false; } diff --git a/src/panel-triggers/module.js b/src/panel-triggers/module.js index 32ca76f..ce412f5 100644 --- a/src/panel-triggers/module.js +++ b/src/panel-triggers/module.js @@ -222,7 +222,7 @@ class TriggerPanelCtrl extends MetricsPanelCtrl { } // Limit triggers number - self.triggerList = _.first(triggerList, self.panel.limit); + self.triggerList = triggerList.slice(0, self.panel.limit); // Notify panel that request is finished self.setTimeQueryEnd(); From 8df8e66cbd86b216876e8b1fcb9e8157d9efb6d3 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 10:07:17 +0300 Subject: [PATCH 07/30] Bump version to 3.1.0-pre1. --- src/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin.json b/src/plugin.json index e44aaf2..9a30f99 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -31,7 +31,7 @@ {"name": "Metric Editor", "path": "img/screenshot-metric_editor.png"}, {"name": "Triggers", "path": "img/screenshot-triggers.png"} ], - "version": "3.0.0", + "version": "3.1.0-pre1", "updated": "2016-07-03" }, From f44fce8d75aff301cbb53a853c6bee79a275afb5 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 10:33:47 +0300 Subject: [PATCH 08/30] Add delta() series transform function, closes #172. --- src/datasource-zabbix/DataProcessor.js | 11 +++++++++++ src/datasource-zabbix/metricFunctions.js | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/src/datasource-zabbix/DataProcessor.js b/src/datasource-zabbix/DataProcessor.js index 0dad30d..020132f 100644 --- a/src/datasource-zabbix/DataProcessor.js +++ b/src/datasource-zabbix/DataProcessor.js @@ -151,6 +151,16 @@ export default class DataProcessor { }); } + static delta(datapoints) { + let newSeries = []; + let deltaValue; + for (var i = 1; i < datapoints.length; i++) { + deltaValue = datapoints[i][0] - datapoints[i - 1][0]; + newSeries.push([deltaValue, datapoints[i][1]]); + } + return newSeries; + } + static groupByWrapper(interval, groupFunc, datapoints) { var groupByCallback = DataProcessor.aggregationFunctions[groupFunc]; return DataProcessor.groupBy(interval, groupByCallback, datapoints); @@ -181,6 +191,7 @@ export default class DataProcessor { return { groupBy: this.groupByWrapper, scale: this.scale, + delta: this.delta, aggregateBy: this.aggregateByWrapper, average: _.partial(this.aggregateWrapper, this.AVERAGE), min: _.partial(this.aggregateWrapper, this.MIN), diff --git a/src/datasource-zabbix/metricFunctions.js b/src/datasource-zabbix/metricFunctions.js index 5616bc2..ac332ef 100644 --- a/src/datasource-zabbix/metricFunctions.js +++ b/src/datasource-zabbix/metricFunctions.js @@ -39,6 +39,13 @@ addFuncDef({ defaultParams: [100], }); +addFuncDef({ + name: 'delta', + category: 'Transform', + params: [], + defaultParams: [], +}); + addFuncDef({ name: 'sumSeries', category: 'Aggregate', From 3a713846b6343a9acb215b5ab3c73f1d3cb2de1d Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 10:41:50 +0300 Subject: [PATCH 09/30] Add docs for delta() function. --- docs/sources/reference/functions.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/sources/reference/functions.md b/docs/sources/reference/functions.md index 089edac..10db01f 100644 --- a/docs/sources/reference/functions.md +++ b/docs/sources/reference/functions.md @@ -30,6 +30,13 @@ scale(100) scale(0.01) ``` +### delta +``` +delta() +``` +Convert absolute values to delta, for example, bits to bits/sec. + + Aggregate --------- From dfbcce9c8f5a37107bf822b92f625394883caee9 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 11:08:22 +0300 Subject: [PATCH 10/30] Fix connection errors handling, fixes #236. --- src/datasource-zabbix/zabbixAPI.service.js | 17 +++++++----- .../zabbixAPICore.service.js | 26 +++++++++++-------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/datasource-zabbix/zabbixAPI.service.js b/src/datasource-zabbix/zabbixAPI.service.js index 523f8a1..8cc2d8e 100644 --- a/src/datasource-zabbix/zabbixAPI.service.js +++ b/src/datasource-zabbix/zabbixAPI.service.js @@ -41,12 +41,12 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) { request(method, params) { var self = this; - return this.zabbixAPICore.request(this.url, method, params, this.requestOptions, this.auth) - .then(function(result) { + return this.zabbixAPICore + .request(this.url, method, params, this.requestOptions, this.auth) + .then((result) => { return result; - }, - // Handle API errors - function(error) { + }, (error) => { + // Handle API errors if (isNotAuthorized(error.data)) { return self.loginOnce().then( function() { @@ -56,15 +56,18 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) { function(error) { self.alertAPIError(error.data); }); + } else { + this.alertSrv.set("Connection Error", error.data, 'error', 5000); } }); } - alertAPIError(message) { + alertAPIError(message, timeout = 5000) { this.alertSrv.set( "Zabbix API Error", message, - 'error' + 'error', + timeout ); } diff --git a/src/datasource-zabbix/zabbixAPICore.service.js b/src/datasource-zabbix/zabbixAPICore.service.js index a1623e6..2a7473c 100644 --- a/src/datasource-zabbix/zabbixAPICore.service.js +++ b/src/datasource-zabbix/zabbixAPICore.service.js @@ -51,19 +51,23 @@ class ZabbixAPICoreService { requestOptions.headers.Authorization = options.basicAuth; } - this.backendSrv.datasourceRequest(requestOptions).then(function (response) { - // General connection issues - if (!response.data) { - deferred.reject(response); - } + this.backendSrv.datasourceRequest(requestOptions) + .then((response) => { + // General connection issues + if (!response.data) { + deferred.reject(response); + } - // Handle Zabbix API errors - else if (response.data.error) { - deferred.reject(response.data.error); - } + // Handle Zabbix API errors + else if (response.data.error) { + deferred.reject(response.data.error); + } + + deferred.resolve(response.data.result); + }, (error) => { + deferred.reject(error.err); + }); - deferred.resolve(response.data.result); - }); return deferred.promise; } From aa882d752ecc1335e5b00985e32264ee97dccd3a Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 12:44:22 +0300 Subject: [PATCH 11/30] Add top N and bottom N filter functions, closes #241. --- docs/sources/reference/functions.md | 32 ++++++++++++++++++++++++ src/datasource-zabbix/DataProcessor.js | 18 +++++++++++++ src/datasource-zabbix/datasource.js | 12 ++++++++- src/datasource-zabbix/metricFunctions.js | 21 ++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) diff --git a/docs/sources/reference/functions.md b/docs/sources/reference/functions.md index 10db01f..c620ca7 100644 --- a/docs/sources/reference/functions.md +++ b/docs/sources/reference/functions.md @@ -78,6 +78,38 @@ max(interval) ``` **Deprecated**, use `aggregateBy(interval, max)` instead. + +Filter +--------- + +### top + +``` +top(N, value) +``` + +Returns top N series, sorted by _value_, which can be one of: _avg_, _min_, _max_, _median_. + +Examples: +``` +top(10, avg) +top(5, max) +``` + +### bottom + +``` +bottom(N, value) +``` + +Returns bottom N series, sorted by _value_, which can be one of: _avg_, _min_, _max_, _median_. + +Examples: +``` +bottom(5, avg) +``` + + ## Trends ### trendValue diff --git a/src/datasource-zabbix/DataProcessor.js b/src/datasource-zabbix/DataProcessor.js index 020132f..cb6c4c2 100644 --- a/src/datasource-zabbix/DataProcessor.js +++ b/src/datasource-zabbix/DataProcessor.js @@ -116,6 +116,22 @@ export default class DataProcessor { return sortByTime(new_timeseries); } + static limit(order, n, orderByFunc, timeseries) { + let orderByCallback = DataProcessor.aggregationFunctions[orderByFunc]; + let sortByIteratee = (ts) => { + let values = _.map(ts.datapoints, (point) => { + return point[0]; + }); + return orderByCallback(values); + }; + let sortedTimeseries = _.sortBy(timeseries, sortByIteratee); + if (order === 'bottom') { + return sortedTimeseries.slice(0, n); + } else { + return sortedTimeseries.slice(-n); + } + } + static AVERAGE(values) { var sum = 0; _.each(values, function(value) { @@ -198,6 +214,8 @@ export default class DataProcessor { max: _.partial(this.aggregateWrapper, this.MAX), median: _.partial(this.aggregateWrapper, this.MEDIAN), sumSeries: this.sumSeries, + top: _.partial(this.limit, 'top'), + bottom: _.partial(this.limit, 'bottom'), setAlias: this.setAlias, }; } diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index 2e914a4..c9db4bb 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -92,7 +92,11 @@ export class ZabbixAPIDatasource { _.forEach(target.functions, func => { func.params = _.map(func.params, param => { - return this.templateSrv.replace(param, options.scopedVars); + if (typeof param === 'number') { + return +this.templateSrv.replace(param.toString(), options.scopedVars); + } else { + return this.templateSrv.replace(param, options.scopedVars); + } }); }); @@ -181,6 +185,7 @@ export class ZabbixAPIDatasource { return getHistory.then(timeseries_data => { let transformFunctions = bindFunctionDefs(target.functions, 'Transform'); let aggregationFunctions = bindFunctionDefs(target.functions, 'Aggregate'); + let filterFunctions = bindFunctionDefs(target.functions, 'Filter'); let aliasFunctions = bindFunctionDefs(target.functions, 'Alias'); // Apply transformation functions @@ -189,6 +194,11 @@ export class ZabbixAPIDatasource { return timeseries; }); + // Apply filter functions + if (filterFunctions.length) { + timeseries_data = sequence(filterFunctions)(timeseries_data); + } + // Apply aggregations if (aggregationFunctions.length) { let dp = _.map(timeseries_data, 'datapoints'); diff --git a/src/datasource-zabbix/metricFunctions.js b/src/datasource-zabbix/metricFunctions.js index ac332ef..5d467f4 100644 --- a/src/datasource-zabbix/metricFunctions.js +++ b/src/datasource-zabbix/metricFunctions.js @@ -5,6 +5,7 @@ var index = []; var categories = { Transform: [], Aggregate: [], + Filter: [], Trends: [], Alias: [] }; @@ -99,6 +100,26 @@ addFuncDef({ defaultParams: ['1m', 'avg'], }); +addFuncDef({ + name: 'top', + category: 'Filter', + params: [ + { name: 'number', type: 'int' }, + { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'median'] } + ], + defaultParams: [5, 'avg'], +}); + +addFuncDef({ + name: 'bottom', + category: 'Filter', + params: [ + { name: 'number', type: 'int' }, + { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'median'] } + ], + defaultParams: [5, 'avg'], +}); + addFuncDef({ name: 'trendValue', category: 'Trends', From dc72bc2780c3a07d43ac8a528aab805c01567d27 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 14:02:20 +0300 Subject: [PATCH 12/30] Fixed undefined host names after lodash upgrade. --- src/datasource-zabbix/queryProcessor.service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/datasource-zabbix/queryProcessor.service.js b/src/datasource-zabbix/queryProcessor.service.js index 6931468..5f8e8e9 100644 --- a/src/datasource-zabbix/queryProcessor.service.js +++ b/src/datasource-zabbix/queryProcessor.service.js @@ -230,13 +230,13 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) { // Group history by itemid var grouped_history = _.groupBy(history, 'itemid'); - var hosts = _.groupBy(_.flatten(_.map(items, 'hosts')), 'hostid'); + var hosts = _.flatten(_.map(items, 'hosts')); return _.map(grouped_history, function(hist, itemid) { var item = _.find(items, {'itemid': itemid}); var alias = item.name; if (_.keys(hosts).length > 1 || addHostName) { - var host = hosts[item.hostid]; + var host = _.find(hosts, {'hostid': item.hostid}); alias = host.name + ": " + alias; } return { From 0338026c96f88151aaf961fef9aa5dafdaf8301d Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 14:28:24 +0300 Subject: [PATCH 13/30] Update license file. --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d7b33b6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2015-2016 Alexander Zobnin + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 2e84881ce633025f4d4cdf09565202bb9f9ca296 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 14:29:13 +0300 Subject: [PATCH 14/30] Delete LICENSE --- LICENSE | 201 -------------------------------------------------------- 1 file changed, 201 deletions(-) delete mode 100644 LICENSE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d7b33b6..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2015-2016 Alexander Zobnin - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. From 59db866d8d881fb8084c096fd5e232827c87895c Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 14:31:35 +0300 Subject: [PATCH 15/30] Add license from GitHub template template. --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 248a6cd15871bc4c740013ea67ed53afb39ef92f Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 14:32:11 +0300 Subject: [PATCH 16/30] Update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 8dada3e..d7b33b6 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright 2015-2016 Alexander Zobnin Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 3bde99e0d69ae202c031180b0b71efff16a07aa7 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 24 Sep 2016 14:34:15 +0300 Subject: [PATCH 17/30] Delete LICENSE.md --- LICENSE.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index ee0bee2..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2015-2016 Alexander Zobnin - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file From 22f3e9861c2e90939768a07c36375ea94fc91a12 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 26 Sep 2016 22:16:09 +0300 Subject: [PATCH 18/30] Bump version to 3.1.0 --- src/plugin.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugin.json b/src/plugin.json index 9a30f99..9cf9542 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -31,8 +31,8 @@ {"name": "Metric Editor", "path": "img/screenshot-metric_editor.png"}, {"name": "Triggers", "path": "img/screenshot-triggers.png"} ], - "version": "3.1.0-pre1", - "updated": "2016-07-03" + "version": "3.1.0", + "updated": "2016-09-26" }, "includes": [ From 07ad717df43b85fd4ebe0bdfbfd097be1bec4c54 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 27 Sep 2016 20:15:05 +0300 Subject: [PATCH 19/30] Fix backward compatibility with lodash 2.4, fixes #279. --- src/datasource-zabbix/datasource.js | 5 +++++ src/datasource-zabbix/utils.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index c9db4bb..cd1e2de 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -504,3 +504,8 @@ function sequence(funcsArray) { return result; }; } + +// Fix for backward compatibility with lodash 2.4 +if (!_.includes) { + _.includes = _.contains; +} diff --git a/src/datasource-zabbix/utils.js b/src/datasource-zabbix/utils.js index 1f05572..fbebd5b 100644 --- a/src/datasource-zabbix/utils.js +++ b/src/datasource-zabbix/utils.js @@ -93,3 +93,8 @@ export function convertToZabbixAPIUrl(url) { return url.replace(trimSlashPattern, "$1"); } } + +// Fix for backward compatibility with lodash 2.4 +if (!_.includes) { + _.includes = _.contains; +} From e10b831a918cca4681313803c6fdb7b4e7b76e45 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 27 Sep 2016 20:19:35 +0300 Subject: [PATCH 20/30] Added jshint and jscs checks to Grunt tasks. --- Gruntfile.js | 27 ++++++++++++++++++++++++++- package.json | 3 +++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 646705d..a26d125 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -68,6 +68,29 @@ module.exports = function(grunt) { 'dist/panel-triggers/css/panel_triggers.css' : 'src/panel-triggers/sass/panel_triggers.scss', } } + }, + + jshint: { + source: { + files: { + src: ['src/**/*.js'], + } + }, + options: { + jshintrc: true, + reporter: require('jshint-stylish'), + ignores: [ + 'node_modules/*', + 'dist/*', + ] + } + }, + + jscs: { + src: ['src/**/*.js'], + options: { + config: ".jscs.json", + }, } }); @@ -76,7 +99,9 @@ module.exports = function(grunt) { 'clean', 'copy:src_to_dist', 'copy:pluginDef', + 'sass', 'babel', - 'sass' + 'jshint', + 'jscs' ]); }; diff --git a/package.json b/package.json index b4b96f1..560e34b 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,9 @@ "babel-plugin-transform-es2015-modules-systemjs": "^6.5.0", "babel-plugin-transform-es2015-for-of": "^6.5.0", "babel-preset-es2015": "^6.5.0", + "grunt-contrib-jshint": "^1.0.0", + "grunt-jscs": "^2.8.0", + "jshint-stylish": "^2.1.0", "lodash": "~4.0.0" }, "homepage": "http://grafana-zabbix.org" From 65308375f4de9844eb1662a3faf5ed51348725b7 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 27 Sep 2016 20:28:18 +0300 Subject: [PATCH 21/30] Fixed linter warnings. --- src/datasource-zabbix/datasource.js | 12 +++--------- src/datasource-zabbix/query.controller.js | 1 + src/datasource-zabbix/queryProcessor.service.js | 6 ------ src/datasource-zabbix/utils.js | 1 - src/datasource-zabbix/zabbixCache.service.js | 1 - 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index cd1e2de..ee7d960 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -433,13 +433,6 @@ function bindFunctionDefs(functionDefs, category) { }); } -function filterFunctionDefs(funcs, category) { - let filteredFuncs = _.map(metricFunctions.getCategories()[category]); - return _.filter(funcs, func => { - return _.includes(filteredFuncs, func.def.name); - }); -} - function formatMetric(metricObj) { return { text: metricObj.name, @@ -457,7 +450,7 @@ function formatMetric(metricObj) { * template variables, for example * /CPU $cpu_item.*time/ where $cpu_item is system,user,iowait */ -function zabbixTemplateFormat(value, variable) { +function zabbixTemplateFormat(value) { if (typeof value === 'string') { return utils.escapeRegex(value); } @@ -466,7 +459,8 @@ function zabbixTemplateFormat(value, variable) { return '(' + escapedValues.join('|') + ')'; } -/** If template variables are used in request, replace it using regex format +/** + * If template variables are used in request, replace it using regex format * and wrap with '/' for proper multi-value work. Example: * $variable selected as a, b, c * We use filter $variable diff --git a/src/datasource-zabbix/query.controller.js b/src/datasource-zabbix/query.controller.js index ca271cc..5536d48 100644 --- a/src/datasource-zabbix/query.controller.js +++ b/src/datasource-zabbix/query.controller.js @@ -1,4 +1,5 @@ import {QueryCtrl} from 'app/plugins/sdk'; +import angular from 'angular'; import _ from 'lodash'; import * as utils from './utils'; import * as metricFunctions from './metricFunctions'; diff --git a/src/datasource-zabbix/queryProcessor.service.js b/src/datasource-zabbix/queryProcessor.service.js index 5f8e8e9..959645b 100644 --- a/src/datasource-zabbix/queryProcessor.service.js +++ b/src/datasource-zabbix/queryProcessor.service.js @@ -335,12 +335,6 @@ function getByFilter(list, filter) { } } -function getFromIndex(index, objids) { - return _.map(objids, function(id) { - return index[id]; - }); -} - function convertHistoryPoint(point) { // Value must be a number for properly work return [ diff --git a/src/datasource-zabbix/utils.js b/src/datasource-zabbix/utils.js index fbebd5b..01e0932 100644 --- a/src/datasource-zabbix/utils.js +++ b/src/datasource-zabbix/utils.js @@ -1,7 +1,6 @@ import _ from 'lodash'; import moment from 'moment'; - /** * Expand Zabbix item name * diff --git a/src/datasource-zabbix/zabbixCache.service.js b/src/datasource-zabbix/zabbixCache.service.js index 9970568..7107654 100644 --- a/src/datasource-zabbix/zabbixCache.service.js +++ b/src/datasource-zabbix/zabbixCache.service.js @@ -1,6 +1,5 @@ import angular from 'angular'; import _ from 'lodash'; -import * as utils from './utils'; // Use factory() instead service() for multiple datasources support. // Each datasource instance must initialize its own cache. From c6659478416315e420701d5b6a2c6f888682f528 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 27 Sep 2016 20:32:21 +0300 Subject: [PATCH 22/30] Run jshint and jscs tasks before babel transpiler. --- Gruntfile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index a26d125..f3ca1e0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -99,9 +99,9 @@ module.exports = function(grunt) { 'clean', 'copy:src_to_dist', 'copy:pluginDef', - 'sass', - 'babel', 'jshint', - 'jscs' + 'jscs', + 'sass', + 'babel' ]); }; From 28f95c62aa22a2bbf55e86fc2710e93bd396282a Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 27 Sep 2016 20:53:56 +0300 Subject: [PATCH 23/30] Bump version to 3.1.1 --- src/plugin.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugin.json b/src/plugin.json index 9cf9542..d0232e7 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -31,8 +31,8 @@ {"name": "Metric Editor", "path": "img/screenshot-metric_editor.png"}, {"name": "Triggers", "path": "img/screenshot-triggers.png"} ], - "version": "3.1.0", - "updated": "2016-09-26" + "version": "3.1.1", + "updated": "2016-09-27" }, "includes": [ From 61d1fede117b419dbd73fa28031056c7eb4d0927 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 28 Sep 2016 16:17:59 +0300 Subject: [PATCH 24/30] Fix license url in docs. --- docs/sources/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/index.md b/docs/sources/index.md index bd9ed6b..0ace143 100644 --- a/docs/sources/index.md +++ b/docs/sources/index.md @@ -22,7 +22,7 @@ a number of ways to get help: - [Gitter room](https://gitter.im/alexanderzobnin/grafana-zabbix) - [Twitter](https://twitter.com/AlexanderZobnin) -Or you can just send me [email](mailto:alexanderzobnin@gmail.com). +Or you can send me [email](mailto:alexanderzobnin@gmail.com). ## Support Project I develop this project in my free time, but if you really find it helpful and promising, you can @@ -34,5 +34,5 @@ Triggers panel was sponsored by [Core IT Project](http://coreit.fr/)). By utilizing this software, you agree to the terms of the included license. Grafana-Zabbix plugin is licensed under the Apache 2.0 agreement. See -[LICENSE](https://github.com/alexanderzobnin/grafana-zabbix/blob/master/LICENSE.md) for the full +[LICENSE](https://github.com/alexanderzobnin/grafana-zabbix/blob/master/LICENSE) for the full license terms. From e68adb0aecd8ccfcccaf014a7eb06e06688e6b71 Mon Sep 17 00:00:00 2001 From: Tom Zhang Date: Fri, 30 Sep 2016 13:36:13 +0930 Subject: [PATCH 25/30] not show host name when only 1 host selected fix #261 --- src/datasource-zabbix/queryProcessor.service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/datasource-zabbix/queryProcessor.service.js b/src/datasource-zabbix/queryProcessor.service.js index 959645b..d151ff0 100644 --- a/src/datasource-zabbix/queryProcessor.service.js +++ b/src/datasource-zabbix/queryProcessor.service.js @@ -230,12 +230,12 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) { // Group history by itemid var grouped_history = _.groupBy(history, 'itemid'); - var hosts = _.flatten(_.map(items, 'hosts')); + var hosts = _.uniq(_.flatten(_.map(items, 'hosts')),'hostid'); //uniq is needed to deduplicate return _.map(grouped_history, function(hist, itemid) { var item = _.find(items, {'itemid': itemid}); var alias = item.name; - if (_.keys(hosts).length > 1 || addHostName) { + if (_.keys(hosts).length > 1 && addHostName) { //only when actual multi hosts selected var host = _.find(hosts, {'hostid': item.hostid}); alias = host.name + ": " + alias; } From 62509caeb9e5f0f5009cecb0e859ff8952bba890 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 7 Nov 2016 21:03:42 +0300 Subject: [PATCH 26/30] Fixed annotations bug with time filtering, fixes #244. --- src/datasource-zabbix/datasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index ee7d960..5a1321b 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -365,7 +365,7 @@ export class ZabbixAPIDatasource { return buildQuery.then(query => { return self.zabbixAPI .getTriggers(query.groupids, query.hostids, query.applicationids, - showTriggers, timeFrom, timeTo) + showTriggers) .then(triggers => { // Filter triggers by description From ca97d392e9e43dd9ab5cbf0435869d7402a7aa62 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 7 Nov 2016 21:14:40 +0300 Subject: [PATCH 27/30] Fixed annotation popup bug after lodash upgrade. --- src/datasource-zabbix/datasource.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index 5a1321b..eea0db2 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -388,7 +388,7 @@ export class ZabbixAPIDatasource { return self.zabbixAPI .getEvents(objectids, timeFrom, timeTo, showOkEvents) .then(events => { - var indexedTriggers = _.groupBy(triggers, 'triggerid'); + var indexedTriggers = _.keyBy(triggers, 'triggerid'); // Hide acknowledged events if option enabled if (annotation.hideAcknowledged) { @@ -500,6 +500,5 @@ function sequence(funcsArray) { } // Fix for backward compatibility with lodash 2.4 -if (!_.includes) { - _.includes = _.contains; -} +if (!_.includes) {_.includes = _.contains;} +if (!_.keyBy) {_.keyBy = _.indexBy;} From 912bf825e7736aca3e5769e3eb0ccd6bbd178824 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 7 Nov 2016 21:15:31 +0300 Subject: [PATCH 28/30] Fix for backward compatibility with lodash 2.4 (indexBy() => keyBy()). --- src/datasource-zabbix/zabbixCache.service.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/datasource-zabbix/zabbixCache.service.js b/src/datasource-zabbix/zabbixCache.service.js index 7107654..e2a9a00 100644 --- a/src/datasource-zabbix/zabbixCache.service.js +++ b/src/datasource-zabbix/zabbixCache.service.js @@ -116,7 +116,7 @@ angular.module('grafana.services').factory('ZabbixCachingProxy', function($q, $i var deferred = this.$q.defer(); var historyStorage = this.storage.history; var full_history; - var expired = _.filter(_.groupBy(items, 'itemid'), function(item, itemid) { + var expired = _.filter(_.keyBy(items, 'itemid'), function(item, itemid) { return !historyStorage[itemid]; }); if (expired.length) { @@ -235,3 +235,6 @@ String.prototype.getHash = function() { } return hash; }; + +// Fix for backward compatibility with lodash 2.4 +if (!_.keyBy) {_.keyBy = _.indexBy;} From 77e16b70a5178ef4c6e5042503a1a8b830b3de4e Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 7 Nov 2016 21:19:29 +0300 Subject: [PATCH 29/30] Refactor: removed trick with self and this. --- src/datasource-zabbix/datasource.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index eea0db2..0b2eed4 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -257,10 +257,9 @@ export class ZabbixAPIDatasource { * @return {object} Connection status and Zabbix API version */ testDatasource() { - var self = this; return this.zabbixAPI.getVersion() .then(version => { - return self.zabbixAPI.login() + return this.zabbixAPI.login() .then(auth => { if (auth) { return { @@ -361,11 +360,10 @@ export class ZabbixAPIDatasource { .buildTriggerQuery(this.replaceTemplateVars(annotation.group, {}), this.replaceTemplateVars(annotation.host, {}), this.replaceTemplateVars(annotation.application, {})); - var self = this; + return buildQuery.then(query => { - return self.zabbixAPI - .getTriggers(query.groupids, query.hostids, query.applicationids, - showTriggers) + return this.zabbixAPI + .getTriggers(query.groupids, query.hostids, query.applicationids, showTriggers) .then(triggers => { // Filter triggers by description @@ -385,7 +383,7 @@ export class ZabbixAPIDatasource { }); var objectids = _.map(triggers, 'triggerid'); - return self.zabbixAPI + return this.zabbixAPI .getEvents(objectids, timeFrom, timeTo, showOkEvents) .then(events => { var indexedTriggers = _.keyBy(triggers, 'triggerid'); From 2330a3ae081ccdadac652196bd53908fd9b1ea05 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 7 Nov 2016 23:30:58 +0300 Subject: [PATCH 30/30] Annotations: show host name as colored tag. --- src/datasource-zabbix/datasource.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/datasource-zabbix/datasource.js b/src/datasource-zabbix/datasource.js index 0b2eed4..f2176c2 100644 --- a/src/datasource-zabbix/datasource.js +++ b/src/datasource-zabbix/datasource.js @@ -396,19 +396,20 @@ export class ZabbixAPIDatasource { } return _.map(events, event => { - var title =''; + let tags; if (annotation.showHostname) { - title += event.hosts[0].name + ': '; + tags = _.map(event.hosts, 'name'); } // Show event type (OK or Problem) - title += Number(event.value) ? 'Problem' : 'OK'; + let title = Number(event.value) ? 'Problem' : 'OK'; - var formatted_acknowledges = utils.formatAcknowledges(event.acknowledges); + let formatted_acknowledges = utils.formatAcknowledges(event.acknowledges); return { annotation: annotation, time: event.clock * 1000, title: title, + tags: tags, text: indexedTriggers[event.objectid].description + formatted_acknowledges }; });