nas_space - pokazuje zajętość miejsca w katalogu

Cytat z gielo data 2024-11-03, 12:50Moduł monitoruje zajętość miejsca we wskazanym katalogu np. /nas (ścieżkę do katalogu deklarujemy w pliku źródłowym modułu). Po osiągnięciu zadeklarowanej wartości wysyłany jest alert.
Paczka do pobrania nas_space_v1.2
Module Setup
1. Extract the package to /etc/monit/custommodules/. If the custommodules directory does not exist, create it.
2. Modify the settings in the config.cpp file if needed.
3. Run the autogen script. This will create the executable file for the module.
4. Add the following entry to the /etc/monit/monitrc file:# nas_space
check program home_nas with path "/etc/monit/custommodules/nas_space/nas_space"
every 60 cycles
if status > 250 then alert # > 250GB - set your own limit5. Reload Monit with the command:
$ systemctl reload monitModule Update
1. Replace the module files with the newer version.
2. Run the autogen script.
3. Reload Monit with the command:
$ systemctl reload monitUruchomienie modułu
1. Rozpakuj paczkę do /etc/monit/custrommodules/ Jeśli nie masz katalogu custommodules, utwórz go
2. Zmień ustawienia w pliku config.cpp jeśli masz taką potrzebę
3. Uruchom plik autogen. Spowoduje to utworzenie pliku wykonywalnego modułu
4. Dodaj do pliku /etc/monit/monitrc poniższy wpis:# nas_space
check program home_nas with path "/etc/monit/custommodules/nas_space/nas_space"
every 60 cycles
if status > 250 then alert # > 250GB - ustaw własny limit5. przeładuj monit poleceniem:
$ systemctl reload monitAktualizacja modułu
1. Zastąp pliki modułu, jego nowszą wersją
2. Uruchom plik autogen
3. przeładuj monit poleceniem:
$ systemctl reload monit-- chanelog --
v1.2
- I added the option to display messages in English
- Dodałem możliwość wyświetlenia komunikatów po angielsku
v1.1.1
- I moved the variable with the declaration of the monitored directory path, to the config.cpp.
- Przeniosłem zmienną z deklaracją ścieżki monitorowanego katalogu do config.cpp.
v1.1
- I improved the readability of the code and moved the variable with the declaration of the monitored directory path, to the beginning of the program.
- Poprawiłem czytelność kodu i przeniosłem zmienną z deklaracją ścieżki monitorowanego katalogu na początek programu.
Test obciążeniowy
% time seconds usecs/call calls errors syscall
100.00 0.015527 15527 1 wait4
0.00 0.000000 0 1 fcntl
0.00 0.000000 0 1 1 faccessat
0.00 0.000000 0 5 openat
0.00 0.000000 0 7 close
0.00 0.000000 0 1 pipe2
0.00 0.000000 0 5 read
0.00 0.000000 0 1 write
0.00 0.000000 0 7 newfstatat
0.00 0.000000 0 1 set_tid_address
0.00 0.000000 0 1 futex
0.00 0.000000 0 1 set_robust_list
0.00 0.000000 0 2 rt_sigprocmask
0.00 0.000000 0 3 brk
0.00 0.000000 0 9 munmap
0.00 0.000000 0 1 clone
0.00 0.000000 0 1 execve
0.00 0.000000 0 17 mmap
0.00 0.000000 0 10 mprotect
0.00 0.000000 0 3 prlimit64
0.00 0.000000 0 1 getrandom
0.00 0.000000 0 1 rseq100.00 0.015527 194 80 1 total
Moduł monitoruje zajętość miejsca we wskazanym katalogu np. /nas (ścieżkę do katalogu deklarujemy w pliku źródłowym modułu). Po osiągnięciu zadeklarowanej wartości wysyłany jest alert.
Paczka do pobrania nas_space_v1.2
Module Setup
1. Extract the package to /etc/monit/custommodules/. If the custommodules directory does not exist, create it.
2. Modify the settings in the config.cpp file if needed.
3. Run the autogen script. This will create the executable file for the module.
4. Add the following entry to the /etc/monit/monitrc file:
# nas_space
check program home_nas with path "/etc/monit/custommodules/nas_space/nas_space"
every 60 cycles
if status > 250 then alert # > 250GB - set your own limit
5. Reload Monit with the command:
$ systemctl reload monit
Module Update
1. Replace the module files with the newer version.
2. Run the autogen script.
3. Reload Monit with the command:
$ systemctl reload monit
Uruchomienie modułu
1. Rozpakuj paczkę do /etc/monit/custrommodules/ Jeśli nie masz katalogu custommodules, utwórz go
2. Zmień ustawienia w pliku config.cpp jeśli masz taką potrzebę
3. Uruchom plik autogen. Spowoduje to utworzenie pliku wykonywalnego modułu
4. Dodaj do pliku /etc/monit/monitrc poniższy wpis:
# nas_space
check program home_nas with path "/etc/monit/custommodules/nas_space/nas_space"
every 60 cycles
if status > 250 then alert # > 250GB - ustaw własny limit
5. przeładuj monit poleceniem:
$ systemctl reload monit
Aktualizacja modułu
1. Zastąp pliki modułu, jego nowszą wersją
2. Uruchom plik autogen
3. przeładuj monit poleceniem:
$ systemctl reload monit
-- chanelog --
v1.2
- I added the option to display messages in English
- Dodałem możliwość wyświetlenia komunikatów po angielsku
v1.1.1
- I moved the variable with the declaration of the monitored directory path, to the config.cpp.
- Przeniosłem zmienną z deklaracją ścieżki monitorowanego katalogu do config.cpp.
v1.1
- I improved the readability of the code and moved the variable with the declaration of the monitored directory path, to the beginning of the program.
- Poprawiłem czytelność kodu i przeniosłem zmienną z deklaracją ścieżki monitorowanego katalogu na początek programu.
Test obciążeniowy
% time seconds usecs/call calls errors syscall
100.00 0.015527 15527 1 wait4
0.00 0.000000 0 1 fcntl
0.00 0.000000 0 1 1 faccessat
0.00 0.000000 0 5 openat
0.00 0.000000 0 7 close
0.00 0.000000 0 1 pipe2
0.00 0.000000 0 5 read
0.00 0.000000 0 1 write
0.00 0.000000 0 7 newfstatat
0.00 0.000000 0 1 set_tid_address
0.00 0.000000 0 1 futex
0.00 0.000000 0 1 set_robust_list
0.00 0.000000 0 2 rt_sigprocmask
0.00 0.000000 0 3 brk
0.00 0.000000 0 9 munmap
0.00 0.000000 0 1 clone
0.00 0.000000 0 1 execve
0.00 0.000000 0 17 mmap
0.00 0.000000 0 10 mprotect
0.00 0.000000 0 3 prlimit64
0.00 0.000000 0 1 getrandom
0.00 0.000000 0 1 rseq
100.00 0.015527 194 80 1 total