数据库监控:zabbix(percona)

[root@wallet01 ~]# useradd zabbix
[root@wallet01 ~]# id zabbix
uid=503(zabbix) gid=504(zabbix) groups=504(zabbix)

[root@wallet01 ~]# tar zxvf zabbix-3.0.4.tar.gz
[root@wallet01 ~]# cd zabbix-3.0.4
[root@wallet01 zabbix-3.0.4]# ./configure --enable-agent
[root@wallet01 zabbix-3.0.4]# make install
[root@wallet01 zabbix-3.0.4]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d
[root@wallet01 zabbix-3.0.4]# chkconfig --add zabbix_agentd
[root@wallet01 zabbix-3.0.4]# chkconfig zabbix_agentd on

[root@wallet01 ~]# vi /usr/local/etc/zabbix_agentd.conf
Server=192.168.1.200  
Hostname=wallet01  
Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf

[root@wallet01 ~]# service zabbix_agentd start
Starting zabbix_agentd:                                    [  OK  ]

[root@wallet01 ~]# service zabbix_agentd status
zabbix_agentd (pid 11458 11457 11456 11455 11454 11453) is running...

[root@wallet01 ~]# netstat -tupln |grep zabbix_agentd
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      11453/zabbix_agentd

[root@wallet01 ~]# rpm -ivh https://mirror.webtatic.com/yum/el6/latest.rpm
[root@wallet01 ~]# yum install -y php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-devel.x86_64 php56w-mysqlnd.x86_64
[root@wallet01 ~]# php -v
PHP 5.6.39 (cli) (built: Dec  6 2018 23:42:38) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

[root@wallet01 ~]# rpm -ivh percona-zabbix-templates-1.1.8-1.noarch.rpm 
warning: percona-zabbix-templates-1.1.8-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing...                ########################################### [100%]
   1:percona-zabbix-template########################################### [100%]
Scripts are installed to /var/lib/zabbix/percona/scripts
Templates are installed to /var/lib/zabbix/percona/templates

[root@wallet01 ~]# cd /var/lib/zabbix/percona/templates
[root@wallet01 templates]# cp userparameter_percona_mysql.conf /usr/local/etc/zabbix_agentd.conf.d

[root@wallet01 ~]# cd /var/lib/zabbix/percona/scripts
[root@wallet01 scripts]# vi ss_get_mysql_stats.php
$mysql_user = 'root';
$mysql_pass = 'abcd.1234';
$mysql_port = 3306;
$mysql_socket = '/tmp/mysql.sock';

[root@wallet01 ~]# /usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host localhost --items gg
gg:14

[root@wallet01 ~]# service zabbix_agentd restart
Shutting down zabbix_agentd:                               [  OK  ]
Starting zabbix_agentd:                                    [  OK  ]

部署zabbix
http://blog.51cto.com/13598811/2097609
一,导入模板
二,创建主机并关联模板


猜你喜欢

转载自blog.51cto.com/13598811/2340161