Play with Zabbix (by quqi99)

版权声明:本文为博主原创文章,如需转载,请注明出处! https://blog.csdn.net/quqi99/article/details/81629884

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 (作者:张华 发表于:2018-08-13)

问题

客户说keystone端口总在zabbit中报错:

net.tcp.service.perf[http,,35357] 
({host1:net.tcp.service.perf[http,,35357].count(#3,0)}=3 & {host2:net.tcp.service.perf[http,,35357].count(#3,0)}=3) | {host1:net.tcp.service.perf[http,,35357].prev(0)}>15 | {host2:net.tcp.service.perf[http,,35357].prev(0)}>15 
net.tcp.service.perf[http,,5000] 
({host1:net.tcp.service.perf[http,,5000].count(#3,0)}=3 & {host2:net.tcp.service.perf[http,,5000].count(#3,0)}=3) | {host1:net.tcp.service.perf[http,,5000].prev(0)}>15 | {host2:net.tcp.service.perf[http,,5000].prev(0)}>15 

改成下列的配置可能会减小误报:

net.tcp.service.perf[http,,35357] 
({host1:net.tcp.service.perf[http,,35357].max(#3)}=0 & {host2:net.tcp.service.perf[http,,35357].max(#3)}=0) 
net.tcp.service.perf[http,,5000] 
({host1:net.tcp.service.perf[http,,5000].max(#3)}=0 & {host2:net.tcp.service.perf[http,,5000].max(#3)}=0) 

Zabbix是什么? 我不是做运维的, 之前从来没有用过也没有听说过这个名词. 好吧, 学吧. 另外, 我发现网上安装zabbix的文章一搜一堆堆的, 但没有一篇照着是可以顺利安装成功的, 包括官方文档, 总共遇到了下列4个错误:

  1. ‘Table ‘users’ already exists’
  2. Job for zabbix-server.service failed because a configured resource limit was exceeded.
  3. Cannot connect to the database.
  4. Zabbix server cannot work with a Zabbix proxy database

所以我还是将这么个玩意也写篇博客吧. Zabbix是一个监控软件, Zabbix 3.0中提供的监控方式包括:
- Active agents
- Passive agents
- Extending agents
- Simple checks
- SNMP agents
- Zabbix Internal checks
- Zabbix trapper
- IPMI agents
- JMX agents
- External checks
- Database monitoring
- SSH agents
- Telnet agents
- SNMP Traps
- Aggregate checks
- Calculated checks

Install Zabbix Server

# https://tecadmin.net/install-zabbix-on-ubuntu/
wget https://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
sudo dpkg -i zabbix-release_3.4-1+xenial_all.deb
sudo apt update
sudo apt install zabbix-server-mysql zabbix-frontend-php mysql-server
sudo apt-get install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql libapache2-mod-php

sudo vim /etc/php/7.0/apache2/php.ini
[Date]
date.timezone = Asia/Shanghai
max_input_time = 600
max_execution_time= 600
post_max_size = 32M
sudo service apache2 restart

mysql -uroot -hlocalhost -ppassword
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@'t440p.lan' identified by 'password';
mysql> flush privileges;
mysql> exit;

sudo zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz |mysql -uzabbix -hlocalhost -p zabbix
#sudo zcat /usr/share/doc/zabbix-proxy-mysql/schema.sql.gz |mysql -uzabbix -hlocalhost -p zabbix
cat << EOF | sudo tee -a /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
EOF

#sudo apt install policycoreutils
#setsebool -P httpd_can_connect_zabbix on
sudo systemctl start zabbix-server
http://192.168.99.124  Admin/zabbix

Install Zabbix Agent

http://blog.51cto.com/dyc2005/1971212
wget https://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
sudo dpkg -i zabbix-release_3.4-1+xenial_all.deb
sudo apt update
sudo apt install zabbix-agent
sudo vi /etc/zabbix/zabbix_agentd.conf
Server=192.168.99.124
ServerActive=192.168.99.124:1005 #主动提交监控数据时使用
sudo systemctl restart zabbix-agent

Configuration -> Templates -> Create Host
Click this host, and select the monitor template, eg: Template OS Linux 
How to Define template(http://blog.51cto.com/ywzhou/1579917), 'Configuration -> Templates', 
 - create 'Item' for this template, eg: net.tcp.service.perf[tcp,192.168.99.216,7070]
 - create 'Trigger' for this template
 - create 'Graph' for this template, it will link to 'Item'
 - Link template to Host

上几张图

这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述

阅读更多
换一批

没有更多推荐了,返回首页