CollectD Plugin: MySQL

Source: Internet
Author: User

One collectdserver: IP: 192.168.91.134; one collectdclient: IP: 192.168.91.133.

First, perform a local experiment on collectdserver:

1. Install MYSQL: APT-Get install mysql-server mysql-client.

2. collectD requires a user to connect to MySQL and does not grant other permissions.

CREATE USER 'collectd'@'localhost' IDENTIFIED BY 'Fat4ohse'; -- Give appropriate permissions -- ("GRANT USAGE" is synonymous to "no privileges") GRANT USAGE ON *.* TO 'collectd'@'localhost'; -- Permissions for the MasterStats and SlaveStats options GRANT REPLICATION CLIENT ON *.* TO 'collectd'@'localhost';

3. Configure in collectD. conf. (Configure two databases: testc and test)

<Plugin mysql>

<Database testc>
Host "localhost"
User "collectD"
Password "fat4ohse"
Port 3306
# Database "testc"
Masterstats true
</Database>

<Database test>
Host "localhost"
User "collectD"
Password "fat4ohse"
Port 3306
# Database "testc"
Masterstats true
</Database>

<Database bar>
Host "localhost"
Socket "/var/run/MySQL/mysqld. Sock"
Slavestats true
Slavenotifications true
</Database>
</Plugin>

4. Restart collectD to output data. Finally, an image is generated, such as the input and output traffic of the database testc.


However

/Var/log/syslog has always encountered a problem:

Jan 5 16:59:58 collectdserver-Virtual-machine collectD [6355]: MySQL Plugin: failed to connect to database <none> at server localhost: can't connect to local MySQL server through socket '/var/run/MySQL/mysqld. sock '(2)

Jan 5 16:59:58 collectdserver-Virtual-machine collectD [6355]: Read-function of plugin 'mysql' failed. will suspend it for 160 seconds.
Jan 5 16:59:58 collectdserver-Virtual-machine collectD [6355]: MySQL Plugin: failed to get master statistics: 'Show master status' did not return any rows.

Usage: sudo chown-R
MySQL/var/run/mysqld/

..

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.