Skip to main content

FreeBSD Nagios Setup



Required Packages: Apache, PHP5, GCC and GD development libs

1-Add user and group
pw groupadd nagios
adduser
Username: nagios
Full name:
Uid (Leave empty for default):
Login group [nagios]:
Login group is nagios. Invite jru into other groups? []:
Login class [default]:
Shell (sh csh tcsh zsh nologin) [sh]: zsh
Home directory [/home/nagios]:
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
.
.
OK? (yes/no): yes
adduser: INFO: Successfully added (nagios) to the user database.
Add another user? (yes/no): no
Goodbye!
---Creating group for web interface
pw groupadd nagcmd
pw groupmod nagcmd -M nagios
pw groupmod nagcmd -m www
pw groupadd root

2-Configure and install
cd /usr/ports/net-mgmt/nagios
make config
make
make install
make install-init
make install-config
make install-commandmod

3-Customaize Configuration
cd /usr/local/etc/nagios
cp cgi.cfg-sample cgi.cfg
cp nagios.cfg-sample nagios.cfg
cp resource.cfg-sample resource.cfg
cd objects
cp commands.cfg-sample commands.cfg
cp printer.cfg-sample printer.cfg
cp localhost.cfg-sample localhost.cfg
cp switch.cfg-sample switch.cfg
cp tempelates.cfg-sample tempelates.cfg
cp timeperiods.cfg-sample timeperiods.cfg
cp contacts.cfg-sample contacts.cfg
vim contacts.cfg –-**change the email address of nagiosadmin

4-Configuring web interface
cd /usr/ports/net-mgmt/nagios
make install-webconf
htpasswd -c /usr/local/etc/nagios/htpasswd.users nagiosadmin
**enter the password and remmember**
apachectl restart

5-Install nagios plugins
cd /usr/ports/net-mgmt/nagios-plugins
make config
make install

6-Configuring of apache httpd.conf
cd /usr/local/etc/apache/
vim httpd.conf

6-a-Add ScriptAlias and Alias
ScriptAlias /nagios/cgi-bin/ /usr/local/www/data/nagios/cgi-bin/
<Directory "/usr/local/www/data/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>

Alias /nagios /usr/local/www/data/nagios/

<Directory "/usr/local/www/data/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>

6-b-uncomment out
AddHandler cgi-script .cgi

7-Restart the Apache
apachectl restart

8-Check configuration and start nagios
cd /usr/local/etc/rc.d
--for checing the configuration use
nagios -v /usr/local/etc/nagios/nagios.cfg
--or
./nagios checkconfig
--starting nagios
./nagios start

9-Open the browser and go to http://localhost( ip or domain)/nagios
user/password will show up. Enter the nagiosadmin as user and password you have selected befor.woooo!!

Comments

  1. make install-webconf
    gives me an error: make: don't know how to make install-webconf. Stop

    Do you have updated instructions?

    ReplyDelete

Post a Comment

Popular posts from this blog

Installing MS SQL Server driver on Ubuntu Linux

Although making a connection to SQL Server can be done using unixODBC and FreeTDS, it does not work with some collations on SQL Server 2008. Recently, Microsoft released an ODBC driver for Linux that works on 64-bit systems only. Installing the driver is tricky. I begin by installing the build-essential, which is required for compiling from source. Checkinstall can be installed if you want to add the following application to the package manager. $ sudo apt-get install build-essential  Download unixODBC-2.3.0  and Microsoft ODBC dirver  and extract. $ sudo wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.0.tar.gz $ tar xvf unixODBC-2.3.0.tar.gz $ wget http://download.microsoft.com/download/6/A/B/6AB27E13-46AE-4CE9-AFFD-406367CADC1D/Linux6/sqlncli-11.0.1790.0.tar.gz $ tar xvf sqlncli-11.0.1790.0.tar.gz  Install the unixodbc using the following commands: $ ./configure --disable-gui --disable-drivers --enable-iconv --with-iconv-char-enc=UTF8 --with-ico...

Installing pyodbc on ubuntu

Installing pyodbc is straight forward but if  getting     "error: command 'gcc' failed with exit status 1"  when installing pyodbc, make sure you have installed  requirements  as below. sudo apt-get install unixODBC-dev g++ pip install pyodbc

Monkey Patching Django Model Class

Django is shipped with some useful application, also there are lots of third party re-usable application written for Django. Sometime you need to modify or customize these applications(Models of application) to meet your software requirements. One of the usual solution is adding a Model class to have a one-to-one relationship with the third party Models. This solution has some disadvantages such as having more tables and classes which can highly adversely affect database performance, scalability and add more complexity to the software development.  I think of another solution to this problem. I used Django South along with monkey patching of third party Model classes. I added a field to Django user class. Here is a walk through over this approach. 1. Add an application: python manage.py startapplication userpatch 2. Add the following  code to add the new field to the user class from django.db import models from django.contrib.auth.models import User ...