16
dist/datasource-zabbix/dataProcessor.js
vendored
16
dist/datasource-zabbix/dataProcessor.js
vendored
@@ -126,6 +126,14 @@ System.register(['lodash', './utils'], function (_export, _context) {
|
|||||||
} else {
|
} else {
|
||||||
return sortedTimeseries.slice(-n);
|
return sortedTimeseries.slice(-n);
|
||||||
}
|
}
|
||||||
|
}function SUM(values) {
|
||||||
|
var sum = 0;
|
||||||
|
_.each(values, function (value) {
|
||||||
|
sum += value;
|
||||||
|
});
|
||||||
|
return sum;
|
||||||
|
}function COUNT(values) {
|
||||||
|
return values.length;
|
||||||
}function AVERAGE(values) {
|
}function AVERAGE(values) {
|
||||||
var sum = 0;
|
var sum = 0;
|
||||||
_.each(values, function (value) {
|
_.each(values, function (value) {
|
||||||
@@ -250,6 +258,8 @@ System.register(['lodash', './utils'], function (_export, _context) {
|
|||||||
min: _.partial(aggregateWrapper, MIN),
|
min: _.partial(aggregateWrapper, MIN),
|
||||||
max: _.partial(aggregateWrapper, MAX),
|
max: _.partial(aggregateWrapper, MAX),
|
||||||
median: _.partial(aggregateWrapper, MEDIAN),
|
median: _.partial(aggregateWrapper, MEDIAN),
|
||||||
|
sum: _.partial(aggregateWrapper, SUM),
|
||||||
|
count: _.partial(aggregateWrapper, COUNT),
|
||||||
sumSeries: sumSeries,
|
sumSeries: sumSeries,
|
||||||
top: _.partial(limit, 'top'),
|
top: _.partial(limit, 'top'),
|
||||||
bottom: _.partial(limit, 'bottom'),
|
bottom: _.partial(limit, 'bottom'),
|
||||||
@@ -261,7 +271,9 @@ System.register(['lodash', './utils'], function (_export, _context) {
|
|||||||
avg: AVERAGE,
|
avg: AVERAGE,
|
||||||
min: MIN,
|
min: MIN,
|
||||||
max: MAX,
|
max: MAX,
|
||||||
median: MEDIAN
|
median: MEDIAN,
|
||||||
|
sum: SUM,
|
||||||
|
count: COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
_export('default', {
|
_export('default', {
|
||||||
@@ -271,6 +283,8 @@ System.register(['lodash', './utils'], function (_export, _context) {
|
|||||||
MIN: MIN,
|
MIN: MIN,
|
||||||
MAX: MAX,
|
MAX: MAX,
|
||||||
MEDIAN: MEDIAN,
|
MEDIAN: MEDIAN,
|
||||||
|
SUM: SUM,
|
||||||
|
COUNT: COUNT,
|
||||||
unShiftTimeSeries: unShiftTimeSeries,
|
unShiftTimeSeries: unShiftTimeSeries,
|
||||||
|
|
||||||
get aggregationFunctions() {
|
get aggregationFunctions() {
|
||||||
|
|||||||
2
dist/datasource-zabbix/dataProcessor.js.map
vendored
2
dist/datasource-zabbix/dataProcessor.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/datasource-zabbix/datasource.js
vendored
2
dist/datasource-zabbix/datasource.js
vendored
@@ -446,7 +446,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
value = extractText(point.value, target.textFilter, target.useCaptureGroups);
|
value = extractText(point.value, target.textFilter, target.useCaptureGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [value, point.clock * 1000];
|
return [value, point.clock * 1000 + Math.round(point.ns / 1000000)];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
2
dist/datasource-zabbix/datasource.js.map
vendored
2
dist/datasource-zabbix/datasource.js.map
vendored
File diff suppressed because one or more lines are too long
24
dist/datasource-zabbix/metricFunctions.js
vendored
24
dist/datasource-zabbix/metricFunctions.js
vendored
@@ -85,7 +85,7 @@ System.register(['lodash', 'jquery'], function (_export, _context) {
|
|||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'groupBy',
|
name: 'groupBy',
|
||||||
category: 'Transform',
|
category: 'Transform',
|
||||||
params: [{ name: 'interval', type: 'string' }, { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'median'] }],
|
params: [{ name: 'interval', type: 'string' }, { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count', 'median'] }],
|
||||||
defaultParams: ['1m', 'avg']
|
defaultParams: ['1m', 'avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -140,10 +140,24 @@ System.register(['lodash', 'jquery'], function (_export, _context) {
|
|||||||
defaultParams: ['1m']
|
defaultParams: ['1m']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addFuncDef({
|
||||||
|
name: 'sum',
|
||||||
|
category: 'Aggregate',
|
||||||
|
params: [{ name: 'interval', type: 'string' }],
|
||||||
|
defaultParams: ['1m']
|
||||||
|
});
|
||||||
|
|
||||||
|
addFuncDef({
|
||||||
|
name: 'count',
|
||||||
|
category: 'Aggregate',
|
||||||
|
params: [{ name: 'interval', type: 'string' }],
|
||||||
|
defaultParams: ['1m']
|
||||||
|
});
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'aggregateBy',
|
name: 'aggregateBy',
|
||||||
category: 'Aggregate',
|
category: 'Aggregate',
|
||||||
params: [{ name: 'interval', type: 'string' }, { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'median'] }],
|
params: [{ name: 'interval', type: 'string' }, { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count', 'median'] }],
|
||||||
defaultParams: ['1m', 'avg']
|
defaultParams: ['1m', 'avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -152,14 +166,14 @@ System.register(['lodash', 'jquery'], function (_export, _context) {
|
|||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'top',
|
name: 'top',
|
||||||
category: 'Filter',
|
category: 'Filter',
|
||||||
params: [{ name: 'number', type: 'int' }, { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'median'] }],
|
params: [{ name: 'number', type: 'int' }, { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count', 'median'] }],
|
||||||
defaultParams: [5, 'avg']
|
defaultParams: [5, 'avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'bottom',
|
name: 'bottom',
|
||||||
category: 'Filter',
|
category: 'Filter',
|
||||||
params: [{ name: 'number', type: 'int' }, { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'median'] }],
|
params: [{ name: 'number', type: 'int' }, { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count', 'median'] }],
|
||||||
defaultParams: [5, 'avg']
|
defaultParams: [5, 'avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -168,7 +182,7 @@ System.register(['lodash', 'jquery'], function (_export, _context) {
|
|||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'trendValue',
|
name: 'trendValue',
|
||||||
category: 'Trends',
|
category: 'Trends',
|
||||||
params: [{ name: 'type', type: 'string', options: ['avg', 'min', 'max'] }],
|
params: [{ name: 'type', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count'] }],
|
||||||
defaultParams: ['avg']
|
defaultParams: ['avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
dist/datasource-zabbix/query.controller.js
vendored
2
dist/datasource-zabbix/query.controller.js
vendored
@@ -139,7 +139,7 @@ System.register(['app/plugins/sdk', 'angular', 'lodash', './utils', './metricFun
|
|||||||
|
|
||||||
if (target.mode === 0 || target.mode === 2) {
|
if (target.mode === 0 || target.mode === 2) {
|
||||||
|
|
||||||
this.downsampleFunctionList = [{ name: "avg", value: "avg" }, { name: "min", value: "min" }, { name: "max", value: "max" }];
|
this.downsampleFunctionList = [{ name: "avg", value: "avg" }, { name: "min", value: "min" }, { name: "max", value: "max" }, { name: "sum", value: "sum" }, { name: "count", value: "count" }];
|
||||||
|
|
||||||
this.initFilters();
|
this.initFilters();
|
||||||
} else if (target.mode === 1) {
|
} else if (target.mode === 1) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
8
dist/datasource-zabbix/responseHandler.js
vendored
8
dist/datasource-zabbix/responseHandler.js
vendored
@@ -71,7 +71,7 @@ System.register(['lodash'], function (_export, _context) {
|
|||||||
}
|
}
|
||||||
}function convertHistoryPoint(point) {
|
}function convertHistoryPoint(point) {
|
||||||
// Value must be a number for properly work
|
// Value must be a number for properly work
|
||||||
return [Number(point.value), point.clock * 1000];
|
return [Number(point.value), point.clock * 1000 + Math.round(point.ns / 1000000)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertTrendPoint(valueType, point) {
|
function convertTrendPoint(valueType, point) {
|
||||||
@@ -86,6 +86,12 @@ System.register(['lodash'], function (_export, _context) {
|
|||||||
case "avg":
|
case "avg":
|
||||||
value = point.value_avg;
|
value = point.value_avg;
|
||||||
break;
|
break;
|
||||||
|
case "sum":
|
||||||
|
value = point.value_sum;
|
||||||
|
break;
|
||||||
|
case "count":
|
||||||
|
value = point.value_count;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
value = point.value_avg;
|
value = point.value_avg;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
20
dist/test/datasource-zabbix/dataProcessor.js
vendored
20
dist/test/datasource-zabbix/dataProcessor.js
vendored
@@ -143,6 +143,18 @@ function limit(order, n, orderByFunc, timeseries) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SUM(values) {
|
||||||
|
var sum = 0;
|
||||||
|
_lodash2.default.each(values, function (value) {
|
||||||
|
sum += value;
|
||||||
|
});
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
function COUNT(values) {
|
||||||
|
return values.length;
|
||||||
|
}
|
||||||
|
|
||||||
function AVERAGE(values) {
|
function AVERAGE(values) {
|
||||||
var sum = 0;
|
var sum = 0;
|
||||||
_lodash2.default.each(values, function (value) {
|
_lodash2.default.each(values, function (value) {
|
||||||
@@ -296,6 +308,8 @@ var metricFunctions = {
|
|||||||
min: _lodash2.default.partial(aggregateWrapper, MIN),
|
min: _lodash2.default.partial(aggregateWrapper, MIN),
|
||||||
max: _lodash2.default.partial(aggregateWrapper, MAX),
|
max: _lodash2.default.partial(aggregateWrapper, MAX),
|
||||||
median: _lodash2.default.partial(aggregateWrapper, MEDIAN),
|
median: _lodash2.default.partial(aggregateWrapper, MEDIAN),
|
||||||
|
sum: _lodash2.default.partial(aggregateWrapper, SUM),
|
||||||
|
count: _lodash2.default.partial(aggregateWrapper, COUNT),
|
||||||
sumSeries: sumSeries,
|
sumSeries: sumSeries,
|
||||||
top: _lodash2.default.partial(limit, 'top'),
|
top: _lodash2.default.partial(limit, 'top'),
|
||||||
bottom: _lodash2.default.partial(limit, 'bottom'),
|
bottom: _lodash2.default.partial(limit, 'bottom'),
|
||||||
@@ -308,7 +322,9 @@ var aggregationFunctions = {
|
|||||||
avg: AVERAGE,
|
avg: AVERAGE,
|
||||||
min: MIN,
|
min: MIN,
|
||||||
max: MAX,
|
max: MAX,
|
||||||
median: MEDIAN
|
median: MEDIAN,
|
||||||
|
sum: SUM,
|
||||||
|
count: COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.default = {
|
exports.default = {
|
||||||
@@ -318,6 +334,8 @@ exports.default = {
|
|||||||
MIN: MIN,
|
MIN: MIN,
|
||||||
MAX: MAX,
|
MAX: MAX,
|
||||||
MEDIAN: MEDIAN,
|
MEDIAN: MEDIAN,
|
||||||
|
SUM: SUM,
|
||||||
|
COUNT: COUNT,
|
||||||
unShiftTimeSeries: unShiftTimeSeries,
|
unShiftTimeSeries: unShiftTimeSeries,
|
||||||
|
|
||||||
get aggregationFunctions() {
|
get aggregationFunctions() {
|
||||||
|
|||||||
2
dist/test/datasource-zabbix/datasource.js
vendored
2
dist/test/datasource-zabbix/datasource.js
vendored
@@ -304,7 +304,7 @@ var ZabbixAPIDatasource = function () {
|
|||||||
value = extractText(point.value, target.textFilter, target.useCaptureGroups);
|
value = extractText(point.value, target.textFilter, target.useCaptureGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [value, point.clock * 1000];
|
return [value, point.clock * 1000 + Math.round(point.ns / 1000000)];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
24
dist/test/datasource-zabbix/metricFunctions.js
vendored
24
dist/test/datasource-zabbix/metricFunctions.js
vendored
@@ -48,7 +48,7 @@ function addFuncDef(funcDef) {
|
|||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'groupBy',
|
name: 'groupBy',
|
||||||
category: 'Transform',
|
category: 'Transform',
|
||||||
params: [{ name: 'interval', type: 'string' }, { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'median'] }],
|
params: [{ name: 'interval', type: 'string' }, { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count', 'median'] }],
|
||||||
defaultParams: ['1m', 'avg']
|
defaultParams: ['1m', 'avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -103,10 +103,24 @@ addFuncDef({
|
|||||||
defaultParams: ['1m']
|
defaultParams: ['1m']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addFuncDef({
|
||||||
|
name: 'sum',
|
||||||
|
category: 'Aggregate',
|
||||||
|
params: [{ name: 'interval', type: 'string' }],
|
||||||
|
defaultParams: ['1m']
|
||||||
|
});
|
||||||
|
|
||||||
|
addFuncDef({
|
||||||
|
name: 'count',
|
||||||
|
category: 'Aggregate',
|
||||||
|
params: [{ name: 'interval', type: 'string' }],
|
||||||
|
defaultParams: ['1m']
|
||||||
|
});
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'aggregateBy',
|
name: 'aggregateBy',
|
||||||
category: 'Aggregate',
|
category: 'Aggregate',
|
||||||
params: [{ name: 'interval', type: 'string' }, { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'median'] }],
|
params: [{ name: 'interval', type: 'string' }, { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count', 'median'] }],
|
||||||
defaultParams: ['1m', 'avg']
|
defaultParams: ['1m', 'avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,14 +129,14 @@ addFuncDef({
|
|||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'top',
|
name: 'top',
|
||||||
category: 'Filter',
|
category: 'Filter',
|
||||||
params: [{ name: 'number', type: 'int' }, { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'median'] }],
|
params: [{ name: 'number', type: 'int' }, { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count', 'median'] }],
|
||||||
defaultParams: [5, 'avg']
|
defaultParams: [5, 'avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'bottom',
|
name: 'bottom',
|
||||||
category: 'Filter',
|
category: 'Filter',
|
||||||
params: [{ name: 'number', type: 'int' }, { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'median'] }],
|
params: [{ name: 'number', type: 'int' }, { name: 'value', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count', 'median'] }],
|
||||||
defaultParams: [5, 'avg']
|
defaultParams: [5, 'avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -131,7 +145,7 @@ addFuncDef({
|
|||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'trendValue',
|
name: 'trendValue',
|
||||||
category: 'Trends',
|
category: 'Trends',
|
||||||
params: [{ name: 'type', type: 'string', options: ['avg', 'min', 'max'] }],
|
params: [{ name: 'type', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count'] }],
|
||||||
defaultParams: ['avg']
|
defaultParams: ['avg']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ var ZabbixQueryController = exports.ZabbixQueryController = function (_QueryCtrl
|
|||||||
|
|
||||||
if (target.mode === 0 || target.mode === 2) {
|
if (target.mode === 0 || target.mode === 2) {
|
||||||
|
|
||||||
this.downsampleFunctionList = [{ name: "avg", value: "avg" }, { name: "min", value: "min" }, { name: "max", value: "max" }];
|
this.downsampleFunctionList = [{ name: "avg", value: "avg" }, { name: "min", value: "min" }, { name: "max", value: "max" }, { name: "sum", value: "sum" }, { name: "count", value: "count" }];
|
||||||
|
|
||||||
this.initFilters();
|
this.initFilters();
|
||||||
} else if (target.mode === 1) {
|
} else if (target.mode === 1) {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ function handleSLAResponse(itservice, slaProperty, slaObject) {
|
|||||||
|
|
||||||
function convertHistoryPoint(point) {
|
function convertHistoryPoint(point) {
|
||||||
// Value must be a number for properly work
|
// Value must be a number for properly work
|
||||||
return [Number(point.value), point.clock * 1000];
|
return [Number(point.value), point.clock * 1000 + Math.round(point.ns / 1000000)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertTrendPoint(valueType, point) {
|
function convertTrendPoint(valueType, point) {
|
||||||
@@ -95,6 +95,12 @@ function convertTrendPoint(valueType, point) {
|
|||||||
case "avg":
|
case "avg":
|
||||||
value = point.value_avg;
|
value = point.value_avg;
|
||||||
break;
|
break;
|
||||||
|
case "sum":
|
||||||
|
value = point.value_sum;
|
||||||
|
break;
|
||||||
|
case "count":
|
||||||
|
value = point.value_count;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
value = point.value_avg;
|
value = point.value_avg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,7 +247,10 @@ class ZabbixAPIDatasource {
|
|||||||
value = extractText(point.value, target.textFilter, target.useCaptureGroups);
|
value = extractText(point.value, target.textFilter, target.useCaptureGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [value, point.clock * 1000];
|
return [
|
||||||
|
value,
|
||||||
|
point.clock * 1000 + Math.round(point.ns / 1000000)
|
||||||
|
];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ function convertHistoryPoint(point) {
|
|||||||
// Value must be a number for properly work
|
// Value must be a number for properly work
|
||||||
return [
|
return [
|
||||||
Number(point.value),
|
Number(point.value),
|
||||||
point.clock * 1000
|
point.clock * 1000 + Math.round(point.ns / 1000000)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user