chore(demo): add a region label with wildcard color

This commit is contained in:
Łukasz Mierzwa
2019-03-20 21:15:26 +00:00
parent 4ef9052a98
commit 67db581aa5
2 changed files with 23 additions and 12 deletions

View File

@@ -137,7 +137,7 @@ class AlwaysOnAlert(AlertGenerator):
def _gen(size, cluster):
return [newAlert(
self._labels(instance="server{}".format(i), cluster=cluster,
severity="info", job="node_exporter"),
severity="info", job="node_exporter", region="US"),
self._annotations(
summary="Silence this alert, it's always firing")
) for i in xrange(1, size)]
@@ -153,7 +153,8 @@ class RandomInstances(AlertGenerator):
return [
newAlert(
self._labels(instance="server{}".format(i), cluster="staging",
severity="warning", job="node_exporter"),
severity="warning", job="node_exporter",
region="US"),
self._annotations(
dashboard="https://www.google.com/search?q="
"server{}".format(i))
@@ -174,7 +175,7 @@ class RandomName(AlertGenerator):
self._labels(alertname="Alert Nr {}".format(throw),
instance="server{}".format(i),
cluster="dev", severity="info",
job="random_exporter"),
job="random_exporter", region="EU"),
self._annotations(
summary="This is a random alert",
dashboard="https://www.google.com/search?q="
@@ -195,7 +196,8 @@ class LowChance(AlertGenerator):
return [
newAlert(
self._labels(instance="server{}".format(i), cluster="dev",
severity="critical", job="random_exporter"),
severity="critical", job="random_exporter",
region="EU"),
self._annotations()
) for i in xrange(0, 3)
]
@@ -209,7 +211,8 @@ class TimeAnnotation(AlertGenerator):
def alerts(self):
return [
newAlert(self._labels(instance="server1", cluster="prod",
severity="warning", job="ntp_exporter"),
severity="warning", job="ntp_exporter",
region="AP"),
self._annotations(time=str(int(time.time())))
)
]
@@ -228,7 +231,7 @@ class DiskFreeLowAlert(AlertGenerator):
cluster="prod",
device="/dev/sda{}".format(i),
mount_point="/disk", severity="critical",
job="node_exporter"),
job="node_exporter", region="AP"),
self._annotations(
summary="Only {}% free space left on /disk".format(
spaceFree),
@@ -245,7 +248,8 @@ class SilencedAlert(AlertGenerator):
def alerts(self):
return [
newAlert(self._labels(instance="server1", cluster="prod",
severity="info", job="mysql_exporter"),
severity="info", job="mysql_exporter",
region="SA"),
self._annotations(
alertReference="https://www."
"youtube.com/watch?v=dQw4w9WgXcQ")
@@ -281,7 +285,8 @@ class MixedAlerts(AlertGenerator):
def alerts(self):
return [
newAlert(self._labels(instance="server{}".format(i), cluster="prod",
severity="warning", job="node_exporter"),
severity="warning", job="node_exporter",
region="SA"),
self._annotations(
alertReference="https://www."
"youtube.com/watch?v=dQw4w9WgXcQ")
@@ -312,7 +317,8 @@ class LongNameAlerts(AlertGenerator):
def _gen(size, cluster):
return [newAlert(
self._labels(instance="server{}".format(i), cluster=cluster,
severity="info", job="textfile_exporter"),
severity="info", job="textfile_exporter",
region="CN"),
self._annotations(
verylong="Lorem ipsum dolor sit amet, consectetur "
"adipiscing elit, sed do eiusmod tempor incididunt"
@@ -338,7 +344,8 @@ class InhibitedAlert(AlertGenerator):
def alerts(self):
return [
newAlert(self._labels(instance="server1", cluster="prod",
severity="warning", job="textfile_exporter"),
severity="warning", job="textfile_exporter",
region="CN"),
self._annotations()
)
]
@@ -351,7 +358,8 @@ class InhibitingAlert(AlertGenerator):
def alerts(self):
return [
newAlert(self._labels(instance="server1", cluster="prod",
severity="critical", job="textfile_exporter"),
severity="critical", job="textfile_exporter",
region="CN"),
self._annotations()
)
]
@@ -364,7 +372,8 @@ class SilencedAlertWithJiraLink(AlertGenerator):
def alerts(self):
return [
newAlert(self._labels(instance="server%d" % i, cluster="staging",
severity="critical", job="node_exporter"),
severity="critical", job="node_exporter",
region="AF"),
self._annotations(
dashboard="https://www.atlassian.com/software/jira")
) for i in xrange(1, 9)

View File

@@ -41,6 +41,8 @@ labels:
- instance
- "@receiver"
custom:
region:
"*": "#736598"
severity:
info: "#87c4e0"
warning: "#ffae42"