{"id":28632645,"url":"https://github.com/worriedlemon/snmpsubagentexample","last_synced_at":"2025-09-01T03:11:12.782Z","repository":{"id":297923627,"uuid":"997887140","full_name":"worriedlemon/SnmpSubagentExample","owner":"worriedlemon","description":"SNMP Subagent example for overriding internal tables","archived":false,"fork":false,"pushed_at":"2025-06-08T10:36:07.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-08T11:27:27.640Z","etag":null,"topics":["net-snmp","snmp-agent","unix"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/worriedlemon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-06-07T12:06:05.000Z","updated_at":"2025-06-08T10:36:11.000Z","dependencies_parsed_at":"2025-06-08T11:40:01.972Z","dependency_job_id":null,"html_url":"https://github.com/worriedlemon/SnmpSubagentExample","commit_stats":null,"previous_names":["worriedlemon/snmpsubagentexample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/worriedlemon/SnmpSubagentExample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worriedlemon%2FSnmpSubagentExample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worriedlemon%2FSnmpSubagentExample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worriedlemon%2FSnmpSubagentExample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worriedlemon%2FSnmpSubagentExample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/worriedlemon","download_url":"https://codeload.github.com/worriedlemon/SnmpSubagentExample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worriedlemon%2FSnmpSubagentExample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273068847,"owners_count":25039911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"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","snmp-agent","unix"],"created_at":"2025-06-12T14:12:15.951Z","updated_at":"2025-09-01T03:11:12.775Z","avatar_url":"https://github.com/worriedlemon.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SNMP Subagent\n\n## Preparation\n\nFirstly, be sure your have downloaded several libraries:\n+ libsnmp-base\n+ libsnmp-dev\n+ libsnmp40\n\nand SNMP tools itself with daemon:\n+ snmp\n+ snmpd\n\nSecondly, for this example to work, you should edit your snmpd.conf file,\nwhich default location is `/etc/snmp/snmpd.conf`. Minimum setup is persented below:\n\n```snmpd.conf\nsysServices    72\n\n# using AgentX\nmaster  agentx\nagentXSocket /var/agentx/master\n\n# address to call for master agent\nagentaddress  udp:localhost:8888\n\n# access control setup\nview   systemonly  included   .1.3.6.1.2.1.1\nview   systemonly  included   .1.3.6.1.2.1.25.4.2  # hrSWRunTable\nview   systemonly  included   .1.3.6.1.2.1.25.5.1  # hrSWRunPerfTable\n\n# setup read-only SNMPv2 community string access\nrocommunity  public default -V systemonly\n\n# include other .conf files\nincludeDir /etc/snmp/snmpd.conf.d\n```\n\nAs this example overrides default internal tables `hrSWRunTable` and `hrSWRunPerfTable`,\nyou should disable them on daemon start. This should be done in daemon init settings, defaultly\nsettled in directory `/lib/systemd/system/snmpd.service` (**for Debian**).\n\nYou need to modify `ExecStart` line like\n\n```service\n...\nExecStart=/usr/sbin/snmpd -LOw -u Debian-snmp -g Debian-snmp -I -{EXCLUDED_MODULES} -f -M {MIB_FILE_DIRECTORIES} -m {IMPORTED_MIB_FILES}\n...\n```\n\nwhere\n+ {EXCLUDED_MODULES} - *comma-separated* excluded modules, in our case - internal tables `hrSWRunTable` and `hrSWRunPerfTable`\n+ {MIB_FILE_DIRECTORIES} - *colon-separated* directories, where the MIB files are located (in this projects is `{SOURCE_DIR}/mibs`)\n+ {IMPORTED_MIB_FILES} - *colon-separed* imported MIB file names without .txt extensions or `ALL`\n\nExample (in this project):\n```service\n...\nExecStart=/usr/sbin/snmpd -LOw -u Debian-snmp -g Debian-snmp -I -smux,hrSWRunTable,hrSWRunPerfTable -f -M /home/user/snmp_test/mibs -m ALL\n...\n```\n\nAfter this, daemon should be reloaded\n```bash\nsystemctl daemon-reload\nsystemctl restart snmpd\n```\n\n## Build\n\nTo build this masterpiece you can type\n\n```bash\nmake all\n```\n\nThere are several targets:\n+ `load/apt` - this target installs required packages using APT\n+ `configure` - this target call `configure.sh` script\n+ `build` - this target creates CMake directory with *Unix Makefiles*\n+ `install` - this target moves program to `./out/` folder\n+ `test` - some `snmpget`, `snmpwalk` and `snmptable` testing\n\n## Running\n\nRunning a program is simple. Considering that you passed the `install` target:\n\n```\nout/snmp_test\n```\n\n`sudo` is also can be important, if your agentx socket is owned by root.\n\nIf you want to include MIB-files, override some environment variables as follows:\n\n```bash\nexport MIBDIRS=$(pwd)/mibs\nexport MIBS=ALL\n```\n\nTo perform some testing you should run target `test`.\n\n```bash\nmake test\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworriedlemon%2Fsnmpsubagentexample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworriedlemon%2Fsnmpsubagentexample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworriedlemon%2Fsnmpsubagentexample/lists"}