From c8770efd7222f317ccedf228c0a1cae6c1b16262 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 18 Apr 2020 23:20:29 +0200 Subject: add script 'early-erros' --- early-errors | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 early-errors (limited to 'early-errors') diff --git a/early-errors b/early-errors new file mode 100644 index 0000000..ad871f6 --- /dev/null +++ b/early-errors @@ -0,0 +1,22 @@ +#!rsc +# RouterOS script: early-errors +# Copyright (c) 2020 Christian Hesse +# +# send notification with early errors +# https://git.eworm.de/cgit/routeros-scripts/about/doc/early-errors.md + +:global Identity; + +:global SendNotification; + +:local ErrCount [ / log print count-only where topics~"error" ]; +:if ($ErrCount > 0) do={ + :local Message ("The log on " . $Identity . " contains " . $ErrCount . \ + " errors after " . [ / system resource get uptime ] . " uptime.\n"); + :foreach Log in=[ / log find where topics~"error" ] do={ + :local LogVal [ / log get $Log ]; + :set Message ($Message . "\n" . [ :tostr ($LogVal->"topics") ] . \ + " " . ($LogVal->"message")); + } + $SendNotification ("\E2\9A\A0 Early errors") ($Message); +} -- cgit v1.2.3-70-g09d2