Tampilkan postingan dengan label Nagios. Tampilkan semua postingan
Tampilkan postingan dengan label Nagios. Tampilkan semua postingan

Rabu, 18 Februari 2009

HOW TO INSTALL UBUNTU 7.10 NAGIOS 2.11 CENTREON 1.4.2.4

Nagios and Centreon are the perfect Network System Monitoring Solution. Oreon has became a reference as a Nagios Frontend. The Centreon/Nagios couple is used by a wide range of users, from novices to skilled users, even if they didn't knew Nagios before.



INSTALL OS


1.Install Ubuntu Desktop 7.10
2.Remove OpenOffice (optional)
3.Enable VNC Server, System > Admin > Logon > Remote Logon

Install SSHD
# apt-get install openssh-server

Install Compilers and Libraries (may ask the Ubuntu CD)
# apt-get install libc6-dev g++ gcc
# apt-get install libgd2-xpm libgd2-xpm-dev libjpeg62-dev libgd-tools
Install Zlib, Libpng Required by LibGD and then LibGD
# wget http://www.gzip.org/zlib/zlib-1.2.3.tar.gz
# wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.25.tar.gz
# wget http://www.libgd.org/releases/gd-2.0.35.tar.gz

Install Apache
# apt-get install apache

+------------------+
| INSTALL NAGIOS |
+------------------+
# groupadd nagios
# adduser nagios
# passwd nagios
Check if Nagios User is created
# grep nagios /etc/passwd
# grep "^User" /etc/apache2/apache2.conf
Add Webserver user (www-data/apache) and Nagios user (nagios)
# usermod -G nagios nagios
# usermod -G www-data,nagios www-data
Check if the users are the members of the group by
# grep nagios /etc/group
# mkdir /usr/local/nagios

# apt-get install build-essential
# apt-get install libgd2-dev (dosent always find)

# wget http://downloads.sourceforge.net/nagios/nagios-2.11.tar.gz?modtime=1205331081&big_mirror=0
# md5sum nagios-2.11.tar.gz |grep "058c1f4829de748b42da1b584cccc941"
# ./configure --enable-embedded-perl --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagios

Create a Symbolic Link to Perl
# ln -s /usr/lib/libperl.so.5.8.8 libperl.so
Install Nagios
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
# ls -l /usr/local/nagios
You should see five different subdirectories.

SETTING THE WEBSERVER
Set the password for the Web Access
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
edit the apache2.conf
# vim /etc/apache2/apache2.conf
COPY AND PASTE:
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin

Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Alias /nagios /usr/local/nagios/share

Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user


Edit cgi.cfg to allow nagiosadmin user
# vim /usr/local/nagios/etc/cgi.cfg
authorized_for_system_information=nagiosadmin

Restart Apache and Nagios
# /etc/init.d/apache2 restart
# /etc/init.d/nagios restart


+--------------------------+
| INSTALL NAGIOS PLUGINS |
+--------------------------+

->Install OpenSSL (optional)
# wget http://www.openssl.org/source/openssl-0.9.7m.tar.gz
# tar -zxvf openssl-0.9.7m.tar.gz
# cd openssl-0.9.7m.tar.gz
# mkdir /etc/openssl
# ./config --openssldir=/etc/openssl

# wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.11.tar.gz?modtime=1197587122&big_mirror=0
# ./configure --with-openssl=/etc/openssl --enable-perl-modules --prefix=/usr/local/nagios --with-nagios-user=nagios
# make all
# make install
Check if the plugins are here
# ls -l /usr/local/nagios/libexec
Give nagios:nagios permission
# chown nagios:nagios /usr/local/nagios/libexec


+-------------------------------+
| INSTALL OREON WEB INTERFACE |
+-------------------------------+

Install MySQL
# apt-get install mysql-server
Install php5
# apt-get install php5
# apt-get install php-db php-date
# apt-get install php5-gd php5-mysql php5-snmp php5-ldap
# apt-get install php-mail php-mail-mime php-net-smtp php-net-socket
# apt-get install php5-xmlrpc
Install PostFix
# apt-get install postfix
Install SendMail
# apt-get install sendmail
RRDtool
# apt-get install rrdtool librrds-perl
Perl Libs
# apt-get install libconfig-inifiles-perl
Snmp
# apt-get install snmp snmpd libnet-snmp-perl

