Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #675 from jshaughn/hawkular-464
Browse files Browse the repository at this point in the history
Hawkular-464 Deployment Failure Event Alerting
  • Loading branch information
mtho11 committed Nov 20, 2015
2 parents a93a576 + e73ed89 commit 56db44b
Show file tree
Hide file tree
Showing 26 changed files with 488 additions and 291 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ <h3>Deployments</h3>
</div>
</div>
<div class="col-lg-3">
<hk-alert-info list="vm.alertList" limit="(vm.showAllAlerts ? 100000 : 3)" resource-id="vm.resourceId"
title="Deployments">
<hk-alert-info list="vm.alertList" limit="(vm.showAllAlerts ? 100000 : 3)"
resource-id="vm.$routeParams.resourceId" title="Deployments">
</hk-alert-info>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ <h2>GC Duration</h2>
</div>

<div class="col-lg-3">
<hk-alert-info list="vm.alertList" limit="(vm.showAllAlerts ? 100000 : 3)" resource-id="vm.resourceId"
title="JVM">
<hk-alert-info list="vm.alertList" limit="(vm.showAllAlerts ? 100000 : 3)"
resource-id="vm.$routeParams.resourceId" title="JVM">
</hk-alert-info>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ <h2>Web Sessions</h2>
</div>
</div>
<div class="col-lg-3">
<hk-alert-info list="vm.alertList" limit="(vm.showAllAlerts ? 100000 : 3)" resource-id="vm.resourceId"
title="Web">
<hk-alert-info list="vm.alertList" limit="(vm.showAllAlerts ? 100000 : 3)"
resource-id="vm.$routeParams.resourceId" title="Web">
</hk-alert-info>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
<div ng-switch-when="REJECTED_SESSIONS">
<strong>Rejected Web Sessions</strong>: The number of rejected web sessions was {{alert.avg}}.
</div>
<div ng-switch-when="DEPLOYMENT_FAIL">
<strong>Deployment Failed</strong>: {{alert.message}}.
</div>
<div ng-switch-default>
<strong>Alert</strong>: <code>{{alert}}</code>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ <h3>Alert Settings</h3>
<hk-fieldset-dampening hk-duration="tc.adm.trigger.evalTimeSetting"
hk-title="Downtime"
hk-title-met="Every time it goes down."
hk-title-unmet="Only when it is down for more than:"></hk-fieldset-dampening>
hk-title-unmet="Only when it is down for more than:">
</hk-fieldset-dampening>

<hk-fieldset-notification hk-alert-email="tc.adm.trigger.email"></hk-fieldset-notification>
</form>
Expand Down
57 changes: 57 additions & 0 deletions console/src/main/scripts/plugins/metrics/html/triggers/event.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<div class="hk-alert-center-detail">

<div class="hk-screen-top-nav">
<div class="container">
<div class="row hk-top-row">
<div class="col-xs-6">
<a href="/hawkular-ui/alerts-center-triggers" class="back">&laquo; All Definitions</a>
</div>
</div>
<div class="hk-heading">
<h1 class="offset-panels">Alert Definition Details</h1>
</div>
</div>
</div>

<div class="container">

<div class="row">
<div class="col-lg-9 col-md-8">
<div class="panel panel-default clearfix">
<div class="panel-heading">
<h2>{{tc.adm.trigger.name}}</h2>
</div>
<div class="panel-body">
<form class="form-horizontal">
<div ng-include="'plugins/metrics/html/partials/trigger-general-setup.html'"></div>

<h3>Alert Settings</h3>

<fieldset>
{{tc.adm.trigger.conditionContext.description !== '' ?
tc.adm.trigger.conditionContext.description : "Event"}}
</fieldset>

<hk-fieldset-notification hk-alert-email="tc.adm.trigger.email"></hk-fieldset-notification>
</form>

<div class="form-actions hk-form-actions-separator text-right">
<a type="button" class="btn btn-default" ng-href="{{tc.cancel()}}" class="button">Cancel</a>
<button type="button" class="btn btn-primary" ng-click="tc.save()"
ng-disabled="tc.saveProgress || !tc.isSettingChange">
<div ng-show="tc.saveProgress" class="spinner spinner-xs hk-modal-spinner"></div>
Save
</button>
</div>

</div>
</div>
</div>

<div ng-include="'plugins/metrics/html/partials/trigger-alerts-sidebar.html'"></div>

</div> <!-- row -->

</div> <!-- container -->

