Showing posts with label Observium. Show all posts
Showing posts with label Observium. Show all posts

Saturday, 12 March 2016

Observium - A Complete Network Management and Monitoring System for Linux

Observium:

A Complete Network Management and Monitoring System for Linux
==========================================

Observium is a PHP/MySQL driven Network Observation and Monitoring application, that supports a wide range of operating systems/hardware platforms including, Linux, Windows, FreeBSD, Cisco, HP, Dell, NetApp and many more. It seeks to present a robust and simple web interface to monitor health and performance of your network.Observium gathers data from devices with the help of SNMP and display those data in graphical pattern via a web interface. It makes hefty use of the RRDtool package. It has a number of thin core design goals, which includes collecting as much historical information about devices, being totally auto-discovered with slight or no manual interruption, and having a very simple yet powerful interface.

Observium gathers data from devices with the help of SNMP and display those data in graphical pattern via a web interface. It makes hefty use of the RRDtool package. It has a number of thin core design goals, which includes collecting as much historical information about devices, being totally auto-discovered with slight or no manual interruption, and having a very simple yet powerful interface.


Step 1: Adding RPM Forge and EPEL Repositories

# yum install wget
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.rpm
# wget http://epel.mirror.net.in/epel/6/x86_64/epel-release-6-8.noarch.rpm
# wget http://apt.sw.be/RPM-GPG-KEY.dag.txt
# rpm --import RPM-GPG-KEY.dag.txt
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm

Step 2: Install Needed Software Packages

yum install php php-mysql php-gd php-snmp vixie-cron php-mcrypt php-pear net-snmp net-snmp-utils graphviz subversion mysql-server mysql rrdtool fping ImageMagick jwhois nmap ipmitool php-pear.noarch MySQL-python

Step 3:If you wish to monitor virtual machines, please install ‘libvirt‘ package.

# yum install libvirt


Download Observium

First, create a directory for Observium to live in:

Step 4: mkdir -p /opt/observium && cd /opt



Observium Editions

Observium comes in two editions, an Open Source Community Edition released on a 6 month cycle, and a Subscription Edition with additional features, rapid bug fixes and feature improvements on a daily basis and an easy to use SVN-based update mechanism.


Observium Community Edition (I am installing  open source ..)

If you would like to install the Community Edition, please install using the most recent .tar.gz release.

Download the latest .tar.gz of Observium and unpack:

Step 5:wget http://www.observium.org/observium-community-latest.tar.gz
Step 6:tar zxvf observium-community-latest.tar.gz


Configuration

Change into the new install directory:

Step 7:cd observium

Copy the default configuration file and edit it for your system:

Step 8: cp -rv config.php.default config.php

Edit config.php. Change the options to reflect your installation.

Step 9:Now open ‘config.php‘ file and enter MySQL details such as database name, username and password.

# vi config.php

// Database config
$config['db_host'] = 'localhost';
$config['db_user'] = 'observium';
$config['db_pass'] = 'dbpassword';
$config['db_name'] = 'observium';

Then add an entry for fping binary location to config.php. In RHEL distribution the location is different.

$config['fping'] = "/usr/sbin/fping";



Step 10:MySQL Credentials

You must change the MySQL username and password. Most other settings can be left as default.
MySQL Database

Create the MySQL database:

#mysql -u root -p
<mysql root password>
mysql> CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost'
    -> IDENTIFIED BY '<observium db password>';

Setup the MySQL database and insert the default schema:

Step 11:php includes/update/update.php

It is OK to have some errors in the SQL revisions


Step 12 :
We need to disable SELinux permanently, so you also need to change /etc/selinux/config so that the SELINUX option is set to permissive

SELINUX=permissive

#setenforce 0

Step 13: Configure Apache for Observium

Now create a ‘rrd‘ directory under ‘/opt/observium‘ directory for storing RRD’s.

# /opt/observium
# mkdir rrd

Next, grant Apache ownership to ‘rrd‘ directory to write and store RRD’s under this directory.

# chown apache:apache rrd

Create a Apache Virtual Host directive for Obervium in ‘/etc/httpd/conf/httpd.conf‘ file.

# vi /etc/httpd/conf/httpd.conf

Add the following Virtual Host directive at the bottom of the file and enable Virtualhost section as shown in the screenshot below.

<VirtualHost *:80>
  DocumentRoot /opt/observium/html/
  ServerName  observium.domain.com
  CustomLog /opt/observium/logs/access_log combined
  ErrorLog /opt/observium/logs/error_log
  <Directory "/opt/observium/html/">
  AllowOverride All
  Options FollowSymLinks MultiViews
  </Directory>
  </VirtualHost>

To maintain observium logs, create a ‘logs‘ directory for Apache under ‘/op/observium‘ and apply Apache ownership to write logs.

# mkdir /opt/observium/logs
# chown apache:apache /opt/observium/logs

After all settings, restart Apache service.

# service httpd restart

Step 14: Create Observium Admin User

Add a first user, give level of 10 for admin. Make sure to replace username and password with your choice.

# cd /opt/observium
# ./adduser.php admin Firstcry@123 10

User tecmint added successfully.

Next add a New Device and run following commands to populate the data for new device.

Next set a cron jobs, create a new file ‘/etc/cron.d/observium‘ and add the following contents.

