Thursday, October 24, 2013

My Aventures in Installing Cacti (Part 2)

This is a continuation of my first post about installing Cacti.  You can find that post here

Now that I've got this new Cacti server up and running we need to get some data collection setup so we can get some of those pretty graphs.

But first things first.  Out of the box this install is setup for DHCP.  We'll need to change that to a static IP address so it doesn't go jumping around on the network.  Now that I'm done with all the console part I'm going to remove the keyboard, mouse, and monitor and I don't want to lose it on the network somewhere.

Configuring an IP address from the console on a Ubuntu box is pretty easy.   There are just a couple of changes that need to be made to a configuration text file.  That file is /etc/network/interfaces.  To edit that use the command sudo nano /etc/network/interfaces  All we going to do there is change the iface eth0 inet dhcp line to iface eth0 inet static and then add a couple of lines for the actual static address.  It should look similar to this when you get finished:

auto eth0
iface eth0 inet static
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.1
dns-server 10.0.0.2

Once those changes have been made we'll need to restart the network interfaces to make those go into affect.  To restart the network interfaces just use sudo /etc/init.d/networking restart

Easy enough, right?  Now we know which IP address our server will be using and we wont be at the mercy of our DHCP server.

Now let's log back into our Cacti server and get to setting that up.  You'll need to use the IP address that you configure to access the server, but it will look something like http://10.0.0.100/cacti  You'll log in with the username/password that you setup earlier when you went through the initial setup wizard.

Once logged into Cacti you'll want to add a new device. Just click on Devices on the left side and then click on Add over on the right side.  You'll want to type in a description that's useful for you.  This is what's going to show up in all the lists in Cacti.  For the hostname I just entered the IP address of the switch I wanted to monitor.  For host template, it defaults to None, but if you'll go ahead and select something here it'll make things a little easier later on.  For me, I'm monitoring a Cisco 3750 switch so I just picked the "Generic SNMP-enabled Host" template.  I left the next bit on the defaults.  I did have to change the SNMP Community string.  I couldn't remember what it was setup to on the switch so I had to go look through my documentation, but after I found it entered that in there.  If you're not sure just stick with "public", a lot of equipment comes with that by default so it may work for you.  Once you've got that in there, just click Create and then you'll be done with that page.

Your page now should have "Save Successful" at the top.  Below that it shows my SNMP info from my switch.  Over on the right there's a link for "Create Graphs for this Host."  Go ahead and click on that.  There should be a new page up that lists all of the interfaces on available on your switch.  If you don't see that, go back to the last screen and check that your Host Template is set correctly (mine is Generic SNMP-enabled Host).  Now for my switches I see all of my interfaces that are configured on the switches, the ports, and the stacking ports too.  If you've configured descriptions on your ports those will show up too.  For my interests I wanted to see how much traffic was coming and going on the WAN. So I picked the interface  (by checking the box at the right-hand side of the column) that I have setup as the "outside" of my site. Then down at the bottom I picked the graph type out of the drop down box.  For right now I picked "In/Out Bits with Total Bandwidth".  At some point in the future I may change that to one of the bytes graphs but for now I just went with the bits graph.  Now just click on Create and you'll have created your first graph in Cacti.

Wait, you just clicked Create and it doesn't look like it did anything right?  Check up at the very top, you should see a line that says "Create graph: blah blah blah"  I guess you want to see your graph now, right?  Well, I don't want to disappoint you, so I'll tell you how to get there.  Click on Devices on the left, then click on the Device that you added earlier, and then click on Graph List (toward the top right).  Then just click on the graph that you just created.  VoilĂ !  It's blank, right?  Well that's because we just set it up and there's no data yet.  By default it polls every 5 minute, so it's going to take a while to get some data.  Go do something else for a little and then come back.  Really, watching it doesn't make it go any faster.  Trust me.  I've tried.

While you wait, you can go ahead and add the graph to the "Tree".  This way you can just use the "graphs" link at the top to see your.... empty... graphs.  Don't worry, the data will start coming in eventually.  But let's pass this time productively and add it to the Tree already.  Go back to your Graph List.  You can do that the same way I listed earlier, or here's a different way.  Just click on Graph Management on the right, pick your host out of the drop down and you graphs should be listed there.  Now we want to pick one (check the box on the right side), then select the "Place on Tree (Default: Tree)" action out of the bottom drop down list, and then click on Go.  It asks for a Destination Branch, but right now we've only got one, the [root], so we're going to use it and click on Continue.

Now if you click on graphs at the top it'll take you to the graphs view (obviously, right?).  It defaults to the Tree view, but I don't have a lot in there so I click on the icon at the top on the far right.  I know it's a graph, but it looks like mountains to me.  Since there are not many graphs setup yet, I like this view better.  Later on I'll probably prefer one of the other ones, but for now I'll just stick with this one.

Still waiting for the data to show up?  Let's get rid of the localhost device and graph that came with the installation.  I don't really have any interesting in watching the machine that's watching everything else, so I just deleted that device.  To do that go back to the console and then click on Devices.  Check the box by your localhost and then select the Delete action at the bottom and click Go.  Click to confirm that you want to get rid of it and then it'll be gone.

By now you might have a single column on your chart.  It's not much to look at right?  Well, tomorrow it will be more impressive.  In the mean time you'll have to find something else to do.  How about reading some of my other blog posts?  That sounds like fun, right?



No comments:

Post a Comment