包含javasnmp的詞條

本文目錄一覽:

java 開發 SNMP 一些疑問

1、具體實現可參考開源snmp代碼 snmp4j:

裡面有具體實現方法,網上相關介紹也有不少。

2、如果僅僅是配置客戶端trap,有很多小工具安裝配置一下就可以,如net-snmp(網上相關資料也不少)

3、代理端是需要開一個線程監聽客戶端trap消息的

java測試snmp監聽埠是否可用

用SNMPWALK,如果對方的SNMP服務開啟,工作正常的話,就會列出SNMP查詢的數據。如果不正常工作或者未開啟,則提示查詢超時。

SNMPWALK在網上可以下載下來使用。

在DOS下,輸入:

snmpwalk -c 【SNMP字串】 -v 【1|2c】 【IP地址】

例如:

snmpwalk -c public -v 2c 192.168.1.1

java通過snmp多線程並發訪問設備獲取數據

snmp訪問設備獲取數據有非同步的方法,跟多線程同時使用效果更好

java 發送snmp trap消息如何確定發送成功

snmptrapd需要一個配置文檔,snmptrapd.conf。

此文件用來指定管理進程如何處理接收到的snmp notification。

1. 在net-snmp安裝目錄下新建snmptrapd.conf文件,假設本系統使用以下路徑:/ABC/soft/net-snmp/share/snmp/snmptrapd.conf

2. 在snmptrapd.conf中加入以下指令:

authCommunity log,execute,net public

這條指令指明以「public」為「community」請求的snmp 「notification」允許的操作。

各變數意義如下:

log: log the details of the notification – either in a specified file, to standard output (or stderr), or via syslog(or similar).

execute: pass the details of the trap to a specified handler program, including embedded perl.

net: forward the trap to another notification receiver.

3. 若想對接收到的信息進行處理,可以使用traphandle,示例如下:

traphandle SNMPv2-MIB::coldStart /usr/nba/bin/traps cold

traphandle SNMPv2-MIB::warmStart /usr/nba/bin/traps warm

traphandle IF-MIB::linkDown /usr/nba/bin/traps down

traphandle IF-MIB::linkUp /usr/nba/bin/traps up

第一個參數為從snmptrapd接收的OID,第二個參數為調用的程序。此系統未做traphandle處理。

4. 啟動snmptrapd

使用以下指令啟動snmptrapd:

snmptrapd -f -Lo

該指令將接收到的信息通過標準輸出設備列印出來,各參數意義如下:

-f: Do not fork() from the calling shell.

-L[efos]: Specify where logging output should be directed (standard error or output, to a file or via syslog

java支持snmp協議實現嗎

基於java開發的SugarNMStool,支持SNMP協議實現,SugarNMStool是帶拓撲圖界面的全功能SNMP工具,可用於SNMP設備開發調試、SNMP診斷的日常必備工具

原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/181992.html

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
小藍的頭像小藍
上一篇 2024-11-24 06:17
下一篇 2024-11-24 06:17

相關推薦

發表回復

登錄後才能評論