Cacti monitors mysql database server implementation process

Source: Internet
Author: User
Tags snmp error snmpwalk

1. Install the mysql template on the cacti server first

Wget https://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz

Tar-xvf better-cacti-templates-1.1.8.tar.gz

Cd better-cacti-templates-1.1.8

Put the ss_get_mysql_stats.php script in better-cacti-templates-1.1.8 \ scripts on the cacti server.

For example, if cacti is deployed in the/var/www/html directory, cp is deployed under/var/www/html/cacti/scripts /.

Cp

/Root/better-cacti-templates-1.1.8/scripts/ss_get_mysql_stats.php/var/www/html/cacti/scripts/

Modify row 30th of the ss_get_mysql_stats.php File

$ Mysql_user = 'cacti _ user ';

Grant the apache account operation permission

Chown-R apache. apache/var/www/html/cacti/scripts

Chmod-R 755/var/www/html/cacti/scripts

Use http to access the cacti host for import:

/Root/better-cacti-templates-1.1.8/templates/cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml

2. Create a mysql account

To create a database cacti account on the monitored mysql server, the PROCESS, SUPER, and replication client permissions are required. The SQL statements are as follows:

Grant process, SUPER, replication client on *. * TO 'cacti' @ '% 'identified '';

3. Add the host on cacti:

3.1 Click Create devices

 

3.2 click the add button to add a host.

3.3 enter the descriptor and host name or IP address, and click Create in the lower right corner.

3.4 The error message is as follows:

 

When a monitoring host is added to cacti, an error "SNMP error" is displayed. Generally, there are two solutions:

(1) Make sure that all cacti hosts can be pinged to the monitored hosts. If the host cannot be pinged, check whether the network configuration and IP settings of the monitored hosts are correct.

[Root @ squid-2 templates] # ping 10. xxx.3.xx

PING 10.254.3.72 (10.254.3.72) 56 (84) bytesof data.

64 bytes from 10. xx.3.xx: icmp_seq = 1 ttl = 64 time = 0.427 MS

64 bytes from 10. xx.3.xx: icmp_seq = 2 ttl = 64 time = 0.389 MS

64 bytes from 10. xx.3.xx: icmp_seq = 3 ttl = 64 time = 0.402 MS

64 bytes from 10. xx.3.xx: icmp_seq = 4 ttl = 64 time = 0.415 MS

It can be pinged to prove that it is not a network fault.

(2) check whether the snmpd service is enabled on the monitored Host:

[Root @ xxx ~] # Ps-eaf | grep snmpd

Root 4540 27133 0 00:00:00 pts/0 grep snmpd

[Root @ xxx ~] #

[Root @ xxx ~] # Service snmpd start

Snmpd: unrecognized service

[Root @ xxx ~] #

The snmpd service needs to be installed on the monitored host. Use yum-y install snmpd to install the snmpd service.

[Root @ db-m2-slave-1 ~] # Service snmpdrestart

Snmpd: unrecognized service

[Root @ db-m2-slave-1 ~] #

[Root @ db-m2-slave-1 ~] # Yum-y install snmp

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

* Base: pai.neu.edu.cn

* Extras: pai.neu.edu.cn

* Updates: pai.neu.edu.cn

Setting up Install Process

No package snmp available.

Error: Nothing to do

Yum cannot be installed. Try yum install-y net-snmp. The installation is successful:

[Root @ db-m2-slave-1 ~] # Yum install-ynet-snmp

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

* Base: pai.neu.edu.cn

* Extras: pai.neu.edu.cn

* Updates: pai.neu.edu.cn

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package net-snmp.x86_641: 5.5-49. el6_5.1 will be installed

--> Processing Dependency: net-snmp-libs =. 5-49.el6_5.1 for package: 1: net-snmp-5.5-49.el6_5.1.x86_64

--> Processing Dependency: libsensors. so.4 () (64bit) for package: 1: net-snmp-5.5-49.el6_5.1.x86_64

--> Processing Dependency: libnetsnmptrapd. so.20 () (64bit) for package: 1: net-snmp-5.5-49.el6_5.1.x86_64

--> Processing Dependency: libnetsnmpmibs. so.20 () (64bit) for package: 1: net-snmp-5.5-49.el6_5.1.x86_64

[Root @ db-m2-slave-1 ~] # Service snmpdrestart

Stop snmpd: [failed]

Starting snmpd: [OK]

[Root @ db-m2-slave-1 ~] #

You can also use the service snmpd reload command to reload.

(3) Check the host status at this time and the instance is recovering:

You can also go to the cacti server and run snmpwalk to check:

Snmpwalk-c public-v 2c 10. xxx.1.xx # (this ip10.xxx. 1. xx is the IP address of the monitored host)

If you receive the data of the monitored host, it indicates that the snmp configuration of the monitored host has been completed and there is no error.

4. Add the graph of the monitored host and add graphs:

On the Right of the Console interface, click Createdevices connection, as shown in:

Then click host name connection, as shown below:

Click Create Graphs for this Host connection in the upper-right corner.


5. Add a host Group

Add a tree under graphs, click console, select Graphs Trees on the Left bar, and click Add on the right,

Enter the trees name, select Natural Ordering as the sorting type, and click Create.

Then select the created graphs trees and click the add button to add the database host to the trees, as shown in the following figure:

Click graphs at the top of the page.

Related Article

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.