</div>
16 changes: 10 additions & 6 deletions console/src/main/scripts/plugins/metrics/html/url-alerts.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
<hawkular-subtab ng-controller="Subtab.SubtabController">
<div class="hk-nav-tabs-container">
<ul class="nav nav-tabs nav-tabs-pf">
<li class="active"><a href="/hawkular-ui/url/alerts/{{mac.$routeParams.resourceId}}/{{mac.$routeParams.timeOffset}}" class="hk-alerts">All Alerts</a></li>
<li><a href="/hawkular-ui/url/availability/{{mac.$routeParams.resourceId}}/{{mac.$routeParams.timeOffset}}" class="hk-availability">Availability</a></li>
<li><a href="/hawkular-ui/url/response-time/{{mac.$routeParams.resourceId}}/{{mac.$routeParams.timeOffset}}" class="hk-response-time">Response Time</a></li>
<li class="active"><a
href="/hawkular-ui/url/alerts/{{mac.$routeParams.resourceId}}/{{mac.$routeParams.timeOffset}}"
class="hk-alerts">All Alerts</a></li>
<li><a href="/hawkular-ui/url/availability/{{mac.$routeParams.resourceId}}/{{mac.$routeParams.timeOffset}}"
class="hk-availability">Availability</a></li>
<li><a href="/hawkular-ui/url/response-time/{{mac.$routeParams.resourceId}}/{{mac.$routeParams.timeOffset}}"
class="hk-response-time">Response Time</a></li>
</ul>
</div>
</hawkular-subtab>
Expand All @@ -13,9 +17,9 @@
<div class="hk-info-top clearfix">
<h3 class="pull-left">Alerts <span>({{(mac.alertList).length}})</span></h3>
<span class="hk-settings pull-left">
<a href="#" ng-click="mac.openResponseSetup()"><i class="fa fa-cog"></i>Response Time Alert Settings</a>
<a href="#" ng-controller="MetricsAvailabilityController as vm" ng-click="vm.openAvailabilitySetup()">
<i class="fa fa-cog"></i>Availability Alert Settings</a>
<a ng-href="/hawkular-ui/alerts-center-triggers/{{mac.$routeParams.resourceId}}">
<i class="fa fa-cog"></i>Definitions
</a>
</span>
</div>
<div ng-include="'plugins/metrics/html/partials/url-alerts-view.html'"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ <h3 class="pull-left" data-toggle="tooltip" data-placement="top" title="" data-o
<button class="btn btn-link hk-trigger" ng-click="showAllAlerts = !showAllAlerts">
<i ng-show="vm.alertList.length" ng-class="showAllAlerts ? 'fa fa-minus-square-o':'fa fa-plus-square-o'"></i>
Availability Alerts
<span ng-show="vm.alertList.length">
({{showAllAlerts ? vm.alertList.length : MetricsAvailabilityController.min(vm.alertList.length, 3)}} of
<ng-span ng-show="vm.alertList.length">
({{showAllAlerts ? vm.alertList.length : vm.min(vm.alertList.length, 3)}} of
{{vm.alertList.length}})
</span>
</ng-span>
</button>
</h3>
<span class="hk-settings pull-left">
<a ng-href="/hawkular-ui/alerts-center-triggers/{{vm.resourceId}}">
<i class="fa fa-cog"></i>Alert Settings
<a ng-href="/hawkular-ui/alerts-center-triggers/{{vm.$routeParams.resourceId}}">
<i class="fa fa-cog"></i>Definitions
</a>
</span>
</div>
Expand All @@ -109,7 +109,7 @@ <h3 class="pull-left" data-toggle="tooltip" data-placement="top" title="" data-o
<h3 class="pull-left">Metrics</h3>

<div class="hk-update pull-right">
<button ng-click="vm.refreshAvailPageNow(vm.getResourceId())" class="btn btn-link hk-chart-update"
<button ng-click="vm.refreshAvailPageNow(vm.$routeParams.resourceId)" class="btn btn-link hk-chart-update"
tooltip-trigger tooltip-placement="top" tooltip-append-to-body="true" tooltip="Update chart">
<i class="fa fa-refresh"></i>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ <h3 class="pull-left" data-toggle="tooltip" data-placement="top" title="" data-o
<button class="btn btn-link hk-trigger" ng-click="showAllAlerts = !showAllAlerts">
<i ng-show="vm.alertList.length" ng-class="showAllAlerts? 'fa fa-minus-square-o' : 'fa fa-plus-square-o'"></i>
Response Time Alerts
<span ng-show="vm.alertList.length">
({{showAllAlerts ? vm.alertList.length : MetricsViewController.min(vm.alertList.length, 3)}} of
<ng-span ng-show="vm.alertList.length">
({{showAllAlerts ? vm.alertList.length : vm.min(vm.alertList.length, 3)}} of
{{vm.alertList.length}})
</span>
</ng-span>
</button>
</h3>
<span class="hk-settings pull-left">
<a ng-href="/hawkular-ui/alerts-center-triggers/{{vm.resourceId}}">
<i class="fa fa-cog"></i>Alert Settings
<a ng-href="/hawkular-ui/alerts-center-triggers/{{vm.$routeParams.resourceId}}">
<i class="fa fa-cog"></i>Definitions
</a>
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module HawkularMetrics {
public hasDisabledSelectedItems:boolean = false;
public sortField:string = 'name';
public sortAsc:boolean = true;
public resourceId;


public loadingMoreItems:boolean = false;
public addProgress:boolean = false;
Expand All @@ -63,8 +63,6 @@ module HawkularMetrics {
this.$rootScope.prevLocation = $location.url();

this.autoRefresh(120);
this.resourceId = $routeParams.resourceId ?
this.decodeResourceId($routeParams.resourceId) : '';

if ($rootScope.currentPersona) {
this.getTriggers();
Expand Down Expand Up @@ -93,7 +91,8 @@ module HawkularMetrics {
ordering = 'desc';
}

let tagValue = this.resourceId ? this.resourceId : '*';
let resourceId:string = this.$routeParams.resourceId ? this.decodeResourceId(this.$routeParams.resourceId) : '';
let tagValue = resourceId ?resourceId : '*';
this.HawkularAlertsManager.queryTriggers({
tags: 'resourceId|' + tagValue,
currentPage: this.triggersCurPage,
Expand Down Expand Up @@ -188,37 +187,55 @@ module HawkularMetrics {
let route = 'unknown-trigger-type';
let encodedId = this.encodeResourceId(trigger.id);

if ('Availability' === trigger.context.triggerType) {
route = '/hawkular-ui/alerts-center-triggers/availability/' + encodedId;
} else if ('Range' === trigger.context.triggerType) {
route = '/hawkular-ui/alerts-center-triggers/range/' + encodedId;
} else if ('RangeByPercent' === trigger.context.triggerType) {
route = '/hawkular-ui/alerts-center-triggers/range-percent/' + encodedId;
} else if ('Threshold' === trigger.context.triggerType) {
route = '/hawkular-ui/alerts-center-triggers/threshold/' + encodedId;
switch (trigger.context.triggerType) {
case 'Availability' :
route = '/hawkular-ui/alerts-center-triggers/availability/' + encodedId;
break;
case 'Event' :
route = '/hawkular-ui/alerts-center-triggers/event/' + encodedId;
break;
case 'Range' :
route = '/hawkular-ui/alerts-center-triggers/range/' + encodedId;
break;
case 'RangeByPercent' :
route = '/hawkular-ui/alerts-center-triggers/range-percent/' + encodedId;
break;
case 'Threshold' :
route = '/hawkular-ui/alerts-center-triggers/threshold/' + encodedId;
break;
}

return route;
}

public getResourceRoute(trigger:IAlertTrigger):string {
let route = 'unknown-resource-type';
let encodedId = this.encodeResourceId(trigger.id);

if ('App Server' === trigger.context.resourceType) {
route = '/hawkular-ui/app/app-details/' + trigger.context.resourceName + '/jvm';
} else if ('DataSource' === trigger.context.resourceType) {
let resIdPart = trigger.context.resourceName.split('~/')[0];
route = '/hawkular-ui/app/app-details/' + resIdPart + '/datasources';
} else if ('URL' === trigger.context.resourceType) {
let parts = trigger.id.split('_trigger_');
let resourceId = parts[0];
let segment = ( parts[1] === 'thres' ) ? 'response-time' : 'availability';
route = '/hawkular-ui/url/' + segment + '/' + trigger.id.split('_trigger_')[0];
switch (trigger.context.resourceType) {
case 'App Server' :
route = '/hawkular-ui/app/app-details/' + trigger.context.resourceName + '/jvm';
break;
case 'App Server Deployment' :
route = '/hawkular-ui/app/app-details/' + trigger.context.resourceName + '/deployments';
break;
case 'DataSource' :
let resIdPart = trigger.context.resourceName.split('~/')[0];
route = '/hawkular-ui/app/app-details/' + resIdPart + '/datasources';
break;
case 'URL' :
let parts = trigger.id.split('_trigger_');
let resourceId = parts[0];
let segment = ( parts[1] === 'thres' ) ? 'response-time' : 'availability';
route = '/hawkular-ui/url/' + segment + '/' + trigger.id.split('_trigger_')[0];
break;
}

return route;
}

public setPage(page:number):void {
public
setPage(page:number):void {
this.triggersCurPage = page;
this.getTriggers();
}
Expand Down

0 comments on commit 56db44b

Please sign in to comment.