(iv) Cacti installation configuration

Source: Internet
Author: User
Tags install openssl rrdtool snmp

First, CACTI monitoring introduction

1, Cacti Introduction

Cacti is a set of graphical analysis tools for network traffic monitoring based on PHP,MYSQL,SNMP and RRDtool development.

Simply put, cacti is a PHP program. It uses the SNMP protocol to obtain remote network devices and related information, (in fact, using the NET-SNMP software package snmpget and Snmpwalk command) and through the RRDtool tool drawing, through the PHP program to show. We use it to show the status or performance trend of a monitored object over time.

2. CACTI Architecture Overview

We can find that cacti has three main components: MySQL database, RRDtool tool, NET-SNMP program. MySQL is not responsible for monitoring the storage of data, only save the template and Rra files and host corresponding information, and the real monitoring data storage and image display are rrdtool to do. and NET-SNMP is responsible for data collection.

3. SNMP protocol

SNMP (Simple network Management Protocol) is an easy Web management protocol. is a set of network management protocols defined by the Internet Engineering Task Force (Ietf:internet Engineering). The protocol is based on a simple Gateway monitoring Protocol (Sgmp:simple Gateway Monitor Protocol). With SNMP, an administrative workstation can remotely manage all network devices that support this Protocol, including monitoring network status, modifying network device configuration, receiving network event warnings, and so on. SNMP uses the special form of the Client/server Model: Agent/Management station model. The management and maintenance of the network is done through the interaction between the management workstation and the SNMP agent. Each SNMP from the agent is responsible for answering various queries about MIB definition information from the SNMP management station (master agent).

NET-SNMP installation package as follows, the first two packages net-snmp,net-snmp-libs is the basic NET-SNMP package, net-snmp-utils is some tools.

4. RRDtool Tools

RRDTool is an open source software developed by Tobias Oetiker, which uses RRD (Round Rebin Databases) as a storage format, and Round Robin is a technique for processing quantitative data and pointers to current elements RRDTool It is mainly used to track the changes of objects and to generate a trend graph of changing objects.

Second, installation configuration cacti

Related packages:

Cacti-0.8.8a.tar.gz

Rrdtool-1.4.7.tar.gz

Cacti-spine-0.8.8a.tar.gz

Upload the above packages to the/data1 directory.

Related Download URL:

http://www.cacti.net/download_cacti.php

http://www.cacti.net/spine_download.php

http://www.cacti.net/downloads/pia/

Install cacti Environment:

Os:rhel Server 6.3

ip:192.168.10.250

Web platform: LNMP

Web root directory:/data1/html

1. Install native SNMP related services

[email protected] ~]# Yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils

[Email protected] ~]# chkconfig–level snmpd on

[[Email protected] ~]# service SNMPD start

[Email protected] ~]# vim/etc/snmp/snmpd.conf

Modify default to 127.0.0.1, such as:

Change the SystemView of 62 rows to all and enable 85 rows: View all included. 1 80, such as:

2, installation RRDtool

(1) Check and install dependent packages

[email protected] ~]# Yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel Libart _lgpl-devel Pear Pear-devel

(2) Source code installation RRDtool

[Email protected] ~]# cd/data1

[Email protected] data1]# Mkdir/usr/local/rrdtool

[Email protected] data1]# TAR-XZF rrdtool-1.4.7.tar.gz

[Email protected] data1]# CD rrdtool-1.4.7

[Email protected] rrdtool-1.4.7]#./configure–-prefix=/usr/local/rrdtool

[[email protected] rrdtool-1.4.7]# make && make install

3. Unzip the cacti and move to the web directory

[Email protected] ~]# cd/data1

[Email protected] data1]# TAR-XZF cacti-0.8.8a.tar.gz

[Email protected] data1]# MV Cacti-0.8.8a/data1/html/cacti

4. Create a database in MySQL cacti

Establish the database cacti, and increase the user name cacti that has all the permissions on the database, the user password is: cacti.

[Email protected] data1]# mysql-uroot-p

Enter Password:

mysql> CREATE database cacti;

Query OK, 1 row Affected (0.00 sec)

Mysql> Grant all on cacti.* to [e-mail protected] identified by ' cacti ';

Query OK, 0 rows Affected (0.00 sec)

Mysql> Grant all on cacti.* to [e-mail protected] identified by ' cacti ';

Query OK, 0 rows Affected (0.00 sec)

mysql> flush Privileges;

Query OK, 0 rows Affected (0.00 sec)

5, create the system user cacti (depending on the situation to decide whether to create users)

[Email protected] data1]# useradd cacti

[Email protected] data1]# echo "Cacti" | passwd--stdin Cacti

Changing password for user cacti.

Passwd:all authentication tokens updated successfully.

6, routine scheduling settings

[Email protected] data1]# crontab–e–u Nginx

*/1 * * * */usr/local/php/bin/php/data1/html/cacti/poller.php >/dev/null

Attention:

In practical applications, 5 minutes is more appropriate.

Here the user can be a user running the web, such as the user who runs Nginx in my LNMP environment: nginx, or it can be a user created specifically for cacti: cacti, which also determines whether to create a cacti dedicated user (5th above).

In BSD,>/dev/nul 2>&1 may cause the file not to be generated in the rra/directory (even if the directory permissions are correct), manually generated, there is no data on the graph, if the above two cases, please delete 2>& 1, but in Linux, theoretically not required, but if it appears, you can try it, and then change back to see. Make sure that the user running the Web or the cacti dedicated user has read executable permissions to the scripts in the scripts/directory. These together determine the next step (7th below) to limit the permissions on the directory.

7. Modify Cacti Directory Permissions

[Email protected] ~]# cd/data1/html/

[Email protected] html]# chown-r root:root cacti/

