zabbix3.0 server已自带mysql的模板了,只需配置好agent客户端,然后在web端给主机增加模板就行了。
Zabbix_agent客户端操作
(1)首先在客户端的mysql里添加权限,即本机使用zabbix账号连接本地的mysql
mysql> grant all on *.* to zabbix@'localhost' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.02 sec)
[root@localhost zabbix_agentd.conf.d]# ls userparameter_mysql.conf
userparameter_mysql.conf
然后查看 userparameter_mysql.conf 文件,看到类似 HOME=/var/lib/zabbix 的路径设置,把路径全都替换为 /usr/local/zabbix/etc/,也就是上面的.my.cnf文件所在的目录路径。
另外,注意userparameter_mysql.conf 文件里的mysql命令路径(提前做好mysql的系统环境变量,以防mysql命令不被系统识别)
如下:
[root@server1 zabbix_agentd.conf.d]# cat userparameter_mysql.conf # For all the following commands HOME should be set to the directory that has .my.cnf file with password information.
# Flexible parameter to grab global variables. On the frontend side, use keys like mysql.status[Com_insert].
# Key syntax is mysql.status[variable].
UserParameter=mysql.status
,echo "show global status where Variable_name='$1';" | HOME=/usr/local/zabbix/etc/ mysql -N | awk '{print $$2}'
# Flexible parameter to determine database or table> # Key syntax is mysql.size[,,].
# Database may be a database name or "all". Default is "all".
# Table may be a table name or "all". Default is "all".
# Type may be "data", "index", "free" or "both". Both is a sum of data and index. Default is "both".
# Database is mandatory if a table is specified. Type may be specified always.
# Returns value in bytes.
# 'sum' on data_length or index_length alone needed when we are getting this information for whole database instead of a single table
UserParameter=mysql.size
如果在配置过程中出现错误可以有效快速解决 如下
at /usr/local/bin/sendEmail line 1906.
invalid SSL_version specified at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 415
注:进行发送邮件测试时,出现了第一个报错
原因是sendemail软件和perl5里面的ssl版本不兼容导致的,通过修改sendemail里面的内容可以解决这个问题。
解决方法:
在sendemail中1906行的内容,从
if (! IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'SSLv3 TLSv1')) { 修改为
if (! IO::Socket::SSL->start_SSL($SERVER)) {