Académique Documents
Professionnel Documents
Culture Documents
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:-
• written in PHP
• Stores all of the necessary information to create graphs and gather data in
a MySQL database.
• RRDTool-
CPU load ,
Such as:-
• Graphics:
• Data sources:
✔ Data collection:
• Templates:
• User management-
-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
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.
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.
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.
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.
The next page is the login page. The first time you log into Cacti, use admin as
user name and password.
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.
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:
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).
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).
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.
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.
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.
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
(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.
Those changes are enough for the remote server to work answering SNMP
queries from your Cacti server.
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).
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.
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
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.
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
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
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