您好,登錄后才能下訂單哦!
?? ?
??
Zabbix 是一個基于 WEB 界面的提供分布式系統監視以及網絡監視功能的企業級的開源解決方案。它能監視各種網絡參數,保證服務器系統的安全運營;并提供靈活的通知機制以讓系統管理員快速定位/解決存在的各種問題。
?
安裝環境:CentOS Linux release 7.5? IP:192.168.1.100
#?wget?https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
#?rpm?–ivh?zabbix-release-4.4-1.el7.noarch.rpm
?
安裝?Zabbix?server并使用?MySQL?數據庫:#?yum?-y?install?zabbix-server-mysql? 安裝?Zabbix?前端并使用?MySQL?數據庫:#?yum?-y?install?zabbix-web-mysql安裝Zabbix?agent客戶端,本機監控:#?yum?-y?install?zabbix-agent
安裝zabbix-get工具
# yum –y install zabbix-get
安裝mariadb數據庫#?yum?-y?install?mariadb-server
?
#?systemctl?start?mariadb #?systemctl?enable?mariadb
創建Zabbix的數據庫名為zabbix,注意字符集的選擇MariaDB?[(none)]>?CREATE?DATABASE?zabbix?CHARSET?utf8?COLLATE?utf8_bin;創建Zabbix的用戶名為zabbixadmin,密碼為123456MariaDB?[(none)]>?GRANT?ALL?ON?zabbix.*?TO?zabbixadmin@localhost?IDENTIFIED?BY?'123456';
?
查看SQL語句的目錄#rpm?-ql?zabbix-server-mysql ... /usr/share/doc/zabbix-server-mysql-4.4.3/create.sql.gz ...導入SQL語句到剛才創建的zabbix數據庫中#zcat?/usr/share/doc/zabbix-server-mysql-4.4.3/create.sql.gz?|?mysql?-uzabbixadmin?-p123456?zabbix
?
#?vim?/etc/zabbix/zabbix_server.conf ... DBHost=localhost DBName=zabbix DBUser=zabbixadmin DBPassword=123456...
?
#?systemctl?start?zabbix-server #?systemctl?enable?zabbix-server
?
修改時區#?vim?/etc/httpd/conf.d/zabbix.conf php_value?date.timezone?Asia/Shanghai
?
#?systemctl?start?httpd #?systemctl?enable?httpd
?
安裝環境:CentOS release 6.9 (Final)? IP:192.168.1.200
?
注意:這里客戶端選擇的是CentOS6,需要安裝的是CentOS 6的yum源,如果要安裝其他版本的需要去阿里的mirrors里自行查找
#?wget?--no-check-certificate?https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/6/x86_64/zabbix-release-4.4-1.el6.noarch.rpm
#?rpm?–ivh?zabbix-release-4.4-1.el6.noarch.rpm
?
#?yum?install?zabbix-agent
?
#?vim?/etc/zabbix/zabbix_agentd.conf ... Server=192.168.1.100????????????????????????????#?Zabbix?Server的ip地址ServerActive=192.168.1.100Hostname=web01 ...
?
#?service?zabbix-agent?start #?chkconfig?--add?zabbix-agent #?chkconfig?zabbix-agent?on
?
官方地址:https://www.zabbix.com/cn/download_agents
?
?
修改如下字段:
LogFile=c:\zabbix\zabbix_agentd.log
Server=192.168.1.100
ServerActive=192.168.1.100
Hostname=windows-web
?
C:Windows\system32>? cd c:\zabbix
c:\zabbix> bin\zabbix_agentd –i –c conf\zabbix_agentd.conf???? #安裝zabbix客戶端
c:\zabbix> bin\zabbix_agentd –s –c conf\zabbix_agentd.conf??? #啟動zabbix服務
?
http://192.168.1.100/zabbix
?
?
?
?
系統默認的用戶名:Admin
系統默認密碼:zabbix
?
?
?
原亂碼現象
服務器端安裝字體 #?yum?install?wqy-microhei-fonts?-y 修改字體鏈接,鏈接到新安裝的字體 #?rm?/usr/share/zabbix/assets/fonts/graphfont.ttf? #?ln?-sv?/usr/share/fonts/wqy-microhei/wqy-microhei.ttc?/usr/share/zabbix/assets/fonts/graphfont.ttf
?
修改后刷新頁面即可
?
?
?
除了Zabbix給的模板監控項,我們可以自定義監控的內容
httpd開啟服務后會打開80端口
#?ss?-tnl State???????Recv-Q?Send-Q?????????????????????????????????????????????Local?Address:Port???????????????????????????????????????????????Peer?Address:Port? LISTEN??????0??????128???????????????????????????????????????????????????????????:::10050????????????????????????????????????????????????????????:::*?????LISTEN??????0??????128????????????????????????????????????????????????????????????*:10050?????????????????????????????????????????????????????????*:*?????LISTEN??????0??????128???????????????????????????????????????????????????????????:::80???????????????????????????????????????????????????????????:::*?????LISTEN??????0??????128???????????????????????????????????????????????????????????:::22???????????????????????????????????????????????????????????:::*?????LISTEN??????0??????128????????????????????????????????????????????????????????????*:22????????????????????????????????????????????????????????????*:*
可以通過命令取到值:ss -tnl | awk '{print $4}' | grep ':80$'
#?ss?-tnl?|?awk?'{print?$4}'?|?grep?–o?'80$'80
如過httpd服務關閉后,80端口也會關閉,此命令取不到值
?
自定義監控項的目錄是/etc/zabbix/zabbix_agentd.d,在里面創建以.conf結尾的文件即可#?vim?/etc/zabbix/zabbix_agentd.d/port80.conf UserParameter=httpd.port80,??ss?-tnl?|?awk?'{print?$4}'?|?grep?–o?'80'
?
重啟服務
#?service?zabbix-agent?restarthttpd.port80?是給該監控項取的名字 ss?-tnl?|?awk?'{print?$4}'?|?grep?–o?'80'?是自定義的監控項取值命令
?
?
?
?
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。