Setting up the SNMP function on the router so that you can then query OID. For this, all installation steps on the server and client side are shown. Node RED is used in the second step for a web-based display.
For the implementation with Node RED in the second step
Enable the SNMP function on the router.
You can add information to the two parameters “Contact”
and “Location”
.
For the “Operation mode”
parameter, you can restrict the query options.
For the “Listening port”
option, you can specify a port other than the standard port 161. It is important that you then always specify the port when making a request. Otherwise, a client would always use port 161 for the request if it is not specified.
Further settings can be stored under the “Authentication”
tab.
If you need more than just reading rights and need to query deeper structures of the OID. Must be activated for the admin account to access.
The question of who can make a request can be restricted again using “Allowed host”
. In this test, access was granted to everyone.
To access it, you have to make a change in the user administration.
Please select the pencil icon on the right.
Under this mask, you have to enable the “Store password unencrypted”
option for the SNMP query.
The server side of SNMP would then be set up for the time being.
For more information, you can also refer to the manual.
The queries are carried out via a Linux client on the console.
To do this, you need to install a few programs and adjust a few settings. Debian is used as the Linux system.
The “snmp” package must be installed for the query. The command
“sudo apt-get install snmp”
installs the program with all the necessary components.
Next, please install the standard MIB file for SNMP on the computer. This is set up with the command “sudo apt-get install snmp-mibs-downloader”
.
Now you still need to customize settings and store the NetModule MIB file on the computer.
First create a subdirectory in the Linux user's home directory. It is important that the file name is .snmp
. The dot before the name is important for the file.
Please change to the directory .snmp
with the command “cd”
Now a subdirectory for the NetModule MIB file must be created with mkdir
.
Next, a snmp.conf
control file for the MIB file is still needed. This can be created using the “vi”
program.
Output file contents :~/.snmp$ cat snmp.conf mibs +NB-MIB
This entry “mibs +NB-MIB”
must then be stored in this config file so that the NetModule MIB can then be accessed during queries.
You can download the NetModule MIB directly from the router.
The MIB file that you have downloaded still has to be stored in the SNMP subdirectory. This can be done with this command.
:~/.snmp$ ls mibs snmp.conf
:~/.snmp$ ls mibs/ VENDOR-MIB.txt
For the first request a snmpwalk
is used.
The second query is to test whether the NetModule MIB is stored and can be used.
If the OID is needed, you can cancel the resolution to the name or you can translate the name into an OID directly.
:~$ snmptranslate -On -IR serialNumber.0 .1.3.6.1.4.1.31496.10.40.3.0
If a query is to be carried out with SNMP v3
:~$ snmpget -v3 -l authNoPriv -u admin -a SHA -A admin2024 192.168.1.1/ serialNumber.0 NB-MIB::serialNumber.0 = STRING: 00112BFFDF16
The link below takes you to a wiki that describes how to install and set up an LXC container on a NetModule router.
* Set up an LXC container / set-up-lxc
Once the LXC container has been installed, we can install Node-RED.
For the further installation, we need the curl
program on the container. We will then roll out Node-RED on the router using a script.
Next, the Node-RED program is installed via a script file.
Further information on the installation script can be found at this link.
* Node-RED script information github link
The script command for this:
„bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) –node18“
The first question is whether the installation should be carried out under
the “root” user. We only have the “root” user in the container, so
the answer is yes
.
Are you really sure you want to install as root ? (y/N) ? y
If I want to see the installation steps, please also say yes
here
Are you really sure you want to do this ? [y/N] ? y
I don't have a Pi where I install Node-RED on it, so no
here
Would you like to install the Pi-specific nodes ? [y/N] ? n
Running Node-RED update for user root at /root on debian Stop Node-RED \u2714
Remove old version of Node-RED \u2714 Remove old version of Node.js \u2714 20.18.2-1nodesource1 Install Node 18.20.6-1nodesource1 \u2714 v18.20.6 Npm 10.8.2 Clean npm cache \u2714 Install Node-RED core \u2714 4.0.8 Move global nodes to local - Npm rebuild existing nodes \u2714 Install extra Pi nodes - Add shortcut commands \u2714 Update systemd script \u2714
Any errors will be logged to /var/log/nodered-install.log All done.
If you want to test the whole thing first, you can start the Node-RED server manually by entering the command “node-red-start”
.
If you want this to happen automatically when you start the LXC container, you have to set it up with the command “sudo systemctl enable nodered.service”
.
Once you have stored the systemctl for Node-RED, you still have to restart the container for the service to start.
You can access the Node-RED interface via a web browser. Simply enter the IP address of the container and port 1880.
The Node-RED interface will then be displayed.
For Node-RED, further “app nodes”
need to be installed.