Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Install cacti-0.8.7i under Centos6.5

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

(because I am a novice, there are a lot of large and small problems in the installation, I have a note here, welcome newcomers to refer to) Cacti function

Cacti uses snmpget to get data, uses RRDtool to draw graphics, and you don't need to know the complex parameters of RRDtool.

It provides very powerful data and user management functions, you can specify that each user can view the tree structure, host and any map, can also be combined with LDAP for user authentication, but also can add their own templates. In addition to basic Snmp traffic and system information monitoring, Cacti can also plug in Scripts and add Templates to make a variety of monitoring charts.

Introduction to Cacti

Cacti is a software implemented in PHP language, its main function is to use snmp services to obtain data, then use rrdtool to store and update data, and when users need to view data, use rrdtool to generate charts and present them to users. Therefore, snmp and rrdtool are the key to cacti. Snmp is related to data collection, and rrdtool is related to data storage and chart generation.

Mysql cooperates with PHP program to store some variable data and call it, such as hostname, host ip, snmp community name, port number, template information and other variables.

The data captured by snmp is not stored in mysql, but in the rrd file generated by rrdtool (in the rra folder of the cacti root directory). The update and storage of data in rrdtool is the processing of rrd file. Rrd file is a fixed-size archive file (Round Robin Archive), and the number of data it can store has been defined at the time of creation. For knowledge about RRDTool, please refer to RRDTool Teaching.

System installation and basic network configuration

Do not write the installation of the operating system, I personally use CentOS 6.5 minimum installation

Turn off the firewall and selinux after installing the system

# service iptables stop / / disable firewall service

# chkconfig iptables off / / permanent shutdown

# vi / etc/sysconfig/selinux / / change SELINUX=enforcing to SELINUX=disabled

Install software that Cacti depends on

Yum install mysql mysql-server mysql-devel php-mysql httpd php php-pdo lm_sensors net-snmp net-snmp-devel openssl-devel php-snmp net-snmp-utils perl-Net-Daemon perl-PlRPC perl-DBI rrdtool perl-rrdtool perl-DBD-MySQL net-snmp-libs php-gd

SNMP configuration

1. Modify snmp configuration file

# vim / etc/snmp/snmpd.conf / / enter snmpd.conf to modify the configuration file

1) change the default in line 41 to 127.0.0.1

Before change: com2sec notConfigUser default public

Changed: com2sec notConfigUser 127.0.0.1 public

2) change systemview in line 62 to all

Before change: access notConfigGroup "" any noauth exact systemview none none

After change: access notConfigGroup "" any noauth exact all none none

3) remove the comment "#" from line 85

Before change: # view all included. 180

After change: view all included. 180

4) Save (: wq)

2. Start the snmpd/httpd/mysql service

# service snmpd start / / enable snmp service

# chkconfig snmpd on / / set snmp to boot

# service httpd start / / enable http service

# chkconfig httpd on / / set http to boot

# service mysqld start / / enable mysql service

# chkconfig mysqld on / / set mysql to boot

# Snmpwalk-v 2c-c public localhost / / Test whether snmpd starts normally

Set up the mysql database

# mysql-uroot-p / / the newly installed mysql does not have a password, so enter directly to enter the mysql database

(note: after entering mysql, you must add ";" at the end of each command before the command can be entered successfully.)

Mysql > create database cacti; / / first create the cacti database

Mysql > grant all privileges on cacti.* to cacti@localhost identified by 'cacti'

/ / create a cacti user and authorize it

(format: grant all privileges on database name. * to user name @ hostname identified by 'password';)

Mysql > use cacti

Mysql > source / var/www/html/cacti/cacti.sql; / / Import cacti database file

Mysql > exit

CACTI installation and configuration

1. Installation of cacti

Wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz

Tar zxvf cacti-0.8.8b.tar.gz

Mv cacti-0.8.8b / var/www/html/cacti

/ / move the cacti-0.8.8b folder to the / var/www/html directory and rename cacti-0.8.8b to cacti