33  */6   * * *   root    /opt/observium/discovery.php -h all >> /dev/null 2>&1
*/5 *      * * *   root    /opt/observium/discovery.php -h new >> /dev/null 2>&1
*/5 *      * * *   root    /opt/observium/poller-wrapper.py 1 >> /dev/null 2>&1

Reload cron process to take new entries.

# /etc/init.d/cron reload

The final step is to add httpd and mysqld services system-wide, to automatically start after system boot.

Next set a cron jobs, create a new file ‘/etc/cron.d/observium‘ and add the following contents.

33  */6   * * *   root    /opt/observium/discovery.php -h all >> /dev/null 2>&1
*/5 *      * * *   root    /opt/observium/discovery.php -h new >> /dev/null 2>&1
*/5 *      * * *   root    /opt/observium/poller-wrapper.py 1 >> /dev/null 2>&1

Reload cron process to take new entries.

# /etc/init.d/cron reload

The final step is to add httpd and mysqld services system-wide, to automatically start after system boot.


########################################add Client Machine#######################################
you can see output from following commnad for testing

On server side you need to configuer follwing things

vim /etc/hosts
#you need add hosts name and ip address in this file,because observium only
172.31.9.134   awshaproxy1.firstcry.net awshaproxy1

snmpwalk -v 2c -c public -O e 172.31.9.134             ------>>remote client machanine ip adrress


######   On client centos6 machine

yum install snmpd
yum install snmp
netstat -a | grep snmp

snmpwalk -v 2c -c public -O e localhost

yum install net-snmp-utils

you need create this file /usr/bin/distro

[root@ip-172-31-9-134 ec2-user]# cat /usr/bin/distro
#!/bin/sh
# Detects which OS and if it is Linux then it will detect which Linux Distribution.

OS=`uname -s`
REV=`uname -r`
MACH=`uname -m`

if [ "${OS}" = "SunOS" ] ; then
  OS=Solaris
  ARCH=`uname -p`
  OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
elif [ "${OS}" = "AIX" ] ; then
  OSSTR="${OS} `oslevel` (`oslevel -r`)"
elif [ "${OS}" = "Linux" ] ; then
  KERNEL=`uname -r`
  if [ -f /etc/redhat-release ] ; then
    DIST=$(cat /etc/redhat-release | awk '{print $1}')
    if [ "${DIST}" = "CentOS" ]; then
      DIST="CentOS"
    elif [ "${DIST}" = "Mandriva" ]; then
      DIST="Mandriva"
      PSEUDONAME=`cat /etc/mandriva-release | sed s/.*\(// | sed s/\)//`
      REV=`cat /etc/mandriva-release | sed s/.*release\ // | sed s/\ .*//`
    elif [ "${DIST}" = "Fedora" ]; then
      DIST="Fedora"
    else
      DIST="RedHat"
    fi

    PSEUDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
    REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
  elif [ -f /etc/SuSE-release ] ; then
    DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
    REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
  elif [ -f /etc/mandrake-release ] ; then
    DIST='Mandrake'
    PSEUDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
    REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
  elif [ -f /etc/debian_version ] ; then
    if [ -f /etc/mailcleaner/etc/mailcleaner/version.def ] ; then
      DIST="MailCleaner"
      REV=`cat /etc/mailcleaner/etc/mailcleaner/version.def`
    else
      DIST="Debian `cat /etc/debian_version`"
      REV=""
    fi
  fi

  if [ -f /etc/UnitedLinux-release ] ; then
    DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
  fi

  if [ -f /etc/lsb-release ] ; then
    LSB_DIST="`cat /etc/lsb-release | grep DISTRIB_ID | cut -d "=" -f2`"
    LSB_REV="`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2`"
    if [ "$LSB_DIST" != "" ] ; then
      DIST=$LSB_DIST
      REV=$LSB_REV
    fi
  fi

#  OSSTR="${OS} ${DIST} ${REV}(${PSEUDONAME} ${KERNEL} ${MACH})"
  OSSTR="${DIST} ${REV}"
elif [ "${OS}" = "Darwin" ] ; then
  if [ -f /usr/bin/sw_vers ] ; then
    OSSTR=`/usr/bin/sw_vers|grep -v Build|sed 's/^.*:.//'| tr "\n" ' '`
  fi
fi

echo ${OSSTR}
[root@ip-172-31-9-134 ec2-user]#

###################################

[root@ip-172-31-9-134 ec2-user]# cat  /etc/snmp/snmpd.conf
com2sec readonly  default         public
group MyROGroup v1         readonly
group MyROGroup v2c        readonly
group MyROGroup usm        readonly
view all    included  .1                               80
access MyROGroup ""      any       noauth    exact  all    none   none
syslocation AWS-Linux,
syscontact namdev.rathod@firstcry.com
#This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro

[root@ip-172-31-9-134 ec2-user]#/etc/init.d/snmpd restart


##########################################

How To Change Login Images and Name:


go to /opt/observium/html/images/

mv login-hamster-large.png  login-hamster-large.png-bak

and put your image with name "login-hamster-large.png"

and  go to /opt/observium/html/pages/

please check with logon.inc.php file coding.

service httpd restart/reload

##################################################################