mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-08-03 01:35:03 +02:00
add script 'early-erros'
This commit is contained in:
parent
aedc314519
commit
c8770efd72
3 changed files with 65 additions and 0 deletions
22
early-errors
Normal file
22
early-errors
Normal file
|
@ -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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue