Quantcast
Channel: How Tos – OliverMarshall.net
Viewing all articles
Browse latest Browse all 52

How to install LibreNMS on Ubuntu

$
0
0
libre

There’s a range of great monitoring tools available to you to monitor and alert on all aspects of your network. Here we’re going to look at one of my favourite open-source packages, LibreNMS.

LibreNMS is a fork of Observium but it has a focus on presentation and usability. It’s certainly easier to get up and running with LibreNMS. With great graphs, a truck-load of notification options, including PushBullet, it’s everything you want from a network tool.

One area where LibreNMS is currently weak is in the support for custom MIB files. Whilst LibreNMS has good support for a large range of network switches and devices, it’s support for MIB files is still very experimental. This has never been an issue for me when it comes to monitoring networks as LibreNMS always seems to discover something it can monitor, but you might need to get down and dirty in terminal to get more esoteric devices up and monitoring.

For this walk-through I’m assuming that you have a Ubuntu Server 14.04 and we’re using LibreNMS version c72d8cc. I’m using Emacs as my editor of choice (it is the best, after all) but feel free to use whatever you want. I’m also assuming that LibreNMS will be the only thing running on this server and that you aren’t looking to run the MySQL functions on another server.

  1. First off install Emacs.
    sudo apt-get install emacs
  2. Configure MySQL using the command line.
    mysql -u root -p
  3. Enter the following commands in to the mysql prompt.
    create database librenms;
    grant all privileges on librenms.* to 'librenms'@'localhost' identified by 'password';
    flush privileges;
    exit
  4. Install the required software.
    apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-snmp php-pear php5-curl snmp graphviz php5-mcrypt php5-json apache2 fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git
  5. Create a user account for Libre and add it to the www-data group for apache.
    sudo useradd librenms -d /opt/librenms -M -r
    sudo usermod -a -G librenms www-data
    sudo chmod ug+w librenms
  6. Download the LibreNMS files using GIT, which was installed as part of the software packages in step 4.
    cd /opt
    sudo git clone https://github.com/librenms/librenms.git librenms
    cd /opt/librenms
  7. Web interface

  8. Create the folders needed for RRD and assign the right permissions.
    sudo mkdir rrd logs
    sudo chown -R librenms:librenms /opt/librenms
    sudo chmod 775 rrd
  9. Next create the Apache configuration file for Libre;
    sudo emacs sudo emacs /etc/apache2/sites-available/librenms.conf
  10. Paste the following text in to the editor. Change “MyHostname” to match your servers hostname.
    DocumentRoot /opt/librenms/html/
    ServerName MyHostname
    CustomLog /opt/librenms/logs/access_log combined
    ErrorLog /opt/librenms/logs/error_log
    AllowEncodedSlashes On
    <Directory "/opt/librenms/html/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
  11. Enable the mcrypt Apache module
    sudo php5enmod mcrypt
  12. Tidy up and restart Apache
    sudo a2ensite librenms.conf
    sudo a2enmod rewrite
    sudo a2dissite 000-default
    sudo service apache2 restart
  13. Right. Now for the web based configuration. Visit the install URL in your browser to start the configuration process. Change the “MyHostname” to match your hostname.
    http://MyHostname/install.php
  14. All being well you should see the following configuration page. Click Next.
    LibreConf1
  15. On the following screen enter your MySQL details. The database, username and password have to match the details used in step 4 above.
    libre36
  16. In the next page enter the username and password for your main admin user. Don’t lose this, it will be needed for any system changes.
    libre
  17. Confirm you want to create the configuration file (you do after all) and hit Generate.
    2016-02-17 13_19_56-test-libre_install.php
  18. All being well, you shouldn’t see any error messages. Click Finish.
    2016-02-17 14_01_10-test-libre_install.php
  19. …and you are done. Congratulations. Now to quickly look at adding devices.
    2016-02-17 14_09_04-test-libre_install.php
  20. Adding devices

    Now you need to configure a few more things. We’re going to add the LibreNMS box to the list of devices from the command line and then we’re going to set up regular polling of the registered devices in LibreNMS.

  21. Go back to your terminal window and add the local server to the list of LibreNMS devices and run a discovery of the SNMP objects available.
    sudo php addhost.php localhost public v2c
    sudo php discovery.php -h all
  22. Copy the cron file containing all the scheduled times for the discovery scripts to the right location.
    sudo cp librenms.nonroot.cron /etc/cron.d/librenms
  23. Finally, you can add network devices. Pop back to the web interface. Click on the Devices menu then Add Device. Enter the IP of the device.
    2016-02-17 15_17_36-Add host - LibreNMS
  24. It should be added and LibreNMS will start monitoring.
    2016-02-17 15_17_47-Add host - LibreNMS
  25. And we are done. Phew, high five people!

    The post How to install LibreNMS on Ubuntu appeared first on Oliver Marshall.


Viewing all articles
Browse latest Browse all 52

Trending Articles