diff options
author | Christian Hesse <mail@eworm.de> | 2020-04-18 23:20:29 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-04-19 00:11:01 +0200 |
commit | c8770efd7222f317ccedf228c0a1cae6c1b16262 (patch) | |
tree | ea9d6ff306b25b06a0914f48fbe03a9bfb800af9 /early-errors | |
parent | aedc31451950809f9f7dae4a4d7e40d1495f9ac5 (diff) |
add script 'early-erros'
Diffstat (limited to 'early-errors')
-rw-r--r-- | early-errors | 22 |
1 files changed, 22 insertions, 0 deletions
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 <mail@eworm.de> +# +# 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); +} |