node-red-contrib-snmp-trap-listener
Version:
Node-RED node that receives snmp traps.
832 lines (792 loc) • 36.3 kB
HTML
<script type="text/javascript">
RED.nodes.registerType("snmp-trap-listener", {
category: "input",
color: "#9574d8",
defaults: {
port: {
value: 162,
required: true,
validate: RED.validators.number(),
},
snmpV1: { value: true },
snmpV2: { value: true },
snmpV3: { value: true },
communities: { value: [{ community: "" }] },
users: {
value: [
{
name: "",
authProtocol: "",
authKey: "",
privProtocol: "",
privKey: "",
},
],
},
ipfilter: { value: "" },
ipmask: { value: "" },
},
inputs: 0,
outputs: 1,
icon: "bridge.png",
label: function () {
return this.name || "snmp-trap-listener";
},
oneditprepare: function () {
let node = this;
let tabs = RED.tabs.create({
id: "node-input-snmp-trap-tabs",
onchange: function (tab) {
$("#node-input-tabs-content").children().hide();
$("#" + tab.id).show();
},
});
tabs.addTab({
id: "snmp-trap-general-tab",
label: "General",
});
if (node.snmpV1 || node.snmpV2) {
tabs.addTab({
id: "snmp-trap-community-tab",
label: "SNMP v1/v2c",
});
}
if (node.snmpV3) {
tabs.addTab({
id: "snmp-trap-user-tab",
label: "SNMP v3",
});
}
let portPrevious = null;
let portSelector = $("#node-input-port");
portSelector
.on("focus", function () {
portPrevious = portSelector.value;
})
.change(function () {
if (portPrevious == null) {
portPrevious = $("#node-input-port").val();
}
if (node.port) {
node.port = parseInt(node.port);
}
});
let snmpV1Current = $("#node-input-snmpV1").is(":checked");
let snmpV2Current = $("#node-input-snmpV2").is(":checked");
let snmpV3Current = $("#node-input-snmpV3").is(":checked");
let snmpV1Previous = $("#node-input-snmpV1").is(":checked");
let snmpV2Previous = $("#node-input-snmpV2").is(":checked");
let snmpV3Previous = $("#node-input-snmpV3").is(":checked");
let snmpV1Checkbox = $("#node-input-snmpV1");
snmpV1Checkbox.change(function () {
snmpV1Current = $("#node-input-snmpV1").is(":checked");
snmpV2Current = $("#node-input-snmpV2").is(":checked");
if (
(snmpV1Current || snmpV2Current) &&
!(snmpV1Previous || snmpV2Previous)
) {
if (snmpV3Current) {
tabs.removeTab("snmp-trap-user-tab");
}
tabs.addTab({
id: "snmp-trap-community-tab",
label: "SNMP v1/v2c",
});
if (snmpV3Current) {
tabs.addTab({
id: "snmp-trap-user-tab",
label: "SNMP v3",
});
}
} else if (
!(snmpV1Current || snmpV2Current) &&
(snmpV1Previous || snmpV2Previous)
) {
tabs.removeTab("snmp-trap-community-tab");
}
snmpV1Previous = snmpV1Current;
snmpV2Previous = snmpV2Current;
});
let snmpV2Checkbox = $("#node-input-snmpV2");
snmpV2Checkbox.change(function () {
snmpV1Current = $("#node-input-snmpV1").is(":checked");
snmpV2Current = $("#node-input-snmpV2").is(":checked");
if (
(snmpV1Current || snmpV2Current) &&
!(snmpV1Previous || snmpV2Previous)
) {
if (snmpV3Current) {
tabs.removeTab("snmp-trap-user-tab");
}
tabs.addTab({
id: "snmp-trap-community-tab",
label: "SNMP v1/v2c",
});
if (snmpV3Current) {
tabs.addTab({
id: "snmp-trap-user-tab",
label: "SNMP v3",
});
}
} else if (
!(snmpV1Current || snmpV2Current) &&
(snmpV1Previous || snmpV2Previous)
) {
tabs.removeTab("snmp-trap-community-tab");
}
snmpV1Previous = snmpV1Current;
snmpV2Previous = snmpV2Current;
});
let snmpV3Checkbox = $("#node-input-snmpV3");
snmpV3Checkbox.change(function () {
snmpV3Current = $("#node-input-snmpV3").is(":checked");
if (snmpV3Current && !snmpV3Previous) {
tabs.addTab({
id: "snmp-trap-user-tab",
label: "SNMP v3",
});
} else if (!snmpV3Current && snmpV3Previous) {
tabs.removeTab("snmp-trap-user-tab");
}
snmpV3Previous = snmpV3Current;
});
// this.resizeRule = function(community,newWidth) {
// community.find(".node-input-community-value").width(newWidth);
// }
// Generate the coomunity tab
function generateCommunity(i, community) {
let container = $("<li/>", {
style:
"background: #fff; margin:0; padding:8px 0px 0px; border-bottom: 1px solid #ccc;",
});
let rowDiv = $("<div/>", {
style: "display:table-row;",
}).appendTo(container);
// Sort button
let sortDiv = $("<div/>", {
style: "display:table-cell; vertical-align: middle;",
}).appendTo(rowDiv);
let sortButton = $("<a/>", {
href: "#",
class: "editor-button",
style:
"font-size:1.3em; margin-left: 0px; margin-right: 6px;",
}).appendTo(sortDiv);
$(
'<i style="color:#eee; cursor:move; margin-left:3px;" class="node-input-community-handle fa fa-bars"></i>',
).appendTo(sortButton);
// Value input
let valueDiv = $("<div/>", {
style:
"display:table-cell; vertical-align: middle; width:100%;",
}).appendTo(rowDiv);
let valueClass = "node-input-community-value";
if (!community.community) {
valueClass = "node-input-community-value input-error";
}
let valueField = $("<input/>", {
class: valueClass,
type: "text",
style: "width: 100%;",
placeholder: "e.g. name",
value: community.community,
}).appendTo(valueDiv);
valueField.keyup(function () {
if ($(this).val() && $(this).hasClass("input-error")) {
$(this).removeClass("input-error");
} else {
if (!$(this).val()) {
$(this).addClass("input-error");
}
}
});
// Delete button
let deleteDiv = $("<div/>", {
style: "display:table-cell; vertical-align: middle;",
}).appendTo(rowDiv);
let deleteButton = $("<a/>", {
href: "#",
class: "editor-button",
style:
"font-size:1.3em; margin-left: 12px; margin-right: 12px;",
}).appendTo(deleteDiv);
$("<i/>", { class: "fa fa-trash-o" }).appendTo(deleteButton);
deleteButton.click(function () {
container.css({ background: "#fee" });
container.fadeOut(300, function () {
$(this).remove();
});
});
$("#node-input-community-container").append(container);
}
$("#node-input-add-community").click(function () {
generateCommunity(
$("#node-input-community-container").children().length + 1,
{},
);
$("#node-input-community-container-div").scrollTop(
$("#node-input-community-container-div").get(0)
.scrollHeight,
);
});
for (let i = 0; i < this.communities.length; i++) {
let community = this.communities[i];
generateCommunity(i + 1, community);
}
$("#node-input-community-container").sortable({
axis: "y",
handle: ".node-input-community-handle",
cursor: "move",
});
// Generate the user tab
function generateUser(i, user) {
let container = $("<li/>", {
style:
"background: #fff; margin:0; padding:8px 0px 0px; border-bottom: 1px solid #ccc;",
});
let rowDiv = $("<div/>", {
style: "display:table-row;",
}).appendTo(container);
// Sort button
let sortDiv = $("<div/>", {
style: "display:table-cell; vertical-align: middle;",
}).appendTo(rowDiv);
let sortButton = $("<a/>", {
href: "#",
class: "editor-button",
style:
"font-size:1.3em; margin-left: 0px; margin-right: 6px;",
}).appendTo(sortDiv);
$(
'<i style="color:#eee; cursor:move; margin-left:3px;" class="node-input-user-handle fa fa-bars"></i>',
).appendTo(sortButton);
// Name input
let nameDiv = $("<div/>", {
style:
"display:table-cell; vertical-align: middle; width:33%;",
}).appendTo(rowDiv);
let nameClass = "node-input-user-name";
if (!user.name) {
nameClass = "node-input-user-name input-error";
}
let nameInput = $("<input/>", {
class: nameClass,
type: "text",
style: "width: 100%;",
placeholder: "e.g. name",
value: user.name,
}).appendTo(nameDiv);
nameInput.keyup(function () {
if ($(this).val() && $(this).hasClass("input-error")) {
$(this).removeClass("input-error");
} else {
if (!$(this).val()) {
$(this).addClass("input-error");
}
}
});
// Authentication input
let authDiv = $("<div/>", {
style:
"display:table-cell; vertical-align: middle; width:33%;",
}).appendTo(rowDiv);
let authProtocolClass = "node-input-user-authProtocol";
let authProtocolSelect = $("<select/>", {
class: authProtocolClass,
type: "text",
style: "width: 100%;",
}).appendTo(authDiv);
let authKeyClass = "node-input-user-authKey";
if (!(user.authProtocol === "none") && !user.authKey) {
authKeyClass = "node-input-user-authKey input-error";
}
let authKeyInput = $("<input/>", {
class: authKeyClass,
type: "text",
style: "width: 100%;",
placeholder: "Key",
value: user.authKey,
}).appendTo(authDiv);
authProtocolSelect.change(function () {
if (
($(this).val() === "none" || authKeyInput.val()) &&
authKeyInput.hasClass("input-error")
) {
authKeyInput.removeClass("input-error");
} else {
if (
!($(this).val() === "none") &&
!authKeyInput.val() &&
!authKeyInput.hasClass("input-error")
) {
authKeyInput.addClass("input-error");
}
}
if (
($(this).val() !== "none" ||
($(this).val() === "none" &&
privProtocolSelect.val() === "none")) &&
privProtocolSelect.hasClass("input-error")
) {
privProtocolSelect.removeClass("input-error");
} else {
if (
$(this).val() === "none" &&
privProtocolSelect.val() !== "none" &&
!privProtocolSelect.hasClass("input-error")
) {
privProtocolSelect.addClass("input-error");
}
}
});
if (user.authProtocol === "none") {
$(
'<option value="none" selected>Disabled</option>',
).appendTo(authProtocolSelect);
} else {
$('<option value="none">Disabled</option>').appendTo(
authProtocolSelect,
);
}
if (user.authProtocol === "md5") {
$('<option value="md5" selected>MD5</option>').appendTo(
authProtocolSelect,
);
} else {
$('<option value="md5">MD5</option>').appendTo(
authProtocolSelect,
);
}
if (user.authProtocol === "sha") {
$('<option value="sha" selected>SHA</option>').appendTo(
authProtocolSelect,
);
} else {
$('<option value="sha">SHA</option>').appendTo(
authProtocolSelect,
);
}
authKeyInput.keyup(function () {
if (
(authProtocolSelect.val() === "none" ||
$(this).val()) &&
$(this).hasClass("input-error")
) {
$(this).removeClass("input-error");
} else {
if (
!(authProtocolSelect.val() === "none") &&
!$(this).val() &&
!$(this).hasClass("input-error")
) {
$(this).addClass("input-error");
}
}
});
// Authentication input
let privDiv = $("<div/>", {
style:
"display:table-cell; vertical-align: middle; width:33%;",
}).appendTo(rowDiv);
let privProtocolClass = "node-input-user-privProtocol";
if (
user.authProtocol === "none" &&
user.privProtocol !== "none"
) {
privProtocolClass =
"node-input-user-privProtocol input-error";
}
let privProtocolSelect = $("<select/>", {
class: privProtocolClass,
type: "text",
style: "width: 100%;",
}).appendTo(privDiv);
let privKeyClass = "node-input-user-privKey";
if (!(user.privProtocol === "none") && !user.privKey) {
privKeyClass = "node-input-user-privKey input-error";
}
let privKeyInput = $("<input/>", {
class: privKeyClass,
type: "text",
style: "width: 100%;",
placeholder: "Key",
value: user.privKey,
}).appendTo(privDiv);
privProtocolSelect.change(function () {
if (
($(this).val() === "none" || privKeyInput.val()) &&
privKeyInput.hasClass("input-error")
) {
privKeyInput.removeClass("input-error");
} else {
if (
!($(this).val() === "none") &&
!privKeyInput.val() &&
!privKeyInput.hasClass("input-error")
) {
privKeyInput.addClass("input-error");
}
}
if (
(authProtocolSelect.val() !== "none" ||
(authProtocolSelect.val() === "none" &&
$(this).val() === "none")) &&
$(this).hasClass("input-error")
) {
$(this).removeClass("input-error");
} else {
if (
authProtocolSelect.val() === "none" &&
$(this).val() !== "none" &&
!$(this).hasClass("input-error")
) {
$(this).addClass("input-error");
}
}
});
if (user.privProtocol === "none") {
$(
'<option value="none" selected>Disabled</option>',
).appendTo(privProtocolSelect);
} else {
$('<option value="none">Disabled</option>').appendTo(
privProtocolSelect,
);
}
if (user.privProtocol === "des") {
$('<option value="des" selected>DES</option>').appendTo(
privProtocolSelect,
);
} else {
$('<option value="des">DES</option>').appendTo(
privProtocolSelect,
);
}
if (user.privProtocol === "aes") {
$('<option value="aes" selected>AES</option>').appendTo(
privProtocolSelect,
);
} else {
$('<option value="aes">AES</option>').appendTo(
privProtocolSelect,
);
}
privKeyInput.keyup(function () {
if (
(privProtocolSelect.val() === "none" ||
$(this).val()) &&
$(this).hasClass("input-error")
) {
$(this).removeClass("input-error");
} else {
if (
!(privProtocolSelect.val() === "none") &&
!$(this).val() &&
!$(this).hasClass("input-error")
) {
$(this).addClass("input-error");
}
}
if (
user.authProtocol === "none" &&
user.privProtocol !== "none"
) {
authProtocolClass =
"node-input-user-privProtocol input-error";
}
});
// Delete button
let deleteDiv = $("<div/>", {
style: "display:table-cell; vertical-align: middle;",
}).appendTo(rowDiv);
let deleteButton = $("<a/>", {
href: "#",
class: "editor-button",
style:
"font-size:1.3em; margin-left: 12px; margin-right: 12px;",
}).appendTo(deleteDiv);
$("<i/>", { class: "fa fa-trash-o" }).appendTo(deleteButton);
deleteButton.click(function () {
container.css({ background: "#fee" });
container.fadeOut(300, function () {
$(this).remove();
});
});
$("#node-input-user-container").append(container);
}
$("#node-input-add-user").click(function () {
generateUser(
$("#node-input-user-container").children().length + 1,
{},
);
$("#node-input-user-container-div").scrollTop(
$("#node-input-user-container-div").get(0).scrollHeight,
);
});
for (let i = 0; i < this.users.length; i++) {
let user = this.users[i];
generateUser(i + 1, user);
}
$("#node-input-user-container").sortable({
axis: "y",
handle: ".node-input-user-handle",
cursor: "move",
});
},
oneditsave: function () {
let node = this;
node.formValue = {};
let communities = $("#node-input-community-container").children();
node.communities = [];
communities.each(function (i) {
let community = $(this);
// communities: {value:[{community:""}]},
let o = {
community: community
.find(".node-input-community-value")
.val(),
};
node.communities.push(o);
});
let users = $("#node-input-user-container").children();
node.users = [];
users.each(function (i) {
let user = $(this);
// users: {value:[{name:"", authProtocol:"", authKey:"", privProtocol:"", privKey:""}]},
let o = {
name: user.find(".node-input-user-name").val(),
authProtocol: user
.find(".node-input-user-authProtocol")
.val(),
authKey: user.find(".node-input-user-authKey").val(),
privProtocol: user
.find(".node-input-user-privProtocol")
.val(),
privKey: user.find(".node-input-user-privKey").val(),
};
node.users.push(o);
});
},
});
</script>
<script type="text/x-red" data-template-name="snmp-trap-listener">
<div class="form-row">
<!--<label for="node-input-name"><i class="icon-tag"></i> Name</label>-->
<!--<input type="text" id="node-input-name" placeholder="Name">-->
</div>
<div class="form-row">
<ul style="background: #fff; min-width: 600px; margin-bottom: 20px;" id="node-input-snmp-trap-tabs"></ul>
</div>
<div id="node-input-tabs-content" style="min-height: 170px;">
<div id="snmp-trap-general-tab" style="display:none">
<div class="form-row">
<label for="node-input-port"><i class="fa fa-link"></i> Port</label>
<input type="number" id="node-input-port"></input>
</div>
<hr>
<div class="header">SNMP Version</div>
<div class="form-row">
<label for="node-input-snmpV1"><i class="fa fa-th-list"></i> v1</label>
<input type="checkbox" id="node-input-snmpV1" style="max-width:10px">
</div>
<div class="form-row">
<label for="node-input-snmpV2"><i class="fa fa-th-list"></i> v2c</label>
<input type="checkbox" id="node-input-snmpV2" style="max-width:10px">
</div>
<div class="form-row">
<label for="node-input-snmpV3"><i class="fa fa-th-list"></i> v3</label>
<input type="checkbox" id="node-input-snmpV3" style="max-width:10px">
</div>
<hr>
<div class="header">IP Filter</div>
<div class="form-row">
<label for="node-input-ipfilter"><i class="fa fa-filter"></i> IP Address</label>
<input type="text" id="node-input-ipfilter" placeholder="127.0.0.1">
</div>
<div class="form-row">
<label for="node-input-ipmask"><i class="fa fa-filter"></i> Network mask</label>
<input type="text" id="node-input-ipmask" placeholder="32">
</div>
</div>
<div id="snmp-trap-community-tab" style="display:none">
<div class="form-row node-input-community-container-row" style="margin-bottom:0px; width:100%;">
<div style="display:inline-block; width:100%; border:1px solid #ccc; border-radius:5px; box-sizing:border-box;">
<div style="width:100%; display: inline-block; background-color:#f3f3f3; padding-top:10px; padding-bottom:10px; border-top:0px solid; border-radius:5px 5px 0 0; border-bottom:1px solid #ccc;">
<div style="width:94%; display:table-row;">
<div style="display:table-cell; text-align: center; vertical-align: middle; width:53px; float:left;"></div>
<div style="display:table-cell; text-align: center; vertical-align: middle; width:100%;">Community String</div>
<div style="display:table-cell; text-align: center; vertical-align: middle; width:60px;">Remove</div>
<div style="display:table-cell; text-align: center; vertical-align: middle; width:22px; float:right;"></div>
</div>
</div>
<div id="node-input-community-container-div" style="height: 273px; padding: 5px; overflow-y:scroll;">
<ol id="node-input-community-container" style="list-style-type:none; margin: 0;"></ol>
</div>
</div>
</div>
<div class="form-row">
<a href="#" class="editor-button editor-button-small" id="node-input-add-community" style="margin-top: 4px;"><i class="fa fa-plus"></i> <span>add</span></a>
</div>
</div>
<div id="snmp-trap-user-tab" style="display:none">
<div class="form-row node-input-user-container-row" style="margin-bottom:0px; width:100%;">
<div style="display:inline-block; width:100%; border:1px solid #ccc; border-radius:5px; box-sizing:border-box;">
<div style="width:100%; display: inline-block; background-color:#f3f3f3; padding-top:10px; padding-bottom:10px; border-top:0px solid; border-radius:5px 5px 0 0; border-bottom:1px solid #ccc;">
<div style="width:94%; display:table-row;">
<div style="display:table-cell; text-align: center; vertical-align: middle; width:53px; float:left;"></div>
<div style="display:table-cell; text-align: center; vertical-align: middle; width:33%;">Username</div>
<div style="display:table-cell; text-align: center; vertical-align: middle; width:33%;">Authentication<br>Protocol / Key</div>
<div style="display:table-cell; text-align: center; vertical-align: middle; width:33%;">Encryption<br>Protocol / Key</div>
<div style="display:table-cell; text-align: center; vertical-align: middle; width:60px;">Remove</div>
<div style="display:table-cell; text-align: center; vertical-align: middle; width:22px; float:right;"></div>
</div>
</div>
<div id="node-input-user-container-div" style="height: 273px; padding: 5px; overflow-y:scroll;">
<ol id="node-input-user-container" style="list-style-type:none; margin: 0;"></ol>
</div>
</div>
</div>
<div class="form-row">
<a href="#" class="editor-button editor-button-small" id="node-input-add-user" style="margin-top: 4px;"><i class="fa fa-plus"></i> <span>add</span></a>
</div>
</div>
</div>
</script>
<script type="text/x-red" data-help-name="snmp-trap-listener">
<p>Receives SNMP Traps</p>
<h3>Configuration Settings</h3>
<p>
<ul>
<li>Port - Sets the port on which to listen for SNMP traps</li>
<li>SNMP Version - Select which version of SNMP should be used.</li>
<li>SNMP v1/v2c:
<ul>
<li>Community - Network community string. The community string acts like a user ID or password. A user with the correct community string has access to network information. The default is public.</li>
</ul>
</li>
<li>SNMP v3
<ul>
<li>Username - Username of the SNMP User-based Security Model (USM) user.</li>
<li>Authentication Protocol - Authentication protocol used to authenticate messages sent on behalf of the specified Username.</li>
<li>Authentication Key - Authentication key used by the selected authentication protocol.</li>
<li>Encryption Protocol - Encryption protocol used to encrypt messages sent on behalf of the specified Username.</li>
<li>Encryption Key - Encryption key used by the selected encryption protocol.</li>
</ul>
</li>
<li>IP Filter:
<ul>
<li>IP Address - Base IP address used for the filter.</li>
<li>Network mask - Network mask used to calculate the filter IP address range.<br>
It can be in four-part dotted-decimal format: 255.255.255.0<br>
or in CIDR (Classless Inter-Domain Routing) notation: 24</li>
</ul>
</li>
</ul>
</p>
<p>
Example of IP filter:<br>
<table style="border-collapse: collapse; border: 2px solid rgb(200, 200, 200); letter-spacing: 1px; font-family: sans-serif; font-size: .6rem; ">
<thead style="background-color: #3f87a6; color: #fff;">
<tr>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">IP Address</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">Network mask</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">Filter Start</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">Filter End</td>
</tr>
</thead>
<tbody style="background-color: #e4f0f5;">
<tr>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">192.168.1.1</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">24</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">192.168.1.1</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">192.168.1.254</td>
</tr>
<tr>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">192.168.1.1</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">255.255.255.0</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">10.0.1.1</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">10.0.1.254</td>
</tr>
<tr>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">10.0.1.25</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">30</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">10.0.1.25</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">10.0.1.26</td>
</tr>
<tr>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">10.0.1.25</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">255.255.255.252</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">10.0.1.25</td>
<td style="border: 1px solid rgb(190, 190, 190); padding: 5px 10px;">10.0.1.26</td>
</tr>
</tbody>
</table>
</p>
<h3>Output</h3>
<p>
Outputs an object called <b>msg</b> containing <b>msg.payload</b> with an array of variable bindings.<br>
</p>
<h4>SNMP v1</h4>
<p>
<code>
{<br>
"payload":[<br>
{<br>
"oid":"1.3.6.1.4.1.13576.10.1.40.4.4.2",<br>
"typename":"OctetString",<br>
"value":[80,108,99,32,83,116,97,114,116],<br>
"string_value":"Plc Start"<br>
}<br>
],<br>
"enterprise":"1.3.6.1.4.1.13576",<br>
"agent_addr":"10.0.1.125",<br>
"generic_trap":6,<br>
"specific_trap":2,<br>
"time_stamp":8932,<br>
"src":{<br>
"family":"IPv4",<br>
"address":"10.0.1.125",<br>
"port":44688<br>
},<br>
"version":0,<br>
"string_version":"Trap",<br>
"_msgid":"e7f3490e.2320d8"<br>
}
</code><br>
</p>
<h4>SNMP v2c/v3</h4>
<p>
<code>
{<br>
"payload":[<br>
{<br>
"oid":"1.3.6.1.2.1.1.3.0",<br>
"typename":"TimeTicks",<br>
"value":760,<br>
"string_value":"760"<br>
},<br>
{<br>
"oid":"1.3.6.1.6.3.1.1.4.1.0",<br>
"typename":"OID",<br>
"value":"1.3.6.1.4.1.13576.0.2",<br>
"string_value":"1.3.6.1.4.1.13576.0.2"<br>
},<br>
{<br>
"oid":"1.3.6.1.4.1.13576.10.1.40.4.4.2",<br>
"typename":"OctetString",<br>
"value":[80,108,99,32,83,116,97,114,116],<br>
"string_value":"Plc Start"<br>
}<br>
],<br>
"src":{<br>
"family":"IPv4",<br>
"address":"10.0.1.125",<br>
"port":28391<br>
},<br>
"version":1,<br>
"string_version":"TrapV2",<br>
"_msgid":"d9562ebf.2f62d"<br>
}
</code>
</p>
</script>