[Main Page](../index.html "Main Page") | [Agenda](../agenda.html "Agenda") # LibreNMS - Lab 1 # Introduction ## Goals * Gain experience with LibreNMS ## Notes * Commands preceded with "$" imply that you should execute the command as a general user - not as root. * Commands preceded with "#" imply that you should be working as root. * Commands with more specific command lines (e.g. "rtrX>" or "mysql>") imply that you are executing commands on remote equipment, or within another program. # LibreNMS lab All components for LibreNMS should already be installed - it will be now up to you to configure the service, add hosts, etc... If this is not the case, a different lab (librenms-install) is available. Follow the instructions in this lab to complete the initial LibreNMS installation. Connect to your virtual machine as the sysadm user, then: # Access LibreNMS! A user has already been created for you. This is the user 'sysadm', and the password is the standard class password: http://librenmsN.ws.nsrc.org/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ User: sysadm Password: the class password ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You should now be logged in to LibreNMS. If you followed the "librenms-install" lab, then you'll have an entry for "localhost". Take a look at the interface for a few minutes. # Add a host - your own router In the web interface (http://librenmsN.ws.nsrc.org), navigate to the Device menu, and click on "Add Device" Use the following parameters: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hostname: rtrX.ws.nsrc.org SNMP Version: v2c [should already be selected] SNMP Community: you can leave this blank, since we have set it in `config.php`, or you can type it in: NetManage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If all goes well, you should see several messages like these: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adding host rtrX.ws.nsrc.org community NetManage port 161 using udp Trying community NetManage ... Device added (6) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can navigate to the `Devices` view on LibreNMS, and see that the device has indeed been added: ... if you explore the web interface, you'll notice there is no data yet, and if you click on the device (rtrX), LibreNMS will complain that the device hasn't been discovered yet. # Force polling We can tell LibreNMS to start collecting data for this host, by running the following command. Note that this will happen automatically thanks to the cron job we installed earlier, but we don't want to wait: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $ cd /opt/librenms $ sudo ./poller.php -h all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Force discovery We want to run a discovery (scan) of the network -- here again, we don't want to wait, so we run: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $ cd /opt/librenms $ sudo ./discovery.php -h all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Note that a LOT of information will appear! We'll run a data collection again manually: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $ sudo ./poller.php -h all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Go back to the web interface http://librenmsN.ws.nsrc.org/ What do you notice ? How do you think LibreNMS found that there were other devices on the network, and how did it know how to contact them ? # LibreNMS UI In Click on "Devices" in menu at the top. Find the router for your group in the list, and click on its name. You will land on the Overview page for your device. You will notice that LibreNMS has automatically detected many, many things about your router! At the top, under your router's hostname, you will see a list of tabs, all of them presenting information about your device: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Overview | Graphs | Health | Ports | Routing | Map | Inventory | Logs | Alerts | Alert Stats | Performance ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Graphs Under "Graphs", you will see all information which can be presented in the form of a graph: Network IO, Disk IO, Memory and CPU usage, etc... ## Health You will also see the "Health" tab, which offers various metrics on how the device is doing hardware wise - if this information is available - such as temperature, voltage, fan speed, etc... Notice that some of this information is already shown in the overview page for the device (which you get when you click on the name of the device). ## Ports Next we'll take a look at the Ports menu tab. Under "Ports" you will find a summary of traffic for all ports, including bits per second and packets per second, port speed, and the type of connection (Ethernet or other). Note that all elements can be clicked on, including the small graphs, and you will be taken to the corresponding page for the data source. ## Routing The Routing tab will present you with an overview of enabled routing protocols. If you have enabled OSPF or BGP on your routers, you will get information about the active sessions, neighbors or peers, and other protocol specific information. ## Map The Map function is an automatically generated diagram of the topology of your network, as seen from the point of view of your router. This will only function for CDP/LLDP enabled devices (Cisco, IOS, ...) Note: It will only be available if you have enabled 'autodiscovery' 'xdp' in the configuration file (we did this earlier!). ## Inventory Inventory contains a full list of hardware modules and serial numbers for equipment installed on your router. Note that this will not work on all vendors. ## Logs Under Logs you will see a list of events for your router: changes that have taken place in the configuration of the device, or in the state of interfaces, services, etc... ## Alerts Alerts is currently empty for your router - we will see more about this later. # Add a location and contact for your router If you navigate back to the Overview page for your router (Go to Devices, click on your router's name), you will see that LibreNMS has picked up the Hardware platform, the Operating System and the Uptime for your device. Now, log into your router with SSH and add the following information to your SNMP configuration: Set the location (make it a City, Country format, so that your host will appear on the geo map overview page) Set the contact (email address or name) To do this: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rtrN> enable Password: rtrN# conf terminal Enter configuration commands, one per line. End with CNTL/Z. rtrN(config)# snmp-server contact user@email.address rtrN(config)# snmp-server location City, Country rtrN(config)# exit rtrN# write memory ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You want to replace "City, Country" with the city and country (or state) we are currently in. For example: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Bloomington, Indiana Thimphu, Bhutan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ etc... If you wait a few minutes (maximum 5), you should see this information appear automatically on the Overview tab for your router in LibreNMS. It's possible to make LibreNMS show this information on a map. Try and add this to `/opt/librenms/config.php`: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $config['front_page'] = "pages/front/globe.php"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Now reload For fun, talk to your colleagues in the classroom, and ask them to pick a different City and Country for each of the routers. Then wait until LibreNMS has re-scanned the devices, and look at the World map view on the main LibreNMS page (http://librenmsX.ws.nsrc.org/) Read more at http://docs.librenms.org/Extensions/Globe-Frontpage/ # Adding an interface description While you are still logged in to your router, add a pseudo interface to your router, to see if LibreNMS will pick it up: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rtrN(config)# interface loopback123 rtrN(config-if)# description A useless interface rtrN(config-if)# exit rtrN(config)# exit rtrN# write memory ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This should also show up in LibreNMS after a while - try and find the description under "Ports" # IP address lookup From LibreNMS's main page, you will find, under the Overview menu at the TOP of the page), a submenu "Search" with 5 options: - IPv4 search -> http://librenmsX.ws.nsrc.org/search/search=ipv4/ - IPv6 search -> http://librenmsX.ws.nsrc.org/search/search=ipv6/ - MAC search -> http://librenmsX.ws.nsrc.org/search/search=mac/ - ARP/NDP tables -> http://librenmsX.ws.nsrc.org/search/search=arp/ - FDB tables -> http://librenmsX.ws.nsrc.org/search/search=fdb/ Using the IPv4 and ARP table searches, try and search IPs of equipment in the class: - IP of the GW (10.10.0.254) - IPs of the routers (10.10.X.254) - IPs of the PCs (10.10.1.1, 10.10.5.17, etc...) Try and search IPs for your OWN laptop! Find the IP of you own laptop, and see if you can search it in LibreNMS. Can you ? Why ? # Add the switch From the TOP menu "Devices", choose "Add device". Fill out the fields: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hostname: sw.ws.nsrc.org ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Click on "Add Host". After a few seconds, it should have added the switch. After a few minutes, data should appear in LibreNMS for the switch. # Let's disable ports that are unused! Find the Overview page for "sw.ws.nsrc.org". From there, you can configure the device (the "wrench" icon on the top right). You are then presented with a configuration page for the device. Click on Port Settings, then you will get an overview of the Port status on the switch. Look at the ones that are "down". For those that are "down", check the "Ignore" box, then "Save" under "Index". (top left). If you call back the main LibreNMS page: http://librenmsX.ws.nsrc.org/ ... LibreNMS should no longer complain about these ports! # Have you tried adding your PC yet? Other PCs in the class? More fun things: - From the top menu, choose Devices -> All devices - Find your router, and click on it on the list. - Below the graph summary, you'll see a list of the interfaces on your router: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fa0/0, Fa0/1, Null0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Click on Fa0/0 - Click on "Real Time"