Opsview – Installing Opsview Server on CentOS

If you are looking for a decent server hardware and software monitor – I have to recommend Opsview. The reason I suggest this is because of a few huge factors – and I’ll name those here. One is that they have a “free” community edition (and yes, it is free, but you get zero support from them and you have to host it yourself… oh and there is an annoying ad on top of the whole web based dashboard). If you have a halfway decent network and systems infrastructure, this is no problem. I’ll work through how to set it up here in a few.

In any event – it can monitor a huge set of information about each server and it supports Linux (though mostly the RPM based and APT based distros), Windows, and OSX . You can choose what you want to monitor (different hard drives, partition sizes and space, RAM, Windows services, Linux services, system performance, SQL Server, MySQL, CPU load, etc…). The best part is the mobile app which allows you to check out the status of your systems while out and about. That doesn’t exactly make it easier to fix any issues that arise – but at least you’ll be able to check out any issues that may arise.

Notifications are also a handy part of this application – for our little enterprise, we get email notifications when our set services are failing on each specific server. It lets you schedule downtime as well so if you want to stop being spammed while you are rebooting a server, you can just schedule some downtime for that particular unit.

So anyway, lets get to installing Opsview Core Server – after the server is installed I’ll show you how to install the clients / agents. If you are lazy and think setting it manually is too much trouble, you can just get the VMware Virtual Appliance (Ubuntu 10.04 Server, x86). I will be running you through how to set it up on a stock, newly created CentOS VM (this will work pretty close to the same on RHEL, and it will be the exact same on a physical machine). I don’t think there are any listed “system requirements” on their site, but here is the Dorkfolio.net system requirements:

CentOS 5.8 or 6.3

At least 2GB of RAM (I’ve tried this with 1 gig before and it didn’t end well. This box idles at about 1.1GB, so you should be good with 2).

At least 2 processors 

And at least 20GB of hard drive space.

A few other notes on this – this can either be dedicated server or a shared server. The actual management GUI is on port 3000, so it doesn’t interfere with web or MySQL, so if you want to make this a server that has some other function, by all means, just be sure to note that it does use about 1.1gigs of RAM just idling and when you are using the GUI, it also is a bit of a CPU hog.

Alright – Let’s get started shall we? I am going to assume here that you meet the specifications above and that you have a fully patched CentOS 5.8 or 6.3 box that you have root access to.

First we need to become root:

$ su

Enter in your credentials and now you are root. Next we need to add the OpsView Repository.

# cd /etc/yum.repos.d
# nano opsview.repo

In the opsview.repo file, paste this:

name = Opsview
baseurl = http://downloads.opsview.com/opsview-core/latest/yum/centos/$releasever/$basearch
enabled = 1
protect = 0
gpgcheck = 0

We now have the opsview repo installed. Now we can run

# yum list updates

It should come back empty – but now the repo will be up to date. Now we can go about actually installing the OpsView Server.

# yum install opsview

It will find all the dependencies for you (which, you’ll note includes MySQL Server – with OpsView Core, it has to be self hosted – as in you can’t host your MySQL Server on another box and use that, it has to be locally hosted – if you use OpsView Pro – you can use a different MySQL Server – but remember this is at a bit of an expense, if your MySQL Server goes down, OpsView also goes down.)

It will take a little bit to get up and running – depending on your hard drives / SAN / NAS / where ever you are installing it, how much CPU power it has, etc…

Once it is all installed, we now need to set up MySQL. I prefer the “Secure Setup” way, to I’d run this:

# /usr/bin/mysql_secure_installation

It will prompt you for a MySQL root password – make sure you remember this – we’ll need it. After it’s finished, we are just about all good with MySQL.

Next, Nagios (the foundation which OpsView is built on) tries to create a suitable environment for the server – it creates a new user called “nagios” We need to verify that it is set up correctly by running this:

# su - nagios
echo "test -f /usr/local/nagios/bin/profile && /usr/local/nagios/bin/profile" >> ~/.bash_profile

If those top two commands work (which they should), we are all good. Next we need to edit a few config files.

# nano /usr/local/nagios/etc/opsview.conf

We need to change the two passwords that say “changeme” to the password we set as your MySQL root password.

Next we need to run a few Opsview scripts to bind OpsView to the MySQL Server and set up all the tables.

# /usr/local/nagios/bin/db_mysql -u root -p{MySQL root password}
# /usr/local/nagios/bin/db_opsview db_install && /usr/local/nagios/bin/db_runtime db_install

Those second two scripts may take a few moments to run and you may or may not get some warnings about UTF-8. You can ignore those.

The last thing we need to do is regenerate all the config files based on what those scripts ran. We can do that by running this:

# /usr/local/nagios/bin/rc.opsview gen_config

If this fails for some reason or either, it may be because the log is not writable by Nagios. I fixed this by doing this:

# chmod 777 /var/log/opsview/opsviewd.log

Once that is set up, we are basically done and we can now start the opsview-web service by running:

# service opsview-web start

We’ll also want to be sure opsview-web and mysqld start on boot

# chkconfig --level 345 mysqld on
# chkconfig --level 345 opsview-web on

Now you are all set up. If you open a browser on your OpsView server and punch in http://localhost:3000, you should be presented with a shiny new login screen.

To log in for the first time, the username is “Admin” and the password is “initial”. You’ll obviously want to change these straight away. The rest is all done via the handy GUI.

If you want to be able to access this on different machines, you’ll need to either have a FQDN or a static IP, with firewall open for port 3000. You can then access it by pointing your browser to http://ip_of_opsview_server:3000, or http://FQDN:3000.