1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/io/snmp/snmp.html
andres 4b99a5f4d1 Added support for V3
Added support for version 3.
All the existing issues with v1 and v2c are also with v3 e.g.
https://github.com/node-red/node-red-nodes/issues/679
snmp walker will not return more than 1000 objects, all following objects cannot be accessed
Incorrect encryption (privacy) passphrase gives a timeout and not an error (protocol limitation?)
Incorrect community string gives a timeout and not an error (protocol limitation?)
Changes to the node are made with following details:
Node-red v1.2.2
Node.js v12.6.0
Windows_NT 10.0.19841 x64 LE
2020-10-24 11:07:16 +10:00

562 lines
25 KiB
HTML

<script type="text/html" data-template-name="snmp">
<div class="form-row">
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
</div>
<div class="form-row">
<label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
<select type="text" id="node-input-version" style="width:150px;">
<option value="v1">v1</option>
<option value="v2c">v2c</option>
<option value="v3">v3</option>
</select>
<span style="margin-left:50px;">Timeout</span>
<input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
</div>
<div class="form-row">
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
<input type="text" id="node-input-community" placeholder="public">
</div>
<!-- Following Data is used for V3 Only -->
<div class="form-row">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="username">
</div>
<div class="form-row">
<label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth. </label>
<select type="text" id="node-input-auth" style="width:150px;">
<option value="noAuthNoPriv">noAuthNoPriv</option>
<option value="authNoPriv">authNoPriv</option>
<option value="authPriv">authPriv</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authprot"><i class="fa fa-user-secret"></i> Auth.Prot. </label>
<select type="text" id="node-input-authprot" style="width:150px;">
<option value="None">None</option>
<option value="MD5">MD5</option>
<option value="SHA">SHA</option>
</select>
<span style="margin-left:50px;">Priv.Prot.</span>
<select type="text" id="node-input-privprot" style="width:150px;">
<option value="None">None</option>
<option value="DES">DES</option>
<option value="AES">AES</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authkey"><i class="fa fa-user"></i> Auth.Key</label>
<input type="password" id="node-input-authkey" placeholder="Authentication key">
</div>
<div class="form-row">
<label for="node-input-privkey"><i class="fa fa-user"></i> Priv.Key</label>
<input type="password" id="node-input-privkey" placeholder="Encryption key">
</div>
<!-- End of unique data for V3 -->
<div class="form-row">
<label for="node-input-oids"><i class="fa fa-tags"></i> OIDs</label>
<textarea rows="4" cols="60" id="node-input-oids" placeholder="e.g. 1.3.6.1.2.1.1.5.0" style="width:70%;"></textarea>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">Tip: Multiple OIDs can be separated by commas.</div>
</script>
<script type="text/html" data-help-name="snmp">
<p>Simple SNMP oid or oid list fetcher. Triggered by any input.</p>
<p><code>msg.host</code> may contain the host.</p>
<p><code>msg.community</code> may contain the community.</p>
<p><code>msg.username</code> may contain the username.</p>
<p><code>msg.authkey</code> may contain the digest security key.</p>
<p><code>msg.privkey</code> may contain the encryption security key.</p>
<p><code>msg.oid</code> may contain a comma separated list of oids to request. (no spaces)</p>
<p>OIDs must be numeric. iso. is the same a 1. </p>
<p>The node will output <code>msg.payload</code> and <code>msg.oid</code>.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('snmp', {
category: 'network-input',
color: "YellowGreen",
defaults: {
host: { value: "127.0.0.1" },
version: { value: "v1", required: true },
timeout: { value: 5 },
community: { value: "public" },
username: { value: "" },
auth: { value: "noAuthNoPriv", required: true },
authprot: { value: "None", required: true },
privprot: { value: "None", required: true },
authkey: { value: "" },
privkey: { value: "" },
oids: { value: "" },
name: { value: "" }
},
inputs: 1,
outputs: 1,
icon: "snmp.png",
label: function () {
return this.name || "snmp " + this.host;
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
</script>
<script type="text/html" data-template-name="snmp set">
<div class="form-row">
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
</div>
<div class="form-row">
<label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
<select type="text" id="node-input-version" style="width:150px;">
<option value="v1">v1</option>
<option value="v2c">v2c</option>
<!-- Following Data is used for V3 Only -->
<option value="v3">v3</option>
<!-- End of unique data for V3 -->
</select>
<span style="margin-left:50px;">Timeout</span>
<input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
</div>
<div class="form-row">
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
<input type="text" id="node-input-community" placeholder="public">
</div>
<!-- Following Data is used for V3 Only -->
<div class="form-row">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="username">
</div>
<div class="form-row">
<label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth. </label>
<select type="text" id="node-input-auth" style="width:150px;">
<option value="noAuthNoPriv">noAuthNoPriv</option>
<option value="authNoPriv">authNoPriv</option>
<option value="authPriv">authPriv</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authprot"><i class="fa fa-user-secret"></i> Auth.Prot. </label>
<select type="text" id="node-input-authprot" style="width:150px;">
<option value="None">None</option>
<option value="MD5">MD5</option>
<option value="SHA">SHA</option>
</select>
<span style="margin-left:50px;">Priv.Prot.</span>
<select type="text" id="node-input-privprot" style="width:150px;">
<option value="None">None</option>
<option value="DES">DES</option>
<option value="AES">AES</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authkey"><i class="fa fa-user"></i> Auth.Key</label>
<input type="password" id="node-input-authkey" placeholder="Authentication key">
</div>
<div class="form-row">
<label for="node-input-privkey"><i class="fa fa-user"></i> Priv.Key</label>
<input type="password" id="node-input-privkey" placeholder="Encryption key">
</div>
<!-- End of unique data for V3 -->
<div class="form-row">
<label for="node-input-varbinds"><i class="fa fa-tags"></i> Varbinds</label>
<textarea rows="10" cols="60" id="node-input-varbinds" placeholder="e.g. [ { &quot;oid&quot;: &quot;1.3.6.1.2.1.1.5.0&quot;,&quot;type&quot;: &quot;OctetString&quot;,&quot;value&quot;: &quot;host1&quot;},{&quot;oid&quot;: &quot;1.3.6.1.2.1.1.6.0&quot;,&quot;type&quot;: &quot;OctetString&quot;,value: &quot;somewhere&quot;}]"
style="width:70%;"></textarea>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">Tip: Numeric inputs must be numbers not strings, e.g. 1 not "1".</div>
</script>
<script type="text/html" data-help-name="snmp set">
<p>Simple snmp Set node. Trigger by any input</p>
<p><code>msg.host</code> may contain the host.</p>
<p><code>msg.community</code> may contain the community.</p>
<p><code>msg.username</code> may contain the username.</p>
<p><code>msg.authkey</code> may contain the digest security key.</p>
<p><code>msg.privkey</code> may contain the encryption security key.</p>
<p><code>msg.varbinds</code> may contain varbinds as an array of json objects containing multiple oids, types and values.
<pre>[
{
"oid": "1.3.6.1.2.1.1.5.0",
"type": "OctetString",
"value": "host1"
},
{ "oid": ... }
]</pre>
<p>Any numeric inputs must be numbers, not strings, e.g. 1 not "1".</p>
<p>OIDs must be numeric. iso. is the same a 1.</p>
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('snmp set', {
category: 'network-input',
color: "YellowGreen",
defaults: {
host: { value: "127.0.0.1" },
version: { value: "v1", required: true },
timeout: { value: 5 },
community: { value: "public" },
username: { value: "" },
auth: { value: "noAuthNoPriv", required: true },
authprot: { value: "None", required: true },
privprot: { value: "None", required: true },
authkey: { value: "" },
privkey: { value: "" },
varbinds: { value: "" },
name: { value: "" }
},
inputs: 1,
outputs: 0,
icon: "snmp.png",
label: function () {
return this.name || "snmp set " + this.host;
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
</script>
<script type="text/html" data-template-name="snmp table">
<div class="form-row">
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
</div>
<div class="form-row">
<label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
<select type="text" id="node-input-version" style="width:150px;">
<option value="v1">v1</option>
<option value="v2c">v2c</option>
<!-- Following Data is used for V3 Only -->
<option value="v3">v3</option>
<!-- End of unique data for V3 -->
</select>
<span style="margin-left:50px;">Timeout</span>
<input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
</div>
<div class="form-row">
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
<input type="text" id="node-input-community" placeholder="public">
</div>
<!-- Following Data is used for V3 Only -->
<div class="form-row">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="username">
</div>
<div class="form-row">
<label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth. </label>
<select type="text" id="node-input-auth" style="width:150px;">
<option value="noAuthNoPriv">noAuthNoPriv</option>
<option value="authNoPriv">authNoPriv</option>
<option value="authPriv">authPriv</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authprot"><i class="fa fa-user-secret"></i> Auth.Prot. </label>
<select type="text" id="node-input-authprot" style="width:150px;">
<option value="None">None</option>
<option value="MD5">MD5</option>
<option value="SHA">SHA</option>
</select>
<span style="margin-left:50px;">Priv.Prot.</span>
<select type="text" id="node-input-privprot" style="width:150px;">
<option value="None">None</option>
<option value="DES">DES</option>
<option value="AES">AES</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authkey"><i class="fa fa-user"></i> Auth.Key</label>
<input type="password" id="node-input-authkey" placeholder="Authentication key">
</div>
<div class="form-row">
<label for="node-input-privkey"><i class="fa fa-user"></i> Priv.Key</label>
<input type="password" id="node-input-privkey" placeholder="Encryption key">
</div>
<!-- End of unique data for V3 -->
<div class="form-row">
<label for="node-input-oids"><i class="fa fa-tags"></i> OID</label>
<input type="text" id="node-input-oids" placeholder="e.g. 1.3.6.1.2.1.1.5.0">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">Tip: ONLY accepts a single OID.</div>
</script>
<script type="text/html" data-help-name="snmp table">
<p>Simple SNMP oid table fetcher. Triggered by any input.</p>
<p><code>msg.host</code> may contain the host.</p>
<p><code>msg.community</code> may contain the community.</p>
<p><code>msg.username</code> may contain the username.</p>
<p><code>msg.authkey</code> may contain the digest security key.</p>
<p><code>msg.privkey</code> may contain the encryption security key.</p>
<p><code>msg.oid</code> may contain the oid of a table to request.</p>
<p>OID must be numeric. iso. is the same a 1.</p>
<p>The node will output <code>msg.payload</code> and <code>msg.oid</code>.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('snmp table', {
category: 'network-input',
color: "YellowGreen",
defaults: {
host: { value: "127.0.0.1" },
version: { value: "v1", required: true },
timeout: { value: 5 },
community: { value: "public" },
username: { value: "" },
auth: { value: "noAuthNoPriv", required: true },
authprot: { value: "None", required: true },
privprot: { value: "None", required: true },
authkey: { value: "" },
privkey: { value: "" },
oids: { value: "" },
name: { value: "" }
},
inputs: 1,
outputs: 1,
icon: "snmp.png",
label: function () {
return this.name || "snmp table " + this.host;
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
</script>
<script type="text/html" data-template-name="snmp subtree">
<div class="form-row">
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
</div>
<div class="form-row">
<label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
<select type="text" id="node-input-version" style="width:150px;">
<option value="v1">v1</option>
<option value="v2c">v2c</option>
<!-- Following Data is used for V3 Only -->
<option value="v3">v3</option>
<!-- End of unique data for V3 -->
</select>
<span style="margin-left:50px;">Timeout</span>
<input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
</div>
<div class="form-row">
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
<input type="text" id="node-input-community" placeholder="public">
</div>
<!-- Following Data is used for V3 Only -->
<div class="form-row">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="username">
</div>
<div class="form-row">
<label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth. </label>
<select type="text" id="node-input-auth" style="width:150px;">
<option value="noAuthNoPriv">noAuthNoPriv</option>
<option value="authNoPriv">authNoPriv</option>
<option value="authPriv">authPriv</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authprot"><i class="fa fa-user-secret"></i> Auth.Prot. </label>
<select type="text" id="node-input-authprot" style="width:150px;">
<option value="None">None</option>
<option value="MD5">MD5</option>
<option value="SHA">SHA</option>
</select>
<span style="margin-left:50px;">Priv.Prot.</span>
<select type="text" id="node-input-privprot" style="width:150px;">
<option value="None">None</option>
<option value="DES">DES</option>
<option value="AES">AES</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authkey"><i class="fa fa-user"></i> Auth.Key</label>
<input type="password" id="node-input-authkey" placeholder="Authentication key">
</div>
<div class="form-row">
<label for="node-input-privkey"><i class="fa fa-user"></i> Priv.Key</label>
<input type="password" id="node-input-privkey" placeholder="Encryption key">
</div>
<!-- End of unique data for V3 -->
<div class="form-row">
<label for="node-input-oids"><i class="fa fa-tags"></i> OID</label>
<input type="text" id="node-input-oids" placeholder="e.g. 1.3.6.1.2.1.1.5.0">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">Tip: ONLY accepts a single OID (node).</div>
</script>
<script type="text/html" data-help-name="snmp subtree">
<p>Simple SNMP oid subtree fetcher. Triggered by any input. Reads all OIDS at and below the current base OID.</p>
<p><code>msg.host</code> may contain the host.</p>
<p><code>msg.community</code> may contain the community.</p>
<p><code>msg.username</code> may contain the username.</p>
<p><code>msg.authkey</code> may contain the digest security key.</p>
<p><code>msg.privkey</code> may contain the encryption security key.</p>
<p><code>msg.oid</code> may contain the oid of a table to request.</p>
<p>OID must be numeric. iso. is the same a 1. </p>
<p>The node will output <code>msg.payload</code> and <code>msg.oid</code>.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('snmp subtree', {
category: 'network-input',
color: "YellowGreen",
defaults: {
host: { value: "127.0.0.1" },
version: { value: "v1", required: true },
timeout: { value: 5 },
community: { value: "public" },
username: { value: "" },
auth: { value: "noAuthNoPriv", required: true },
authprot: { value: "None", required: true },
privprot: { value: "None", required: true },
authkey: { value: "" },
privkey: { value: "" },
oids: { value: "" },
name: { value: "" }
},
inputs: 1,
outputs: 1,
icon: "snmp.png",
label: function () {
return this.name || "snmp subtree " + this.host;
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
</script>
<script type="text/html" data-template-name="snmp walker">
<div class="form-row">
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
</div>
<div class="form-row">
<label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
<select type="text" id="node-input-version" style="width:150px;">
<option value="v1">v1</option>
<option value="v2c">v2c</option>
<!-- Following Data is used for V3 Only -->
<option value="v3">v3</option>
<!-- End of unique data for V3 -->
</select>
<span style="margin-left:50px;">Timeout</span>
<input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
</div>
<div class="form-row">
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
<input type="text" id="node-input-community" placeholder="public">
</div>
<!-- Following Data is used for V3 Only -->
<div class="form-row">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="username">
</div>
<div class="form-row">
<label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth. </label>
<select type="text" id="node-input-auth" style="width:150px;">
<option value="noAuthNoPriv">noAuthNoPriv</option>
<option value="authNoPriv">authNoPriv</option>
<option value="authPriv">authPriv</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authprot"><i class="fa fa-user-secret"></i> Auth.Prot. </label>
<select type="text" id="node-input-authprot" style="width:150px;">
<option value="None">None</option>
<option value="MD5">MD5</option>
<option value="SHA">SHA</option>
</select>
<span style="margin-left:50px;">Priv.Prot.</span>
<select type="text" id="node-input-privprot" style="width:150px;">
<option value="None">None</option>
<option value="DES">DES</option>
<option value="AES">AES</option>
</select>
</div>
<div class="form-row">
<label for="node-input-authkey"><i class="fa fa-user"></i> Auth.Key</label>
<input type="password" id="node-input-authkey" placeholder="Authentication key">
</div>
<div class="form-row">
<label for="node-input-privkey"><i class="fa fa-user"></i> Priv.Key</label>
<input type="password" id="node-input-privkey" placeholder="Encryption key">
</div>
<!-- End of unique data for V3 -->
<div class="form-row">
<label for="node-input-oids"><i class="fa fa-tags"></i> OID</label>
<input type="text" id="node-input-oids" placeholder="e.g. 1.3.6.1.2.1.1.5.0">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">Tip: ONLY accepts a single OID (node).</div>
</script>
<script type="text/html" data-help-name="snmp walker">
<p>Simple SNMP oid walker fetcher. Triggered by any input.
Fetches all nodes from this OID to the end of the table.</p>
<p><code>msg.host</code> may contain the host.</p>
<p><code>msg.community</code> may contain the community.</p>
<p><code>msg.username</code> may contain the username.</p>
<p><code>msg.authkey</code> may contain the digest security key.</p>
<p><code>msg.privkey</code> may contain the encryption security key.</p>
<p><code>msg.oid</code> may contain the oid of a table to request.</p>
<p>OID must be numeric. iso. is the same a 1. </p>
<p>The node will output <code>msg.payload</code> and <code>msg.oid</code>.</p>
<p><b>Note</b>: This node does indeed "walk" down the tree. This is different behaviour to
the typical snmpwalk command line app.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('snmp walker', {
category: 'network-input',
color: "YellowGreen",
defaults: {
host: { value: "127.0.0.1" },
version: { value: "v1", required: true },
timeout: { value: 5 },
community: { value: "public" },
username: { value: "" },
auth: { value: "noAuthNoPriv", required: true },
authprot: { value: "None", required: true },
privprot: { value: "None", required: true },
authkey: { value: "" },
privkey: { value: "" },
oids: { value: "" },
name: { value: "" }
},
inputs: 1,
outputs: 1,
icon: "snmp.png",
label: function () {
return this.name || "snmp walker " + this.host;
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
</script>