obey-robots.txt
Web Master Trouble
Users Online
Guests Online: 1

Members Online: 0

Total Members: 3
Newest Member: Proxyhotdeals
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Last Seen Users
Your ad here below
View Thread
Web Master Trouble » Linux Apache MySQL PHP optimalisation tips tricks » Linux tutorials, Tips & Tricks
Linux tutorials, Tips & Tricks Getting started with SSH An introduction to NGINX, PHP-FPM and MariaDB on CentOS An introduction to NGINX, PHP-FPM and MariaDB on Ubuntu Getting started with OpenVZ! Handle DNS properly with cPanel Munin amass, all your server charts in one place Monitoring server performance with Munin! Getting started with OpenVPN (client) Getting started with OpenVPN (server) Your own mail server with Virtualmin IPtables: IPv6 and more rules
 Print Thread

Observing devices with Observium ? Setting up the server

NuclearFusion

It's time for another tutorial! This time I'm taking you into the magical world of Observium and SNMP. Observium is a tool that helps you monitor your servers remotely. But not only your servers; all devices that support SNMP, so that includes most managed switches. It monitors network performance (it basically monitors all network ports), but also server performance (like CPU, I/O), server status (free disk space, memory status), and much more. It's really the tool out there to get statistics of your servers. Best of all: it's open source and it's free!

I'm going to show you how to set up an Observium server. My next tutorial will cover adding devices. This one is going to be lengthy enough as it is and there's a lot to say about adding a device to Observium, so I will not overload you with too much information. I will show the setup procedure for Ubuntu, as that is where Observium is tested on. This tutorial should also work for Debian. RHEL/CentOS is not recommended for the server, but are fine to be used for devices that you monitor.

Let's get working!

Server installation

As I said before, Ubuntu is recommended for the server installation. Ubuntu 12.04 LTS works best for this, but 12.10 and 13.10 should work as well. 13.10 or higher will give you a lot of issues as they switched to Apache 2.4 and a lot of other packages changed as well, so using one of those version will probably leave you with a broken installation.

First, update the apt cache. On new installations a lot of packages may not be found because they haven't been cached yet.

sudo apt-get update

Second step is to install all required packages:

sudo apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-snmp php-pear snmp graphviz php5-mcrypt php5-json mysql-server mysql-client rrdtool fping imagemagick whois mtr-tiny nmap ipmitool python-mysqldb

This will install Apache, PHP, MySQL, and a lot of other tools needed for Observium to work. I've removed subversion from the original package list, as it's only used for the Observium Subscription Edition. We're going to install the Community Edition. During installation, you are asked for a root password for MySQL (possibly multiple times). Pick a strong password for this and keep it somewhere safe, like in a KeePass database.

Observium needs a home, so create it:

sudo mkdir -p /opt/observium && cd /opt

Download Observium:

sudo wget http://www.observium.org/observium-community-latest.tar.gz

And unpack it (it will automatically put it in the right directory):

sudo tar zxvf observium-community-latest.tar.gz

Head into the observium directory:

cd observium

And copy the default configuration file to an actual configuration file:

sudo cp config.php.default config.php

Next thing we've got to do is set up the MySQL user for Observium and create a database that that user can access. So let's open up MySQL:

mysql -u root -p

This will prompt you for the root password you've set before. Once filled in, you'll be in the MySQL command line client. First thing to do there, is create a database:

CREATE DATABASE observium;

Next, create a user and give it access to the database, all with one line:

GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY '<password>';

Again, pick a strong password here, and replace <password> with your password. Now, exit the MySQL client:

exit

And you're good to go edit the Observium configuration file. Open it up:

sudo vim config.php

And fill out the following config options:

$config['db_user'] = 'USERNAME';
$config['db_pass'] = 'PASSWORD';

Replace USERNAME with 'observium' and PASSWORD with the password you have the observium database user. Save the file and exit vim.

