Zabbix Server 自带模板监控无密码MySQL数据库

时间:2021-07-25 05:45:40

            Zabbix Server 自带模板监控无密码MySQL数据库

                                           作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。 

一.安装MariaDB

1>.安装MariaDB 

[root@node102 ~]# yum -y install mariadb-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors..com
* extras: mirrors.aliyun.com
* updates: mirrors..com
Resolving Dependencies
--> Running transaction check
---> Package mariadb-server.x86_64 :5.5.-.el7_5 will be installed
--> Processing Dependency: perl-DBI for package: :mariadb-server-5.5.-.el7_5.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: :mariadb-server-5.5.-.el7_5.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: :mariadb-server-5.5.-.el7_5.x86_64
--> Processing Dependency: perl(DBI) for package: :mariadb-server-5.5.-.el7_5.x86_64
--> Processing Dependency: libaio.so.(LIBAIO_0.)(64bit) for package: :mariadb-server-5.5.-.el7_5.x86_64
--> Processing Dependency: libaio.so.(LIBAIO_0.)(64bit) for package: :mariadb-server-5.5.-.el7_5.x86_64
--> Processing Dependency: libaio.so.()(64bit) for package: :mariadb-server-5.5.-.el7_5.x86_64
--> Running transaction check
---> Package libaio.x86_64 :0.3.-.el7 will be installed
---> Package perl-DBD-MySQL.x86_64 :4.023-.el7 will be installed
---> Package perl-DBI.x86_64 :1.627-.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-.el7.x86_64
---> Package perl-Data-Dumper.x86_64 :2.145-.el7 will be installed
--> Running transaction check
---> Package perl-PlRPC.noarch :0.2020-.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch :2.061-.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-.el7.noarch
---> Package perl-Net-Daemon.noarch :0.48-.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 :2.061-.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 :2.061-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ===========================================================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================================================
Installing:
mariadb-server x86_64 :5.5.-.el7_5 base M
Installing for dependencies:
libaio x86_64 0.3.-.el7 base k
perl-Compress-Raw-Bzip2 x86_64 2.061-.el7 base k
perl-Compress-Raw-Zlib x86_64 :2.061-.el7 base k
perl-DBD-MySQL x86_64 4.023-.el7 base k
perl-DBI x86_64 1.627-.el7 base k
perl-Data-Dumper x86_64 2.145-.el7 base k
perl-IO-Compress noarch 2.061-.el7 base k
perl-Net-Daemon noarch 0.48-.el7 base k
perl-PlRPC noarch 0.2020-.el7 base k Transaction Summary
===========================================================================================================================================================================================
Install Package (+ Dependent packages) Total download size: M
Installed size: M
Downloading packages:
(/): libaio-0.3.-.el7.x86_64.rpm | kB ::
(/): perl-Compress-Raw-Zlib-2.061-.el7.x86_64.rpm | kB ::
(/): perl-Data-Dumper-2.145-.el7.x86_64.rpm | kB ::
(/): perl-Compress-Raw-Bzip2-2.061-.el7.x86_64.rpm | kB ::
(/): perl-IO-Compress-2.061-.el7.noarch.rpm | kB ::
(/): perl-Net-Daemon-0.48-.el7.noarch.rpm | kB ::
(/): perl-PlRPC-0.2020-.el7.noarch.rpm | kB ::
(/): perl-DBD-MySQL-4.023-.el7.x86_64.rpm | kB ::
(/): perl-DBI-1.627-.el7.x86_64.rpm | kB ::
(/): mariadb-server-5.5.-.el7_5.x86_64.rpm | MB ::
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.7 MB/s | MB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : perl-Data-Dumper-2.145-.el7.x86_64 /
Installing : libaio-0.3.-.el7.x86_64 /
Installing : :perl-Compress-Raw-Zlib-2.061-.el7.x86_64 /
Installing : perl-Net-Daemon-0.48-.el7.noarch /
Installing : perl-Compress-Raw-Bzip2-2.061-.el7.x86_64 /
Installing : perl-IO-Compress-2.061-.el7.noarch /
Installing : perl-PlRPC-0.2020-.el7.noarch /
Installing : perl-DBI-1.627-.el7.x86_64 /
Installing : perl-DBD-MySQL-4.023-.el7.x86_64 /
Installing : :mariadb-server-5.5.-.el7_5.x86_64 /
Verifying : :mariadb-server-5.5.-.el7_5.x86_64 /
Verifying : perl-Compress-Raw-Bzip2-2.061-.el7.x86_64 /
Verifying : perl-Net-Daemon-0.48-.el7.noarch /
Verifying : perl-Data-Dumper-2.145-.el7.x86_64 /
Verifying : perl-DBD-MySQL-4.023-.el7.x86_64 /
Verifying : perl-IO-Compress-2.061-.el7.noarch /
Verifying : :perl-Compress-Raw-Zlib-2.061-.el7.x86_64 /
Verifying : perl-DBI-1.627-.el7.x86_64 /
Verifying : libaio-0.3.-.el7.x86_64 /
Verifying : perl-PlRPC-0.2020-.el7.noarch / Installed:
mariadb-server.x86_64 :5.5.-.el7_5 Dependency Installed:
libaio.x86_64 :0.3.-.el7 perl-Compress-Raw-Bzip2.x86_64 :2.061-.el7 perl-Compress-Raw-Zlib.x86_64 :2.061-.el7 perl-DBD-MySQL.x86_64 :4.023-.el7
perl-DBI.x86_64 :1.627-.el7 perl-Data-Dumper.x86_64 :2.145-.el7 perl-IO-Compress.noarch :2.061-.el7 perl-Net-Daemon.noarch :0.48-.el7
perl-PlRPC.noarch :0.2020-.el7 Complete!
[root@node102 ~]#

