[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MONIT: If match FOO and BAR then alert
From: |
Martin Pala |
Subject: |
Re: MONIT: If match FOO and BAR then alert |
Date: |
Sun, 10 Apr 2016 15:33:09 +0200 |
Hi,
the content match test uses a regular expression ... you can just specify a
pattern, which will match the content you want ("FOO and BAR" shouldn't be
problem).
Regards,
Martin
> On 09 Apr 2016, at 00:20, address@hidden wrote:
>
> My logfiles look like this:
>
> {"level":"info",
> "message":"Fork",
> "timestamp":"2016-04-04 01:30:40",
> "data":
> {"delegate":"018dac7f44fe0a48b21dccb8b5f10f3023e4496aa19ad31dbe9dc8c216c3222f",
> "block": {"id":"13079141691421199733",
> "timestamp":31128640,
> "height":433168,
> "previousBlock":"10210628104998625034"},
> "cause":5}}
>
> Important are only "Fork" and "cause":5
>
> I am using following config currently to alarm "Fork" but I want to
> combine it with different "causes".
>
> # BEGIN OF SCRIPT
> check file messages with path /home/username/software/logs.log
> if match "Fork" then alert
> # END OF SCRIPT
>
> - How does the script have to look like if I only want alerts if a log
> matches "Fork" and "cause":1 and "cause":2?
>
> - And what about the quotes in my logfiles? I think it's better to
> ignore all quotes because they are part of the config file, or? I hope
> you know what I mean.
>
> Thanks in advance for your help!
>
>
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general