You can save all the information about Raspberry Pis on a server with SNMP. At first, let take a look and this network protocol.
What is SNMP?
Simple Network Management Protocol (SNMP) is an Internet Standard protocol for collecting and organizing information about managed devices on IP networks and for modifying that information to change device behavior. Devices that typically support SNMP include cable modems, routers, switches, servers, workstations, printers, and more.
So, now you know that you should install some packages to make your Raspberry Pis as an SNMP agent. After that, they can answer SNMP requests of the SNMP server which is another host (a Windows or a Linux box). On the other words, the host can get the status of all your raspberry pis.
Install packages:
sudo apt-get update
sudo apt-get install snmp snmp-mibs-downloader
sudo apt-get install snmpd
SNMPd Configuration, The configuration file is located at /etc/snmp/snmpd.conf
. Make sure you are editing the snmpd.conf
file and not the snmp.conf
file:
sudo nano /etc/snmp/snmp.conf
Change lines like it:
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
rocommunity public default -V all
rocommunity6 public default -V all
Open the daemon’s configuration file with sudo privileges:
sudo nano /etc/snmp/snmpd.conf
Change lines like it:
# Listen for connections from the local system only
# agentAddress udp:127.0.0.1:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161
Start the services:
sudo service snmpd start
Test the SNMP on the local raspberry pi as a test:
snmpwalk –v2c –c public 127.0.0.1 .1.3.6.1.2.1.25.1.1
You would see the result like it:
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (3) 0:00:00.03
Which tells you the uptime of the device. Now you can install snmpd
packages and run snmpwalk
command to gather this configured raspberry pi uptime status from the host. Also you need to change 127.0.0.1
to that raspberry pi IP address or Domain name.
There is a lot of information that you can get from the SNMP server to SNMP agent like, System hostname, IP address, number of packets, storage capacity, UUID, serial number, mac address, etc. Just search about that and add the OID root to the snmp.conf
then request that OID value.
In addition, you can install a featured SNMP server on your host to monitor your raspberry pis. OpenNMS is one of them but I suggest PRTG. You can even create your own snmp OIDs (can be the output of a command) to send for the SNMP server as you said (5 - Type of data ).
In conclusion, you can send raspberry pi pre-arranged information or self-arranged (ANY information you want) to a host which can be a Linux or Windows PC.