這期內(nèi)容當(dāng)中小編將會給大家?guī)碛嘘P(guān)SNM如何在Zabbix中使用,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
成都創(chuàng)新互聯(lián)公司于2013年開始,先為項(xiàng)城等服務(wù)建站,項(xiàng)城等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為項(xiàng)城企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。1、SNMP協(xié)議介紹
SNMP是英文“Simple Network Management Protocol”的縮寫,中文意思是“簡單網(wǎng)絡(luò)管理協(xié)議,SNMP是一種簡單網(wǎng)絡(luò)管理協(xié)議,它屬于TCP/IP五層協(xié)議中的應(yīng)用層協(xié)議,用于網(wǎng)絡(luò)管理的協(xié)議,SNMP主要用于網(wǎng)絡(luò)設(shè)備的管理。SNMP的基本思想:為不同種類的設(shè)備、不同廠家生產(chǎn)的設(shè)備、不同型號的設(shè)備,定義為一個(gè)統(tǒng)一的接口和協(xié)議,使得管理員可以是使用統(tǒng)一的外觀面對這些需要管理的網(wǎng)絡(luò)設(shè)備進(jìn)行管理。通過網(wǎng)絡(luò),管理員可以管理位于不同物理空間的設(shè)備,從而大大提高網(wǎng)絡(luò)管理的效率,簡化網(wǎng)絡(luò)管理員的工作。SNMP協(xié)議是TCP/IP協(xié)議簇的一個(gè)應(yīng)用層協(xié)議,在1988年被制定,并被Internet體系結(jié)構(gòu)委員會(IAB)采納作為一個(gè)短期的網(wǎng)絡(luò)管理解決方案,由于SNMP的簡單性,在Internet時(shí)代得到了蓬勃的發(fā)展,1992年發(fā)布了SNMPv2版本,以增強(qiáng)SNMPv1的安全性和功能,SNMP的協(xié)議版本目前有SNMP v1、SNMP v2c和SNMP v3三種版本,其具體差別如下:
SNMP v1采用社區(qū)名(Community Name)認(rèn)證,社區(qū)名用來定義SNMP NMS和SNMP Agent的關(guān)系,如果SNMP報(bào)文攜帶的社區(qū)名沒有得到設(shè)備的認(rèn)可,該報(bào)文將被丟棄,社區(qū)名起到了類似于密碼的作用,用來限制SNMP NMS對SNMP Agent的訪問。
SNMP v2c也采用社區(qū)名認(rèn)證,它在兼容SNMP v1的同時(shí)又?jǐn)U充了SNMP v1的功能,它提供了更多的操作類型(GetBulk和InformRequest)、支持更多的數(shù)據(jù)類型(Counter64等)、提供了更豐富的錯(cuò)誤代碼且能夠更細(xì)致地區(qū)分錯(cuò)誤。
SNMP v3提供了基于用戶的安全模型(USM,User-Based Security Model)的認(rèn)證機(jī)制,用戶可以設(shè)置認(rèn)證和加密功能,認(rèn)證用于驗(yàn)證報(bào)文發(fā)送方的合法性,避免非法用戶的訪問,加密則是對NMS和Agent之間的傳輸報(bào)文進(jìn)行加密,以免被竊聽。通過有無認(rèn)證和有無加密等功能組合,可以為SNMP NMS和SNMP Agent之間的通信提供更高的安全性。
2、SNMP工作機(jī)制
SNMP的工作機(jī)制SNMP網(wǎng)絡(luò)元素分為NMS和Agent兩種:NMS(Network Management Station,網(wǎng)絡(luò)管理站)是運(yùn)行SNMP客戶端程序的工作站,能夠提供非常友好的人機(jī)交互界面,方便網(wǎng)絡(luò)管理員完成絕大多數(shù)的網(wǎng)絡(luò)管理工作。Agent是駐留在設(shè)備上的一個(gè)進(jìn)程,負(fù)責(zé)接收、處理來自NMS的請求報(bào)文。在一些緊急情況下,如接口狀態(tài)發(fā)生改變等,Agent也會主動通知NMS。NMS是SNMP網(wǎng)絡(luò)的管理者,Agent是SNMP網(wǎng)絡(luò)的被管理者。NMS和Agent之間通過SNMP協(xié)議來交互管理信息。
3、SNMP數(shù)據(jù)交互
SNMP管理進(jìn)程與代理進(jìn)程之前為了交互信息,定義了5種報(bào)文:
get-request操作:從代理進(jìn)程處提取一個(gè)或多個(gè)參數(shù)值。
get-next-request操作:從代理進(jìn)程處提取一個(gè)或多個(gè)參數(shù)的下一個(gè)參數(shù)值。
set-request操作:設(shè)置代理進(jìn)程的一個(gè)或多個(gè)參數(shù)值。
get-response操作:返回的一個(gè)或多個(gè)參數(shù)值。這個(gè)操作是由代理進(jìn)程發(fā)出的。
trap 操作:代理進(jìn)程主動發(fā)出的報(bào)文,通知管理進(jìn)程有某些事情發(fā)生。
SNMP數(shù)據(jù)交互示意圖
4、SNMP組織結(jié)構(gòu)
一套完整的SNMP系統(tǒng)主要包括以下幾個(gè)方面:SNMP報(bào)文協(xié)議。管理信息結(jié)構(gòu)(SMI, Structure ofManagement Information),一套公用的結(jié)構(gòu)和表示符號。管理信息庫(MIB,Management Information Base),管理信息庫包含所有代理進(jìn)程的所有可被查詢和修改的參數(shù)。OID(Object Identifiers),一個(gè)OID是一個(gè)的鍵值對,用于標(biāo)識具體某一個(gè)設(shè)備的某個(gè)具體信息(對象標(biāo)識),如端口信息、設(shè)備名稱等。
5、SNMP MIB
所謂(MIB)管理信息庫,就是所有代理進(jìn)程包含的、并且能夠被管理進(jìn)程進(jìn)行查詢和設(shè)置的信息的集合。MIB是基于對象標(biāo)識樹的,對象標(biāo)識是一個(gè)整數(shù)序列,中間以"."分割,這些整數(shù)構(gòu)成一個(gè)樹型結(jié)構(gòu),類似于 DNS或Unix的文件系統(tǒng),MIB被劃分為若干個(gè)組,如system、 interfaces、 at(地址轉(zhuǎn)換)和ip組等。iso.org.dod.internet.private.enterprises( 1.3.6.1.4.1)這個(gè)標(biāo)識,是給廠家自定義而預(yù)留的,比如華為的為1.3.6.1.4.1.2011,華三的為1.3.6.1.4.1.25506。
Centos 部分常用的OID
6、在Linux上啟用SNMP
[root@node05 ~]# yum install -y net-snmp
提示:以上安裝是安裝snmp agent,運(yùn)行在被監(jiān)控端;
安裝snmp客戶端工具
[root@node05 ~]# yum install -y net-snmp-utils
配置snmp允許那些社區(qū)的客戶端獲取數(shù)據(jù),以及對snmp有哪些權(quán)限,允許獲取那些數(shù)據(jù)
提示:以上配置表示,首先將社區(qū)名public映射為一個(gè)安全的名稱notConfigUser;其次映射安全名notConfigUser映射為組名notConfigGroup,并將安全模式v1和v2c加入到組內(nèi),這表示只要在這個(gè)組內(nèi)的成員都兼容v1 和v2c兩個(gè)版本的安全模式;第三是創(chuàng)建一個(gè)視圖,名為systemview,并配置允許那些葉子節(jié)點(diǎn)或子樹的oid加入到此視圖;最后授權(quán)notConfigGroup組里的任何用戶,用任何安全模式都對systemview擁有只讀權(quán)限,不擁有寫權(quán)限,也沒有例外;簡單點(diǎn)講以上配置表示只要是public社區(qū)的用戶,都將識別為notConfigGroup里的用戶,而對應(yīng)組里的用戶擁有systemview授權(quán)的子樹只讀權(quán)限;這里需要注意,子樹就是我們要獲取的數(shù)據(jù)對象的標(biāo)識(oid);我們授權(quán)只需要修改對應(yīng)systemview擁有那些子樹或葉子節(jié)點(diǎn)即可;授權(quán)一顆子樹意味著該子樹下的所有葉子節(jié)點(diǎn)或子樹都可以被訪問,授權(quán)一個(gè)葉子節(jié)點(diǎn)表示精確只能看到對應(yīng)葉子節(jié)點(diǎn);
示例:授權(quán)systemview視圖擁有對操作系統(tǒng)cpu負(fù)載1分鐘的數(shù)據(jù)
提示:只需要將對應(yīng)cpu1分鐘負(fù)載對應(yīng)oid加入到systemview視圖即可;
啟動snmpd
[root@node05 ~]# systemctl start snmpd.service [root@node05 ~]# ss -unl State Recv-Q Send-Q Local Address:Port Peer Address:Port UNCONN 0 0 *:161 *:* UNCONN 0 0 127.0.0.1:323 *:* UNCONN 0 0 ::1:323 :::* [root@node05 ~]#
提示:請確保udp的161端口正常監(jiān)聽;
驗(yàn)證:使用snmpget工具來獲取node05上的cpu1分鐘負(fù)載數(shù)據(jù)
[root@node05 ~]# snmpget -c public -v 2c node05 .1.3.6.1.4.1.2021.10.1.3.1 UCD-SNMP-MIB::laLoad.1 = STRING: 0.00 [root@node05 ~]# uptime 20:57:49 up 35 min, 1 user, load average: 0.00, 0.02, 0.05 [root@node05 ~]#
提示:可以看到用snmpget工具獲取的數(shù)據(jù)和我們使用uptime命令獲取的數(shù)據(jù)一樣;指定獲取數(shù)據(jù)可以使用oid來指定,也可以使用mib來獲?。?/p>
[root@node05 ~]# snmpget -c public -v 2c node05 UCD-SNMP-MIB::laLoad.1 UCD-SNMP-MIB::laLoad.1 = STRING: 0.00 [root@node05 ~]#
使用snmpwalk工具獲取非葉子節(jié)點(diǎn)下所有數(shù)據(jù)
首先授權(quán)snmp能夠看到對應(yīng)子樹
提示:以上紅框中內(nèi)容表示systemview包含.1.3.6.1.2.1.25這個(gè)子樹,這意味著其下的所有子樹和葉子節(jié)點(diǎn)都可以看到;
重啟snmpd
[root@node05 ~]# systemctl restart snmpd.service [root@node05 ~]# ss -unl State Recv-Q Send-Q Local Address:Port Peer Address:Port UNCONN 0 0 *:161 *:* UNCONN 0 0 127.0.0.1:323 *:* UNCONN 0 0 ::1:323 :::* [root@node05 ~]#
獲取系統(tǒng)進(jìn)程列表
[root@node05 ~]# snmpwalk -c public -v 2c node05 .1.3.6.1.2.1.25.4.2.1.2 HOST-RESOURCES-MIB::hrSWRunName.1 = STRING: "systemd" HOST-RESOURCES-MIB::hrSWRunName.2 = STRING: "kthreadd" HOST-RESOURCES-MIB::hrSWRunName.3 = STRING: "ksoftirqd/0" HOST-RESOURCES-MIB::hrSWRunName.5 = STRING: "kworker/0:0H" HOST-RESOURCES-MIB::hrSWRunName.7 = STRING: "migration/0" HOST-RESOURCES-MIB::hrSWRunName.8 = STRING: "rcu_bh" HOST-RESOURCES-MIB::hrSWRunName.9 = STRING: "rcu_sched" HOST-RESOURCES-MIB::hrSWRunName.10 = STRING: "watchdog/0" HOST-RESOURCES-MIB::hrSWRunName.11 = STRING: "watchdog/1" HOST-RESOURCES-MIB::hrSWRunName.12 = STRING: "migration/1" HOST-RESOURCES-MIB::hrSWRunName.13 = STRING: "ksoftirqd/1" HOST-RESOURCES-MIB::hrSWRunName.14 = STRING: "kworker/1:0" HOST-RESOURCES-MIB::hrSWRunName.15 = STRING: "kworker/1:0H" HOST-RESOURCES-MIB::hrSWRunName.17 = STRING: "kdevtmpfs" HOST-RESOURCES-MIB::hrSWRunName.18 = STRING: "netns" HOST-RESOURCES-MIB::hrSWRunName.19 = STRING: "khungtaskd" HOST-RESOURCES-MIB::hrSWRunName.20 = STRING: "writeback" HOST-RESOURCES-MIB::hrSWRunName.21 = STRING: "kintegrityd" HOST-RESOURCES-MIB::hrSWRunName.22 = STRING: "bioset" HOST-RESOURCES-MIB::hrSWRunName.23 = STRING: "kblockd" HOST-RESOURCES-MIB::hrSWRunName.24 = STRING: "md" HOST-RESOURCES-MIB::hrSWRunName.25 = STRING: "kworker/0:1" HOST-RESOURCES-MIB::hrSWRunName.30 = STRING: "kswapd0" HOST-RESOURCES-MIB::hrSWRunName.31 = STRING: "ksmd" HOST-RESOURCES-MIB::hrSWRunName.32 = STRING: "khugepaged" HOST-RESOURCES-MIB::hrSWRunName.33 = STRING: "crypto" HOST-RESOURCES-MIB::hrSWRunName.41 = STRING: "kthrotld" HOST-RESOURCES-MIB::hrSWRunName.42 = STRING: "kworker/u256:1" HOST-RESOURCES-MIB::hrSWRunName.43 = STRING: "kmpath_rdacd" HOST-RESOURCES-MIB::hrSWRunName.44 = STRING: "kworker/1:1" HOST-RESOURCES-MIB::hrSWRunName.45 = STRING: "kpsmoused" HOST-RESOURCES-MIB::hrSWRunName.47 = STRING: "ipv6_addrconf" HOST-RESOURCES-MIB::hrSWRunName.66 = STRING: "deferwq" HOST-RESOURCES-MIB::hrSWRunName.98 = STRING: "kauditd" HOST-RESOURCES-MIB::hrSWRunName.265 = STRING: "kworker/1:2" HOST-RESOURCES-MIB::hrSWRunName.282 = STRING: "ata_sff" HOST-RESOURCES-MIB::hrSWRunName.283 = STRING: "scsi_eh_0" HOST-RESOURCES-MIB::hrSWRunName.284 = STRING: "scsi_tmf_0" HOST-RESOURCES-MIB::hrSWRunName.285 = STRING: "scsi_eh_1" HOST-RESOURCES-MIB::hrSWRunName.286 = STRING: "scsi_tmf_1" HOST-RESOURCES-MIB::hrSWRunName.289 = STRING: "mpt_poll_0" HOST-RESOURCES-MIB::hrSWRunName.290 = STRING: "mpt/0" HOST-RESOURCES-MIB::hrSWRunName.298 = STRING: "scsi_eh_2" HOST-RESOURCES-MIB::hrSWRunName.299 = STRING: "scsi_tmf_2" HOST-RESOURCES-MIB::hrSWRunName.300 = STRING: "ttm_swap" HOST-RESOURCES-MIB::hrSWRunName.375 = STRING: "kdmflush" HOST-RESOURCES-MIB::hrSWRunName.376 = STRING: "bioset" HOST-RESOURCES-MIB::hrSWRunName.387 = STRING: "kdmflush" HOST-RESOURCES-MIB::hrSWRunName.388 = STRING: "bioset" HOST-RESOURCES-MIB::hrSWRunName.401 = STRING: "bioset" HOST-RESOURCES-MIB::hrSWRunName.402 = STRING: "xfsalloc" HOST-RESOURCES-MIB::hrSWRunName.403 = STRING: "xfs_mru_cache" HOST-RESOURCES-MIB::hrSWRunName.404 = STRING: "xfs-buf/dm-0" HOST-RESOURCES-MIB::hrSWRunName.405 = STRING: "xfs-data/dm-0" HOST-RESOURCES-MIB::hrSWRunName.406 = STRING: "xfs-conv/dm-0" HOST-RESOURCES-MIB::hrSWRunName.407 = STRING: "xfs-cil/dm-0" HOST-RESOURCES-MIB::hrSWRunName.408 = STRING: "xfs-reclaim/dm-" HOST-RESOURCES-MIB::hrSWRunName.409 = STRING: "xfs-log/dm-0" HOST-RESOURCES-MIB::hrSWRunName.410 = STRING: "xfs-eofblocks/d" HOST-RESOURCES-MIB::hrSWRunName.411 = STRING: "xfsaild/dm-0" HOST-RESOURCES-MIB::hrSWRunName.467 = STRING: "kworker/1:1H" HOST-RESOURCES-MIB::hrSWRunName.468 = STRING: "kworker/0:1H" HOST-RESOURCES-MIB::hrSWRunName.482 = STRING: "systemd-journal" HOST-RESOURCES-MIB::hrSWRunName.506 = STRING: "lvmetad" HOST-RESOURCES-MIB::hrSWRunName.511 = STRING: "systemd-udevd" HOST-RESOURCES-MIB::hrSWRunName.544 = STRING: "xfs-buf/sda1" HOST-RESOURCES-MIB::hrSWRunName.545 = STRING: "xfs-data/sda1" HOST-RESOURCES-MIB::hrSWRunName.546 = STRING: "xfs-conv/sda1" HOST-RESOURCES-MIB::hrSWRunName.547 = STRING: "xfs-cil/sda1" HOST-RESOURCES-MIB::hrSWRunName.548 = STRING: "xfs-reclaim/sda" HOST-RESOURCES-MIB::hrSWRunName.549 = STRING: "xfs-log/sda1" HOST-RESOURCES-MIB::hrSWRunName.550 = STRING: "xfs-eofblocks/s" HOST-RESOURCES-MIB::hrSWRunName.551 = STRING: "xfsaild/sda1" HOST-RESOURCES-MIB::hrSWRunName.554 = STRING: "nfit" HOST-RESOURCES-MIB::hrSWRunName.598 = STRING: "kworker/u257:0" HOST-RESOURCES-MIB::hrSWRunName.599 = STRING: "hci0" HOST-RESOURCES-MIB::hrSWRunName.600 = STRING: "hci0" HOST-RESOURCES-MIB::hrSWRunName.602 = STRING: "kworker/u257:2" HOST-RESOURCES-MIB::hrSWRunName.624 = STRING: "auditd" HOST-RESOURCES-MIB::hrSWRunName.648 = STRING: "rsyslogd" HOST-RESOURCES-MIB::hrSWRunName.649 = STRING: "systemd-logind" HOST-RESOURCES-MIB::hrSWRunName.650 = STRING: "polkitd" HOST-RESOURCES-MIB::hrSWRunName.651 = STRING: "dbus-daemon" HOST-RESOURCES-MIB::hrSWRunName.653 = STRING: "chronyd" HOST-RESOURCES-MIB::hrSWRunName.660 = STRING: "NetworkManager" HOST-RESOURCES-MIB::hrSWRunName.662 = STRING: "irqbalance" HOST-RESOURCES-MIB::hrSWRunName.669 = STRING: "crond" HOST-RESOURCES-MIB::hrSWRunName.674 = STRING: "agetty" HOST-RESOURCES-MIB::hrSWRunName.877 = STRING: "tuned" HOST-RESOURCES-MIB::hrSWRunName.976 = STRING: "sshd" HOST-RESOURCES-MIB::hrSWRunName.1029 = STRING: "zabbix_agentd" HOST-RESOURCES-MIB::hrSWRunName.1030 = STRING: "zabbix_agentd" HOST-RESOURCES-MIB::hrSWRunName.1031 = STRING: "zabbix_agentd" HOST-RESOURCES-MIB::hrSWRunName.1032 = STRING: "zabbix_agentd" HOST-RESOURCES-MIB::hrSWRunName.1033 = STRING: "zabbix_agentd" HOST-RESOURCES-MIB::hrSWRunName.1034 = STRING: "zabbix_agentd" HOST-RESOURCES-MIB::hrSWRunName.1074 = STRING: "master" HOST-RESOURCES-MIB::hrSWRunName.1075 = STRING: "pickup" HOST-RESOURCES-MIB::hrSWRunName.1076 = STRING: "qmgr" HOST-RESOURCES-MIB::hrSWRunName.1240 = STRING: "sshd" HOST-RESOURCES-MIB::hrSWRunName.1242 = STRING: "bash" HOST-RESOURCES-MIB::hrSWRunName.1333 = STRING: "kworker/u256:2" HOST-RESOURCES-MIB::hrSWRunName.1666 = STRING: "kworker/0:0" HOST-RESOURCES-MIB::hrSWRunName.1732 = STRING: "anacron" HOST-RESOURCES-MIB::hrSWRunName.1883 = STRING: "kworker/0:2" HOST-RESOURCES-MIB::hrSWRunName.1960 = STRING: "snmpd" HOST-RESOURCES-MIB::hrSWRunName.1970 = STRING: "snmpwalk" [root@node05 ~]#
配置zabbix web使用snmp信道采集node05上的數(shù)據(jù),并鏈接Template OS Linux SNMPv2模板
鏈接模板
查看主機(jī)列表,看看node05對應(yīng)的SNMP信道是否變綠了?
添加snmp item
提示:在主機(jī)列表中找到對應(yīng)主機(jī)上的item,然后點(diǎn)擊create item ,填寫好item名稱,選擇SNMP v2 agent;這里的key就只是起一個(gè)標(biāo)識作用,盡量不要和已有的內(nèi)建key和自定義key重復(fù)即可;最重要的是要填寫好對應(yīng)主機(jī)的snmp監(jiān)聽的ip地址和端口,以及要采集數(shù)據(jù)對應(yīng)的oid或mib和社區(qū)名稱;社區(qū)名稱可以寫宏,默認(rèn)就有一個(gè){$SNMP_COMMUNITY}其值就是public;調(diào)用對應(yīng)的宏也是可以的;
查看我們定義的item是否采集到數(shù)據(jù)呢?
以上就是zabbix使用snmp信道采集數(shù)據(jù)配置和演示;接下我們再來說說zabbix 使用jmx信道監(jiān)控java程序
jmx是Java Management Extensions的縮寫,即Java管理擴(kuò)展,它可以跨平臺實(shí)現(xiàn)靈活的開發(fā)無縫集成的系統(tǒng)、網(wǎng)絡(luò)和服務(wù)管理應(yīng)用。在zabbix 上使用jmx信道采集對應(yīng)java程序的相關(guān)指標(biāo)數(shù)據(jù),首先zabbix原生是不支持jmx,它依賴zabbix-java-gateway這個(gè)服務(wù);其次對應(yīng)被監(jiān)控主機(jī)上運(yùn)行的java程序要打開jmx功能;zabbix-java-gateway我們可以理解為zabbix jmx的代理服務(wù),它負(fù)責(zé)zabbix server 委派給它使用jmx信道采集數(shù)據(jù),將采集到數(shù)據(jù)發(fā)送給zabbix server ;所以要想使用jmx信道來采集數(shù)據(jù),首先我們得安裝并啟動zabbix java gateway服務(wù),然后配置zabbix server ,告訴zabbix server java gateway服務(wù)地址和端口;最后在對應(yīng)的被監(jiān)控端開啟jmx;
安裝zabbix java gateway
[root@node04 ~]# yum install -y zabbix-java-gateway
提示:這個(gè)服務(wù)可以安裝在zabbix server 上,也可以獨(dú)立一臺服務(wù)器,也可安裝在被監(jiān)控端;總之zabbix server 能夠正常和它通信即可;
配置zabbix java gateway
[root@node04 ~]# grep -Ei "^[a-z]" /etc/zabbix/zabbix_java_gateway.conf LISTEN_IP="0.0.0.0" LISTEN_PORT=10052 PID_FILE="/var/run/zabbix/zabbix_java.pid" START_POLLERS=5 TIMEOUT=3 [root@node04 ~]#
提示:以上是java gateway的默認(rèn)配置,保持默認(rèn)配置即可;如果后續(xù)覺得java gateway的poller少了,可以更改;
啟動zabbix java gateway
[root@node04 ~]# systemctl start zabbix-java-gateway.service [root@node04 ~]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:6379 *:* LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 128 *:10050 *:* LISTEN 0 128 :::80 :::* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 50 :::10052 :::* [root@node04 ~]#
提示:默認(rèn)java gateway監(jiān)聽在10052端口,啟動后請確保該端口處于監(jiān)聽即可;
配置zabbix server
提示:在zabbix server配置文件中找到j(luò)ava gateway的配置,配置Java gateway的ip地址,端口,以及啟動的poller數(shù)量和超時(shí)時(shí)間即可;
重啟zabbix server
[root@node03 ~]# systemctl restart zabbix-server.service [root@node03 ~]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 128 *:10050 *:* LISTEN 0 128 *:10051 *:* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 128 :::10051 :::* [root@node03 ~]#
提示:請確保zabbix server能夠正常啟動起來;對應(yīng)端口能夠正常處于監(jiān)聽狀態(tài);
在node05上安裝tomcat服務(wù)
[root@node05 ~]# yum install -y tomcat-admin-webapps tomcat-webapps tomcat-docs-webapp tomcat
開啟tomcat的jmx功能
完整配置文件內(nèi)容
[root@node05 ~]# grep -Ei "^[a-z]" /etc/tomcat/tomcat.conf TOMCAT_CFG_LOADED="1" TOMCATS_BASE="/var/lib/tomcats/" JAVA_HOME="/usr/lib/jvm/jre" CATALINA_HOME="/usr/share/tomcat" CATALINA_TMPDIR="/var/cache/tomcat/temp" CATALINA_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.0.45" JAVA_OPTS="-Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory" SECURITY_MANAGER="false" [root@node05 ~]
啟動tomcat
[root@node05 ~]# systemctl start tomcat [root@node05 ~]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 128 *:10050 *:* LISTEN 0 128 127.0.0.1:199 *:* LISTEN 0 100 :::8080 :::* LISTEN 0 128 :::80 :::* LISTEN 0 128 :::22 :::* LISTEN 0 50 :::12345 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 128 :::10050 :::* LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* LISTEN 0 50 :::44229 :::* LISTEN 0 50 :::35589 :::* LISTEN 0 100 :::8009 :::* [root@node05 ~]#
提示:請確保對應(yīng)的端口都處于監(jiān)聽狀態(tài),jmx我們剛才指定的是12345端口,默認(rèn)在zabbix使用的端口也是12345,所以這兩個(gè)端口保持一致即可;
在zabbix web上添加node05并指定使用jmx接口來采集數(shù)據(jù)
鏈接模板
查看node05上的jmx信道是否變綠?
查看是否采集到對應(yīng)模板上的監(jiān)控項(xiàng)數(shù)據(jù)呢?
提示:可以看到我們鏈接的模板,對應(yīng)很多監(jiān)控項(xiàng)都采集到數(shù)據(jù)了;說明我們配置使用jmx采集數(shù)據(jù)沒有什么問題;這里需要注意我們鏈接都模版,不一定所有都監(jiān)控項(xiàng)都可以采集到數(shù)據(jù);
上述就是小編為大家分享的SNM如何在Zabbix中使用了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。