prometheus: only check recent munin errors (#50471)
This commit is contained in:
parent
f910dfd327
commit
cb3a3c28ab
|
@ -104,10 +104,15 @@ def local_changes(ctn):
|
|||
|
||||
|
||||
def munin(ctn):
|
||||
f = "/var/log/munin/munin-node.log"
|
||||
if os.path.isfile(f):
|
||||
n = len([l for l in open(f).readlines() if "rror" in l and "mail_space" not in l])
|
||||
eo_munin.labels(ctn, "errors").set(n)
|
||||
since = datetime.datetime.now() - datetime.timedelta(hours=1)
|
||||
since_str = since.strftime("%Y/%m/%d-%H:%M:%S")
|
||||
count = 0
|
||||
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]
|
||||
)
|
||||
eo_munin.labels(ctn, "errors").set(count)
|
||||
|
||||
|
||||
def nginx(ctn):
|
||||
|
|
Loading…
Reference in New Issue