Cacti installation and third-party module Import

Source: Internet
Author: User
Tags rrdtool snmp
Cacti is a set of graphic analysis tools for network traffic monitoring developed based on PHP, MySQL, SNMP, and rrdtool. Cacti uses snmpget to obtain data and uses rrdtool to draw images. In addition, you do not need to understand the complex parameters of rrdtool. It provides powerful data and user management functions, allowing each user to view the tree structure, host, and any graph, and perform user verification with LDAP, you can also add templates by yourself, which are very powerful and complete. User-friendly. The development of the software cacti is based on making it easier for rrdtool users to use the software. In addition to the basic SNMP traffic and system information monitoring, cacti can also plug-in scripts and add templates to make a variety of monitoring charts.

Prerequisites for installing cacti:
Wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
Wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
Wget https://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz
Lamp environment, and GD library support must be enabled. Installation of lamp environment is not provided here
Mysql-cacti-templates is not mandatory, but is used for later demonstration of third-party templates.

1. Install the SNMP service
[[Email protected] ~] # Yum install net-snmp *
[[Email protected] ~] # Chkconfig snmpd on
[[Email protected] ~] # Service snmpd restart
[[Email protected] ~] # Vi/etc/snmp/snmpd. conf

Modify the following content:
Com2sec notconfiguser default public under 41 rows
Com2sec notconfiguser 127.0.0.1 public

Access notconfiggroup "" any noauth exact systemview none under row 62
Access notconfiggroup "" any noauth exact all none

# View all supported ded. 1 80 in 85 rows
View All supported ded. 1 80
[[Email protected] ~] # Service snmpd restart

2. Install rrdtool
[[Email protected] ~] # Tar xf rrdtool-1.4.7.tar.gz
[[Email protected] ~] # 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. Install cacti
[[Email protected] ~] # Tar xf cacti-0.8.8b.tar.gz-C/usr/local/Apache/htdocs
[[Email protected] ~] # Cd/usr/local/Apache/htdocs
[[Email protected] ~] # Cd/usr/local/Apache/htdocs
[[Email protected] ~] # Music cacti-0.8.8b cacti
Create a cacti database in the database:
Mysql> Create Database cacti;
Mysql> grant all on cacti. * to [email protected] identified by 'cacti ';
Mysql> grant all on cacti. * to [email protected] identified by 'cacti ';
Mysql> flush privileges;

Edit/etc/crontab and add the following content:
*/1 *****/usr/local/PHP/bin/PHP/usr/local/Apache/htdocs/cacti/poller. php &>/dev/null

Modify the directory permissions of cacti:
[[Email protected] cacti] # chown-r root. Root cacti/

Import the cacti database:
[[Email protected] cacti] #/usr/local/MySQL/bin/MySQL-ucacti-P cacti <cacti. SQL

Edit the cacti configuration file and change it to the following content:
[[Email protected] cacti] # cd include
[[Email protected] cacti] # vi config. php
$ Database_type = "MySQL ";
$ Database_default = "cacti ";
$ Database_hostname = "127.0.0.1 ";
$ Database_username = "cacti ";
$ Database_password = "cacti ";
$ Database_port = "3306 ";
$ Database_ssl = false;

Enter the following address in the browser: http: // 192.168.1.145/cacti/install/index. PHP, you will see the cacti installation. Click Next and you will find that the cacti path and PHP path are incorrect by default. You only need to change the path. Rrdtool:/usr/local/rrdtool/bin/rrdtool; PHP:/usr/local/PHP/bin/PHP

Click Next To Go To The cacti logon page. The default logon user and password of cacti are admin Admin. After entering this information, you will be prompted to change the new password, change the password you need and run/usr/local/PHP/bin/PHP/usr/local/Apache/htdocs/cacti/poller. PHP: Execute it several times. Then go to cacti and open graphs. The image is displayed.

Possible problems during installation:
1. run/usr/local/PHP/bin/PHP/usr/local/Apache/htdocs/cacti/poller. PHP reports a time error because PHP. no time is set in ini. add date to ini. timezone = "Asia/Shanghai"
2. The traffic diagram is unavailable. There is no file under the RRA file. There may be many reasons for this. First, check whether the user process running cacti has the corresponding permissions on the RRA directory; execute snmpwalk-V 2C-C public yourip if to see whether the corresponding information is returned; check whether the configuration in settings is correct.


By default, cacti templates and images are very limited, and basic traffic monitoring operations are also very simple. However, in most cases, we need more than this traffic monitoring, so we need to install a third-party template. Here we use MySQL as an example to install a third-party module monitoring.
[[Email protected] ~] # Wget https://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz
[[Email protected] ~] # Tar-xvf better-cacti-templates-1.1.8.tar.gz
[[Email protected] ~] # Cd better-cacti-templates-1.1.8
[[Email protected] Better-cacti-templates-1.1.8] # cp scripts/ss_get_mysql_stats.php/usr/local/Apache/htdocs/cacti/scripts/
[[Email protected] Better-cacti-templates-1.1.8] # cd/usr/local/Apache/htdocs/cacti/scripts/
[[Email protected] Scripts] # vi ss_get_mysql_stats.php
Modify
$ Mysql_user = 'cactiuser ';
$ Mysql_pass = 'cactiuser ';
Is
$ Mysql_user = 'cacti ';
$ Mysql_pass = 'cacti ';
Go to the import templates import/better-cacti-templates-1.1.8/templates/cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml on the cacti management interface again, and then you can see many new template diagrams under the device. Run grant all on * on the monitored host *. * To 'cacti' @ '%' identified by 'cacti'; flush privileges; later, the remaining operations will be the same as normal operations.



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.