gbudny93.RouterOS_Useful_Sc.../RouterOS_Low_Disk_Space.rsc

23 lines
609 B
Text
Raw Permalink Normal View History

2019-07-14 22:52:31 +02:00
# RouterOS Function
# Copyright (c) Grzegorz Budny
2020-02-08 20:03:02 +01:00
# Version 1.0
# Last update: 2/8/2020
2019-07-14 22:52:31 +02:00
# Generates log alert when free disk space reach specified treshhold
:global LowDiskSpace do={
:local alertSpace $treshhold;
:local freeSpace [/system resource get free-hdd-space];
:local totalSpace [/system resource get total-hdd-space];
:local diskUsage (($freeSpace * 100)/$totalSpace);
:if ($diskUsage < $treshhold) do={
/log warning ("Disk space reached ".$treshhold." % treshold. Free disk space is ".$diskUsage."%");
}
}
$LowDiskSpace treshhold=free_disk_space_in_%;