Skip to content

Commit

Permalink
Added metrics (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
adri9valle authored and Jesús Ángel committed May 29, 2019
1 parent 79f50de commit f52ceb4
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@
</div>
</div>
<div ng-show="!loadingVizz">

<!-- metrics row -->
<div layout="row" class="wz-margin-9">
<!-- metrics -->
<md-card flex class="wz-metric-color">
<md-card-content layout="row" class="wz-padding-metric">
<div class="wz-text-truncatable" flex>Alerts:
<span class="wz-text-bold" ng-bind="totalAlerts"></span>
</div>
<div class="wz-text-truncatable" flex>Level 12 or above alerts:
<span class="wz-text-bold" ng-bind="levelTwelve"></span>
</div>
<div class="wz-text-truncatable" flex>Authentication failure:
<span class="wz-text-bold" ng-bind="authFailure"></span>
</div>
<div class="wz-text-truncatable" flex>Authentication success:
<span class="wz-text-bold" ng-bind="authSuccess"></span>
</div>
</md-card-content>
</md-card>
</div>

<!-- first row -->
<div id="row1" layout="row">
<!-- first row - first vis - Alert level evolution -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ define([
'../../../services/visualizations/chart/pie-chart',
'../../../services/visualizations/table/table',
'../../../services/visualizations/inputs/time-picker',
'../../../services/visualizations/search/search-handler',
'../../../services/rawTableData/rawTableDataService'
], function(
app,
Expand All @@ -25,6 +26,7 @@ define([
PieChart,
Table,
TimePicker,
SearchHandler,
RawTableDataService
) {
'use strict'
Expand Down Expand Up @@ -58,6 +60,7 @@ define([
) {
this.state = $state
this.urlTokenModel = $urlTokenModel
this.submittedTokenModel = this.urlTokenModel.getSubmittedTokenModel()
this.scope = $scope
this.scope.reportingEnabled = reportingEnabled
this.requestService = $requestService
Expand Down Expand Up @@ -97,6 +100,49 @@ define([
})

this.vizz = [
/**
* Metrics
*/
new SearchHandler(
`totalAlerts`,
`${this.filters} | stats count`,
`totalAlertsToken`,
'$result.count$',
'totalAlerts',
this.submittedTokenModel,
this.scope
),
new SearchHandler(
`searchLevel12`,
`${this.filters} sourcetype=wazuh "rule.level">=12 | chart count`,
`level12token`,
'$result.count$',
'levelTwelve',
this.submittedTokenModel,
this.scope
),
new SearchHandler(
`searchAuthFailure`,
`${
this.filters
} sourcetype=wazuh "rule.groups{}"="authentication_fail*" | stats count`,
`authFailureToken`,
'$result.count$',
'authFailure',
this.submittedTokenModel,
this.scope
),
new SearchHandler(
`searchAuthSuccess`,
`${
this.filters
} sourcetype=wazuh "rule.groups{}"="authentication_success" | stats count`,
`authSuccessToken`,
'$result.count$',
'authSuccess',
this.submittedTokenModel,
this.scope
),
/**
* Visualizations
*/
Expand Down Expand Up @@ -401,4 +447,4 @@ define([
}

app.controller('agentsGeneralCtrl', AgentsGeneral)
})
})

0 comments on commit f52ceb4

Please sign in to comment.