[root@node102 ~]# yum -y install mariadb-server

2>.启动MariaDB

[root@node102 ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@node102 ~]#
[root@node102 ~]# systemctl start mariadb
[root@node102 ~]#
[root@node102 ~]#
[root@node102 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@node102 ~]#
[root@node102 ~]#
[root@node102 ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Tue -- :: PST; 7s ago
Main PID: (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─ /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─ /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/... Feb :: node102.yinzhengjie.org.cn mariadb-prepare-db-dir[]: MySQL manual for more instructions.
Feb :: node102.yinzhengjie.org.cn mariadb-prepare-db-dir[]: Please report any problems at http://mariadb.org/jira
Feb :: node102.yinzhengjie.org.cn mariadb-prepare-db-dir[]: The latest information about MariaDB is available at http://mariadb.org/.
Feb :: node102.yinzhengjie.org.cn mariadb-prepare-db-dir[]: You can find additional information about the MySQL part at:
Feb :: node102.yinzhengjie.org.cn mariadb-prepare-db-dir[]: http://dev.mysql.com
Feb :: node102.yinzhengjie.org.cn mariadb-prepare-db-dir[]: Consider joining MariaDB's strong and vibrant community:
Feb :: node102.yinzhengjie.org.cn mariadb-prepare-db-dir[]: https://mariadb.org/get-involved/
Feb :: node102.yinzhengjie.org.cn mysqld_safe[]: :: mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Feb :: node102.yinzhengjie.org.cn mysqld_safe[]: :: mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb :: node102.yinzhengjie.org.cn systemd[]: Started MariaDB database server.
[root@node102 ~]#
[root@node102 ~]#

二.Zabbix Server 配置监控无密码的MariaDB数据库

1>.创建主机

Zabbix Server 自带模板监控无密码MySQL数据库

2>.配置host界面

Zabbix Server 自带模板监控无密码MySQL数据库

3>.配置zabbix监控数据库的模板

Zabbix Server 自带模板监控无密码MySQL数据库

4>.主机添加完成

Zabbix Server 自带模板监控无密码MySQL数据库

5>.如下图所示,zabbix默认有14个监控项

Zabbix Server 自带模板监控无密码MySQL数据库

6>.查看监控MySQL的图形

Zabbix Server 自带模板监控无密码MySQL数据库