Skip to content

Commit 565a183

Browse files
committed
Update cluster-name, add additional rules
Prevent from an Elastic bug: elastic/elasticsearch#27860
1 parent 7e5b030 commit 565a183

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

elasticsearch.rule

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,37 @@ ALERT ClusterRebalanceDisabled
125125
description="{{$labels.instance}} reports that cluster rebalance has been disabled on {{$labels.cluster}}",
126126
summary="Cluster rebalance disabled on cluster {{$labels.cluster}}"
127127
}
128+
#Cluster settings
129+
ALERT ClusterAllocationDisabledPersistently
130+
IF cluster_persistent_settings{cluster_routing_allocation_enable="none"} > 0
131+
FOR 5m
132+
LABELS {severity="warning"}
133+
ANNOTATIONS {
134+
description="{{$labels.instance}} reports that cluster allocation has been disabled for {{$labels.cluster}}",
135+
summary="Cluster allocation disabled on cluster {{$labels.cluster}}"
136+
}
137+
ALERT ClusterRebalanceDisabledPersistently
138+
IF cluster_persistent_settings{cluster_routing_rebalance_enable="none"} > 0
139+
FOR 5m
140+
LABELS {severity="warning"}
141+
ANNOTATIONS {
142+
description="{{$labels.instance}} reports that cluster rebalance has been disabled on {{$labels.cluster}}",
143+
summary="Cluster rebalance disabled on cluster {{$labels.cluster}}"
144+
}
145+
146+
ALERT ClusterReadOnly
147+
IF cluster_settings{cluster_blocks_read_only!="false"} > 0
148+
FOR 1min
149+
LABELS {severity="critical"}
150+
ANNOTATIONS {
151+
description="{{$labels.instance}} reports that cluster {{$labels.cluster}} is in read-only mode",
152+
summary="Cluster {{$labels.cluster}} is read-only"
153+
}
154+
ALERT ClusterReadOnlyPersistently
155+
IF cluster_persistent_settings{cluster_blocks_read_only!="false"} > 0
156+
FOR 1min
157+
LABELS {severity="critical"}
158+
ANNOTATIONS {
159+
description="{{$labels.instance}} reports that cluster {{$labels.cluster}} is in read-only mode",
160+
summary="Cluster {{$labels.cluster}} is read-only"
161+
}

src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/ClusterStateMetricsGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class ClusterStateMetricsGenerator implements MetricsGenerator<ClusterState> {
99
@Override
1010
public void generateMetrics(PrometheusFormatWriter writer, ClusterState clusterState) {
11-
String clusterName = clusterState.getClusterName().toString();
11+
String clusterName = clusterState.getClusterName().value();
1212

1313
ValueWriter persistentGauge = writer.addGauge("cluster_persistent_settings")
1414
.withHelp("Cluster persistent settings value visible from this node")

0 commit comments

Comments
 (0)