Turn your Pi into a network monitor and I/O device
Node-red Ping Monitor
A good starting program is to make a Web Dashboard that shows ping (node-to-node) delay times. The dashboards are defined in the right panel of Node-Red, (Figure 3). Dashboard items are put into groups, and groups are put into tabs. Each tab will be shown as a separate page on your smart phone.
To create our program drag and drop ping and chart nodes on to the flow sheet (Figure 4), and wire the node pairs together. Double click on the ping node and enter the IP address of the node to ping, and how often to ping it. Next double click on the chart node, and enter the dashboard group, size, label and chart time (Figure 5).
After the configuration is done, click the Deploy button on the Node-Red dashboard. The Node-RED dashboard user interface is accessed by entering <IPaddress>:1880/ui (e.g., 192.168.1.102:1880/ui). Figure 7 shows the final dashboard live. Chart data values are shown by clicking on the chart line.
SNMP Nodes
The ping node is quite simple and it returns just the ping value. The snmp node is more complex and it returns multiple pieces of information. To use snmp nodes in a Node-Red program you need some support nodes to parse/pass the payload messages. To send SNMP data to a chart dashboard (Figure 7) the following nodes are used:
- Big Timer triggers the polling of data
- snmp gets SNMP/OID information
- split splits the message into addressable variables
- change puts the OID value into the message playload
- chart shows the payload
The Big Timer node has many options for start and stop event times. By default, the middle output pin will generate a trigger event every minute. The snmp node must be configured with a numeric OID and a node name. The split node needs to split using a comma (,).
The change node is a powerful node that can adjust and move information within the msg and payload items. For this application we need to set the payload with the payload.value (Figure 8).
There are many possible SNMP objects you can monitor. Table 2 shows some of the more commonly monitored OIDs .
Table 2
Objects to Monitor
Object | OID |
---|---|
1 minute CPU Load |
1.3.6.1.4.1.2021.10.1.3.1 |
5 minute CPU Load |
1.3.6.1.4.1.2021.10.1.3.2 |
15 minute CPU Load |
1.3.6.1.4.1.2021.10.1.3.3 |
Idle CPU time (%) |
1.3.6.1.4.1.2021.11.11.0 |
Total RAM in machine |
1.3.6.1.4.1.2021.4.5.0 |
Total RAM used |
1.3.6.1.4.1.2021.4.6.0 |
Total RAM Free |
1.3.6.1.4.1.2021.4.11.0 |
Total disk/partion size(kBytes) |
1.3.6.1.4.1.2021.9.1.6.1 |
Available space on the disk |
1.3.6.1.4.1.2021.9.1.7.1 |
Used space on the disk |
1.3.6.1.4.1.2021.9.1.8.1 |
Figure 11 shows a dashboard where you monitor the CPU load, total free RAM and available disk space.
« Previous 1 2 3 4 Next »
Buy this article as PDF
Pages: 4
(incl. VAT)