Nagios
Z wiki linux-user
| Linia 63: | Linia 63: | ||
http://adres-ip-serwera-nagios/nagios<br /> | http://adres-ip-serwera-nagios/nagios<br /> | ||
podając wcześniej skonfigurowane dane użytkownika i jego hasło. | podając wcześniej skonfigurowane dane użytkownika i jego hasło. | ||
| + | |||
==== Pliki konfiguracyjne serwera nagios ==== | ==== Pliki konfiguracyjne serwera nagios ==== | ||
| − | Głównym plikiem konfiguracyjnym nagiosa jest plik | + | Głównym plikiem konfiguracyjnym nagiosa jest plik /etc/nagios/nagios.cfg |
| − | + | ===== /etc/nagios/nagios.cfg ===== | |
w tym pliku znajduje się wiele ciekawych opcji a jedną z najważniejszych dla nas jest | w tym pliku znajduje się wiele ciekawych opcji a jedną z najważniejszych dla nas jest | ||
cfg_file=/etc/nagios/objects/localhost.cfg | cfg_file=/etc/nagios/objects/localhost.cfg | ||
| Linia 71: | Linia 72: | ||
która umożliwia pokazanie nagiosowi pliku konfiguracyjnego z nowo dodanym monitoringiem dla zdalnego hosta tzw objekt. | która umożliwia pokazanie nagiosowi pliku konfiguracyjnego z nowo dodanym monitoringiem dla zdalnego hosta tzw objekt. | ||
Kolejnym albo kolejnymi ważnymi plikami są tzw pliki obiektów znajdujące się w ścieżce ''/etc/nagios/objects''. | Kolejnym albo kolejnymi ważnymi plikami są tzw pliki obiektów znajdujące się w ścieżce ''/etc/nagios/objects''. | ||
| − | + | ===== /etc/nagios/objects/serwer-www.cfg ===== | |
Powyższy przykładowy wpis zawiera dane odnośnie monitorowanego systemu tzn adres | Powyższy przykładowy wpis zawiera dane odnośnie monitorowanego systemu tzn adres | ||
* adres serwera | * adres serwera | ||
| Linia 105: | Linia 106: | ||
host_name serwer-www | host_name serwer-www | ||
service_description Partycja home | service_description Partycja home | ||
| − | check_command check_disk!20%!10%!/dev/sda6 | + | check_command check_nrpe!check_disk!20%!10%!/dev/sda6 |
} | } | ||
define service{ | define service{ | ||
| Linia 111: | Linia 112: | ||
host_name serwer-www | host_name serwer-www | ||
service_description Current Users | service_description Current Users | ||
| − | check_command check_users!20!50 | + | check_command check_nrpe!check_users!20!50 |
} | } | ||
define service{ | define service{ | ||
| Linia 121: | Linia 122: | ||
} | } | ||
| + | W tym momencie próba zrestartowania usługi nagiosa będzie nieudana gdyż w pliku konfiguracyjnym serwer-www.cfg mamy podane nie istniejące definicje komend a dokładniej chodzi o trzy definicje czyli | ||
| + | * check_disk | ||
| + | * check_users | ||
| + | * check_nrpe | ||
| + | błąd można bardzo łatwo wykryć poleceniem | ||
| + | # nagios -v /etc/nagios/nagios.cfg | ||
| + | Nagios Core 3.2.3 | ||
| + | Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors | ||
| + | Copyright (c) 1999-2009 Ethan Galstad | ||
| + | Last Modified: 10-03-2010 | ||
| + | License: GPL | ||
| + | Website: http://www.nagios.org | ||
| + | Reading configuration data... | ||
| + | Read main config file okay... | ||
| + | Processing object config file '/etc/nagios/objects/commands.cfg'... | ||
| + | Processing object config file '/etc/nagios/objects/contacts.cfg'... | ||
| + | Processing object config file '/etc/nagios/objects/timeperiods.cfg'... | ||
| + | Processing object config file '/etc/nagios/objects/templates.cfg'... | ||
| + | Processing object config file '/etc/nagios/objects/localhost.cfg'... | ||
| + | Processing object config file '/etc/nagios/objects/serwer-www.cfg'... | ||
| + | Warning: Duplicate definition found for service 'HTTP' on host 'localhost' (config file '/etc/nagios/objects/localhost.cfg', starting on line 150) | ||
| + | Read object config files okay... | ||
| + | Running pre-flight check on configuration data... | ||
| + | Checking services... | ||
| + | Error: Service check command 'check_nrpe' specified in service 'Current Users' for host 'serwer-www' not defined anywhere! | ||
| + | Error: Service check command 'check_nrpe' specified in service 'Partycja home' for host 'serwer-www' not defined anywhere! | ||
| + | Checked 11 services. | ||
| + | Checking hosts... | ||
| + | Checked 2 hosts. | ||
| + | Checking host groups... | ||
| + | Checked 2 host groups. | ||
| + | Checking service groups... | ||
| + | Checked 0 service groups. | ||
| + | Checking contacts... | ||
| + | Checked 1 contacts. | ||
| + | Checking contact groups... | ||
| + | Checked 1 contact groups. | ||
| + | Checking service escalations... | ||
| + | Checked 0 service escalations. | ||
| + | Checking service dependencies... | ||
| + | Checked 0 service dependencies. | ||
| + | Checking host escalations... | ||
| + | Checked 0 host escalations. | ||
| + | Checking host dependencies... | ||
| + | Checked 0 host dependencies. | ||
| + | Checking commands... | ||
| + | Checked 24 commands. | ||
| + | Checking time periods... | ||
| + | Checked 5 time periods. | ||
| + | Checking for circular paths between hosts... | ||
| + | Checking for circular host and service dependencies... | ||
| + | Checking global event handlers... | ||
| + | Checking obsessive compulsive processor commands... | ||
| + | Checking misc settings... | ||
| + | Total Warnings: 0 | ||
| + | Total Errors: 2 | ||
| + | ***> One or more problems was encountered while running the pre-flight check... | ||
| + | Check your configuration file(s) to ensure that they contain valid | ||
| + | directives and data defintions. If you are upgrading from a previous | ||
| + | version of Nagios, you should be aware that some variables/definitions | ||
| + | may have been removed or modified in this version. Make sure to read | ||
| + | the HTML documentation regarding the config files, as well as the | ||
| + | 'Whats New' section to find out what has changed. | ||
| + | co dosyć dokładnie określa nam gdzie jest błąd. Aby usunąć powyższy błąd należy dodać do pliku ''/etc/nagios/objects/commands.cfg'' definicję nowych komend. | ||
| + | |||
| + | ===== /etc/nagios/objects/commands.cfg ===== | ||
| + | Plik '''commands.cfg''' przechowuje komendy dla definicji usług, które mają być monitorowane. Dla przykładu dodam dwie definicje monitorowania dysku oraz użytkowników. | ||
| + | <br /> | ||
| + | Deinicja monitorowania zdalnego dysku | ||
| + | define command{ | ||
| + | command_name check_disk | ||
| + | command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ | ||
| + | } | ||
| + | zwróć uwagę na nazwę opcji ''command_name'' czyli ''check_disk'' musi się zgadzać z nazwą użytą w pliku ''serwer-www.cfg'' | ||
| + | <br /> | ||
| + | Definicja monitorowania użytkowników | ||
| + | define command{ | ||
| + | command_name check_users | ||
| + | command_line $USER1$/check_users -w $ARG1$ -c $ARG2$ | ||
| + | } | ||
| + | Definicja check_nrpe potrzebna do zdalnego monitorowania | ||
| + | define command{ | ||
| + | command_name check_nrpe | ||
| + | command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ | ||
| + | } | ||
| + | |||
| + | reguła działania jest bardzo podobna | ||
| + | opcje | ||
| + | *'''-w''' określa kiedy występuje warning | ||
| + | *'''-c''' określa kiedy występuje critical | ||
| + | zakres tych opcji zostanie ustalony na klientach (stacjach monitorowanych). | ||
HOWTO W TRAKCIE PISANIA | HOWTO W TRAKCIE PISANIA | ||
<br /><google1 style="4"></google1> | <br /><google1 style="4"></google1> | ||
