Play with Zabbix (by quqi99)
阿新 • • 發佈:2018-11-11
版權宣告:可以任意轉載,轉載時請務必以超連結形式標明文章原始出處和作者資訊及本版權宣告 (作者:張華 發表於: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個錯誤:
- ‘Table ‘users’ already exists’
- Job for zabbix-server.service failed because a configured resource limit was exceeded.
- Cannot connect to the database.
- 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 [email protected]'localhost' identified by 'password';
mysql> grant all privileges on zabbix.* to [email protected]'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
上幾張圖