數據庫監控:zabbix(percona-zabbix-templates)

官網:https://www.zabbix.com

zabbix是一個基於web界面的分佈式系統監控以及網絡監控功能的企業級開源解決方案。

[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

官網:http://www.php.net

[root@wallet01 ~]# tar zxvf php-5.6.36.tar.gz 
[root@wallet01 ~]# cd php-5.6.36
[root@wallet01 php-5.6.36]# ./configure --prefix=/usr/local/php \
--with-config-file-path=/etc \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd
[root@wallet01 php-5.6.36]# make
[root@wallet01 php-5.6.36]# make install

[root@wallet01 ~]# ln -s /usr/local/php/bin/php /usr/bin/php
[root@wallet01 ~]# php -v
PHP 5.6.36 (cli) (built: Jan  8 2019 16:44:29) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

官網:https://www.percona.com/software/database-tools/percona-monitoring-plugins

Percona監控插件是高質量組件,可將企業級mysql和mongodb監控和繪圖功能集成到現有的內部監控解決方案中。

[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  ]

[root@wallet01 ~]# cd /tmp
[root@wallet01 tmp]# chown zabbix:zabbix localhost-mysql_cacti_stats.txt 

部署zabbix
https://blog.51cto.com/13598811/2097609
一,導入模板
二,創建主機並關聯模板


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章