313 | | |
| 320 | ==== Web installer ==== |
| 321 | |
| 322 | You 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 | |
| 324 | At this stage you can launch the web installer by going to http://librenms.'yourdomain'.ws.ac.lk/install.php |
| 325 | |
| 326 | Follow 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 | |
| 348 | The config file has been created |
| 349 | |
| 350 | You can now click '''Finish install''' |
| 351 | |
| 352 | - Stage 6: you are done! |
| 353 | |
| 354 | You can now follow the instructions and click where it says '''click here to login to your new install'''. |
| 355 | |
| 356 | A useful tool is provided with LibreNMS to help verify that the software is installed correctly. |
| 357 | |
| 358 | Let's try it out: |
| 359 | {{{ |
| 360 | # cd /opt/librenms |
| 361 | # ./validate.php |
| 362 | }}} |
| 363 | You 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 | |
| 365 | We 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 ==== |
| 373 | First, edit the file /opt/librenms/config.php, |
| 374 | |
| 375 | # vi /opt/librenms/config.php |
| 376 | |
| 377 | and find the line: |
| 378 | {{{ |
| 379 | $config['snmp']['community'] = array("public"); |
| 380 | }}} |
| 381 | And change it to: |
| 382 | {{{ |
| 383 | $config['snmp']['community'] = array("NetManage"); |
| 384 | }}} |
| 385 | |
| 386 | ==== Tell LibreNMS which subnets it's allowed to scan automatically ==== |
| 387 | |
| 388 | By 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 | |
| 390 | But 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 | |
| 392 | Still in the file /opt/librenms/config.php, find the line: |
| 393 | {{{ |
| 394 | #$config['nets'][] = "10.0.0.0/8"; |
| 395 | }}} |
| 396 | And 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 | }}} |
| 400 | We need to make one more change... |
| 401 | |
| 402 | |
| 403 | ==== Tell LibreNMS not to add duplicate devices ==== |
| 404 | |
| 405 | A 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 | |
| 407 | But 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 | |
| 409 | In 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 | |
| 411 | Since "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 | |
| 413 | To 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 | |
| 419 | After you've added the above setting, save the file and exit - we’re nearly done! |
| 420 | |
| 421 | |
| 422 | ==== Add a host ==== |
| 423 | |
| 424 | Let'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 | |
| 429 | You should see: |
| 430 | |
| 431 | Added device localhost (1) |
| 432 | |
| 433 | Notice 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 | |
| 437 | LibreNMS 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 | }}} |
| 442 | NOTE: 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 | |
| 444 | Once 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 | }}} |
| 448 | As 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 | |
| 452 | Create 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 | |
| 459 | 1.4 Install complete |
| 460 | |
| 461 | That'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 | |
| 464 | PLEASE 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 | |