diff --git a/zabbix/datasource.js b/zabbix/datasource.js index b427d8c..ddbdc1c 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -26,6 +26,7 @@ function (angular, _, kbn) { this.password = datasource.meta.password; // Use trends instead history since specified time + this.trends = datasource.meta.trends; this.trendsFrom = datasource.meta.trendsFrom || '7d'; // Limit metrics per panel for templated request @@ -98,12 +99,12 @@ function (angular, _, kbn) { } else { items = _.flatten(items); - if (from > useTrendsFrom) { - return self.performTimeSeriesQuery(items, from, to) - .then(_.partial(self.handleHistoryResponse, items)); - } else { + if ((from < useTrendsFrom) && self.trends) { return self.getTrends(items, from, to) .then(_.partial(self.handleTrendResponse, items)); + } else { + return self.performTimeSeriesQuery(items, from, to) + .then(_.partial(self.handleHistoryResponse, items)); } } }); diff --git a/zabbix/plugin.json b/zabbix/plugin.json index 55c9dcf..5d10ced 100644 --- a/zabbix/plugin.json +++ b/zabbix/plugin.json @@ -16,7 +16,9 @@ "username": "guest", "password": "", + "trends": true, "trendsFrom": "7d", + "limitmetrics": 50, "metrics": true,