mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
SNMP Set Node (#325)
* snmp set node * updated readme * readme * added missing {} * corrected naming in variables, removed unused ones * Use snmpObjectType to map types in SnmpSNode * added varbinds as node property * edit priority between node and message * edit help * updated doc * try catch JSON.parse§ * corrected typo in html * Error message in case of JSON parsing error * removing try/catch on JSON.parse for varbinds, as a wrong varbinds will be catched/handled in Session.set() method * edit doc for better presentation
This commit is contained in:
committed by
Dave Conway-Jones
parent
6c3c16f210
commit
24b0cd60bb
@@ -1,8 +1,7 @@
|
||||
|
||||
<script type="text/x-red" 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="localhost">
|
||||
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
|
||||
<input type="text" id="node-input-host" placeholder="localhost">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
@@ -35,33 +34,101 @@
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('snmp',{
|
||||
RED.nodes.registerType('snmp', {
|
||||
category: 'network-input',
|
||||
color:"YellowGreen",
|
||||
color: "YellowGreen",
|
||||
defaults: {
|
||||
host: {value:"127.0.0.1"},
|
||||
community: {value:"public"},
|
||||
version: {value:"1",required:true},
|
||||
oids: {value:""},
|
||||
name: {value:""}
|
||||
host: { value: "127.0.0.1" },
|
||||
community: { value: "public" },
|
||||
version: { value: "1", required: true },
|
||||
oids: { value: "" },
|
||||
name: { value: "" }
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
inputs: 1,
|
||||
outputs: 1,
|
||||
icon: "snmp.png",
|
||||
label: function() {
|
||||
return this.name||"snmp "+this.host;
|
||||
label: function () {
|
||||
return this.name || "snmp " + this.host;
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
labelStyle: function () {
|
||||
return this.name ? "node_label_italic" : "";
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" 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="localhost">
|
||||
</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>
|
||||
<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="1">v1</option>
|
||||
<option value="2c">v2c</option>
|
||||
</select>
|
||||
</div>
|
||||
<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. [ { "oid": "1.3.6.1.2.1.1.5.0","type": "OctetString","value": "host1"},{"oid": "1.3.6.1.2.1.1.6.0","type": "OctetString",value: "somewhere"}]"
|
||||
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>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" 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.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>
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('snmp set', {
|
||||
category: 'network-input',
|
||||
color: "YellowGreen",
|
||||
defaults: {
|
||||
host: { value: "127.0.0.1" },
|
||||
community: { value: "public" },
|
||||
version: { value: "1", required: true },
|
||||
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/x-red" 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="localhost">
|
||||
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
|
||||
<input type="text" id="node-input-host" placeholder="localhost">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
@@ -94,32 +161,33 @@
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('snmp table',{
|
||||
RED.nodes.registerType('snmp table', {
|
||||
category: 'network-input',
|
||||
color:"YellowGreen",
|
||||
color: "YellowGreen",
|
||||
defaults: {
|
||||
host: {value:"127.0.0.1"},
|
||||
community: {value:"public"},
|
||||
version: {value:"1",required:true},
|
||||
oids: {value:""},
|
||||
name: {value:""}
|
||||
host: { value: "127.0.0.1" },
|
||||
community: { value: "public" },
|
||||
version: { value: "1", required: true },
|
||||
oids: { value: "" },
|
||||
name: { value: "" }
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
inputs: 1,
|
||||
outputs: 1,
|
||||
icon: "snmp.png",
|
||||
label: function() {
|
||||
return this.name||"snmp table "+this.host;
|
||||
label: function () {
|
||||
return this.name || "snmp table " + this.host;
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
labelStyle: function () {
|
||||
return this.name ? "node_label_italic" : "";
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" 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="localhost">
|
||||
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
|
||||
<input type="text" id="node-input-host" placeholder="localhost">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
@@ -152,34 +220,35 @@
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('snmp subtree',{
|
||||
RED.nodes.registerType('snmp subtree', {
|
||||
category: 'network-input',
|
||||
color:"YellowGreen",
|
||||
color: "YellowGreen",
|
||||
defaults: {
|
||||
host: {value:"127.0.0.1"},
|
||||
community: {value:"public"},
|
||||
version: {value:"1",required:true},
|
||||
oids: {value:""},
|
||||
name: {value:""}
|
||||
host: { value: "127.0.0.1" },
|
||||
community: { value: "public" },
|
||||
version: { value: "1", required: true },
|
||||
oids: { value: "" },
|
||||
name: { value: "" }
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
inputs: 1,
|
||||
outputs: 1,
|
||||
icon: "snmp.png",
|
||||
label: function() {
|
||||
return this.name||"snmp subtree "+this.host;
|
||||
label: function () {
|
||||
return this.name || "snmp subtree " + this.host;
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
labelStyle: function () {
|
||||
return this.name ? "node_label_italic" : "";
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script type="text/x-red" 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="localhost">
|
||||
<label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
|
||||
<input type="text" id="node-input-host" placeholder="localhost">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
@@ -212,24 +281,25 @@
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('snmp walker',{
|
||||
RED.nodes.registerType('snmp walker', {
|
||||
category: 'network-input',
|
||||
color:"YellowGreen",
|
||||
color: "YellowGreen",
|
||||
defaults: {
|
||||
host: {value:"127.0.0.1"},
|
||||
community: {value:"public"},
|
||||
version: {value:"1",required:true},
|
||||
oids: {value:""},
|
||||
name: {value:""}
|
||||
host: { value: "127.0.0.1" },
|
||||
community: { value: "public" },
|
||||
version: { value: "1", required: true },
|
||||
oids: { value: "" },
|
||||
name: { value: "" }
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
inputs: 1,
|
||||
outputs: 1,
|
||||
icon: "snmp.png",
|
||||
label: function() {
|
||||
return this.name||"snmp walker "+this.host;
|
||||
label: function () {
|
||||
return this.name || "snmp walker " + this.host;
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
labelStyle: function () {
|
||||
return this.name ? "node_label_italic" : "";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</script>
|
Reference in New Issue
Block a user