Observing devices with Observium ? Setting up the server
Posted on 30-03-2014 05:00
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!
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.
Second step is to install all required packages:
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:
And unpack it (it will automatically put it in the right directory):
Head into the observium directory:
And copy the default configuration file to an actual configuration file:
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:
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:
Next, create a user and give it access to the database, all with one line:
Again, pick a strong password here, and replace
And you're good to go edit the Observium configuration file. Open it up:
And fill out the following config options:
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.
This could give some errors up to revision 006, but I personally didn't get them.
Next, create a directory for RDD:
And set the right permissions on it:
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:
And make sure the contents match this:
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:
And finally, restart Apache:
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).
Make sure you are in the observium directory:
And run the following script:
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:
And add the following lines:
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!
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
|Subject||Discussion Forum||Last Post|
|Server monitoring with Icinga 2 ? Part 1: the server (Ubuntu host)||Linux tutorials, Tips & Tricks||: 1||17-10-2016|
|Server monitoring with Icinga 2 ? Part 2: the node (Ubuntu host)||Linux tutorials, Tips & Tricks||: 1||03-09-2015|
|Observing devices with Observium ? Adding a device||Linux tutorials, Tips & Tricks||: 1||06-04-2014|
|Munin amass, all your server charts in one place||Linux tutorials, Tips & Tricks||: 1||22-09-2013|
|Monitoring server performance with Munin!||Linux tutorials, Tips & Tricks||: 1||15-09-2013|