This repository was archived by the owner on Dec 23, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +36
-3
lines changed
src/main/java/org/graylog/plugins/usagestatistics Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 1919import com .google .common .collect .ImmutableMap ;
2020import org .cliffc .high_scale_lib .Counter ;
2121import org .graylog .plugins .usagestatistics .UsageStatsMetaData ;
22+ import org .graylog .plugins .usagestatistics .dto .AlarmStats ;
2223import org .graylog .plugins .usagestatistics .dto .ClusterDataSet ;
2324import org .graylog .plugins .usagestatistics .dto .ClusterStats ;
2425import org .graylog .plugins .usagestatistics .dto .LdapStats ;
@@ -99,7 +100,8 @@ private ClusterStats buildClusterStats() {
99100 clusterStats .contentPackCount (),
100101 counts .total (),
101102 buildStreamThroughput (),
102- buildLdapStats ()
103+ buildLdapStats (),
104+ buildAlarmStats ()
103105 );
104106 }
105107
@@ -126,4 +128,9 @@ private LdapStats buildLdapStats() {
126128 ldapStats .roleMappingCount (),
127129 ldapStats .roleCount ());
128130 }
131+
132+ private AlarmStats buildAlarmStats () {
133+ final org .graylog2 .system .stats .AlarmStats stats = clusterStatsService .alarmStats ();
134+ return AlarmStats .create (stats .alertCount (), stats .alarmcallbackCountByType ());
135+ }
129136}
Original file line number Diff line number Diff line change 1+ package org .graylog .plugins .usagestatistics .dto ;
2+
3+ import com .fasterxml .jackson .annotation .JsonAutoDetect ;
4+ import com .fasterxml .jackson .annotation .JsonProperty ;
5+ import com .google .auto .value .AutoValue ;
6+
7+ import java .util .Map ;
8+
9+ @ JsonAutoDetect
10+ @ AutoValue
11+ public abstract class AlarmStats {
12+ @ JsonProperty
13+ public abstract long alertCount ();
14+
15+ @ JsonProperty
16+ public abstract Map <String , Long > alarmcallbackCountByType ();
17+
18+ public static AlarmStats create (long alertCount , Map <String , Long > alarmcallbackCountByType ) {
19+ return new AutoValue_AlarmStats (alertCount , alarmcallbackCountByType );
20+ }
21+ }
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ public static ClusterStats create(ElasticsearchClusterStats elasticsearchCluster
4646 long contentPackCount ,
4747 long totalMessages ,
4848 Map <String , Long > streamThroughput ,
49- LdapStats ldapStats
49+ LdapStats ldapStats ,
50+ AlarmStats alarmStats
5051 ) {
5152 return new AutoValue_ClusterStats (
5253 elasticsearchCluster ,
@@ -68,7 +69,8 @@ public static ClusterStats create(ElasticsearchClusterStats elasticsearchCluster
6869 contentPackCount ,
6970 totalMessages ,
7071 streamThroughput ,
71- ldapStats );
72+ ldapStats ,
73+ alarmStats );
7274 }
7375
7476 @ JsonProperty
@@ -130,4 +132,7 @@ public static ClusterStats create(ElasticsearchClusterStats elasticsearchCluster
130132
131133 @ JsonProperty
132134 public abstract LdapStats ldapStats ();
135+
136+ @ JsonProperty
137+ public abstract AlarmStats alarmStats ();
133138}
You can’t perform that action at this time.
0 commit comments