Move plugins to separate directories for support Grafana
external plugins model.
This commit is contained in:
221
plugins/panel-triggers/editor.html
Normal file
221
plugins/panel-triggers/editor.html
Normal file
@@ -0,0 +1,221 @@
|
||||
<div class="editor-row">
|
||||
<div class="section tight-form-container" style="margin-bottom: 20px">
|
||||
<h5>Select triggers</h5>
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 80px">
|
||||
Group
|
||||
</li>
|
||||
<li>
|
||||
<select class="tight-form-input input-large"
|
||||
ng-model="panel.triggers.group"
|
||||
ng-options="g.name for g in metric.groupList track by g.name"
|
||||
ng-change="groupChanged()">
|
||||
</select>
|
||||
</li>
|
||||
<li class="tight-form-item" style="width: 50px">
|
||||
Host
|
||||
</li>
|
||||
<li>
|
||||
<select class="tight-form-input input-large last"
|
||||
ng-model="panel.triggers.host"
|
||||
ng-options="h.name for h in metric.hostList track by h.name"
|
||||
ng-change="hostChanged()">
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 80px">
|
||||
Application
|
||||
</li>
|
||||
<li>
|
||||
<select class="tight-form-input input-large"
|
||||
ng-model="panel.triggers.application"
|
||||
ng-options="app.name for app in metric.applicationList track by app.name"
|
||||
ng-change="appChanged()">
|
||||
</select>
|
||||
</li>
|
||||
<li class="tight-form-item" style="width: 50px">
|
||||
Trigger
|
||||
</li>
|
||||
<li>
|
||||
<input type="text"
|
||||
class="input-large tight-form-input last"
|
||||
placeholder="trigger name"
|
||||
ng-model="panel.triggers.name"
|
||||
empty-to-null
|
||||
ng-blur="get_data()">
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h5>Data source</h5>
|
||||
<div class="section tight-form-container" style="margin-bottom: 20px">
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li>
|
||||
<select class="tight-form-input input-large last"
|
||||
ng-model="panel.datasource"
|
||||
ng-options="ds for ds in datasources"
|
||||
ng-change="datasourceChanged()">
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="editor-row">
|
||||
<div class="section">
|
||||
<h5>Options</h5>
|
||||
<div class="tight-form-container" style="margin-bottom: 20px">
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 100px">
|
||||
<strong>Acknowledged</strong>
|
||||
</li>
|
||||
<li>
|
||||
<select class="input-medium tight-form-input"
|
||||
ng-model="panel.showTriggers"
|
||||
ng-options="f for f in ackFilters"
|
||||
ng-change="get_data()">
|
||||
</select>
|
||||
</li>
|
||||
<li class="tight-form-item" style="width: 13em">
|
||||
<strong>Limit triggers number to</strong>
|
||||
</li>
|
||||
<li>
|
||||
<input class="input-small tight-form-input last"
|
||||
type="number"
|
||||
ng-model="panel.limit"
|
||||
ng-model-onblur
|
||||
ng-change="get_data()">
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 100px">
|
||||
<strong>Sort by</strong>
|
||||
</li>
|
||||
<li>
|
||||
<select class="input-medium tight-form-input"
|
||||
ng-model="panel.sortTriggersBy"
|
||||
ng-options="f.text for f in sortByFields track by f.value"
|
||||
ng-change="get_data()">
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 100px">
|
||||
<strong>Show fields</strong>
|
||||
</li>
|
||||
<li class="tight-form-item">
|
||||
<label class="checkbox-label" for="panel.hostField">Host</label>
|
||||
<input class="cr1"
|
||||
id="panel.hostField"
|
||||
type="checkbox"
|
||||
ng-model="panel.hostField"
|
||||
ng-checked="panel.hostField">
|
||||
<label for="panel.hostField" class="cr1"></label>
|
||||
</li>
|
||||
<li class="tight-form-item">
|
||||
<label class="checkbox-label" for="panel.severityField">Severity</label>
|
||||
<input class="cr1"
|
||||
id="panel.severityField"
|
||||
type="checkbox"
|
||||
ng-model="panel.severityField"
|
||||
ng-checked="panel.severityField">
|
||||
<label for="panel.severityField" class="cr1"></label>
|
||||
</li>
|
||||
<li class="tight-form-item">
|
||||
<label class="checkbox-label" for="panel.lastChangeField">Last change</label>
|
||||
<input class="cr1"
|
||||
id="panel.lastChangeField"
|
||||
type="checkbox"
|
||||
ng-model="panel.lastChangeField"
|
||||
ng-checked="panel.lastChangeField">
|
||||
<label for="panel.lastChangeField" class="cr1"></label>
|
||||
</li>
|
||||
<li class="tight-form-item">
|
||||
<label class="checkbox-label" for="panel.ageField">Age</label>
|
||||
<input class="cr1"
|
||||
id="panel.ageField"
|
||||
type="checkbox"
|
||||
ng-model="panel.ageField"
|
||||
ng-checked="panel.ageField">
|
||||
<label for="panel.ageField" class="cr1"></label>
|
||||
</li>
|
||||
<li class="tight-form-item last">
|
||||
<label class="checkbox-label" for="panel.infoField">Info</label>
|
||||
<input class="cr1"
|
||||
id="panel.infoField"
|
||||
type="checkbox"
|
||||
ng-model="panel.infoField"
|
||||
ng-checked="panel.infoField">
|
||||
<label for="panel.infoField" class="cr1"></label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h5>Customize triggers severity and colors</h5>
|
||||
<div class="tight-form"
|
||||
ng-repeat="trigger in panel.triggerSeverity"
|
||||
ng-class="{last: $last}"
|
||||
ng-style="{background:trigger.color}">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 10px; color: #101010">
|
||||
{{ trigger.priority }}
|
||||
</li>
|
||||
<li>
|
||||
<input class="tight-form-input input-medium"
|
||||
type="text"
|
||||
style="color: #101010"
|
||||
empty-to-null
|
||||
ng-model="trigger.severity"
|
||||
ng-style="{background:trigger.color}"
|
||||
ng-model-onblur
|
||||
ng-change="get_data()">
|
||||
</li>
|
||||
<li data-trigger-index="{{trigger.priority}}">
|
||||
|
||||
<i class="pointer fa fa-eyedropper trigger-color"
|
||||
style="color: #101010"
|
||||
ng-click="openTriggerColorSelector($event)"> </i>
|
||||
<input type="text"
|
||||
class="tight-form-input input-small"
|
||||
style="color: #101010"
|
||||
empty-to-null
|
||||
ng-model="trigger.color"
|
||||
ng-style="{background:trigger.color}"
|
||||
ng-model-onblur
|
||||
ng-change="get_data()">
|
||||
</li>
|
||||
<li class="tight-form-item last" style="width: 28px">
|
||||
<label class="checkbox-label" for="{{ 'trigger-show-' + $index }}"></label>
|
||||
<input class="cr1"
|
||||
ng-attr-id="{{ 'trigger-show-' + $index }}"
|
||||
type="checkbox"
|
||||
ng-model="trigger.show"
|
||||
ng-checked="trigger.show"
|
||||
ng-change="get_data()">
|
||||
<label for="{{ 'trigger-show-' + $index }}" class="cr1"></label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
118
plugins/panel-triggers/module.html
Normal file
118
plugins/panel-triggers/module.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<grafana-panel>
|
||||
<div style="padding-top: 10px">
|
||||
<table class="table table-bordered zbx-trigger-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th ng-if="panel.hostField">Host</th>
|
||||
<th ng-if="panel.severityField">Severity</th>
|
||||
<th style="width: 50%">Issue</th>
|
||||
<th ng-if="panel.lastChangeField">Last change</th>
|
||||
<th ng-if="panel.ageField">Age</th>
|
||||
<th ng-if="panel.infoField">Info</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class=""
|
||||
ng-repeat="trigger in triggerList"
|
||||
style="background-color: {{trigger.color}}">
|
||||
<td ng-if="panel.hostField">
|
||||
<div>
|
||||
<span><strong>{{trigger.host}}</strong></span>
|
||||
</div>
|
||||
</td>
|
||||
<td ng-if="panel.severityField">
|
||||
<div>
|
||||
{{trigger.severity}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
{{trigger.description}}
|
||||
<a ng-if="trigger.comments"
|
||||
class="pointer"
|
||||
style="float: right;"
|
||||
data-toggle="collapse"
|
||||
data-target="#comments-{{trigger.triggerid}}"
|
||||
bs-tooltip="'Show additional trigger description'"
|
||||
data-placement="top">
|
||||
<i class="fa fa-file-text-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Trigger comments -->
|
||||
<div class="collapse"
|
||||
id="comments-{{trigger.triggerid}}"
|
||||
ng-if="trigger.comments">
|
||||
<div>
|
||||
<small>{{trigger.comments}}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Trigger acknowledges -->
|
||||
<div class="collapse"
|
||||
id="acknowledges-{{trigger.triggerid}}"
|
||||
ng-if="trigger.acknowledges">
|
||||
<div style="padding-top: 12px;">
|
||||
<table class="table table-condensed table-striped table-bordered zbx-table-ack"
|
||||
style="background-color: initial">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><small>Time</small></th>
|
||||
<th><small>User</small></th>
|
||||
<th><small>Comments</small></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="ack in trigger.acknowledges">
|
||||
<td>
|
||||
<small>{{ack.time}}</small>
|
||||
</td>
|
||||
<td>
|
||||
<small>{{ack.user}}</small>
|
||||
</td>
|
||||
<td>
|
||||
<small>{{ack.message}}</small>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td ng-if="panel.lastChangeField">
|
||||
{{trigger.lastchange}}
|
||||
</td>
|
||||
<td ng-if="panel.ageField">
|
||||
{{trigger.age}}
|
||||
</td>
|
||||
<td ng-if="panel.infoField">
|
||||
|
||||
<!-- Trigger Url -->
|
||||
<a class="zbx-trigger-info"
|
||||
ng-if="trigger.url"
|
||||
href="{{trigger.url}}"
|
||||
target="_blank">
|
||||
<i class="fa fa-external-link"></i>
|
||||
</a>
|
||||
|
||||
<!-- Trigger state -->
|
||||
<span class="zbx-trigger-info"
|
||||
ng-if="trigger.state === '1'"
|
||||
bs-tooltip="'{{trigger.error}}'">
|
||||
<i class="fa fa-question-circle"></i>
|
||||
</span>
|
||||
|
||||
<!-- Trigger acknowledges -->
|
||||
<a class="zbx-trigger-info"
|
||||
ng-if="trigger.acknowledges"
|
||||
bs-tooltip="'Acknowledges ({{trigger.acknowledges.length}})'"
|
||||
data-toggle="collapse"
|
||||
data-target="#acknowledges-{{trigger.triggerid}}">
|
||||
<i class="fa fa-comments"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</grafana-panel>
|
||||
300
plugins/panel-triggers/module.js
Normal file
300
plugins/panel-triggers/module.js
Normal file
@@ -0,0 +1,300 @@
|
||||
/**
|
||||
* Grafana-Zabbix
|
||||
* Zabbix plugin for Grafana.
|
||||
* http://github.com/alexanderzobnin/grafana-zabbix
|
||||
*
|
||||
* Trigger panel.
|
||||
* This feature sponsored by CORE IT
|
||||
* http://www.coreit.fr
|
||||
*
|
||||
* Copyright 2015 Alexander Zobnin alexanderzobnin@gmail.com
|
||||
* Licensed under the Apache License, Version 2.0
|
||||
*/
|
||||
|
||||
define([
|
||||
'angular',
|
||||
'app/app',
|
||||
'lodash',
|
||||
'jquery',
|
||||
'app/core/config',
|
||||
'app/features/panel/panel_meta',
|
||||
'app/plugins/datasource/zabbix/helperFunctions',
|
||||
],
|
||||
function (angular, app, _, $, config, PanelMeta) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.panels.triggers', []);
|
||||
app.useModule(module);
|
||||
|
||||
module.directive('grafanaPanelTriggers', function() {
|
||||
return {
|
||||
controller: 'TriggersPanelCtrl',
|
||||
templateUrl: 'app/plugins/panels/triggers/module.html',
|
||||
};
|
||||
});
|
||||
|
||||
module.controller('TriggersPanelCtrl', function($q, $scope, $element, datasourceSrv, panelSrv,
|
||||
templateSrv, zabbixHelperSrv, popoverSrv) {
|
||||
|
||||
$scope.panelMeta = new PanelMeta({
|
||||
panelName: 'Zabbix triggers',
|
||||
editIcon: "fa fa-lightbulb-o",
|
||||
fullscreen: true,
|
||||
});
|
||||
|
||||
$scope.panelMeta.addEditorTab('Options', 'app/plugins/panels/triggers/editor.html');
|
||||
|
||||
$scope.ackFilters = [
|
||||
'all triggers',
|
||||
'unacknowledged',
|
||||
'acknowledged'
|
||||
];
|
||||
|
||||
$scope.sortByFields = [
|
||||
{ text: 'last change', value: 'lastchange' },
|
||||
{ text: 'severity', value: 'priority' }
|
||||
];
|
||||
|
||||
var grafanaDefaultSeverity = [
|
||||
{ priority: 0, severity: 'Not classified', color: '#B7DBAB', show: true },
|
||||
{ priority: 1, severity: 'Information', color: '#82B5D8', show: true },
|
||||
{ priority: 2, severity: 'Warning', color: '#E5AC0E', show: true },
|
||||
{ priority: 3, severity: 'Average', color: '#C15C17', show: true },
|
||||
{ priority: 4, severity: 'High', color: '#BF1B00', show: true },
|
||||
{ priority: 5, severity: 'Disaster', color: '#890F02', show: true }
|
||||
];
|
||||
|
||||
var panelDefaults = {
|
||||
datasource: null,
|
||||
triggers: {
|
||||
group: {name: 'All', groupid: null},
|
||||
host: {name: 'All', hostid: null},
|
||||
application: {name: 'All', value: null}
|
||||
},
|
||||
hostField: true,
|
||||
severityField: false,
|
||||
lastChangeField: true,
|
||||
ageField: true,
|
||||
infoField: true,
|
||||
limit: 10,
|
||||
showTriggers: 'all triggers',
|
||||
sortTriggersBy: { text: 'last change', value: 'lastchange' },
|
||||
triggerSeverity: grafanaDefaultSeverity
|
||||
};
|
||||
|
||||
_.defaults($scope.panel, panelDefaults);
|
||||
$scope.triggerList = [];
|
||||
|
||||
$scope.init = function() {
|
||||
panelSrv.init($scope);
|
||||
if ($scope.isNewPanel()) {
|
||||
$scope.panel.title = "Zabbix Triggers";
|
||||
}
|
||||
|
||||
if (!$scope.metric) {
|
||||
$scope.metric = {
|
||||
groupList: [{name: 'All', groupid: null}],
|
||||
hostList: [{name: 'All', hostid: null}],
|
||||
applicationList: [{name: 'All', applicationid: null}]
|
||||
};
|
||||
}
|
||||
|
||||
// Get zabbix data sources
|
||||
var datasources = _.filter(datasourceSrv.getMetricSources(), function(datasource) {
|
||||
return datasource.meta.type === 'zabbix';
|
||||
});
|
||||
$scope.datasources = _.map(datasources, 'name');
|
||||
|
||||
// Set default datasource
|
||||
if (!$scope.panel.datasource) {
|
||||
$scope.panel.datasource = $scope.datasources[0];
|
||||
}
|
||||
|
||||
// Update lists of groups, hosts and applications
|
||||
$scope.updateGroups()
|
||||
.then($scope.updateHosts)
|
||||
.then($scope.updateApplications);
|
||||
};
|
||||
|
||||
$scope.refreshData = function() {
|
||||
|
||||
// Load datasource
|
||||
return datasourceSrv.get($scope.panel.datasource).then(function (datasource) {
|
||||
var zabbix = datasource.zabbixAPI;
|
||||
|
||||
var groupid = $scope.panel.triggers.group.groupid;
|
||||
var hostid = $scope.panel.triggers.host.hostid;
|
||||
var applicationids = $scope.panel.triggers.application.value;
|
||||
|
||||
// Get triggers
|
||||
return zabbix.getTriggers($scope.panel.limit,
|
||||
$scope.panel.sortTriggersBy.value,
|
||||
groupid,
|
||||
hostid,
|
||||
applicationids,
|
||||
$scope.panel.triggers.name)
|
||||
.then(function(triggers) {
|
||||
var promises = _.map(triggers, function (trigger) {
|
||||
var lastchange = new Date(trigger.lastchange * 1000);
|
||||
var lastchangeUnix = trigger.lastchange;
|
||||
var now = new Date();
|
||||
|
||||
// Consider local time offset
|
||||
var ageUnix = now - lastchange + now.getTimezoneOffset() * 60000;
|
||||
var age = zabbixHelperSrv.toZabbixAgeFormat(ageUnix);
|
||||
var triggerObj = trigger;
|
||||
triggerObj.lastchangeUnix = lastchangeUnix;
|
||||
triggerObj.lastchange = lastchange.toLocaleString();
|
||||
triggerObj.age = age.toLocaleString();
|
||||
triggerObj.color = $scope.panel.triggerSeverity[trigger.priority].color;
|
||||
triggerObj.severity = $scope.panel.triggerSeverity[trigger.priority].severity;
|
||||
|
||||
// Request acknowledges for trigger
|
||||
return zabbix.getAcknowledges(trigger.triggerid, lastchangeUnix)
|
||||
.then(function (acknowledges) {
|
||||
if (acknowledges.length) {
|
||||
triggerObj.acknowledges = _.map(acknowledges, function (ack) {
|
||||
var time = new Date(+ack.clock * 1000);
|
||||
ack.time = time.toLocaleString();
|
||||
ack.user = ack.alias + ' (' + ack.name + ' ' + ack.surname + ')';
|
||||
return ack;
|
||||
});
|
||||
}
|
||||
return triggerObj;
|
||||
});
|
||||
});
|
||||
return $q.all(promises).then(function (triggerList) {
|
||||
|
||||
// Filter acknowledged triggers
|
||||
if ($scope.panel.showTriggers === 'unacknowledged') {
|
||||
$scope.triggerList = _.filter(triggerList, function (trigger) {
|
||||
return !trigger.acknowledges;
|
||||
});
|
||||
} else if ($scope.panel.showTriggers === 'acknowledged') {
|
||||
$scope.triggerList = _.filter(triggerList, 'acknowledges');
|
||||
} else {
|
||||
$scope.triggerList = triggerList;
|
||||
}
|
||||
|
||||
// Filter triggers by severity
|
||||
$scope.triggerList = _.filter($scope.triggerList, function (trigger) {
|
||||
return $scope.panel.triggerSeverity[trigger.priority].show;
|
||||
});
|
||||
|
||||
$scope.panelRenderingComplete();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.groupChanged = function() {
|
||||
return $scope.updateHosts()
|
||||
.then($scope.updateApplications)
|
||||
.then($scope.refreshData);
|
||||
};
|
||||
|
||||
$scope.hostChanged = function() {
|
||||
return $scope.updateApplications()
|
||||
.then($scope.refreshData);
|
||||
};
|
||||
|
||||
$scope.appChanged = function() {
|
||||
var app = $scope.panel.triggers.application.name;
|
||||
|
||||
return datasourceSrv.get($scope.panel.datasource).then(function (datasource) {
|
||||
return datasource.zabbixAPI.getAppByName(app).then(function (applications) {
|
||||
var appids = _.map(applications, 'applicationid');
|
||||
$scope.panel.triggers.application.value = appids.length ? appids : null;
|
||||
});
|
||||
}).then($scope.refreshData);
|
||||
};
|
||||
|
||||
$scope.updateGroups = function() {
|
||||
return datasourceSrv.get($scope.panel.datasource).then(function (datasource) {
|
||||
return $scope.updateGroupList(datasource);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateHosts = function() {
|
||||
return datasourceSrv.get($scope.panel.datasource).then(function (datasource) {
|
||||
return $scope.updateHostList(datasource);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateApplications = function() {
|
||||
return datasourceSrv.get($scope.panel.datasource).then(function (datasource) {
|
||||
return $scope.updateAppList(datasource);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.refreshTriggerSeverity = function() {
|
||||
_.each($scope.triggerList, function(trigger) {
|
||||
trigger.color = $scope.panel.triggerSeverity[trigger.priority].color;
|
||||
trigger.severity = $scope.panel.triggerSeverity[trigger.priority].severity;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.datasourceChanged = function() {
|
||||
$scope.refreshData();
|
||||
};
|
||||
|
||||
$scope.changeTriggerSeverityColor = function(trigger, color) {
|
||||
$scope.panel.triggerSeverity[trigger.priority].color = color;
|
||||
$scope.refreshTriggerSeverity();
|
||||
};
|
||||
|
||||
function getTriggerIndexForElement(el) {
|
||||
return el.parents('[data-trigger-index]').data('trigger-index');
|
||||
}
|
||||
|
||||
$scope.openTriggerColorSelector = function(event) {
|
||||
var el = $(event.currentTarget);
|
||||
var index = getTriggerIndexForElement(el);
|
||||
var popoverScope = $scope.$new();
|
||||
popoverScope.trigger = $scope.panel.triggerSeverity[index];
|
||||
popoverScope.changeTriggerSeverityColor = $scope.changeTriggerSeverityColor;
|
||||
|
||||
popoverSrv.show({
|
||||
element: el,
|
||||
placement: 'top',
|
||||
templateUrl: 'app/plugins/panels/triggers/trigger.colorpicker.html',
|
||||
scope: popoverScope
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateGroupList = function (datasource) {
|
||||
datasource.zabbixAPI.performHostGroupSuggestQuery().then(function (groups) {
|
||||
$scope.metric.groupList = $scope.metric.groupList.concat(groups);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateHostList = function (datasource) {
|
||||
var groups = $scope.panel.triggers.group.groupid ? $scope.panel.triggers.group.name : '*';
|
||||
if (groups) {
|
||||
datasource.zabbixAPI.hostFindQuery(groups).then(function (hosts) {
|
||||
$scope.metric.hostList = [{name: 'All', hostid: null}];
|
||||
$scope.metric.hostList = $scope.metric.hostList.concat(hosts);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.updateAppList = function (datasource) {
|
||||
var groups = $scope.panel.triggers.group.groupid ? $scope.panel.triggers.group.name : '*';
|
||||
var hosts = $scope.panel.triggers.host.hostid ? $scope.panel.triggers.host.name : '*';
|
||||
if (groups && hosts) {
|
||||
datasource.zabbixAPI.appFindQuery(hosts, groups).then(function (apps) {
|
||||
apps = _.map(_.uniq(_.map(apps, 'name')), function (appname) {
|
||||
return {
|
||||
name: appname,
|
||||
value: appname
|
||||
};
|
||||
});
|
||||
$scope.metric.applicationList = [{name: 'All', value: null}];
|
||||
$scope.metric.applicationList = $scope.metric.applicationList.concat(apps);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
});
|
||||
});
|
||||
8
plugins/panel-triggers/plugin.json
Normal file
8
plugins/panel-triggers/plugin.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"pluginType": "panel",
|
||||
|
||||
"name": "Zabbix triggers",
|
||||
"type": "triggers",
|
||||
|
||||
"module": "app/plugins/panels/triggers/module"
|
||||
}
|
||||
13
plugins/panel-triggers/trigger.colorpicker.html
Normal file
13
plugins/panel-triggers/trigger.colorpicker.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<div class="graph-legend-popover">
|
||||
<a class="close"
|
||||
href=""
|
||||
ng-click="dismiss();">×</a>
|
||||
|
||||
<div class="editor-row">
|
||||
<i ng-repeat="color in colors" class="pointer"
|
||||
ng-class="{'fa fa-circle-o': color === trigger.color,'fa fa-circle': color !== trigger.color}"
|
||||
ng-style="{color:color}"
|
||||
ng-click="changeTriggerSeverityColor(trigger, color);dismiss();"> </i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user