In my previous post, “Set Up A Cacti Monitoring Server in Minutes with this GoGrid Community Server Image”, I showed how to use a Community GSI to quickly and easily set up a monitoring server on GoGrid running Cacti. In this second part of the Cacti GoGrid Community GSI blog series, I would like to walk you through how I connected my Cacti server up to an Ubuntu server (a node in my Glusterfs file storage array). First we will review the objectives we are looking to achieve and then dive into each one.
- Confirm private network configuration on both Cacti server and Ubuntu server, and test connectivity.
- Enable SNMP server and configure SNMP rocommunity string on Ubuntu servers.
- Establish SNMP agent listening IP address
- Create “Device” in Cacti console and confirm SNMP connectivity to Ubuntu server
- Create Graphs – CPU usage, Load Average, Memory Usage, PING Latency, Processes, Eth0 Traffic, Eth1 Traffic
- Repeat process for other Ubuntu servers in your network.
Confirm private network configuration on both Cacti server and Ubuntu server, and test connectivity
On GoGrid, you have the ability to network your servers together over a private network allocated to your account. (Note: all private networking within GoGrid is free.) We need to take advantage of this secure communication method to allow your Cacti server SNMP access to your servers. I recommend you use the private network IP range that is specified in your account – under the “List” tab then “Network”.
In this example we will be using the 10.129.151.0/24 network (yours will be different).
First, log into the Cacti server and assign a private IP address to the eth1 interface. To do this open up the /etc/sysconfig/network-scripts/ifcfg-eth1 file and configure the IPADDR parameter and NETMASK parameter. Now save the file and toggle the interface /etc/init.d/network restart or ifdown eth1 and ifup eth1.
I would recommend using ifdown (which brings a specific network interface in this case we would specify eth1 right after command) and following the completion of that command execute the ifup (which will bring up a specified interface). This serves the same function as restarting networking but doesn’t touch the other interfaces that we don’t need to restart.
Once this is done – confirm you now have a private IP address on the eth1 interface.
While we are at it – let’s add the host name of the Ubuntu server to the /etc/hosts file. You need to open up the /etc/hosts file and add a line containing the 10.x.x.x address you are going to give the Ubuntu host. In this case, the Ubuntu server has a hostname equal to Gluster2.
Renaming our Cacti server is the last step before we log out. The hostname of a GoGrid system is a unique string after initial deployment. Let’s change this to something that is more descriptive of what the host is. While in the Cacti server – modify the line HOSTNAME in /etc/hostname to “Cacti”, see image below. After saving and closing this file, reboot your Cacti system for this hostname change to take effect.
The second part of this objective is to bring up private network connectivity on the Ubuntu server – in this case Gluster2.
Log the Ubuntu server via SSH and open up the file – /etc/network/interfaces. In Ubuntu, the networking configurations for all interfaces are contained this file unlike the Cacti server which is running on CentOS. The screen shot below shows how I changed the eth1 inet from DHCP to Static and added the address and netmask parameters.
After the file /etc/network/interfaces has been updated – the network interface needs to be restarted.
You should now be able to ping the Cacti server via its private IP address. You may also want to add the Cacti server to the /etc/hosts file on your Ubuntu server. This is the same file and location as on a CentOS server (The Cacti image is saved on CentOS 5.5). After you have confirmed private network connectivity between the two servers, you can move onto the next objective.
Enable SNMP server and configure SNMP rocommunity string on Ubuntu servers.
This objective requires us to log into the Ubuntu server via SSH. From the SSH login, we need to install the necessary packages to get SNMP running on your Ubuntu server. Run the command below.
snmpd will be installed and configured to start on boot automatically
After successful installation of the packages for SNMP, it is time to edit the snmp.conf. Here we need to add the unique read-only community (rocommunity) string identifier and the host (Cacti) that will be accessing this server via SNMP inquires.
If you are following along on your own – add your own unique string anywhere in this file and reference your Cacti server’s private IP address which should be different than mine.
rocommunity <unique string> <private IP of your Cacti server>
Establish SNMP agent listening IP address
Next edit the file /etc/default/snmpd. This file contains default SNMP configurations. We are interested in modifying the default interface the SNMP daemon will be listening on. By default, this interface is 127.0.0.1. We need to change this setting to the local 10.x.x.x interface of the Cacti host.
Modify this entry to reflect your private IP address (your private IP address will be different than mine):
Check to make sure SNMPD is listening on the right IP with netstat –lpn | grep snmpd
We are now ready to create the device in Cacti for monitoring. If you don’t see the snmpd process listening on your correct private IP – check the configuration in /etc/default/snmpd again. If you don’t get anything back from this command then confirm that snmpd is started and running properly with /etc/init.d/snmpd status
Create “Device” in Cacti console and confirm SNMP connectivity to Ubuntu server
Our next objective requires us to log into the Cacti graphical interface as admin. In the last Cacti blog post – I had you deploy the server and do the initial log in which will require you to update the admin login password to a password of your own. I use my web-browser and point to the public IP address of the Cacti server via http://<public_IP>/cacti/
Once you have successfully logged in – go to the “Create devices” on the main page. Refer to image below.
On the “devices” page click on the “Add” button.
Here is where we will set the Description, Hostname, Host Template, SNMP version, SNMP Community, and Notes. Once this information is filled out appropriately, click on the “Create” button.
Create Graphs – CPU usage, Load Average, Memory Usage, PING Latency, Processes, Eth0 Traffic, Eth1 Traffic
If the device was created successfully, the SNMP information will be displayed for the device near the top of the device page. If you get an SNMP Error message there, then it is possible your private networking on one or both of the hosts is not configured properly or SNMP was not configured properly on the Ubuntu server.
Next, click on “Create Graphs for this Host”
This will take you to a new page where you can select the graphs available from the template used for this device. Remember, the template we set was the ucd/net SNMP host template. Put a check box next to the items you want to graph (CPU usage, Load Average, Memory Usage, PING Latency, Processes, Eth0 Traffic, Eth1 Traffic) and click “Create”.
**Note – it will take 5 minutes for the Cacti poller to start gathering data and populating into the rrd file This is the default /etc/crontab setting for poller execution. (An rrd file is essentially the data base the Cacti poller creates and uses to house data gathered from the device. )
After a few minutes Cacti will have built out the rrd file for this device and gathered initial data to be viewed in graphs. To get there go to “Graphs” in the upper left and then to “Lists” on the upper right side.
From here we select the host “Gluster2” and filter for the graphs available for this device. See image below.
Click on each graph and you should see data being graphed (If you receive a “broken image” wait for a few minutes as Cacti may not have enough data to present a graph yet).
Repeat process for other Ubuntu servers in your network.
Repeat this process on other Ubuntu servers on your network. Shortly, I will follow up with a blog post on how to monitor your Windows server via Cacti! Remember to look for my Community GoGrid Server Image (CGSI) within GoGrid to get you up and running with Cacti in a matter of minutes!
Questions? Leave a comment!