Vous êtes sur la page 1sur 24

Installation and configuration guide for cacti on Ubuntu 14.

04

Guide for cacti installation and configuration


on Ubuntu 14.04

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

Introduction
Cacti is a web-based tool for monitoring and graphing, designed as an easy-to-
use front-end for the data logging software RRDTool. Cacti used to get a graph
data for the CPU and network bandwidth utilization, it monitors the network
traffic by polling a router or switch via SNMP. SNMP stands for simple
network management protocol. It is a way that servers can share information
about their current state, and also a channel through which an administer can
modify per-defined values. While the protocol itself is very simple, the structure
of programs that implement SNMP can be very complex.
Generally cacti has the following features:-

• Cacti monitors the performance and usage of devices.

• written in PHP

• Stores all of the necessary information to create graphs and gather data in
a MySQL database.

• cacti is Full SNMP support for data gathering

• Cacti is the complete front-end for RRDTool!

• RRDTool-

➢ used to create a graph for each devices

➢ handles time series data such as network bandwidth,

CPU load ,

The primary cacti include:


• unlimited graph items
• graph data manipulation
• flexible data sources
• data gathering on a non-standard timespan

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

• custom data-gathering scripts


• built-in SNMP support
• graph templates
• data source templates
• host templates
• tree, list, and preview views of graph data
• user-based management and security
cacti network monitoring tool has the following advantages and disavantages
comparing with other network monitoring tools.
Advantages of Cacti Monitoring Tool
There are a lot of advantages using the cacti network monitoring tool.

Such as:-

• Graphics:

✔ allows us to organize information in hierarchical trees.

✔ allows to define functions of rrdgraph to define the graphics

• Data sources:

✔ allows us to use rrdcreate and rrdupdate functions

✔ defining multiple data sources for RRD files

✔ Data collection:

✔ data sources can be updated via SNMP

• Templates:

✔ we can create template to reuse the graphics definition,data sources and


devices.

• User management-

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

-we can manage authentication having distinct levels of authorization for users

Cacti is also used to view routers and switches interfaces and their traffic.

Disadvantages

• Configuration of Interfaces is Tedious

• Upgrading versions can be complex

before we begin installation we need to check if our system is updated. To do


use the commands below:
sudo apt-get update
sudo apt-get upgrade
next we need to install cacti required packages like apache,mysql sever, and
php. To do this use the command below:
sudo apt-get -y install apache2 mysql-server php5 libapache2-mod-php5

Apache HTTP Server, also known as httpd, is a web server.


MySQL server is a SQL complaint server, in other words it is a relational
model database server.
php is an open source, server-side, scripting language used for the
development of web applications.
We don't finish installation of dependencies we need to install snmp and
RRDTools. use the command below:
sudo apt-get -y install snmp snmpd rrdtool

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

RRDTools: -
• are used to create graph for each devices.
• Handles times series data such as network bandwidth and CPU load
SNMP: is a popular protocol for network management. It is used for collecting
information from, and configuring, network devices, such as servers, printers,
hubs, switches, and routers on an Internet Protocol (IP) network.
after installing all dependencies we will start the installation of cacti. Use the
command below to do this
sudo apt-get -y install cacti cacti-spine
The installer then will ask you to choose the web server for which Cacti will be
automatically configured. Select Apache or Lighttpd, as you prefer (you can
also skip this step and configure your web server later). In this example, we’ll
choose to configure apache2.

In

the next step, the installer will offer you to set up the database automatically.
Select Yes.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

The installer will ask you for the MySQL administrator (root) password. Input
the MySQL root password and select OK

The next step is to provide the password Cacti will use to connect to the
database server. You can provide your own new password, or leave it blank and
let the installer generate a random one for you.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

At this point, Cacti is installed, but before using it, you first need to set it up.

From a web browser, go to http://your Pc Ip address/cacti. You will see the web
setup wizard. Click Next.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

On the next screen, select New Install and click Next.

Cacti will now check for the packages it needs to run properly. Make sure all
the checks appear with an “OK” status, and then click Finish.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

The next page is the login page. The first time you log into Cacti, use admin as
user name and password.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

The system will ask you to change the password for the admin account. After
you choose the new password (and enter it again in the second field to confirm),
the system automatically will log you in as the “admin” user.

