Ubuntu Server Guide Changes, errors and bugs
Download 1.27 Mb. Pdf ko'rish
|
ubuntu-server-guide
Configuration
• First, create a host configuration file for server02. Unless otherwise specified, run all these commands on server01. In a terminal enter: sudo cp / e t c / n a g i o s 3 / c o n f . d/ l o c a l h o s t _ n a g i o s 2 . c f g \ / e t c / n a g i o s 3 / c o n f . d/ s e r v e r 0 2 . c f g Note In the above and following command examples, replace “server01”, “server02” 172.18.100.100, and 172.18.100.101 with the host names and IP addresses of your servers. Next, edit /etc/nagios3/conf.d/server02.cfg: d e f i n e h o s t { u s e g e n e r i c −h o s t ; Name o f h o s t t e m p l a t e t o u s e host_name s e r v e r 0 2 a l i a s S e r v e r 02 a d d r e s s 1 7 2 . 1 8 . 1 0 0 . 1 0 1 } # check DNS s e r v i c e . d e f i n e s e r v i c e { u s e g e n e r i c −s e r v i c e 295 host_name s e r v e r 0 2 s e r v i c e _ d e s c r i p t i o n DNS check_command check_dns ! 1 7 2 . 1 8 . 1 0 0 . 1 0 1 } Restart the nagios daemon to enable the new configuration: sudo s y s t e m c t l r e s t a r t n a g i o 3 . s e r v i c e • Now add a service definition for the MySQL check by adding the following to /etc/nagios3/conf.d/ services_nagios2.cfg: # check MySQL s e r v e r s . d e f i n e s e r v i c e { hostgroup_name mysql−s e r v e r s s e r v i c e _ d e s c r i p t i o n MySQL check_command check_mysql_cmdlinecred ! n a g i o s ! s e c r e t ! $HOSTADDRESS u s e g e n e r i c −s e r v i c e n o t i f i c a t i o n _ i n t e r v a l 0 ; s e t > 0 i f you want t o be r e n o t i f i e d } A mysql-servers hostgroup now needs to be defined. Edit /etc/nagios3/conf.d/hostgroups_nagios2.cfg adding: # MySQL h o s t g r o u p . d e f i n e h o s t g r o u p { hostgroup_name mysql−s e r v e r s a l i a s MySQL s e r v e r s members l o c a l h o s t , s e r v e r 0 2 } The Nagios check needs to authenticate to MySQL. To add a nagios user to MySQL enter: mysql −u r o o t −p −e ” c r e a t e u s e r n a g i o s i d e n t i f i e d by ’ s e c r e t ’ ; ” Note The nagios user will need to be added all hosts in the mysql-servers hostgroup. Restart nagios to start checking the MySQL servers. sudo s y s t e m c t l r e s t a r t n a g i o s 3 . s e r v i c e • Lastly configure NRPE to check the disk space on server02. On server01 add the service check to /etc/nagios3/conf.d/server02.cfg: # NRPE d i s k check . d e f i n e s e r v i c e { u s e g e n e r i c −s e r v i c e host_name s e r v e r 0 2 s e r v i c e _ d e s c r i p t i o n nrpe−d i s k check_command check_nrpe_1arg ! c h e c k _ a l l _ d i s k s ! 1 7 2 . 1 8 . 1 0 0 . 1 0 1 } Now on server02 edit /etc/nagios/nrpe.cfg changing: 296 a l l o w e d _ h o s t s = 1 7 2 . 1 8 . 1 0 0 . 1 0 0 And below in the command definition area add: command [ c h e c k _ a l l _ d i s k s ]=/ u s r / l i b / n a g i o s / p l u g i n s / check_disk −w 20% −c 10% −e Finally, restart nagios-nrpe-server: sudo s y s t e m c t l r e s t a r t n a g i o s −nrpe−s e r v e r . s e r v i c e Also, on server01 restart nagios: sudo s y s t e m c t l r e s t a r t n a g i o s 3 . s e r v i c e You should now be able to see the host and service checks in the Nagios CGI files. To access them point a browser to http://server01/nagios3. You will then be prompted for the nagiosadmin username and password. Download 1.27 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling