日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > windows >内容正文

windows

分布式系统——网络监视系统zabbix3.4.2,以及向zabbix中添加被监视主机(一)

發(fā)布時(shí)間:2025/3/19 windows 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 分布式系统——网络监视系统zabbix3.4.2,以及向zabbix中添加被监视主机(一) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

#一、認(rèn)識(shí)zabbix

  • zabbix(音同 za:bix)是一個(gè)基于WEB界面的提供分布式系統(tǒng)監(jiān)視以及網(wǎng)絡(luò)監(jiān)視功能的企業(yè)級(jí)的開源解決方案。
  • zabbix能監(jiān)視各種網(wǎng)絡(luò)參數(shù),保證服務(wù)器系統(tǒng)的安全運(yùn)營(yíng);并提供靈活的通知機(jī)制以讓系統(tǒng)管理員快速定位/解決存在的各種問題。
  • zabbix由2部分構(gòu)成,zabbix server與可選組件zabbix agent。
  • zabbix server可以通過SNMP,zabbix agent,ping,端口監(jiān)視等方法提供對(duì)遠(yuǎn)程服務(wù)器/網(wǎng)絡(luò)狀態(tài)的監(jiān)視,數(shù)據(jù)收集等功能,它可以運(yùn)行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平臺(tái)上。

##zabbix的功能與特性

  • 安裝與配置簡(jiǎn)單。
  • 可視化web管理界面。
  • 免費(fèi)開源。
  • 自動(dòng)發(fā)現(xiàn)。
  • 分布式監(jiān)控。
  • 實(shí)時(shí)繪圖。

##Zabbix的系統(tǒng)組成

  • Zabbix Server:負(fù)責(zé)接收Agent發(fā)送的報(bào)告信息,組織所有配置、數(shù)據(jù)和操作。
  • Database Storage:存儲(chǔ)配置信息以及收集到的數(shù)據(jù)。
  • Web Interface:Zabbix的GUI 接口,通常與Server運(yùn)行在同一臺(tái)機(jī)器上。
  • Proxy:可選組件,常用于分布式監(jiān)控環(huán)境中。
    Agent:部署在被監(jiān)控主機(jī)上,負(fù)責(zé)收集數(shù)據(jù)發(fā)送給Server。
    ##zabbix系統(tǒng)包含的進(jìn)程
    默認(rèn)情況下zabbix包含5個(gè)程序:zabbix_agentd、zabbix_get、zabbix_proxy、zabbix_sender、zabbix_server,另外一個(gè)zabbix_java_gateway是可選,這個(gè)需要另外安裝。下面來分別介紹下他們各自的作用。
  • zabbix_agentd 客戶端守護(hù)進(jìn)程,此進(jìn)程收集客戶端數(shù)據(jù),例如cpu負(fù)載、內(nèi)存、硬盤使用情況等。
  • zabbix_get zabbix工具,單獨(dú)使用的命令,通常在server或者proxy端執(zhí)行獲取遠(yuǎn)程客戶端信息的命令。通常用戶排錯(cuò)。例如在server端獲取不到客戶端的內(nèi)存數(shù)據(jù),我們可以使用- - zabbix_get獲取客戶端的內(nèi)容的方式來做故障排查。
  • zabbix_sender zabbix工具,用于發(fā)送數(shù)據(jù)給server或者proxy,通常用于耗時(shí)比較長(zhǎng)的檢查。很多檢查非常耗時(shí)間,導(dǎo)致zabbix超時(shí)。于是我們?cè)谀_本執(zhí)行完畢之后,使用sender主動(dòng)提交數(shù)據(jù)。
  • zabbix_server zabbix服務(wù)端守護(hù)進(jìn)程。zabbix_agentd、- zabbix_get、zabbix_sender、zabbix_proxy、- zabbix_java_gateway的數(shù)據(jù)最終都是提交到server
  • 備注:當(dāng)然不是數(shù)據(jù)都是主動(dòng)提交給zabbix_server,也有的是server主動(dòng)去取數(shù)據(jù)。
  • zabbix_proxy zabbix代理守護(hù)進(jìn)程。功能類似server,唯一不同的是它只是一個(gè)中轉(zhuǎn)站,它需要把收集到的數(shù)據(jù)提交/被提交到server里。。
  • zabbix_java_gateway zabbix2.0之后引入的一個(gè)功能。顧名思義:Java網(wǎng)關(guān),類似agentd,但是只用于Java方面。需要特別注意的是,它只能主動(dòng)去獲取數(shù)據(jù),而不能被動(dòng)獲取數(shù)據(jù)。它的數(shù)據(jù)最終會(huì)給到server或者proxy。

