Installing Nagios on Linux

 

Presumptions:

                        1. Apache is already installed in /usr/local/apache2

                        2. Default server is test.example

 

 

Installing Nagios:

           

            1. Download tar ball from www.nagios.org extract it

            2. Go to the extracted directory and give following commands:

                        # ./configure –prefix=/usr/local/nagios

                        # make all

                        ##### create nagios user and group###

                        # groupadd nagios

                        # adduser -g nagios nagios

                        # passwd nagios ——-> set passwd to nagios

                        ##### Give following cmds ###

                        # make install

                        # make install-init

                        # make install-commandmode

                        # make install-config

 

            3. Create dir nagios in your documentroot of http server. For example: your docroot 
is /var/www/html then create diirectory

            mkdir /var/www/html/nagios

11. Change owner and group to nagios:nagios

            chown nagios:nagios

12. cp -ap /usr/local/nagios/share/* /var/www/html/nagios

 

13. Now check in your browser http://localhost/nagios

 

14. remove “sample” from filenames of all configuration files which are under /usr/local/nagios/etc/

 

15. open /usr/local/nagios/etc/cgi.cfg and replace following line
 

physical_html_path=/usr/local/nagios/share   ———-> to ——–>

 

physical_html_path=/var/www/html/nagios

 

use_authentication=1  ——-> to  ———> use-authentication=0

 

 

16. mkdir /var/www/html/nagios/cgi-bin

 

17. chown nagios:nagios /var/www/html/nagios/cgi-bin

 

18. cp -ap /usr/local/nagios/sbin/* /var/www/html/nagios/cgi-bin

 

19. in httpd.conf add following line:

 

            ScriptAlias /nagios/cgi-bin/  “/var/www/html/nagios/cgi-bin/” ——> PLEASE DO NOT 
FORGET to GIVE “/” in the END.

 

20. Restart Apache

 

21. Start nagios deamon

 

            /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg  ——> For testing conf

            /usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg -d &

 

22. Check nagios is started or not

 

            ps -ef|grep nagios

 

 

23. Check again in your browser  http://localhost/nagios and try clicking on different “menus in side 
bar.” It shuld show you some status.

 

           

 

23. Installing nagios plugins –>

 

 

24. untar nagios-plugins tarball.

 

25. go to that directory and execute following commands:

            ./configure –prefix=/usr/local/nagios/

            make

            make install

 

26. It will install nagios-plugins in following dir : /usr/local/nagios/libexec/

 

 

27. For refreshing nagios deamon:

 

            killall -HUP /usr/local/nagios/bin/nagios

Neelesh Gurjar has written 122 articles

Leave a Reply