首页 > 代码库 > zabbix(2)
zabbix(2)
dd4:安装nginx
tar zxf nginx-1.10.3.tar.gz
cd nginx-1.10.3
cd auto
cd cc
vim gcc
./configure --with-http_stub_status_module --prefix=/usr/local/nginx
make && make install
cd /usr/local/nginx
vim nginx.conf
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx
curl -s http://172.25.42.13/status | grep Active | awk‘{print $NF}‘
cd /etc/zabbix/zabbix_agentd.d
vim nginx.conf
dd5:
rpm -ivh zabbix-get-2.4.5-1.el6.x86_64.rpm
zabbix_get -s 172.25.42.13 -p 10050 -k "nginx.active"
dd5:nginx策率自定义添加:
测试图表:ab -c 100 -t 20 http://172.25.42.13/
查看:
dd5:mysql策率自定义添加:
rpm -ivh percona-zabbix-templates-1.1.6-1.noarch.rpm
rpm -ql percona-zabbix-templates
cd /var/lib/zabbix/percona
cd scripts/
mysqladmin -u root password westos
vim ss_get_mysql_stats.php (php脚本访问mysql需要mysql授权)
cd templates/
cp userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/ (将key值给agent)
cd /etc/zabbix/zabbix_agentd.d
vim /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php.cnf
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
cd /var/lib/zabbix/
vim .my.cnf (指定 zabbix agent 如何登陆数据库)
/etc/init.d/zabbix-agent restart
cd /tmp/
chown zabbix.zabbix localhost-mysql_cacti_stats.txt
cd templates/
scp zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.6.xml 172.25.42.250:/root/
zabbix警报:
dd5:
tar zxf alert-agent-4.1.3.1-linux-x64.tar.gz
cp -r alert-agent /usr/lib/zabbix/alertscripts/
cp alert-agent/plugin/zabbix-plugin/110monitor/usr/lib/zabbix/alertscripts/chmod +x /usr/lib/zabbix/alertscripts/110monitor
配置虚拟机网络,使能上网:
ip addr add 172.25.254.142/24 dev eth0
route add default gw 172.25.254.251
sysctl -w net.ipv4.icmp_echo_ignore_all=1 (禁ping)
tail -f /usr/lib/zabbix/alertscripts/alert-agent/log/agent.log (查看日志)
./110monitor 8d39347c-35dc-e7eb-a48e-92ca8a31d50f trigger"alarmName:helloworld" (手动调用脚本)
sysctl -w net.ipv4.icmp_echo_ignore_all=0 (实验完成后改回正确的)
angent 主动发起监控信息传送
vim/etc/zabbix/zabbix_agentd.conf
/etc/init.d/zabbix-agent restart
netstat -antlpe | grep :10050 (关闭别人主动连接我的端口 )
配置zappix:
zappix代理(proxy):
再开一台虚拟机:dd3.example.com
yum install zabbix-proxy-2.4.5-1.el6.x86_64.rpmzabbix-proxy-mysql-2.4.5-1.el6.x86_64.rpm fping-2.4b2-16.el6.x86_64.rpm zabbix-2.4.5-1.el6.x86_64.rpmmysql
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by‘westos‘;
cd /usr/share/doc/
cd zabbix-proxy-mysql-2.4.5/
cd create/
mysql zabbix < schema.sql
vim /etc/zabbix/zabbix_proxy.conf
/etc/init.d/zabbix-proxy start
dd4:agent
vim /etc/zabbix/zabbix_agentd.conf
server (被动模式) server Active(主动模式)
配置server web zabbix:
(注意重启顺序 server proxyagent)
dd4:/etc/init.d/zabbix-agent restart
dd5:/etc/init.d/zabbix-server restart
注意:server端要有agent和proxy的主机名解析
查看日志是否成功:tail -f /var/log/zabbix/zabbix_server.log
zabbix(2)