Upgrade PEAR
# pear upgrade pear
# pear install -o -f --alldeps DB_DataObject DB_DataObject_FormBuilder MDB2 Numbers_Roman \
Numbers_Words HTML_Common HTML_QuickForm2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL \
HTTP Image_Canvas Image_Color Image_Graph Image_GraphViz Net_Traceroute Net_Ping Validate XML_RPC
# pear install -o -f --alldeps SOAP

Get Oreon (at this time latest is 1.4.2.4 03/03/2008 , 2 should be on its way.
# wget http://download.oreon-project.org/index.php?id=74
# md5sum centreon-1.4.2.4.tar.gz | grep "3c8cdaaf92bd8600e42e1278902222cc"
# bash install.sh

All defaults OK, but these:
Where is installed RRD perl modules [RRDs.pm] ? /usr/lib/perl5/
Where is mail binary ? /usr/sbin/sendmail

Setup the Permissions
# chown www-data:nagios -R /usr/local/nagios/libexec/
# chmod 775 -R /usr/local/nagios/libexec/

Start Configuration
http:///oreon/install/setup.php

Oreon Installation is DONE:
http:///oreon/


+----------+
| APPENDIX |
+----------+
*Common Linux Instalation:
# tar -zxvf gd-2.0.35.tar.gz
# cd gd-2.0.35
# ./configure
# make
# make install

**SETUP SAMBA ROOTSHARE:
Note: This will give COMPLETE RW access to you linux server,
I do not recomend this in production but for testing only!
# apt-get install samba
# /usr/bin/smbpasswd root
Copy And Paste this Config
# vim /etc/samba/smb.conf
[global]
workgroup = OSX
realm = OSX
server string = %h server
interfaces = eth0
obey pam restrictions = Yes
passdb backend = tdbsam
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *password\supdated\ssuccessfully* .
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
panic action = /usr/share/samba/panic-action %d
[ShareRoot]
comment = Root
path = /
username = root
valid users = %S, root
force user = root
read only = No
create mask = 0700
directory mask = 0700
guest ok = Yes
# /etc/init.d/samba restart
In windows cmd:
# net use p: \\IP\ShareRoot /user:root

***ALLOW MYSQL REMOTE ACCESS:
MySQL5 - connect from Remote
1. download Navicat 8 (or others MYSQL Win Clients)
2. Login via SSH
Edit /etc/mysql/my.cnf with bind-address = 192.168.X.X (localhost IP)
# vim /etc/mysql/my.cnf
# mysql -u root -p mysql
use oreon
GRANT ALL ON ods.* TO root@'192.168.X.X' IDENTIFIED BY 'PASSWORD';
use ods
GRANT ALL ON ods.* TO root@'192.168.X.X' IDENTIFIED BY 'PASSWORD';
# /etc/init.d/mysql restart
Run Navicat to browse MySQL DB

****GRAPH USING OREON ODS
make sure to start ods
# /etc/init.d/ods start
Oreon Web Interface - > create a service template > Data Treatment > Process Perf Data (On)
Configure ODS
Oreon Web Interface - > Options > CentreonDataStorage > Config
Be sure that you have the .rrd files created
# find / -name *.rrd

*****Make Nagios Pretty ( Nuvola Style )
First Backup /usr/local/nagios/share/*..html and all stylesheets directory.
# cd /usr/local/nagios/share
# wget http://www.xoroz.com/files/nagiosstyle.zip
# unzip nagiosstyle.zip
Set the permissions
# chown nagios:nagios *.*
# chown nagios:nagios -R side
# chown nagios:nagios -R stylesheet
Edit the config.js with your correct cgi-bin
# /etc/init.d/apache2 restart

*******More cool cmds
Get an overview of all hosts (new cmd with nagios 2.11)
# /usr/local/nagios/bin/nagiostats /usr/local/nagios/etc/nagios.cfg -v NUMHOSTS

********Autostart Daemon Ubuntu
# /usr/sbin/update-rc.d mysql defaults