各進(jìn)程對(duì)應(yīng)的zabbix/3.4/rhel/7/x86_64/安裝包下載(地址http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/)

#二、部署zabbix
##實(shí)驗(yàn)環(huán)境

  • server1:rhel 7.3系統(tǒng)——172.25.54.1
  • server2:rhel 6.5系統(tǒng)——172.25.54.11

##搭建zabbix平臺(tái)
####server1所需安裝包
zabbix-server-mysql-3.4.6-1.el7.x86_64.rpm
zabbix-web-3.4.6-1.el7.noarch.rpm
zabbix-web-mysql-3.4.6-1.el7.noarch.rpm
fping-3.10-1.el7.x86_64.rpm
iksemel-1.4-2.el7.centos.x86_64.rpm
php-bcmath-5.4.16-42.el7.x86_64.rpm
php-mbstring-5.4.16-42.el7.x86_64.rpm
zabbix-agent-3.4.2-1.el7.x86_64.rpm
####server1

[root@server1 ~]# ls zabbix-server-mysql-3.4.6-1.el7.x86_64.rpm zabbix-web-3.4.6-1.el7.noarch.rpm zabbix-web-mysql-3.4.6-1.el7.noarch.rpm fping-3.10-1.el7.x86_64.rpm iksemel-1.4-2.el7.centos.x86_64.rpm php-bcmath-5.4.16-42.el7.x86_64.rpm php-mbstring-5.4.16-42.el7.x86_64.rpm zabbix-agent-3.4.2-1.el7.x86_64.rpm [root@server1 ~]# yum install -y *.rpm //安裝數(shù)據(jù)庫(kù)mariadb并進(jìn)行初始化 [root@server1 z~]# yum install -y mariadb-server [root@server1 ~]# systemctl start mariadb [root@server1 ~]# mysql_secure_installation Set root password? [Y/n] y New password: Re-enter new password: Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y [root@server1 ~]# systemctl restart mariadb [root@server1 ~]# mysql -p Enter password: //直接回車 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.52-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; //創(chuàng)建數(shù)據(jù)庫(kù) Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'redhat'; //進(jìn)行授權(quán) Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> Bye [root@server1 ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.6/ [root@server1 zabbix-server-mysql-3.4.6]# ls AUTHORS ChangeLog COPYING create.sql.gz NEWS README [root@server1 zabbix-server-mysql-3.4.6]# zcat create.sql.gz | mysql -u zabbix -p zabbix Enter password: //導(dǎo)入數(shù)據(jù),輸入授權(quán)用戶zabbix的密碼 [root@server1 zabbix-server-mysql-3.4.6]# mysql -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 5.5.52-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> use zabbix; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed MariaDB [zabbix]> show tables; +----------------------------+ | Tables_in_zabbix | +----------------------------+ | acknowledges | | actions | | alerts | | application_discovery |............................| valuemaps | | widget | | widget_field | +----------------------------+ 140 rows in set (0.00 sec)MariaDB [zabbix]> Bye [root@server1 zabbix-server-mysql-3.4.6]# cd /etc/zabbix/ [root@server1 zabbix]# vim zabbix_server.conf 125 DBPassword=redhat 132 DBSocket=/var/lib/mysql/mysql.sock [root@server1 zabbix]# ll /var/lib/mysql/mysql.sock srwxrwxrwx 1 mysql mysql 0 Aug 14 15:28 /var/lib/mysql/mysql.sock [root@server1 zabbix]# vim /etc/httpd/conf.d/zabbix.conf 19 php_value date.timezone Asia/Shanghai //修改時(shí)區(qū) [root@server1 zabbix]# systemctl start zabbix-server [root@server1 zabbix]# systemctl start httpd [root@server1 zabbix]# systemctl start zabbix-agent

