SNMP:添加陷阱目标(SNMP : add a trap destination)
我是SNMP的新手,我使用snmp4j库在java中创建了一个SNMP代理。 在我的代码中,我已将localhost添加为陷阱目标。 因此,我收到162端口的通知:
targetMIB.addTargetAddress(new OctetString("notification"), TransportDomains.transportDomainUdpIpv4, new OctetString(new UdpAddress("127.0.0.1/162").getValue()), 200, 1, new OctetString("notify"), new OctetString("v2c"), StorageType.permanent);
我现在要做的是使用snmp浏览器(例如iReasoning MIB Browser)从另一个ip地址接收陷阱。 但是我无法在目标mib中添加条目。
我错过了什么吗?
谢谢。
编辑:
我想使用mib浏览器向目标地址表添加一个条目。 使用iReasoning Mib浏览器我没有创建行按钮,而且使用ManageEngine的工具我有一个添加按钮,但似乎没有做任何事情。
因此,我只是在这里尝试使用代码更改我创建的行:
这是mib浏览器的屏幕截图:
当我尝试更改IP地址时,我收到一个错误:
我试图使用OctetString设置值:127.0.0.1:162 127.0.0.1/162 0700000100A2 0x0700000100A2
但没有任何作用
I am fairly new to SNMP and i have created a SNMP Agent in java using the snmp4j library. In my code, i have added localhost as a trap destination. I therefore receive the notifications on the port 162 :
targetMIB.addTargetAddress(new OctetString("notification"), TransportDomains.transportDomainUdpIpv4, new OctetString(new UdpAddress("127.0.0.1/162").getValue()), 200, 1, new OctetString("notify"), new OctetString("v2c"), StorageType.permanent);
What i am trying to do now is to receive traps from another ip address using a snmp browser such as iReasoning MIB Browser. But there i cannot manage to add an entry to the target mib.
Am i missing something ?
Thank you.
EDIT :
I want to add an entry using the mib browser to the target Address table. With iReasoning Mib browser i don't have the create row button and with ManageEngine's tool i have an add button but it does not seem to do anything.
I am therefore only trying here to change the row i have created with the code :
Here is a screen shot of the mib browser :
When i try to change the ip address i get an error :
I have tried to set the value using an OctetString with : 127.0.0.1:162 127.0.0.1/162 0700000100A2 0x0700000100A2
but nothing works
原文:https://stackoverflow.com/questions/21609014
最满意答案
您可以使用
func dropFirst(_ n: Int)
来跳过初始行:let lines = contents.components(separatedBy: "\n") for line in lines.dropFirst(4) { // ... }
dropFirst(4)
返回一个“数组切片”,除了lines
数组中的前4个元素外,这意味着元素存储不会被复制。You can use
func dropFirst(_ n: Int)
to skip initial lines:let lines = contents.components(separatedBy: "\n") for line in lines.dropFirst(4) { // ... }
dropFirst(4)
returns an “array slice” with all but the first 4 elements in thelines
array, which means that the element storage is not duplicated.
相关问答
更多-
你可以使用startswith() 例如 for line in open("file"): li=line.strip() if not li.startswith("#"): print line.rstrip() you can use startswith() eg for line in open("file"): li=line.strip() if not li.startswith("#"): print line.rstri ...
-
我不是100%肯定我理解这个问题,但尝试: string[] lines = File.ReadAllLines("FilePath"); string[] _columns; //Start at index 2 - and keep looping until index Length - 2 for (int i = 2; i < lines.Length - 2; i++) { _columns = lines[i].Split('|'); JazzORBuffer.AddRow( ...
-
尝试read.table(comment.char="?" ...) ,你用作comment.char的东西不在你的表中: read.table( comment.char="?", header=T, check.names=F, text="ColA ColB# ColC ColD ColE\n1 2 3 4 5" ) # ColA ColB# ColC ColD ColE # 1 1 2 3 4 5 try read.table(comment.char= ...
-
步骤1: hdrs <- read.table("somefile.txt", nrows=1, skip=10, comment.char="") 第2步: dat <- read.table("somefile.txt", skip=12) 第三步: names(dat) <- scan(textConnection(sub("# Fields\\:", "", hdrs)), what="character", sep=";") Step1: hd ...
-
您可以使用func dropFirst(_ n: Int)来跳过初始行: let lines = contents.components(separatedBy: "\n") for line in lines.dropFirst(4) { // ... } dropFirst(4)返回一个“数组切片”,除了lines数组中的前4个元素外,这意味着元素存储不会被复制。 You can use func dropFirst(_ n: Int) to skip initial lines: let l ...
-
在R中读取文本文件(Reading a text file in R)[2022-06-19]
您可以指定一个向量,其中包含您要读取的列的类。 例如,如果您的源数据有两列,第一列是您想要的数字,第二列是因子,那么您可以使用: classes <- c(col1="numeric", col2="factor") read.table("file.text", colClasses=classes, stringsAsFactors=FALSE) You can specify a vector which contains the classes of the columns which you i ... -
以下代码将使用fgets()来读取每一行。 对于每一行, sscanf()用于扫描字符串并将其存储为双变量。 在ideone上查看正在运行的示例(使用stdin) 。 #include
int main() { /* maybe the buffer must be greater */ char lineBuffer[256]; FILE *potential = fopen("orderedfile.txt", "r"); /* loop through ... -
阅读文本文件 - bash(reading text file - bash)[2021-10-08]
您需要设置记录分隔符: while IFS=, read -r columnOne columnTwo columnThree do echo "$columnOne" done < info.txt You need to set the record separator: while IFS=, read -r columnOne columnTwo columnThree do echo "$columnOne" done < info.txt -
fgets()在行上留下换行符(\ n)(如果存在)。 所以带注释的行是:## // Comment \ n没有注释的行是:## \ n 当你调用strtok()时,它会根据分隔符将行拆分为标记,在你的情况下是“//”。 因此带注释的行返回“##”和“Comment \ n”,没有注释的行只返回“## \ n”。 因此,当您打印它们时,没有注释的行最终会有两个换行符。 以这种格式检索号码的简单方法是atoi(buf)。 由于atoi()跳过前导空格,解析一个前导+或 - 符号的选项,然后解析所有数字,在两个 ...
-
创建一个列表,其中包含需要忽略的单词列表: List
ignoreAll= Arrays.asList("and","it", "you"); 然后在while循环中添加一个将忽略单词包含这些单词的条件 if(ignoreAll.contains(word)){ continue; } Create one list which will have list of word need to ignore as: List 相关文章
更多- Memcached add 添加key-value命令(存在不会更新)
- Securing Solr on Tomcat access using a user account
- Becoming a data scientist
- 按钮样式
- Solr: a custom Search RequestHandler
- Spring Data: a new perspective of data operations
- A Great List of Windows Tools
- Create a Bootable MicroSD Card
- Drupal Forums instead of phpBB or vBulletin: A casestudy
- Hibernate 异常之:associate a collection with two ...
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。