[Email protected] html]# chown–r Nginx:nginx cacti/rra/

[Email protected] html]# chown–r Nginx:nginx cacti/log/

[Email protected] html]# chown-r Nginx:nginx cacti/scripts/

8. Import the database to MySQL

[Email protected] html]# CD cacti/

[Email protected] cacti]# mysql-ucacti-pcacti cacti

9, modify the Cacti configuration script

[Email protected] cacti]# CD.

[Email protected] html]# vim cacti/include/config.php

$database _type = "MySQL";

$database _default = "cacti";

$database _hostname = "localhost";

$database _username = "cacti";

$database _password = "cacti";

$database _port = "3306";

10. Cacti Initialization Configuration

(1) Initialize cacti

Enter the URL in the Windows 7 client IE browser: http://192.168.10.250/cacti/; Enter to see the cacti initialization interface.

Click "Next".

Select "New Install" and click "Next".

Manually fill in the correct path. Click "Finish".

Cacti default Admin User is: admin, Password: admin, enter here Click "Login".

Admin user First login, will be required to force change password, here I change password: 123456, click "Save".

This is the first time to login to the cacti interface.

(2) Cacti global configuration

Modify the Poller time to quickly see the effect. This is set to one minute, which is the most suitable five minutes in the real world.

This machine is already monitored by default:

Monitoring Windows 7 Clients

One, Windows 7 client Configuration

1. Installing the SNMP service on Windows 7 clients

In Control Panel, programs and features, turn Windows features on or off, check Simple Network Management Protocol (SNMP), OK

2. Configuring the SNMP Service for Windows 7

Open Computer Management, click Services on the left, and on the right, locate SNMP service and double-click Properties, open the service, and then switch to the Security tab. Make the following changes.

Second, cacti configuration

1. Add a monitored host

Login to Cacti, click "Devices", click "Add".

Fill in the information for the added host.

After completing the information, click "Create".

To paint the console, click "Create Graphs for this host".

Tick the information and click "Create". Enter the color interface for paint selection.

Select the color and click "Create". Complete.

2. Add the monitored host to the graphics tree

Click "Device" on the left, select Host, select Action "Place on a Tree (Windows Desktop)" and click "Go".

Click "Continue" to complete the Add.

Third, view the host monitoring information

Wait a minute, click Windows 7, Windows Desktop, Graphs tab, to see the Windows 7 hosts that you are monitoring.

To do this, use cacti to monitor the Windows host successfully.

Monitoring Linux Servers

One, the monitored Linux Server settings

1, installation Net-snmp

[email protected] ~]# Yum install Net-snmp

2. Configuring the Snmpd.conf File

[Email protected] ~]# vim/etc/snmp/snmpd.conf

3. Start SNMPD Service

[Email protected] ~]# chkconfig--level snmpd on

[[Email protected] ~]# service SNMPD start

Second, cacti configuration

1. Add a monitored Linux server

When you have completed the correct information, click "Create".

To add paint to the server being monitored, click on "Create Graphs for this host" on the right.

Tick the device you want to monitor and click "Create" to enter the picture color selection screen.

After selecting the color, click "Create" to add the success.

Add this monitored Linux server to the graphics tree Linux servers.

Click "Device" on the left, select Host, select Action "Place on a Tree (Linux Server)", click "Go".

Click "Continue" to complete.

Third, view the host monitoring information

Wait a minute, click on "Graphs" tab, "Linux Server", "RHEL Server 6.0", you can see the Linux host just joined the situation.

At this point, use cacti to monitor the Linux host successfully.

Installing spine

Spine, formerly known as Cactid, was written in pure C and was a substitute for cmd.php, in order to speed up SNMP polling. If you find your cmd.php running for more than 300 seconds, it is recommended to use spine.

Cacti Data acquisition method: Spine,cmd.php. There is a great delay in cmd.php acquisition and the execution efficiency is too low. Hatchback comparison, from the addition of devices to the device up,spine only need less than a minute, and CMD and so on longer, more than 10 minutes.

First, install the spine

(1) Install spine dependency Package

[email protected] ~]# Yum install openssl-devel mysql-devel net-snmp-devel

(2) Source Code installation Spine

[Email protected] ~]# cd/data1/

[Email protected] data1]# TAR-XZF cacti-spine-0.8.8a.tar.gz

[Email protected] data1]# CD cacti-spine-0.8.8a

[Email protected] cacti-spine-0.8.8a]#/configure--with-mysql=/usr/local/mysql/

[[email protected] cacti-spine-0.8.8a]# make && make instll

(3) Spine configuration file spine.conf

[Email protected] cacti-spine-0.8.8a]# cd/usr/local/spine/etc/

[Email protected] etc]# MV Spine.conf.dist spine.conf

[Email protected] etc]# vim spine.conf

Db_host/tmp/mysql.sock

Db_database cacti

Db_user cacti

Db_pass cacti

Db_port 3306

Attention:

This version of spine uses/tmp/mysqld.sock to log on to MySQL by default. And my LNMP environment was specified as/tmp/mysql.sock when compiling MySQL. This time can be resolved with a soft link, you can also specify the sock file in the spine.conf file, that is, modify the Db_host value to mysql.sock file location.

(4) Execute spine command to check if correct

[Email protected] bin]# pwd

/usr/local/spine/bin

[Email protected] bin]#./spine

A similar message appears, stating that there is no problem:

Poller[0] time:2.1460 s, threads:1, hosts:4

First, spine configuration

"Setting"--"Paths"--"Spine poller File Path" filled in:/usr/local/spine/bin/spine; and "Save".

"Setting"--"poller" under Modify Poller type is spine, and "Save".

At this point, the spine function is complete.

Transferred from: http://www.linuxidc.com/Linux/2012-07/66918.htm

(iv) Cacti installation configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.