linux运维、架构之路-Zabbix监控
生活随笔
收集整理的這篇文章主要介紹了
linux运维、架构之路-Zabbix监控
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、監控常用命令
1、物理服務器監控命令
①添加yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo②安裝
yum -y install OpenIPMI ipmitool [root@xenserver7-01 ~]# ipmitool sdr type Temperature #查看溫度 Temp | 01h | ns | 3.1 | Disabled Temp | 02h | ns | 3.2 | Disabled Temp | 05h | ns | 10.1 | Disabled Temp | 06h | ns | 10.2 | Disabled Ambient Temp | 0Eh | ok | 7.1 | 20 degrees C Planar Temp | 0Fh | ns | 7.1 | Disabled IOH THERMTRIP | 5Dh | ns | 7.1 | Disabled CPU Temp Interf | 76h | ns | 7.1 | Disabled Temp | 0Ah | ns | 8.1 | Disabled Temp | 0Bh | ns | 8.1 | Disabled Temp | 0Ch | ns | 8.1 | Disabled2、cpu常用監控命令
lscpu top:z加顏色 x高亮排序列 < > 左右移動 uptime htop:top的升級版,支持鼠標3、內存、硬盤監控命令?
free -h、free -m、df -h、iotop4、網絡監控命令
yum -y install iftop nethogsiftop:查看主機間的流量,指定網卡查看 iftop -i eth1
nethogs:查看進程使用的流量
smokeing
二、Zabbix監控
1、介紹
? ? ? ??Zabbix是一個企業級的、開源的、分布式的監控套件,Zabbix可以監控網絡和服務的監控狀況. Zabbix利用靈活的告警機制,允許用戶對事件發送基于Email的告警. 這樣可以保證快速的對問題作出相應. Zabbix可以利用存儲數據提供杰出的報告及圖形化方式. 這一特性將幫助用戶完成容量規劃。是目前生產環境非常流行的一個zabbix監控軟件了
2、Zabbix架構圖形
?3、安裝部署
①部署環境
[root@m01 tools]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@m01 tools]# uname -r 2.6.32-696.el6.x86_64 [root@m01 tools]# getenforce Disabled [root@m01 tools]# /etc/init.d/iptables status iptables: Firewall is not running.②服務器規劃
管理機m01 [root@m01 tools]# hostname -I 10.0.0.61 172.16.1.61 web01 [root@web01 ~]# hostname -I 10.0.0.8 172.16.1.8③服務端安裝配置
#上傳定制好的rpm包解壓 tar xfP zabbix3.0.9_yum.tar.gz #快速安裝LAMP環境 yum -y --nogpgcheck -C install httpd zabbix-web zabbix-server-mysql zabbix-web-mysql zabbix-get mysql-server php55w php55w-mysql php55w-common php55w-gd php55w-mbstring php55w-mcrypt php55w-devel php55w-xml php55w-bcmath zabbix-get zabbix-java-gateway wqy-microhei-fonts net-snmp net-snmp-utils #配置mysql \cp /usr/share/mysql/my-medium.cnf /etc/my.cnf /etc/init.d/mysqld start mysql -e 'create database zabbix character set utf8 collate utf8_bin;' mysql -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';" zcat /usr/share/doc/zabbix-server-mysql-3.0.9/create.sql.gz |mysql -uzabbix -pzabbix zabbix #配置PHP egrep -n "^post_max_size|^max_execution_time|^max_input_time|^date.timezone" /etc/php.ini sed -i 's#max_execution_time = 30#max_execution_time = 300#;s#max_input_time = 60#max_input_time = 300#;s#post_max_size = 8M#post_max_size = 16M#;910a date.timezone = Asia/Shanghai' /etc/php.ini #配置zabbix-server連接數據庫 sed -i '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf #配置zabbix網頁及授權 cp -R /usr/share/zabbix/ /var/www/html/ chmod -R 755 /etc/zabbix/web chown -R apache.apache /etc/zabbix/web #啟動zabbix服務 echo "ServerName 127.0.0.1:80">>/etc/httpd/conf/httpd.conf /etc/init.d/httpd start /etc/init.d/zabbix-server start #加入開機自啟動 cat>>/etc/rc.local<<EOF /etc/init.d/mysqld start /etc/init.d/httpd start /etc/init.d/zabbix-server start EOF④客戶端安裝配置
rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/6/x86_64/zabbix-agent-3.0.9-1.el6.x86_64.rpm sed -i 's#Server=127.0.0.1#Server=172.16.1.61#' /etc/zabbix/zabbix_agentd.conf /etc/init.d/zabbix-agent startStarting Zabbix agent:? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[? OK? ]
CentOS7
rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-agent-3.0.9-1.el7.x86_64.rpm sed -i 's#Server=127.0.0.1#Server=172.16.1.61#' /etc/zabbix/zabbix_agentd.conf systemctl start zabbix-agent.service systemctl enable zabbix-agent.service⑤瀏覽器輸入http://10.0.0.61/zabbix/
?
?
?
⑥解決web頁面顯示亂碼問題
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf到此Zabbix網頁端安裝完畢
4、網頁添加一個被監控客戶端web01
如上圖所示,說明監控項已添加成功?
轉載于:https://www.cnblogs.com/yanxinjiang/p/7715155.html
總結
以上是生活随笔為你收集整理的linux运维、架构之路-Zabbix监控的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 预处理指令(C#)
- 下一篇: Linux课堂笔记-第二天