Now we can set up Observium by running the following file. This will populate the database with the necessary tables.

php includes/update/update.php

This could give some errors up to revision 006, but I personally didn't get them.

Next, create a directory for RDD:

sudo mkdir rrd

And set the right permissions on it:

sudo chown www-data:www-data rrd

The 'rdd' folder is now owned by www-data. Apache runs the web server as that user, so the Apache process can now write to that directory. Observium writes .rrd files for each device to this directory. RDDTool is a data logging and graphing system, so it gets you all these fancy graphs.

Now we have to create the virtual host configuration for Observium. You can either add a new virtual host or alter the default one. I'm going to alter the default one, as my server is only going to contain observium and nothing else. Open up the default virtual host file:

sudo vim /etc/apache2/sites-available/default

And make sure the contents match this:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /opt/observium/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /opt/observium/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog  ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog  ${APACHE_LOG_DIR}/access.log combined
ServerSignature On
</VirtualHost>

You may change the ServerAdmin e-mail address to one of your choosing, but it's not required. This e-mail address will be used on error pages, so make sure not to enter your super private e-mail address here. Save the file.

We now need to enable the Apache rewrite module, which allows Observium to rewrite URLs:

sudo a2enmod rewrite

And finally, restart Apache:

sudo service apache2 restart

And you're good! Observium is now running. It's not doing much yet and you can't log in, but it works. Visit the IP address of your server or the domain name you pointed there and you should see the Observium login screen. Let's configure observium (don't worry, this is just a few steps).

Configuring Observium

Make sure you are in the observium directory:

cd /opt/observium

And run the following script:

./adduser.php <username> <password> <level>

Replace <username> with a username you would like to use, <password> with a strong password, and <level> with 10. Level 10 means you have all access (it's the 'admin' level). So, a filled out command should look like:

./adduser.php mpkossen AStrongPassword 10

The user should now be added and you should be able to log in to Observium.

Finally, we should set up some cron jobs that Observium needs. Open up the generic cron tab:

sudo vim /etc/crontab

And add the following lines:

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

You should not place this in a user's crontab, as it includes a username. So don't use 'crontab -e' or something.

These three cron jobs are for discovering devices (new and existing) and one that polls them for data, which is basically the most essential part of Observium.

Once this is done, you are all set! Observium is up and running and you're ready to add devices!

Final notes

This installation is a bit of a lengthy process by the looks of it. If you've done it before, though, you know what to do at each step and it'll go pretty fast. Of course, you probably only ever need one Observium server, so that's a moot point.

Next week, I'm going to show you how to add devices to your Observium installation. You could also have a go and figure it out yourself, of course. Or, if you want something else to do, try to secure the Observium server with an SSL connection so not all data you're looking at goes over the internet as plain text.

Up next week: Observing devices with Observium - Adding a device


Warning about ParkingCrew.com! Case: ParkingCrew.com acquires NameDrive.com but earnings are not transferred despite assurances and promises. Inquiries about this are ignored! It's just a con compagny. Don't do business with them!
 
Jump to Forum:
New Thread Post Reply
Use this BBcode or HTML to refer to; 'Observing devices with Observium ? Setting up the server'
BBcode:
HTML:
Vergelijkbare onderwerpen
Thread Forum Replies Last Post
Server monitoring with Icinga 2 ? Part 1: the server (Ubuntu host) Linux tutorials, Tips & Tricks 1 17-10-2016 09:21
Server monitoring with Icinga 2 ? Part 2: the node (Ubuntu host) Linux tutorials, Tips & Tricks 1 03-09-2015 07:15
Observing devices with Observium ? Adding a device Linux tutorials, Tips & Tricks 1 06-04-2014 05:00
Munin amass, all your server charts in one place Linux tutorials, Tips & Tricks 1 22-09-2013 05:00
Monitoring server performance with Munin! Linux tutorials, Tips & Tricks 1 15-09-2013 05:00