mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
parent
27a1038993
commit
8f83e471b8
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name" : "node-red-node-snmp",
|
||||
"version" : "0.0.18",
|
||||
"version" : "0.0.19",
|
||||
"description" : "A Node-RED node that looks for SNMP oids.",
|
||||
"dependencies" : {
|
||||
"net-snmp" : "1.1.19"
|
||||
"net-snmp" : "1.2.4"
|
||||
},
|
||||
"repository" : {
|
||||
"type":"git",
|
||||
|
@ -1,7 +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">
|
||||
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
@ -62,7 +62,7 @@
|
||||
<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">
|
||||
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
@ -131,7 +131,7 @@
|
||||
<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">
|
||||
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
@ -192,7 +192,7 @@
|
||||
<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">
|
||||
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
@ -254,7 +254,7 @@
|
||||
<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">
|
||||
<input type="text" id="node-input-host" placeholder="ip address(:optional port)">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-community"><i class="fa fa-user"></i> Community</label>
|
||||
|
@ -7,8 +7,13 @@ module.exports = function (RED) {
|
||||
|
||||
function getSession(host, community, version, timeout) {
|
||||
var sessionKey = host + ":" + community + ":" + version;
|
||||
var port = 161;
|
||||
if (host.indexOf(":") !== -1) {
|
||||
port = host.split(":")[1];
|
||||
host = host.split(":")[0];
|
||||
}
|
||||
if (!(sessionKey in sessions)) {
|
||||
sessions[sessionKey] = snmp.createSession(host, community, { version:version, timeout:(timeout || 5000) });
|
||||
sessions[sessionKey] = snmp.createSession(host, community, { port:port, version:version, timeout:(timeout || 5000) });
|
||||
}
|
||||
return sessions[sessionKey];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user