Step by step how to install Nagios Monitoring Server in FreeBSD 10.0 Release

Nagios Monitoring is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. (www.nagios.org)

In this tutorial we will show you about how to install Nagios in FreeBSD (FreeBSD 10.0).  We will start by installing Apache24, Php5, and MySQL.

Step 1. Install mysql server 5.6

Install mysql-server from ports

$ cd /usr/ports/databases/mysql56-server/
$ make install clean

Enable and launch the mysql service when boot

$ echo 'mysql_enable="YES"' >> /etc/rc.conf

Start mysql56-server

$ /usr/local/etc/rc.d/mysql-server start

Make mysql admin password, because when install default password in mysql is null

$ mysqladmin -u root password "your new password"

Step 2. Install apache24 from ports

Install apache24 from ports

$ cd /usr/ports/www/apache24/
$ make install clean

Enable and launch the apache24 service when booting

$ echo 'apache24_enable="YES"' >> /etc/rc.conf

After that, start service apache24 with command

$ /usr/local/etc/rc.d/apache24 start

Test apache running with open in browser page http://ip or hosname

Test apache24 running
Figure 1. Test apache24 running

Step 3. Install PHP and PHP extention

Install php55 from ports, before install system must config. Enable module “Build apache module” when blue screen show.

$ cd /usr/ports/lang/php55
$ make config
$ make install clean

Check Build apache module with press space

Config php module
Figure 2. Config php module
$ cd /usr/ports/lang/php55-extensions/
$ make config
$ make install clean

Select sessions and mysql – support

Figure 3. Select mysql and session
Figure 3. Select mysql and session

After that, activate the php configuration with copy file php.ini-development to file php.in

$ cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini

Configure apache24 can read php file with edit httpd.conf and add line in below

$ vi /usr/local/etc/apache24/httpd.conf

Add index.php  etc

<IfModule dir_module>
 DirectoryIndex index.php index.html index.php
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps
</IfModule>

Next, restart service apache24 to check if have any errors

$ /usr/local/etc/rc.d/apache24 start

Check  php info in Document root standart in apache, the location in /usr/local/www/apache24/data/
Type this below in terminal

$ echo "<?php phpinfo(); ?>" >> /usr/local/www/apache24/data/phpinfo.php

Now check the page http://ip/phpinfo.php

Figure 5. Check phpinfo() in Apache24 load
Figure 4. Check phpinfo() in Apache24 load

Step 4. Install Nagios Monitoring

Nagios Monitoring we use install applications nagios core from ports

$ cd /usr/ports/net-mgmt/nagios4
$ make config

Check all module in nagios

Install nagios
Figure 5. Install nagios core

After that type

$ make install clean

In instalation screen of nagios plugins do not forget to add NETSNMP to nagios group and user.

Figure 6. Nagios Plugins
Figure 6. Nagios Plugins

Enable nagios service when boot

$ echo 'nagios_enable="YES"' >> /etc/rc.conf

After installation nagios include file sample configuration, now copy sample page to the config files

$ cd /usr/local/etc/nagios
$ mv cgi.cfg-sample cgi.cfg
$ mv misccommands.cfg-sample misccommands.cfg
$ mv nagios.cfg-sample nagios.cfg
$ mv resource.cfg-sample resource.cfg

The figure in below

Figure 7. Move Sample Nagios configurations
Figure 7. Move Sample Nagios configurations

Move into directory /usr/local/etc/nagios/objects/ and do the same move sample config

$ cd /usr/local/etc/nagios/objects
$ mv commands.cfg-sample commands.cfg
$ mv contacts.cfg-sample contacts.cfg
$ mv localhost.cfg-sample localhost.cfg
$ mv printer.cfg-sample printer.cfg
$ mv switch.cfg-sample switch.cfg
$ mv templates.cfg-sample templates.cfg
$ mv timeperiods.cfg-sample timeperiods.cfg
Figure 7. Move sample config nagios
Figure 8. Move sample config nagios

Next step is check configurations errors from nagios. Type this command

$ nagios -v /usr/local/etc/nagios/nagios.cfg

After that, we must create password for login web interface, type command like this (admin is nagiosadmin)

$ htpasswd -c /usr/local/etc/nagios/htpasswd.users nagiosadmin

Next, create virtual host in apache24 configurations in file httpd.conf
Write this script in end of line

<VirtualHost *:80>
 ServerName web.nagios.mx
 ServerAdmin webmaster@web.nagios.mx
 DocumentRoot "/usr/local/www/nagios"
 <Directory /usr/local/www/nagios>
 Options None
 AllowOverride None
 Order allow,deny
 Allow from all
 AuthName "Nagios Access"
 AuthType Basic
 AuthUSerFile /usr/local/etc/nagios/htpasswd.users
 Require valid-user
 </Directory>
 <Directory /usr/local/www/nagios/cgi-bin>
 Options ExecCGI
 AllowOverride None
 Order allow,deny
 Allow from all
 AuthName "Nagios Access"
 AuthType Basic
 AuthUSerFile /usr/local/etc/nagios/htpasswd.users
 Require valid-user
 </Directory>
 <Directory /usr/local/www/nagios/cgi-bin>
 Options ExecCGI
 </Directory>
 ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/
 Alias /nagios /usr/local/www/nagios/
</VirtualHost>

And then, apache24 must be can load cgi module. Delete # in script module cgi file httpd.conf

LoadModule cgi_module libexec/apache24/mod_cgi.so
LoadModule cgid_module libexec/apache24/mod_cgid.so

Add the module for CGI, Save and Exit

Options +ExecCGI
AddHandler cgi-script .cgi

After that, restart service nagios and apache24

Figure 9. Restart Service Nagios and Apache24
Figure 9. Restart Service Nagios and Apache24

Let’s try to open web browser with page http://ipaddress/nagios, and appear page like this and insert your login  and password creates before

Figure 10. Nagios after instalations
Figure 10. Nagios after instalations

Source : www.unixmen.com and www.nagios.org

2 thoughts on “Step by step how to install Nagios Monitoring Server in FreeBSD 10.0 Release”

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s