KML_FLASHEMBED_PROCESS_SCRIPT_CALLS
 

How To Monitor your Ubuntu Server on GoGrid in 6 Steps Using Cacti 0.8.7g

June 1st, 2011 by - 13,212 views

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.

Objectives:

  1. Confirm private network configuration on both Cacti server and Ubuntu server, and test connectivity.
  2. Enable SNMP server and configure SNMP rocommunity string on Ubuntu servers.
  3. Establish SNMP agent listening IP address
  4. Create “Device” in Cacti console and confirm SNMP connectivity to Ubuntu server
  5. Create Graphs – CPU usage, Load Average, Memory Usage, PING Latency, Processes, Eth0 Traffic, Eth1 Traffic
  6. 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”.

List_tab

List_tab2

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.

Cacti_privatenetwork

Once this is done – confirm you now have a private IP address on the eth1 interface.

Cacti_Private_nic_confirmation

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.

Gluster2_PING

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.

Cacti_hostname2

The second part of this objective is to bring up private network connectivity on the Ubuntu server – in this case Gluster2.

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.

Gluster_privatenetwork_interface_eth1

After the file /etc/network/interfaces has been updated – the network interface needs to be restarted.

interface_restart

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.

Gluster_Install_SNMPD

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.

Gluster_Enter_SNMPD_conf

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>

Gluster_rocommunity_setting

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.

Gluster_SNMP_Default_Interface1

Modify this entry to reflect your private IP address (your private IP address will be different than mine):

Gluster_SNMP_Default_interface2

Restart SNMPD

snmpd_restart_gluster

Check to make sure SNMPD is listening on the right IP with netstat –lpn | grep snmpd

netstat_snmpd_listening_port

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.

Cacti_CreateDevice

On the “devices” page click on the “Add” button.

Cacti_CreateDevice2

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.

Cacti_Configure_new_Device

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”

Cacti_Configure_Save_Generate_Graphs1

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. )

Cacti_Configure_Save_Generate_Graphs2

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.

Cacti_Click_on_Graph

Cacti_click_on_List_view

From here we select the host “Gluster2” and filter for the graphs available for this device. See image below.

Cacti_View_new_Graphs

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).

Cacti_graph1

Cacti_Graph2

Cacti_graph3

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!

One Response to “How To Monitor your Ubuntu Server on GoGrid in 6 Steps Using Cacti 0.8.7g”

  1. One of my friends is having a problem on monitoring his ubuntu server, I send him the link of this article for I think it would help him with his current problem.

Leave a reply