Cacti is ready to use.


Set Up the SNMP Daemon
Before setting up the polling of data in the Cacti web interface, we’ll need to
configure the SNMP daemon running on the server.
SNMP is a powerful protocol and describing its features and capabilities
exceeds the purpose of this guide. For our needs, we will just enable full access
to SNMP resources for the local host (that is, the server).
open the configuration file /etc/snmp/snmpd.conf. By using the command:
sudo nano /etc/snmp/snmpd.conf

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

Uncomment (take out the initial #) the following line inside that file:
rocommunity public localhost
Optionally, you can also modify the contact and location information about
your server. This information shows up along with other data such as
hostname, kernel version, and system uptime in the Cacti notification area
when you check your server details.

Edit the sysLocation and sysContact values under the system information
section. Change the text in the right column without changing the variable
names on the left. By default, the following values appear on that section
of the configuration file:

sysLocation Sitting on the Dock of the Bay


sysContact Me me@example.org
Save your modifications . Reboot the daemon to apply your changes. To do this
use the command below:
sudo service snmpd restart

Add a Cacti Graph Monitoring Network Traffic


Go to the Console tab, in the upper left. On the left panel beneath, under
Management click Devices.
Just to the right, select Localhost. This page will show you properties related to
your server.
In the SNMP Options section, click the drop-down menu next to SNMP version
and select Version 2. Click Save in the lower right.
If all is working right, on the top left of the page will appear a notification area
with a message showing SNMP information with data such as uptime and
hostname of your server, confirming the SNMP polling was successful.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

Without leaving that page, look at the bottom for the Associated Data Queries
section.
From the drop down menu next to Add Data Query, select SNMP – Interface
Statistics.
Click Add and then Save.
Still in the same page but at the top, click on Create Graphs for this Host.
Cacti will take you to a new page with available data sources to generate
graphs.
Under Data Query [SNMP – Interface Statistics] select the interface to monitor
(for example, eth0).

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

Click Create.
The same window will reload. Check the notification area on the top left for the
confirmation message: Created graph: Localhost - Traffic – eth0.
Give Cacti a couple of minutes to begin gathering and graphing data. Then go
to the Graphs tab to see the new data you just added.
Monitoring Disk Usage on Cacti
Let’s add a graph showing server disk (or partition) usage.
Go to the Console tab. On the left panel, under Management click Devices. On
the right page, select Localhost.
Click Create Graph for this Host.
Go to Data Query [Unix – Get Mounted Partitions] section and check the
partition you want to monitor (for example, /dev/sda1).

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

Cacti page showing storage partitions available for monitoring

Click Create, and check success message on the notification area: Created
graph: Localhost - Disk Space - /dev/sda1.
Go to the Graphs tab to check. Remember to give Cacti a few minutes to
collect and process the initial data.

Monitoring Connectivity via Ping on Cacti


You can also use Cacti to monitor ping response times to remote servers.
Go to the Console tab. On the left panel, under Management, click Devices.
In previous steps, we have used the Localhost device already present on the
page. Now we will create a new device for the remote server we want to ping.
Click on Add on the far right of the Devices header.
Input a description for the host you will monitor–for example, Google Public
DNS Server. Then its hostname or IP–8.8.8.8 in this same example.
In the Availability/Reachability Options section, select the type of Downed
Device Detection. Choose Ping from the drop-down menu. For Ping Method,

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

select ICMP Ping.


In the SNMP options section, select Not in use in the drop-down menu for
SNMP Version.

Cacti page showing parameters to ping a remote host

Click Create. The page will reload, and a few extra sections will appear at the
bottom.
In the Associated Graph Template section, from the Add Graph Template drop-
down menu, select Unix – Ping Latency and click the Add button at the
bottom right of this particular section.
Click Save.
Now, click on Create Graphs for this Host.
In the Graph Templates section, check the box to the right of Create: Unix –
Ping Latency, and click Create.
A new page will show up. Select the color of the graph and, optionally, enter
whatever legend text you desire, and then click Create.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

In the notification area on top, you can see if the graph was created
successfully. If so, after a few minutes, go to the Graphs tab to check your new
graph.
Initially, until you organize the way to display the graphs (see the section
Manage Graphs below), this new graph will not appear along with the
other graphs you already have for localhost.

To be able to see this remote ping graph, you should change the viewing
mode from the default Tree view to Preview view. Use the icons on the
top right area of the page, next to the settings tab. To select the Preview
View, click on the icon furthest right that looks like a mountain range.

Poll SNMP data from a Remote Host on Cacti


Now, let’s use Cacti and SNMP to monitor and graph resources from another
server.
On the Remote Server:-

Install the SNMP daemon (shown here for Ubuntu 14.04). On the command
line type:
sudo apt-get install snmpd
Edit the SNMP daemon configuration file /etc/snmp/snmpd.conf to enable the
remote server to accept the connection from your Cacti server. Using the
command below:
sudo nano /etc/snmp/snmpd.conf
Inside the nano set the SNMP community using this:-
rocommunity public your ipaddresss
Use the IP address of your Cacti server to permit connections just from that IP
address.
The public word that appears in the second field is called an SNMP Community
string. It is like a password, and you can choose any word you want. If you
choose a different word, remember to use it when you configure the SNMP
connection in Cacti.
Still in the same configuration file, enable access to the SNMP daemon from
remote hosts. Comment out the line that restricts access only to localhost

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

(127.0.0.1) and uncomment the line that enables access from the Internet.
#agentAddress udp:127.0.0.1:161
agentAddress udp:161,udp6:[::1]:161

You may find it helpful to also change the sysLocation and sysContact
information (as above) as well.

Save changes and restart snmpd using the command below:

sudo service snmpd restart

Those changes are enough for the remote server to work answering SNMP
queries from your Cacti server.

In the Cacti Web Interface


Go to the Console tab. On the left panel, under Management click Devices.
Click on Add.

In the General Host Options section, enter a description for the remote server
and its hostname or IP address.
For Host template select ucd/net SNMP Host.
In the Availability/Reachability Options section, for Downed Device Detection
select Ping and SNMP uptime. For Ping Method, ICMP Ping.
In the SNMP Options section, select for SNMP Version Version 2 and enter the
SNMP Community you configured in your remote host (public, in our example).

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

Cacti page showing the parameters to connect to remote server using SNMP

Click Create, and check the notification area for information about a successful
SNMP connection to the remote host and ping results.

Now, click Create Graphs for this Host.


A list will appear, showing all the available data sources from the remote host. Check all the items
you want to monitor and then click on Create.
In a few minutes, in the Graphs tab, Cacti will begin to show the new graphs.

Manage Graphs on Cacti

You can organize the way Cacti displays graphs by grouping them under Trees.

At first, from the Graphs tab, there is a “Default Tree” with just Localhost
under it.
In this example, we will create two more branches to group our graphs: my

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

remote server and remote Pings.


Go to the Console tab. On the left panel, under Management click Graph
Trees. Click Add (on the far right).
Give a name Name for the branch. In this case, my remote server.
Select the ordering method you prefer and click Create.
Monitoring host with windows Operating System

so far we have seen monitoring hosts with Linux operating system. In this
section we will see how to monitor hosts having windows operating system. To
do this we need to enable SNMP on the remote device to be monitored. So,
right click on the windows start menu ,and then click programs and features.

After you click the window below will be displayed.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

Click on the option ''turn windows features on or off''.

Since the SNMP is not selected. Select the SNMP feature in the window that
opens. After selecting click the OK Button.
After completing this execute the service.msc command in the run to check the

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

SNMP service.

Click OK.

If you look at status drop-down column the SNMP services says running this
indicates SNMP service is running smoothly .
Now right click on the SNMP services and click properties

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

now click security from the SNMP service properties

and then click Add and give name of your community. For example let's say
SNMP

click Add.
Now click on the Traps button from the SNMP service Properties

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

then click Add to list ,and click Apply.


If you look at the security column there are two options for accepting packets.
The second option allows only to accept from the localhost . You have to click
the first option to accept packet from remote host

after selecting the first option click Add.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)


Installation and configuration guide for cacti on Ubuntu 14.04

Add the IP address of the device to monitor your device.

Compiled by Gebrecherkos G. computer science and engineering(2011 E.C)

Vous aimerez peut-être aussi