发送包含自定义数据的SNMP陷阱(Sending SNMP Traps containing custom data)
客户已请求我们将SNMP陷阱发送到其Nagios服务器而不是电子邮件警报。 我昨天才知道关于SNMP的唯一事情就是它听起来像一个缩写词,所以请原谅(并纠正我)我可能有的任何误解。
需要在陷阱中发送的唯一信息涉及我们警告客户的事件的数据,这只是从我们的数据库中提取的几个值。 毋庸置疑,这些不属于任何类型的MIB,也没有任何OID,这就是我无法找到答案的地方。
我无法弄清楚我是如何在没有使用MIB OID的情况下将我们的特定数据添加到陷阱中的,我没有。
我正在使用PySNMP来生成请求,并且现在只有不完整的代码,因为我不确定如何将数据合并到数据包中。
from pysnmp.hlapi import * def sendSNMP(destination, community_string, data): community = CommunityData(community_string, mpModel = 0) target = UdpTransportTarget((destination, 162)) notification_type = None req = sendNotification(SnmpEngine(), community, target, ContextData(), 'trap', notification_type) errorIndication, errorStatus, errorIndex, varBinds = next(req)
任何帮助表示赞赏! 谢谢。
A client has requested that instead of email alerts that we send SNMP Traps to their Nagios server instead. The only thing I knew about SNMP before yesterday was that it sounded like an acronym, so please excuse (and correct me on) any misconceptions about it that I may have.
The only information that needs to be sent in the trap pertains to data about the event we are alerting our client about, which is just a couple of values pulled from our database. Needless to say these aren't in any sort of MIB, nor do they have any OIDs, and this is where I'm having trouble finding answers.
I can't figure out how I am meant to add our specific data to the trap without using MIB OIDs, which I don't have.
I'm using PySNMP to generate the request and have only incomplete code right now as I'm not sure how to go about incorporating our data into the packet.
from pysnmp.hlapi import * def sendSNMP(destination, community_string, data): community = CommunityData(community_string, mpModel = 0) target = UdpTransportTarget((destination, 162)) notification_type = None req = sendNotification(SnmpEngine(), community, target, ContextData(), 'trap', notification_type) errorIndication, errorStatus, errorIndex, varBinds = next(req)
Any assistance is appreciated! Thanks.
原文:https://stackoverflow.com/questions/34654949
最满意答案
To select elements specifically without a class you can use this:
Elements tds = row.select("td:not([class])");
This uses the pseudo selector
:not()
implemented by JSoup.
相关问答
更多-
访问数据的单元格值(Access cell value of datatable)[2020-12-24]
如果您需要对单元格值的弱引用: object field = d.Rows[0][3] 要么 object field = d.Rows[0].ItemArray[3] 应该做 如果您需要强类型引用(在您的情况下为字符串),则可以使用DataRowExtensions.Field扩展方法: string field = d.Rows[0].Field(3); (在这种情况下,请确保System.Data在名称空间中列出) 索引为0,所以我们首先访问第一行(0),然后访问该行(3)中的第 ... -
您可以使用[tableView cellForRowAtIndexPath:indexPath]访问单元格,然后从单元格中,您可以使用viewWithTag访问它的子视图(内容) - - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // access the cell for selected cell UITableViewCell *cell ...
-
按名称访问excel单元格(Access excel cell by its name)[2022-02-22]
我想你可能正在寻找Range("C2") 。 对于格式化信息,可以通过Excel对象模型的各种属性来获取。 有关更多信息,请参见http://msdn.microsoft.com/en-us/library/ff197454.aspx 。 Range类型(与上面引用的Range索引属性相对)也公开了Name属性,您可以在代码中设置它: worksheet.get_Range("C2").Name = "fdafdfs" worksheet.get_Range("fdafdfs").Select(); I ... -
要在没有类的情况下选择元素,可以使用: Elements tds = row.select("td:not([class])"); 这使用了伪选择器:not()由JSoup实现的:not() 。 To select elements specifically without a class you can use this: Elements tds = row.select("td:not([class])"); This uses the pseudo selector :not() impleme ...
-
你会想要这个,因为你想要一个,然后两个。 $(this).parent().prev().prev().html('test'); 或者像这样: $(this).parent().prevAll(':last').html('test'); 或这个: $(this).parent().siblings(':first-child').html('test'); ...或者你可以在没有jQuery的情况下轻松完成: this.parentNode.parentNode.cells[0].innerHTM ...
-
在你打印输出你有AttributeError: 'tuple' object ... ,你的单元格打印像(
,) ,所以你的实际变量持有一个元组,但你正在对待它,就像它是细胞。 您需要解压缩元组以获取单元格变量。 如果你这样做: for cell, in rows: ... 这是拆包的一种方式,或者: for tmp in rows: cell = tmp[0] 是另一个。 顺便说一句, sheets = wb2.sheetnames #list of ... | -
@IBOutlet var companyName : UILabel是一个插座,如果你调用var vc = SearchTableViewController(style: UITableViewStyle.Plain)插座companyName标签没有初始化,因此它是nil,因此访问companyName标签会导致崩溃。 但在第一种情况下,您正在从storyboard初始化viewController,其中SearchTableViewController场景包含带有outlet companyName ...
-
在c#中访问Excel单元格值(Access Excel cell value in c#)[2023-02-03]
尝试使用Range.Formula: Microsoft.Office.Interop.Excel.Range cell //it points to address A1 object obj=cell.Formula; Try to use Range.Formula: Microsoft.Office.Interop.Excel.Range cell //it points to address A1 object obj=cell.Formula; -
如何在UICollectionView中访问所选单元格的索引(How to access the index of the selected cell in UICollectionView)[2023-10-13]
喜欢 步骤1 button.tag = indexPath.row button.setTitle("ButtonTitle") button.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside) 第2步 func buttonAction(sender: UIButton) { if let sendertitle = sender.titleLabel?.tex ... -
如何访问静态单元格(How to access to a static cell)[2022-05-02]
对于在故事板中创建的静态单元格,您可以简单地将IBOutlet设置为您想要编辑的元素,方法是将IBOutlet从故事板拖到相应的视图控制器,最后得到如下所示的内容: class MyViewController: UIViewController { @IBOutlet weak var cell1: UITableViewCell! @IBOutlet weak var cell2: UITableViewCell! } 然后,您可以使用cell1.textLabel等访问Basic视图中的内置 ...