{"id":22807945,"url":"https://github.com/guycole/snmp4sbc","last_synced_at":"2026-04-27T12:01:39.442Z","repository":{"id":265554225,"uuid":"894786269","full_name":"guycole/snmp4sbc","owner":"guycole","description":"SNMP for Single Board Computers such as Raspberry Pi and BeagleBone Black","archived":false,"fork":false,"pushed_at":"2024-12-09T21:07:56.000Z","size":150,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T20:51:57.193Z","etag":null,"topics":["net-snmp","raspberry-pi","raspberrypi","snmp"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guycole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-27T01:43:18.000Z","updated_at":"2024-12-04T00:58:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"b1b135cf-f193-47eb-8b32-66d7dbcdba95","html_url":"https://github.com/guycole/snmp4sbc","commit_stats":null,"previous_names":["guycole/snmp4sbc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/guycole/snmp4sbc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fsnmp4sbc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fsnmp4sbc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fsnmp4sbc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fsnmp4sbc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guycole","download_url":"https://codeload.github.com/guycole/snmp4sbc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fsnmp4sbc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32335297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["net-snmp","raspberry-pi","raspberrypi","snmp"],"created_at":"2024-12-12T11:07:18.433Z","updated_at":"2026-04-27T12:01:39.426Z","avatar_url":"https://github.com/guycole.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# snmp4sbc\nSNMP for Single Board Computers (i.e. \"BeagleBone Black\" or \"Raspberry Pi\")\n\n## Introduction\nThis project is to share my experience using [SNMP](https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol) to manage a fleet of single board computers such as [BeagleBone Black](https://beagleboard.org/black) (etc) or the [Raspberry Pi](https://en.wikipedia.org/wiki/Raspberry_Pi) (etc).\n\nSNMP is mature and well documented, there are several decent books and a great open source implementation provided by the [Net-SNMP](https://en.wikipedia.org/wiki/Net-SNMP) agent and utilities.  I share some advice about configuring and using Net-SNMP and end with extending the agent to monitor GPIO.\n\nI am writing this in November, 2024 and the current source version of Net-SNMP is 5.9.4\n\n## The Players\nWRT54GL Wireless Access Point (all client IP address via DHCP)\n\n| host  | IP address    | interface | role    | type                           | operating system                       |\n|-------|---------------|-----------|---------|--------------------------------|----------------------------------------|\n| bb11  | 192.168.1.109 | wlan0     | agent   | beaglebone black wireless      | Debian 10 Buster                       |\n| rpi4e | 192.168.1.113 | wlan0     | agent   | raspberry pi 4                 | 2024-03-15 64bit rPi OS                |\n| waifu | 192.168.1.126 | wlp0s20f3 | manager | Lenovo Notebook P/N 21FVX001US | Ubuntu 22.04.5 LTS (Jammy Jellyfish)   |\n\n## The Plan (Raspberry Pi)\n1. Simple Start (Notification/Trap)\n    1. Goal: use the snmptrap(1) utility to generate notifications from a rPi to a manager host running tcpdump(8), which demonstrates routing between machines on UDP 162.\n    1. On the agent (rPi) install the SNMP utilities by running ***apt-get install snmp***, which (in November, 2024) installs the Net-SNMP v5.9.3 utilities.\n    1. On the manager, invoke tcpdump(8) (might need to be root) as ***tcpdump -v port 162***\n    1. On the agent (rPi), tweak [trap-demo.sh](https://github.com/guycole/snmp4sbc/blob/main/bin/trap-demo.sh) to have the correct IP address of your manager and then invoke it.\n    1. On the manager, tcpdump(8) should look similar to this:\n        ```\n        22:46:40.250146 IP (tos 0x0, ttl 64, id 2503, offset 0, flags [DF], proto UDP (17), length 122) 192.168.1.113.58095 \u003e waifu.snmp-trap:  { SNMPv2c { V2Trap(79) R=212351885  system.sysUpTime.0=17714770 S:1.1.4.1.0=E:8072.2.3.0.1 E:8072.2.3.2.1=123456 } }\n        ```\n    1. snmptrapd(8) could also be used by the manager to log trap messages.\n1. Simple \"Read Only\" Agent\n    1. Goal: introduce a minimal SNMP agent configuration (rPi), and interrogate it from a manager host.\n    1. On the agent (rPi) install the SNMP agent by running ***apt-get install snmpd***, which (in November, 2024) installs the Net-SNMP v5.9.3 SNMP agent.\n        1. Verify working installation by invoking ***systemctl status snmpd***, the response should be similar to this:\n        ```\n        ● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.\n             Loaded: loaded (/lib/systemd/system/snmpd.service; enabled; preset: enabled)\n             Active: active (running) since Sat 2024-11-30 07:59:56 UTC; 7h ago\n           Main PID: 1232 (snmpd)\n              Tasks: 1 (limit: 8731)\n                CPU: 29.445s\n             CGroup: /system.slice/snmpd.service\n                     └─1232 /usr/sbin/snmpd -LOw -u Debian-snmp -g Debian-snmp -I -smux mteTrigger mteTrigger\u003e \n        ```\n    1. Surprisingly (for a systemd(1) service) journalctl(1) does not contain the agent logs.  snmpd(8) logs to /var/log/snmpd.log\n    1. Now update the agent (rPi) configuration, use [simple.conf](https://github.com/guycole/snmp4sbc/blob/main/config/simple.conf) by copying it to overwrite /etc/snmp/snmpd.conf\n    1. Restart the agent (rPi) by invoking ***systemctl restart snmpd***\n    1. Request the system MIB contents by invoking ***snmpwalk -v 2c -c public 192.168.1.113 1.3.6.1.2.1.1*** (replace the address 192.168.1.113 with the IP address of your rPi).  The result should look like:\n        ```\n        SNMPv2-MIB::sysDescr.0 = STRING: Linux rpi4e 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64\n        SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10\n        DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (19905) 0:03:19.05\n        SNMPv2-MIB::sysContact.0 = STRING: \"hax4bux”\n        SNMPv2-MIB::sysName.0 = STRING: rpi4e\n        SNMPv2-MIB::sysLocation.0 = STRING: \"shasta\"\n        (etc, etc..)\n        ```\n1. Configure SNMP agent to generate start/shutdown traps\n    1. Goal: configure the SNMP agent (rPi) to generate SNMPv2-MIB::coldStart and UCD-SNMP-MIB::ucdShutDown \n    1. On the manager, invoke tcpdump(8) as ***tcpdump -v port 162***\n    1. On the agent (rPi) update the configuration by copying [simple_with_trap.conf](https://github.com/guycole/snmp4sbc/blob/main/config/simple_with_trap.conf) to replace /etc/snmp/snmpd.conf\n        1. Update the IP address to match your manager\n    1. Restart the agent (rPi) by invoking ***systemctl restart snmpd***\n    1. On the agent (rPi) install the SNMP agent by running ***apt-get install snmpd***, which (in November, 2024) installs the Net-SNMP v5.9.3 SNMP agent.\n    1. Note that when you restart the agent, a trap is now generated to announce \"coldStart\"  From tcpdump(8) it looks like:\n        ```\n        09:19:32.472153 IP (tos 0x0, ttl 64, id 54386, offset 0, flags [DF], proto UDP (17), length 123) 192.168.1.113.52157 \u003e waifu.snmp-trap:  { SNMPv2c { V2Trap(80) R=133045648  system.sysUpTime.0=21 S:1.1.4.1.0=S:1.1.5.1 S:1.1.4.3.0=E:8072.3.2.10 } } \n   \n        ```\n    1. If you restart the agent (rPi) again, there will be two traps: One for \"shut down\" and then \"cold start\".\n1. Use MIB names instead of raw OID\n    1. Goal: refer to objects by name instead of using raw OID.  A component of SNMP is the [Management Information Base (MIB)](https://en.wikipedia.org/wiki/Management_information_base)\n    1. The agent and utilities share a common configuration file \"/etc/snmp/snmp.conf\"\n    1. On your manager, locate the \"snmp.conf\" file and update the \"mibdirs\" variable\n        1. On my manager, \"/usr/share/snmp/mibs\" contains enough freely available MIB to work.\n    1. Verify you can now reference items by name instead of OID\n        1. ***snmpwalk -v 2c -c public 192.168.1.113 system***\n1. Monitor Raspberry Pi using the \"Host Resources MIB\"\n    1. Goal: access host resources such as date/time, file systems, CPU, memory, etc.\n    1. The [HOST-RESOURCES-MIB](http://www.net-snmp.org/docs/mibs/host.html) defines how to access this information.\n    1. Example: ***snmpwalk -v 2c -c public 192.168.1.113 host***\n        ```\n        HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (1117912) 3:06:19.12\n        HOST-RESOURCES-MIB::hrSystemDate.0 = STRING: 2024-11-30,20:25:29.0,+0:0\n        HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0 = INTEGER: 393216\n        HOST-RESOURCES-MIB::hrSystemInitialLoadParameters.0 = STRING: \"coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_hdmi=1 snd_b\"\n        HOST-RESOURCES-MIB::hrSystemNumUsers.0 = Gauge32: 5\n        HOST-RESOURCES-MIB::hrSystemProcesses.0 = Gauge32: 206\n        HOST-RESOURCES-MIB::hrSystemMaxProcesses.0 = INTEGER: 0\n        HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 7997476 KBytes\n        HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1\n        (etc, etc...)\n        ```\n\n## The Plan (BeagleBone Black)\n1. Net-SNMP installation notes\n1. Register BeagleBone boot via notification/trap and share IP address\n1. Configure agent to share useful system identification\n1. Extend agent to share GPIO status\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguycole%2Fsnmp4sbc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguycole%2Fsnmp4sbc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguycole%2Fsnmp4sbc/lists"}