Changes between Version 6 and Version 7 of librenms


Ignore:
Timestamp:
Nov 22, 2016, 8:26:59 AM (8 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • librenms

    v6 v7  
    162162Check now that you can run snmpstatus against your other group members servers:
    163163{{{
    164 $ snmpstatus www.'your neighbors domain.ws.ac.lk
     164$ snmpstatus www.'your neighbors domain'.ws.ac.lk
    165165}}}
    166166
     
    200200}}}
    201201PLEASE NOTE
    202 
     202vi /etc/mysql/mysql.conf.d/mysqld.cnf
     203
     204Within the [mysqld] section please add:
     205{{{
     206innodb_file_per_table=1
     207sql-mode=""
     208}}}
     209service mysql restart
    203210Here we are using <your Password> as the password for LibreNMS to access MySQL. Please replace <your Password> with, Please do not forget the password as you will need it in the future
    204211
     
    254261
    255262We need to create a LibreNMS system user, librenms
    256 
     263{{{
    257264# useradd librenms -d /opt/librenms -M -r
    258265# usermod -a -G librenms www-data
    259 
     266}}}
    260267 
    261268==== Cloning the LibreNMS source code with git ====
     
    311318# service apache2 restart
    312319}}}
    313 
     320==== Web installer ====
     321
     322You can choose either a web configuration or manual configuration at the command line. We're going to use the Web installer, which is by far the easiest, but we'll include the manual configuration as a reference at the end of this document.
     323
     324At this stage you can launch the web installer by going to http://librenms.'yourdomain'.ws.ac.lk/install.php
     325
     326Follow the onscreen instructions.
     327
     328 - Stage 0 is a summary of the PHP modules installed, normally you should just click on ''Next Stage''
     329
     330 - Stage 1 prompts you for the database settings. Enter
     331
     332   *  DB Host: localhost
     333
     334   *  DB User: librenms
     335
     336   *  DB Pass: <your password used for mysql database lireNMS>
     337
     338   *  DB Name: librenms
     339
     340 - Stage 2 is the DB creating itself - it should finish correctly, and you simply click on ''Goto Add User'' at the bottom
     341
     342 - Stage 3: enter a username, password (do not forget the password) and E-mail address. This will become the login you use to access the web interface.
     343
     344 - Stage 4 should show you the successful user creation, click on ''Generate Config''
     345
     346 - Stage 5: the interface should show, at this point:
     347
     348The config file has been created
     349
     350You can now click '''Finish install'''
     351
     352 - Stage 6: you are done!
     353
     354You can now follow the instructions and click where it says '''click here to login to your new install'''.
     355
     356A useful tool is provided with LibreNMS to help verify that the software is installed correctly.
     357
     358Let's try it out:
     359{{{
     360# cd /opt/librenms
     361# ./validate.php
     362}}}
     363You may see warnings about the software not being up to date, and some more about permissions. You can probably ignore these for now, but it might come in useful later if you experience issues with LibreNMS.
     364
     365We can now secure the ''/opt/librenms'' directory again:
     366{{{
     367# chown librenms /opt/librenms
     368}}}
     369
     370=== Configuring LibreNMS ===
     371
     372==== Setting the SNMP community ====
     373First, edit the file /opt/librenms/config.php,
     374
     375# vi /opt/librenms/config.php
     376
     377and find the line:
     378{{{
     379$config['snmp']['community'] = array("public");
     380}}}
     381And change it to:
     382{{{
     383$config['snmp']['community'] = array("NetManage");
     384}}}
     385 
     386==== Tell LibreNMS which subnets it's allowed to scan automatically ====
     387
     388By default, LibreNMS will try ask for the list of “neighbors” that network devices "see" on the network. This is done using the Link Layer Discovery Protocol (LLDP) or Cisco's CDP (Cisco Discovery Protocol).
     389
     390But to be on the safe side, and not scan networks outside your organization, LibreNMS needs to be told which subnets it's allowed to scan for new devices.
     391
     392Still in the file /opt/librenms/config.php, find the line:
     393{{{
     394#$config['nets'][] = "10.0.0.0/8";
     395}}}
     396And replace this with the following to scan our specific subnets in use by our network and the workshop infrastructure.
     397{{{
     398$config['nets'][] = "192.248.0.0/16";
     399}}}
     400We need to make one more change...
     401
     402 
     403==== Tell LibreNMS not to add duplicate devices ====
     404
     405A situation can happen where two devices have duplicate SNMP sysName. (that's hostname in IOS) They could be two different devices, so it would be a good idea to have LibreNMS automatically add and monitor them.
     406
     407But it can also happen that the SAME device is seen multiple times by LibreNMS - once using LLDP/CDP, and another time via OSPF (for example).
     408
     409In that case, it ends up added twice. For instance, you may suddenly see two devices called rtr2-fa0-0.ws.ac.lk and rtr2, and this is not what we want.
     410
     411Since "both" devices are in fact the same, their SNMP sysName will be identical, and we can tell LibreNMS to NOT add devices if one already exists with the same sysName - after all, this shouldn't happen in a well configured network!
     412
     413To avoid this, add the following line at the bottom of the config.php file:
     414{{{
     415$config['allow_duplicate_sysName'] = false;
     416}}}
     417... this will prevent LibreNMS from adding the device if it exists already with the same sysName. You will be able to see if there are duplicate devices deteced in the Event Log (Overview -> Event Log).
     418
     419After you've added the above setting, save the file and exit - we’re nearly done!
     420
     421 
     422==== Add a host ====
     423
     424Let's add localhost (i.e.: YOUR virtual server), using the following commands. Later you'll do this from the Web interface:
     425
     426# cd /opt/librenms
     427# php addhost.php localhost NetManage v2c
     428
     429You should see:
     430
     431Added device localhost (1)
     432
     433Notice we explicitly tell LibreNMS which SNMP community to use. We also assume it's SNMP v2c. If you're using v3, there are additional steps which aren't provided here.
     434
     435==== Discover and Poll newly added hosts ====
     436
     437LibreNMS first “discovers” each host that has been added. This means that it methodically examines each host you added and figures out what it should monitor. The discover.php script does not automatically scan your network to find new devices. To run this script do:
     438{{{
     439# cd /opt/librenms
     440# sudo -u librenms php discovery.php -h all
     441}}}
     442NOTE: This could take some time. If you try to add devices that do not yet have an snmp service configured, then the discovery script takes a while to time out.
     443
     444Once this has finished you can now "poll" the hosts. This means LibreNMS now knows what it wishes to monitor for each host, but it has yet to populate its database with initial values for each item. To do this we do:
     445{{{
     446# sudo -u librenms php poller.php -h all
     447}}}
     448As you can see the poller.php script does quite a bit with just a few devices. When we add it to a cronjob below this helps explain why LibreNMS is a resource intensive tool.
     449
     450==== Create cronjob ====
     451
     452Create the cronjob which will run periodic tasks required by LibreNMS:
     453{{{
     454# cd /opt/librenms
     455# cp librenms.nonroot.cron /etc/cron.d/librenms
     456}}}
     457
     458 
     4591.4 Install complete
     460
     461That's it! You now should be able to log in to http://librenms.'your domain'.ws.ac.lk/ and begin to explore the information being collected for your monitored devices.
     462
     463
     464PLEASE NOTE: We have not covered HTTPS setup in this example, so your LibreNMS install is not secure by default. Please do not expose it to the public Internet unless you have configured HTTPS and taken appropriate web server hardening steps.
     465