do not report for known broken containers_ munin graphs (#68434)
gitea/publik-infra/pipeline/head This commit looks good Details

This commit is contained in:
Frédéric Péters 2023-08-05 09:58:42 +02:00
parent 8e5a61365d
commit 222acc41af
1 changed files with 10 additions and 2 deletions

View File

@ -55,6 +55,7 @@ eo_units = Gauge("eo_units", "systemd units", ["ctn", "name", "state"], registry
eo_packages = Gauge("eo_packages", "packages", ["ctn", "state"], registry=registry)
eo_kernel = Gauge("eo_kernel", "kernel update", ["ctn"], registry=registry)
def run(cmd):
m = shlex.split(cmd)
p = subprocess.Popen(m, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@ -148,7 +149,13 @@ def munin(ctn):
for filename in ["/var/log/munin/munin-node.log", "/var/log/munin/munin-node.log.1"]:
if os.path.isfile(filename):
count += len(
[x for x in open(filename).readlines() if x > since_str and "exited with status" in x]
[
x
for x in open(filename).readlines()
if x > since_str and "exited with status" in x
# do not report for known broken graphs
and not ("containers_cpu" in x or "containers_io" in x or "containers_memory" in x)
]
)
eo_munin.labels(ctn, "errors").set(count)
@ -302,9 +309,10 @@ def check_kernel_version(ctn):
if line != b"Version: " + current_version_extract.encode("ascii"):
eo_kernel.labels(ctn).set(1)
return
break
break
eo_kernel.labels(ctn).set(0)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--test", action="store_true", help="raise errors")