Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

snmp.html 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <style id="node-red-node-snmp-common-style">
  2. .form-row.form-row-snmpv1v2.hidden {
  3. display: none !important;
  4. }
  5. .form-row.form-row-snmpv3.hidden {
  6. display: none !important;
  7. }
  8. .form-row.form-row-snmpv3-auth.hidden {
  9. display: none;
  10. }
  11. </style>
  12. <script type="text/javascript" id="node-red-node-snmp-common-script">
  13. const node_snmp_common = {
  14. oneditprepare: function (node) {
  15. const compat = { "v1": "1", "v2": "2c", "v2c": "2c", "v3": "3" };
  16. if(compat[node.version]) {
  17. node.version = compat[node.version];
  18. } else if(["1","2c","3"].indexOf(node.version) < 0) {
  19. node.version = "1";
  20. }
  21. $("#node-input-version").on("change", function(evt) {
  22. const isV3 = $("#node-input-version").val() === "3";
  23. $(".form-row-snmpv1v2").toggleClass("hidden", isV3);
  24. $(".form-row-snmpv3").toggleClass("hidden", !isV3);
  25. $("#node-input-auth").trigger("change");
  26. });
  27. $("#node-input-auth").on("change", function(evt) {
  28. const isV3 = $("#node-input-version").val() === "3";
  29. const auth = $("#node-input-auth").val();
  30. if(isV3) {
  31. switch (auth) {
  32. case "authNoPriv":
  33. $(".form-row-snmpv3-auth").toggleClass("hidden", false);
  34. $(".form-row-snmpv3-priv").toggleClass("hidden", true);
  35. break;
  36. case "authPriv":
  37. $(".form-row-snmpv3-auth").toggleClass("hidden", false);
  38. $(".form-row-snmpv3-priv").toggleClass("hidden", false);
  39. break;
  40. default: //"noAuthNoPriv":
  41. $(".form-row-snmpv3-auth").toggleClass("hidden", true);
  42. $(".form-row-snmpv3-priv").toggleClass("hidden", true);
  43. break;
  44. }
  45. }
  46. });
  47. $("#node-input-version").val(node.version);
  48. if(!$("#node-input-auth").val()) {
  49. $("#node-input-auth").val("noAuthNoPriv");
  50. }
  51. $("#node-input-version").trigger("change");
  52. }
  53. }
  54. </script>
  55. <script type="text/html" data-template-name="snmp">
  56. <div class="form-row">
  57. <label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
  58. <input type="text" id="node-input-host" placeholder="ip address(:optional port)">
  59. </div>
  60. <div class="form-row">
  61. <label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
  62. <select type="text" id="node-input-version" style="width:150px;">
  63. <option value="1">v1</option>
  64. <option value="2c">v2c</option>
  65. <option value="3">v3</option>
  66. </select>
  67. <span style="margin-left:50px;">Timeout</span>
  68. <input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
  69. </div>
  70. <div class="form-row form-row-snmpv1v2">
  71. <label for="node-input-community"><i class="fa fa-user"></i> Community</label>
  72. <input type="text" id="node-input-community" placeholder="public">
  73. </div>
  74. <!-- Following Data is used for V3 Only -->
  75. <div class="form-row form-row-snmpv3">
  76. <label for="node-input-username"><i class="fa fa-user"></i> Username</label>
  77. <input type="text" id="node-input-username" placeholder="username">
  78. </div>
  79. <div class="form-row form-row-snmpv3">
  80. <label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth.</label>
  81. <select type="text" id="node-input-auth" style="width:150px;">
  82. <option value="noAuthNoPriv">noAuthNoPriv</option>
  83. <option value="authNoPriv">authNoPriv</option>
  84. <option value="authPriv">authPriv</option>
  85. </select>
  86. </div>
  87. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  88. <label for="node-input-authprot"><i class="fa fa-shield"></i> Auth.Prot.</label>
  89. <select type="text" id="node-input-authprot" style="width:150px;">
  90. <option value="MD5">MD5</option>
  91. <option value="SHA">SHA</option>
  92. </select>
  93. </div>
  94. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  95. <label for="node-input-authkey"><i class="fa fa-key"></i> Auth.Key</label>
  96. <input type="password" id="node-input-authkey" placeholder="Authentication key">
  97. </div>
  98. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  99. <label for="node-input-privprot"><i class="fa fa-shield"></i> Priv.Prot.</label>
  100. <select type="text" id="node-input-privprot" style="width:150px;">
  101. <option value="DES">DES</option>
  102. <option value="AES">AES</option>
  103. </select>
  104. </div>
  105. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  106. <label for="node-input-privkey"><i class="fa fa-key"></i> Priv.Key</label>
  107. <input type="password" id="node-input-privkey" placeholder="Encryption key">
  108. </div>
  109. <!-- End of unique data for V3 -->
  110. <div class="form-row">
  111. <label for="node-input-oids"><i class="fa fa-tags"></i> OIDs</label>
  112. <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>
  113. </div>
  114. <div class="form-row">
  115. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  116. <input type="text" id="node-input-name" placeholder="Name">
  117. </div>
  118. <div class="form-tips">Tip: Multiple OIDs can be separated by commas.</div>
  119. </script>
  120. <script type="text/html" data-help-name="snmp">
  121. <p>Simple SNMP oid or oid list fetcher. Triggered by any input.</p>
  122. <p><code>msg.host</code> may contain the host.</p>
  123. <p><code>msg.community</code> may contain the community.</p>
  124. <p><code>msg.username</code> may contain the username. (V3 only)</p>
  125. <p><code>msg.authkey</code> may contain the digest security key. (V3 only)</p>
  126. <p><code>msg.privkey</code> may contain the encryption security key. (V3 only)</p>
  127. <p><code>msg.oid</code> may contain a comma separated list of oids to request. (no spaces)</p>
  128. <p>OIDs must be numeric. iso. is the same a 1. </p>
  129. <p>The node will output <code>msg.payload</code> and <code>msg.oid</code>.</p>
  130. </script>
  131. <script type="text/javascript">
  132. RED.nodes.registerType('snmp', {
  133. category: 'network-input',
  134. color: "YellowGreen",
  135. defaults: {
  136. host: { value: "127.0.0.1" },
  137. version: { value: "1", required: true },
  138. timeout: { value: 5 },
  139. community: { value: "public" },
  140. auth: { value: "noAuthNoPriv", required: true },
  141. authprot: { value: "MD5", required: true },
  142. privprot: { value: "DES", required: true },
  143. oids: { value: "" },
  144. name: { value: "" },
  145. },
  146. credentials: {
  147. username: { type: "text" },
  148. authkey: { type: "password" },
  149. privkey: { type: "password" }
  150. },
  151. inputs: 1,
  152. outputs: 1,
  153. icon: "snmp.png",
  154. label: function () {
  155. return this.name || "snmp " + this.host;
  156. },
  157. labelStyle: function () {
  158. return this.name ? "node_label_italic" : "";
  159. },
  160. oneditprepare: function () {
  161. node_snmp_common.oneditprepare(this);
  162. }
  163. });
  164. </script>
  165. <script type="text/html" data-template-name="snmp set">
  166. <div class="form-row">
  167. <label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
  168. <input type="text" id="node-input-host" placeholder="ip address(:optional port)">
  169. </div>
  170. <div class="form-row">
  171. <label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
  172. <select type="text" id="node-input-version" style="width:150px;">
  173. <option value="1">v1</option>
  174. <option value="2c">v2c</option>
  175. <!-- Following Data is used for V3 Only -->
  176. <option value="3">v3</option>
  177. <!-- End of unique data for V3 -->
  178. </select>
  179. <span style="margin-left:50px;">Timeout</span>
  180. <input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
  181. </div>
  182. <div class="form-row form-row-snmpv1v2">
  183. <label for="node-input-community"><i class="fa fa-user"></i> Community</label>
  184. <input type="text" id="node-input-community" placeholder="public">
  185. </div>
  186. <!-- Following Data is used for V3 Only -->
  187. <div class="form-row form-row-snmpv3">
  188. <label for="node-input-username"><i class="fa fa-user"></i> Username</label>
  189. <input type="text" id="node-input-username" placeholder="username">
  190. </div>
  191. <div class="form-row form-row-snmpv3">
  192. <label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth.</label>
  193. <select type="text" id="node-input-auth" style="width:150px;">
  194. <option value="noAuthNoPriv">noAuthNoPriv</option>
  195. <option value="authNoPriv">authNoPriv</option>
  196. <option value="authPriv">authPriv</option>
  197. </select>
  198. </div>
  199. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  200. <label for="node-input-authprot"><i class="fa fa-shield"></i> Auth.Prot.</label>
  201. <select type="text" id="node-input-authprot" style="width:150px;">
  202. <option value="MD5">MD5</option>
  203. <option value="SHA">SHA</option>
  204. </select>
  205. </div>
  206. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  207. <label for="node-input-authkey"><i class="fa fa-key"></i> Auth.Key</label>
  208. <input type="password" id="node-input-authkey" placeholder="Authentication key">
  209. </div>
  210. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  211. <label for="node-input-privprot"><i class="fa fa-shield"></i> Priv.Prot.</label>
  212. <select type="text" id="node-input-privprot" style="width:150px;">
  213. <option value="DES">DES</option>
  214. <option value="AES">AES</option>
  215. </select>
  216. </div>
  217. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  218. <label for="node-input-privkey"><i class="fa fa-key"></i> Priv.Key</label>
  219. <input type="password" id="node-input-privkey" placeholder="Encryption key">
  220. </div>
  221. <!-- End of unique data for V3 -->
  222. <div class="form-row">
  223. <label for="node-input-varbinds"><i class="fa fa-tags"></i> Varbinds</label>
  224. <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; } ]"
  225. style="width:70%;"></textarea>
  226. </div>
  227. <div class="form-row">
  228. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  229. <input type="text" id="node-input-name" placeholder="Name">
  230. </div>
  231. <div class="form-tips">Tip: Numeric inputs must be numbers not strings, e.g. 1 not "1".</div>
  232. </script>
  233. <script type="text/html" data-help-name="snmp set">
  234. <p>Simple snmp Set node. Trigger by any input</p>
  235. <p><code>msg.host</code> may contain the host.</p>
  236. <p><code>msg.community</code> may contain the community.</p>
  237. <p><code>msg.username</code> may contain the username. (V3 only)</p>
  238. <p><code>msg.authkey</code> may contain the digest security key. (V3 only)</p>
  239. <p><code>msg.privkey</code> may contain the encryption security key. (V3 only)</p>
  240. <p><code>msg.varbinds</code> may contain varbinds as an array of json objects containing multiple oids, types and values.
  241. <code style="font-size: smaller;"><pre style="white-space: pre;">[
  242. {
  243. "oid": "1.3.6.1.2.1.1.5.0",
  244. "type": "OctetString",
  245. "value": "host1"
  246. },
  247. { "oid": ... }
  248. ]</pre></code>
  249. <p>Any numeric inputs must be numbers, not strings, e.g. 1 not "1".</p>
  250. <p>OIDs must be numeric. iso. is the same a 1.</p>
  251. </p>
  252. </script>
  253. <script type="text/javascript">
  254. RED.nodes.registerType('snmp set', {
  255. category: 'network-input',
  256. color: "YellowGreen",
  257. defaults: {
  258. host: { value: "127.0.0.1" },
  259. version: { value: "1", required: true },
  260. timeout: { value: 5 },
  261. community: { value: "public" },
  262. auth: { value: "noAuthNoPriv", required: true },
  263. authprot: { value: "MD5", required: true },
  264. privprot: { value: "DES", required: true },
  265. oids: { value: "" },
  266. varbinds: { value: "", validate:function(v) {
  267. try {
  268. return !v || !!JSON.parse(v);
  269. } catch(e) {
  270. return false;
  271. }
  272. }},
  273. name: { value: "" }
  274. },
  275. credentials: {
  276. username: { type: "text" },
  277. authkey: { type: "password" },
  278. privkey: { type: "password" }
  279. },
  280. inputs: 1,
  281. outputs: 0,
  282. icon: "snmp.png",
  283. label: function () {
  284. return this.name || "snmp set " + this.host;
  285. },
  286. labelStyle: function () {
  287. return this.name ? "node_label_italic" : "";
  288. },
  289. oneditprepare: function () {
  290. node_snmp_common.oneditprepare(this);
  291. }
  292. });
  293. </script>
  294. <script type="text/html" data-template-name="snmp table">
  295. <div class="form-row">
  296. <label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
  297. <input type="text" id="node-input-host" placeholder="ip address(:optional port)">
  298. </div>
  299. <div class="form-row">
  300. <label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
  301. <select type="text" id="node-input-version" style="width:150px;">
  302. <option value="1">v1</option>
  303. <option value="2c">v2c</option>
  304. <!-- Following Data is used for V3 Only -->
  305. <option value="3">v3</option>
  306. <!-- End of unique data for V3 -->
  307. </select>
  308. <span style="margin-left:50px;">Timeout</span>
  309. <input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
  310. </div>
  311. <div class="form-row form-row-snmpv1v2">
  312. <label for="node-input-community"><i class="fa fa-user"></i> Community</label>
  313. <input type="text" id="node-input-community" placeholder="public">
  314. </div>
  315. <!-- Following Data is used for V3 Only -->
  316. <div class="form-row form-row-snmpv3">
  317. <label for="node-input-username"><i class="fa fa-user"></i> Username</label>
  318. <input type="text" id="node-input-username" placeholder="username">
  319. </div>
  320. <div class="form-row form-row-snmpv3">
  321. <label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth.</label>
  322. <select type="text" id="node-input-auth" style="width:150px;">
  323. <option value="noAuthNoPriv">noAuthNoPriv</option>
  324. <option value="authNoPriv">authNoPriv</option>
  325. <option value="authPriv">authPriv</option>
  326. </select>
  327. </div>
  328. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  329. <label for="node-input-authprot"><i class="fa fa-shield"></i> Auth.Prot.</label>
  330. <select type="text" id="node-input-authprot" style="width:150px;">
  331. <option value="MD5">MD5</option>
  332. <option value="SHA">SHA</option>
  333. </select>
  334. </div>
  335. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  336. <label for="node-input-authkey"><i class="fa fa-key"></i> Auth.Key</label>
  337. <input type="password" id="node-input-authkey" placeholder="Authentication key">
  338. </div>
  339. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  340. <label for="node-input-privprot"><i class="fa fa-shield"></i> Priv.Prot.</label>
  341. <select type="text" id="node-input-privprot" style="width:150px;">
  342. <option value="DES">DES</option>
  343. <option value="AES">AES</option>
  344. </select>
  345. </div>
  346. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  347. <label for="node-input-privkey"><i class="fa fa-key"></i> Priv.Key</label>
  348. <input type="password" id="node-input-privkey" placeholder="Encryption key">
  349. </div>
  350. <!-- End of unique data for V3 -->
  351. <div class="form-row">
  352. <label for="node-input-oids"><i class="fa fa-tags"></i> OID</label>
  353. <input type="text" id="node-input-oids" placeholder="e.g. 1.3.6.1.2.1.1.5.0">
  354. </div>
  355. <div class="form-row">
  356. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  357. <input type="text" id="node-input-name" placeholder="Name">
  358. </div>
  359. <div class="form-tips">Tip: ONLY accepts a single OID.</div>
  360. </script>
  361. <script type="text/html" data-help-name="snmp table">
  362. <p>Simple SNMP oid table fetcher. Triggered by any input.</p>
  363. <p><code>msg.host</code> may contain the host.</p>
  364. <p><code>msg.community</code> may contain the community.</p>
  365. <p><code>msg.username</code> may contain the username. (V3 only)</p>
  366. <p><code>msg.authkey</code> may contain the digest security key. (V3 only)</p>
  367. <p><code>msg.privkey</code> may contain the encryption security key. (V3 only)</p>
  368. <p><code>msg.oid</code> may contain the oid of a table to request.</p>
  369. <p>OID must be numeric. iso. is the same a 1.</p>
  370. <p>The node will output <code>msg.payload</code> and <code>msg.oid</code>.</p>
  371. </script>
  372. <script type="text/javascript">
  373. RED.nodes.registerType('snmp table', {
  374. category: 'network-input',
  375. color: "YellowGreen",
  376. defaults: {
  377. host: { value: "127.0.0.1" },
  378. version: { value: "1", required: true },
  379. timeout: { value: 5 },
  380. community: { value: "public" },
  381. auth: { value: "noAuthNoPriv", required: true },
  382. authprot: { value: "MD5", required: true },
  383. privprot: { value: "DES", required: true },
  384. oids: { value: "" },
  385. name: { value: "" }
  386. },
  387. credentials: {
  388. username: { type: "text" },
  389. authkey: { type: "password" },
  390. privkey: { type: "password" }
  391. },
  392. inputs: 1,
  393. outputs: 1,
  394. icon: "snmp.png",
  395. label: function () {
  396. return this.name || "snmp table " + this.host;
  397. },
  398. labelStyle: function () {
  399. return this.name ? "node_label_italic" : "";
  400. },
  401. oneditprepare: function () {
  402. node_snmp_common.oneditprepare(this);
  403. }
  404. });
  405. </script>
  406. <script type="text/html" data-template-name="snmp subtree">
  407. <div class="form-row">
  408. <label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
  409. <input type="text" id="node-input-host" placeholder="ip address(:optional port)">
  410. </div>
  411. <div class="form-row">
  412. <label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
  413. <select type="text" id="node-input-version" style="width:150px;">
  414. <option value="1">v1</option>
  415. <option value="2c">v2c</option>
  416. <!-- Following Data is used for V3 Only -->
  417. <option value="3">v3</option>
  418. <!-- End of unique data for V3 -->
  419. </select>
  420. <span style="margin-left:50px;">Timeout</span>
  421. <input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
  422. </div>
  423. <div class="form-row form-row-snmpv1v2">
  424. <label for="node-input-community"><i class="fa fa-user"></i> Community</label>
  425. <input type="text" id="node-input-community" placeholder="public">
  426. </div>
  427. <!-- Following Data is used for V3 Only -->
  428. <div class="form-row form-row-snmpv3">
  429. <label for="node-input-username"><i class="fa fa-user"></i> Username</label>
  430. <input type="text" id="node-input-username" placeholder="username">
  431. </div>
  432. <div class="form-row form-row-snmpv3">
  433. <label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth.</label>
  434. <select type="text" id="node-input-auth" style="width:150px;">
  435. <option value="noAuthNoPriv">noAuthNoPriv</option>
  436. <option value="authNoPriv">authNoPriv</option>
  437. <option value="authPriv">authPriv</option>
  438. </select>
  439. </div>
  440. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  441. <label for="node-input-authprot"><i class="fa fa-shield"></i> Auth.Prot.</label>
  442. <select type="text" id="node-input-authprot" style="width:150px;">
  443. <option value="MD5">MD5</option>
  444. <option value="SHA">SHA</option>
  445. </select>
  446. </div>
  447. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  448. <label for="node-input-authkey"><i class="fa fa-key"></i> Auth.Key</label>
  449. <input type="password" id="node-input-authkey" placeholder="Authentication key">
  450. </div>
  451. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  452. <label for="node-input-privprot"><i class="fa fa-shield"></i> Priv.Prot.</label>
  453. <select type="text" id="node-input-privprot" style="width:150px;">
  454. <option value="DES">DES</option>
  455. <option value="AES">AES</option>
  456. </select>
  457. </div>
  458. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  459. <label for="node-input-privkey"><i class="fa fa-key"></i> Priv.Key</label>
  460. <input type="password" id="node-input-privkey" placeholder="Encryption key">
  461. </div>
  462. <!-- End of unique data for V3 -->
  463. <div class="form-row">
  464. <label for="node-input-oids"><i class="fa fa-tags"></i> OID</label>
  465. <input type="text" id="node-input-oids" placeholder="e.g. 1.3.6.1.2.1.1.5.0">
  466. </div>
  467. <div class="form-row">
  468. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  469. <input type="text" id="node-input-name" placeholder="Name">
  470. </div>
  471. <div class="form-tips">Tip: ONLY accepts a single OID (node).</div>
  472. </script>
  473. <script type="text/html" data-help-name="snmp subtree">
  474. <p>Simple SNMP oid subtree fetcher. Triggered by any input. Reads all OIDS at and below the current base OID.</p>
  475. <p><code>msg.host</code> may contain the host.</p>
  476. <p><code>msg.community</code> may contain the community.</p>
  477. <p><code>msg.username</code> may contain the username. (V3 only)</p>
  478. <p><code>msg.authkey</code> may contain the digest security key. (V3 only)</p>
  479. <p><code>msg.privkey</code> may contain the encryption security key. (V3 only)</p>
  480. <p><code>msg.oid</code> may contain the oid of a table to request.</p>
  481. <p>OID must be numeric. iso. is the same a 1. </p>
  482. <p>The node will output <code>msg.payload</code> and <code>msg.oid</code>.</p>
  483. </script>
  484. <script type="text/javascript">
  485. RED.nodes.registerType('snmp subtree', {
  486. category: 'network-input',
  487. color: "YellowGreen",
  488. defaults: {
  489. host: { value: "127.0.0.1" },
  490. version: { value: "1", required: true },
  491. timeout: { value: 5 },
  492. community: { value: "public" },
  493. auth: { value: "noAuthNoPriv", required: true },
  494. authprot: { value: "MD5", required: true },
  495. privprot: { value: "DES", required: true },
  496. oids: { value: "" },
  497. name: { value: "" }
  498. },
  499. credentials: {
  500. username: { type: "text" },
  501. authkey: { type: "password" },
  502. privkey: { type: "password" }
  503. },
  504. inputs: 1,
  505. outputs: 1,
  506. icon: "snmp.png",
  507. label: function () {
  508. return this.name || "snmp subtree " + this.host;
  509. },
  510. labelStyle: function () {
  511. return this.name ? "node_label_italic" : "";
  512. },
  513. oneditprepare: function () {
  514. node_snmp_common.oneditprepare(this);
  515. }
  516. });
  517. </script>
  518. <script type="text/html" data-template-name="snmp walker">
  519. <div class="form-row">
  520. <label for="node-input-host"><i class="fa fa-globe"></i> Host</label>
  521. <input type="text" id="node-input-host" placeholder="ip address(:optional port)">
  522. </div>
  523. <div class="form-row">
  524. <label for="node-input-version"><i class="fa fa-bookmark"></i> Version</label>
  525. <select type="text" id="node-input-version" style="width:150px;">
  526. <option value="1">v1</option>
  527. <option value="2c">v2c</option>
  528. <!-- Following Data is used for V3 Only -->
  529. <option value="3">v3</option>
  530. <!-- End of unique data for V3 -->
  531. </select>
  532. <span style="margin-left:50px;">Timeout</span>
  533. <input type="text" id="node-input-timeout" placeholder="secs" style="width:50px; direction:rtl; vertical-align:baseline;">&nbsp;S
  534. </div>
  535. <div class="form-row form-row-snmpv1v2">
  536. <label for="node-input-community"><i class="fa fa-user"></i> Community</label>
  537. <input type="text" id="node-input-community" placeholder="public">
  538. </div>
  539. <!-- Following Data is used for V3 Only -->
  540. <div class="form-row form-row-snmpv3">
  541. <label for="node-input-username"><i class="fa fa-user"></i> Username</label>
  542. <input type="text" id="node-input-username" placeholder="username">
  543. </div>
  544. <div class="form-row form-row-snmpv3">
  545. <label for="node-input-auth"><i class="fa fa-user-secret"></i> Auth.</label>
  546. <select type="text" id="node-input-auth" style="width:150px;">
  547. <option value="noAuthNoPriv">noAuthNoPriv</option>
  548. <option value="authNoPriv">authNoPriv</option>
  549. <option value="authPriv">authPriv</option>
  550. </select>
  551. </div>
  552. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  553. <label for="node-input-authprot"><i class="fa fa-shield"></i> Auth.Prot.</label>
  554. <select type="text" id="node-input-authprot" style="width:150px;">
  555. <option value="MD5">MD5</option>
  556. <option value="SHA">SHA</option>
  557. </select>
  558. </div>
  559. <div class="form-row form-row-snmpv3 form-row-snmpv3-auth">
  560. <label for="node-input-authkey"><i class="fa fa-key"></i> Auth.Key</label>
  561. <input type="password" id="node-input-authkey" placeholder="Authentication key">
  562. </div>
  563. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  564. <label for="node-input-privprot"><i class="fa fa-shield"></i> Priv.Prot.</label>
  565. <select type="text" id="node-input-privprot" style="width:150px;">
  566. <option value="DES">DES</option>
  567. <option value="AES">AES</option>
  568. </select>
  569. </div>
  570. <div class="form-row form-row-snmpv3 form-row-snmpv3-priv">
  571. <label for="node-input-privkey"><i class="fa fa-key"></i> Priv.Key</label>
  572. <input type="password" id="node-input-privkey" placeholder="Encryption key">
  573. </div>
  574. <!-- End of unique data for V3 -->
  575. <div class="form-row">
  576. <label for="node-input-oids"><i class="fa fa-tags"></i> OID</label>
  577. <input type="text" id="node-input-oids" placeholder="e.g. 1.3.6.1.2.1.1.5.0">
  578. </div>
  579. <div class="form-row">
  580. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  581. <input type="text" id="node-input-name" placeholder="Name">
  582. </div>
  583. <div class="form-tips">Tip: ONLY accepts a single OID (node).</div>
  584. </script>
  585. <script type="text/html" data-help-name="snmp walker">
  586. <p>Simple SNMP oid walker fetcher. Triggered by any input.
  587. Fetches all nodes from this OID to the end of the table.</p>
  588. <p><code>msg.host</code> may contain the host.</p>
  589. <p><code>msg.community</code> may contain the community.</p>
  590. <p><code>msg.username</code> may contain the username. (V3 only)</p>
  591. <p><code>msg.authkey</code> may contain the digest security key. (V3 only)</p>
  592. <p><code>msg.privkey</code> may contain the encryption security key. (V3 only)</p>
  593. <p><code>msg.oid</code> may contain the oid of a table to request.</p>
  594. <p>OID must be numeric. iso. is the same a 1. </p>
  595. <p>The node will output <code>msg.payload</code> and <code>msg.oid</code>.</p>
  596. <p><b>Note</b>: This node does indeed "walk" down the tree. This is different behaviour to
  597. the typical snmpwalk command line app.</p>
  598. </script>
  599. <script type="text/javascript">
  600. RED.nodes.registerType('snmp walker', {
  601. category: 'network-input',
  602. color: "YellowGreen",
  603. defaults: {
  604. host: { value: "127.0.0.1" },
  605. version: { value: "1", required: true },
  606. timeout: { value: 5 },
  607. community: { value: "public" },
  608. auth: { value: "noAuthNoPriv", required: true },
  609. authprot: { value: "MD5", required: true },
  610. privprot: { value: "DES", required: true },
  611. oids: { value: "" },
  612. name: { value: "" }
  613. },
  614. credentials: {
  615. username: { type: "text" },
  616. authkey: { type: "password" },
  617. privkey: { type: "password" }
  618. },
  619. inputs: 1,
  620. outputs: 1,
  621. icon: "snmp.png",
  622. label: function () {
  623. return this.name || "snmp walker " + this.host;
  624. },
  625. labelStyle: function () {
  626. return this.name ? "node_label_italic" : "";
  627. },
  628. oneditprepare: function () {
  629. node_snmp_common.oneditprepare(this);
  630. }
  631. });
  632. </script>