####瀏覽器操作









#####修改密碼后退出重新登陸
####server2

[root@serevr2 ~]# ls zabbix-agent-3.4.6-1.el6.x86_64.rpm [root@serevr2 ~]# rpm -ivh zabbix-agent-3.4.6-1.el6.x86_64.rpm [root@serevr2 ~]# vim /etc/zabbix/zabbix_agentd.conf97 Server=172.25.54.1 138 ServerActive=172.25.54.1 149 Hostname=server2 [root@serevr2 ~]# /etc/init.d/zabbix-agent start [root@serevr2 ~]# netstat -antpl


##向zabbix添加需要監(jiān)視的主機(jī)的四種方式

  • 方式一:自動(dòng)發(fā)現(xiàn)











  • 方式二:手動(dòng)創(chuàng)建





  • 方式三:自動(dòng)注冊(cè)






等待些許時(shí)間后

  • 方式四、API

[root@server1 ~]# vim zabbix-api.sh [root@server1 ~]# chmod +x zabbix-api.sh [root@server1 ~]# cat zabbix-api.sh curl -s -X POST -H 'Content-Type:application/json' -d ' {"jsonrpc": "2.0","method": "user.login","params": {"user": "Admin","password": "redhat"},"id": 1,"auth": null }' http://172.25.54.1/zabbix/api_jsonrpc.php | python -m json.tool [root@server1 ~]# ./zabbix-api.sh {"id": 1,"jsonrpc": "2.0","result": "2cb16ddca9d07e50b68cf736eaf3f283" } [root@server1 ~]# vim zabbix-api.sh [root@server1 ~]# cat zabbix-api.sh curl -s -X POST -H 'Content-Type:application/json' -d ' {"jsonrpc": "2.0","method": "host.get","params": {"output": ["hostid","host"],"selectInterfaces": ["interfaceid","ip"]},"auth": "2cb16ddca9d07e50b68cf736eaf3f283","id": 2 }' http://172.25.54.1/zabbix/api_jsonrpc.php | python -m json.tool [root@server1 ~]# ./zabbix-api.sh {"id": 2,"jsonrpc": "2.0","result": [{"host": "Zabbix server","hostid": "10084","interfaces": [{"interfaceid": "1","ip": "127.0.0.1"}]},{"host": "server2","hostid": "10259","interfaces": [{"interfaceid": "7","ip": "172.25.54.11"}]}] }[root@server1 ~]# //刪除主機(jī) [root@server1 ~]# vim zabbix-api.sh [root@server1 ~]# cat zabbix-api.sh curl -s -X POST -H 'Content-Type:application/json' -d ' {"jsonrpc": "2.0","method": "host.delete","params": ["10259"],"auth": "2cb16ddca9d07e50b68cf736eaf3f283","id": 2 }' http://172.25.54.1/zabbix/api_jsonrpc.php | python -m json.tool [root@server1 ~]# ./zabbix-api1.sh

//創(chuàng)建主機(jī) [root@server1 ~]# cat zabbix-api.sh curl -s -X POST -H 'Content-Type:application/json' -d ' {"jsonrpc": "2.0","method": "host.create","params": {"host": "server2","interfaces": [{"type": 1,"main": 1,"useip": 1,"ip": "172.25.54.2","dns": "","port": "10050"}],"groups": [{"groupid": "2"}],"templates": [{"templateid": "10001"}],},"auth": "2cb16ddca9d07e50b68cf736eaf3f283","id": 2, }' http://172.25.54.1/zabbix/api_jsonrpc.php | python -m json.tool [root@server1 ~]# ./zabbix-api1.sh

總結(jié)

以上是生活随笔為你收集整理的分布式系统——网络监视系统zabbix3.4.2,以及向zabbix中添加被监视主机(一)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。