Enable the SNMP Agent on Raspberry Pi

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello like me some of you may have multiple raspberry pies deployed around your environment whether it be your home or business they might be print servers they might be security cameras they might be temperature monitors and you want an easy way to monitor them through libra nms well the snmp agent is not installed or configured by default on raspbian and that's what i'm going to cover today we're going to cover installing and enabling the snmp agent so that you can monitor your raspberry pi's these steps will be done in two parts the first part will be the basics of just enabling the snmp agent service that's really all you need to do if you want to get a little bit more detailed with how libra nms is monitoring these devices basically it's just getting the correct icon uh then i'll also have some a second part an optional part that i'll go through as well okay let's dig in this is a fully updated and fresh install of raspbian os i also have a google doc created with all of the commands that we need to go through and i'll post that in the description to give you guys easy access so the first thing we need to do is run sudo apt update and then install the snmp service so let's do that now okay the update has completed so let's install snmpd sudo apt install snmpd yes to confirm you want to install okay great now the next step is to make some minor edits to the config file so i'm going to use nano to do this sudo nano etsy snmp snmpd.conf okay inside the config file we need to add this line ro community public so copy and i'm just going to add this down here and remember right click to paste all right and i need to edit these lines so i need to comment this agent address line by adding a hashtag in front of it so let's find the agent address okay it's right here so i'll comment it out by adding the hash symbol [Music] okay and then i need to uncomment the line uh looks like this one agent address all right great that's all the edits we need to do to the snmp config so i'm going to exit with control x yes that i want to save changes and enter to confirm next i'll restart the snmpd service anytime you make a change to the config you need to restart the service for those changes to take effect so sudo system ctl restart snmpd [Music] okay great the service has restarted if you want to check the status then it's just sudo system ctl status snmpd okay and there is an error here that's okay it's just saying it can't find the pci bus which raspberry pi's do not have but otherwise the service is running okay i'll just hit q to get out of that prompt the next thing we need to do is add it to libra nms if you're not sure what the ip address of the pi is you just do ifconfig and i can see my ip address right here 192.168.4.176. so i'll come in here add a device 192.168.4.176. community is public and add okay it says it was added successfully so let's take a look at it now keep in mind that libre nms does need time to figure out what the system is and figure out what it can monitor about the system this should take about five minutes just to get the basic info but really you'll need a good 20 minutes for the graphs to start coming in and seeing the status of the system okay here we go so at almost five minutes we're starting to collect some information about the device as libra nms collects more history these graphs will start to populate and have actual images now at this point we really are finished with the snmp setup there are a few other things that you can tweak for example down here at location if you want to change the location or perhaps the contact this is done in the snmpd config file so i can show you where that is the other thing is this linux icon this tux icon will never update to the raspberry pi icon and that's what step two covers so first i'll show you how to change the location and then we'll also tackle step step two so if i uh go back into editing this config file if i just push up in the terminal it shows me my command history so i'll do the sudo nano to to edit the config file and if you look through this file carefully [Music] down here under system information you'll find that contact so i'm going to change this just to say that it's a test pie this is a pi 3 that i'm working on and just to show that you can change the contact i'm going to call it [Music] first name last name there [Music] that's it that's all we need to change in here so i'll go ahead and control x to exit yes to save enter to confirm and remember we made a change to the config file so what do we have to do that's right we have to restart the service so i'll just press up to restart the snmp daemon okay now while libra nms continues to collect information i'm going to proceed through the optional steps so to get the raspberry pi logo working what i had to do was steal this distro file that libra nms installed so i'll show you how to install it if you choose to do so okay so what we're going to do with these optional steps is sudo touch the touch command helps us create a file and put it in user bin and the file is called distro hit enter now that the file is created it needs to be executable otherwise you'll have an error so sudo chmod to change the mode plus x and the location at file so user bin distro [Music] okay now this file is empty so we also need to use nano to put the script inside of this file so sudo nano user bin distro okay and here it is the file is empty at the bottom it says there are zero lines so this is the script it's quite long it's in green so go ahead and copy this script i'm going to right click copy and then i'm going to right click and paste and the last thing i'm going to do we we should be able to just exit from here but i'm going to scroll up and the reason for this is sometimes these very long lines will wrap the text will wrap and if that happens the the file will be broken um i might be able to show you a quick example [Music] okay i i can't really but but up here see this dollar sign well this dollar sign indicates that the line is wrapping and so what might happen sometimes i'll just put an enter in here this might be what happens if you copy text that has wrapped so for example if you paste this into notepad and you have wrapped text turned on this might happen to some of your lines and if it does it's going to break the config file from working because each line is executed as a command and it's going to try to execute this partial word as a command and of course it won't be a command and so you'll get an error hello this is me from the future just a quick note if you do make an error in your config or your distro file the error that i was referring to will appear right here in this section generally it will say something like cannot execute command or file not found so even if you go through here and you save it and you're getting an error in libra nms don't worry just a line has wrapped so go back in this file find that line just hit delete to to you know put it back all on a single line and then ctrl x y to save enter to confirm and then the last thing we need to do now that the file is created is we need to add this extension into our sm snmp config file so we're going to do sudo nano etsy snmp snmpd dot conf we're going to edit this file one more time we're going to scroll down to the section where the extends are okay and down here where it says extending the agent i'm just going to put the command in right here i'll copy it okay copy and remember to right click and paste and then save it control x y to c why to save enter to confirm and remember we've edited the snmp config file so what do we have to do restart the service so sudo system ctl restart s m p d enter hello it's me from the future again if you follow the full instruction set including the optional instructions and you're finding that some of the information in libre nms is not updating what you may need to do is go into edit mode on the device and click rediscover device device will be rediscovered and this process may take again about another five minutes if you've done all of the steps and then added the device to libra nms at the very end you should not need to rediscover the device because everything will be discovered during the initial discovery when the device is added okay and here we go about three to five minutes after we rediscovered the device we can find that we now have the raspberry pi logo and also our location as updated as well and that's it don't forget to restart the service if you're troubleshooting an error and you're making changes in your config file and you can't figure out why your changes aren't taking effect restart the service it's very easy to forget this step otherwise i hope that was helpful i hope that you can get snmp set up on your raspberry pi's don't forget to like the video and subscribe for more content and let me know in the comments how you're making out with this and and how you're using your pies at your home thanks and have a great day [Music] [Applause] bye
Info
Channel: Mike S
Views: 3,124
Rating: undefined out of 5
Keywords: SNMP, LibreNMS, Libre NMS, SNMP Agent, Enable SNMP Agent, Single Board Computer, Raspberry Pi, RPi, Raspbian, Raspberry Pi OS, Enable SNMP Agent Raspberry Pi, Install SNMP Linux, monitor raspberry pi, monitor pi on home network, monitor pi, Monitor Raspberry Pi LibreNMS, Get raspberry icon to show LibreNMS, SNMP for network monitoring, snmpd.conf
Id: jxiDgJBFV5E
Channel Id: undefined
Length: 13min 13sec (793 seconds)
Published: Thu Oct 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.