(note: during wget, the download may fail because the ssl connection is not successful. In this case, you should use root permission desktop mode. The browser should log in to www.cacti.net/downloads, download and extract cacti-0.8.8b.tar.gz to the / var/www/html directory, and then rename the folder to cacti.)

2. Configure cacti

# vim / var/www/html/cacti/include/config.php

$database_type = "mysql"; / / connection database type

$database_default = "cacti"; / / Database of the cacti monitoring service

$database_hostname = "localhost"; / / Host of the database

$database_username = "cactiuser"; / / Database user name, changed here to "cacti"

(since the user previously created in the database is "cacti", the default "cactiuser" here should be changed to "cacti".)

$database_password = "cactiabc"; / / Database password, changed here to "cacti"

(the default password here should also be changed to "cacti".)

$database_port = "3306"; / / Database port

$database_ssl = false; / / whether to enable ssl to connect to the database

Then save exit (: wq)

3. Add cacti users to write data to rrd and log directories, otherwise pictures will not be generated

# cd / var/www/html/cacti

# useradd cacti

# cd / var/www/html/cacti

# chown-R cacti rra/ log

(note that there is a space before log)

Add a task schedule

It is up to cacti to decide how long it takes to generate a monitoring chart. Here, take the default time of 5 minutes for cacti as an example.

# cd / var/www/html/cacti

# crontab-e

* / 5 * php / var/www/html/cacti/poller.php > / dev/null 2 > & 1

(just add this line to save)

After configuration, restart to enter the desktop and enter http://ip/cacti, as shown below.

Click NEXT

Click NEXT

Just select finish directly.

If the word "NOT FOUND" appears in red, you need to specify the path manually.

The user name and password for the first login are admin.

The first login will force you to change your password

Click console- > configuration- > setting to the right and check Structured RRA Path.

Because this version cannot delete the RRD database at the same time when deleting the device, it is convenient to delete the host later and delete the RRD file of the corresponding hostid under linux after selecting this option.

Install efficiency improvement load spine plug-in

Wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7i.tar.gz

/ / download the spine file (Note: if you can't wget, you can go to the desktop and log in to the URL to download)

Tar zxvf cacti-spine-0.8.7i.tar.gz / / decompress the spine package

Cd cacti-spine-0.8.7i

. / configure / / configure the source code package

Make&&make install / / compile and install

Cd / usr/local/spine/etc

Cp spine.conf.dist spine.conf / / rename configuration document

Vi spine.conf / / modify configuration document

DB_Host localhost

DB_Database cacti

DB_User cacti

DB_Pass cacti

DB_Port 3306

DB_PreG 0

: wq / / the information here should be consistent with that of mysql

Add / usr/local/spine/bin/spine in console- > configuration- > settings Paths in cacti as shown in the following figure

Change the Poller Type in console- > configuration- > settings Poller to spine

Add various plug-ins in cacti

Thold: used for equipment abnormal warning and threshold alarm

Settings: for mail alarm

Monitor: graphically displays device status

Rrdclean:rrd assistive tools (not quite understood)

Go to console- > User Managerment and click admin

Select Plugin Managerment and save it, and you can see that plugin managerment appears below the left setting.

Next, download the plug-in installation package as follows: settings, monitor, thold and rrdclean, and modify the file name

Wget http://docs.cacti.net/_media/plugin:settings-v0.71-1.tgz-O settings.tgz

Wget http://docs.cacti.net/_media/plugin:monitor-v1.3-1.tgz-O monitor.tgz

Wget http://docs.cacti.net/_media/plugin:thold-v0.5.0.tgz-O thold.tgz

Wget http://docs.cacti.net/_media/plugin:rrdclean-v0.41.tgz-O rrdclean.tgz

Extract the installation package

Tar zxvf settings.tgz

Tar zxvf monitor.tgz

Tar zxvf thold.tgz

Tar zxvf rrdclean.tgz

Put the plug-in into the plugins directory

Mv settings monitor thold rrdclean / var/www/html/cacti/plugins/

Enter cacti console- > configure- > plugin managerment to see the plug-in you just put in.

Click actions to install and apply, that is, to install the corresponding plug-ins

Plug-in installed successfully!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report