From 7c883bd781f7528159a1d238898a822ec70c0fc1 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 1 Feb 2016 17:33:08 +0300 Subject: [PATCH] Update cache periodically. --- plugins/datasource-zabbix/datasource.js | 6 +++++- plugins/datasource-zabbix/partials/config.html | 10 +++++++++- plugins/datasource-zabbix/zabbixCache.js | 5 ++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/plugins/datasource-zabbix/datasource.js b/plugins/datasource-zabbix/datasource.js index 2b0d24f..8ca918a 100644 --- a/plugins/datasource-zabbix/datasource.js +++ b/plugins/datasource-zabbix/datasource.js @@ -35,11 +35,15 @@ function (angular, _, dateMath, utils, metricFunctions) { this.trends = instanceSettings.jsonData.trends; this.trendsFrom = instanceSettings.jsonData.trendsFrom || '7d'; + // Set cache update interval + var ttl = instanceSettings.jsonData.cacheTTL || '1h'; + this.cacheTTL = utils.parseInterval(ttl); + // Initialize Zabbix API this.zabbixAPI = new ZabbixAPI(this.url, this.username, this.password, this.basicAuth, this.withCredentials); // Initialize cache service - this.zabbixCache = new ZabbixCachingProxy(this.zabbixAPI); + this.zabbixCache = new ZabbixCachingProxy(this.zabbixAPI, this.cacheTTL); // Initialize query builder this.queryProcessor = new QueryProcessor(this.zabbixCache); diff --git a/plugins/datasource-zabbix/partials/config.html b/plugins/datasource-zabbix/partials/config.html index cde0b21..0b42568 100644 --- a/plugins/datasource-zabbix/partials/config.html +++ b/plugins/datasource-zabbix/partials/config.html @@ -12,7 +12,7 @@ ng-model='current.jsonData.username' placeholder=""> -
  • +
  • Password
  • @@ -25,6 +25,14 @@
      +
    • + Cache update interval +
    • +
    • + +
    • Trends