wifi_agent

Example of the component leoribg/esp-snmp v1.0.0
# Wi-Fi SNMP agent

This ESP-IDF project connects to an existing 2.4 GHz Wi-Fi network, starts the SNMP agent, and registers four demonstration OIDs in addition to the seven standard system scalars.

## Build and run locally

From the component directory containing `idf_component.yml` (`components/esp-snmp` in the development workspace):

```bash
idf.py -C examples/wifi_agent set-target esp32c6
idf.py -C examples/wifi_agent menuconfig
idf.py -C examples/wifi_agent build
idf.py -C examples/wifi_agent -p COM19 flash monitor
```

Configure **Wi-Fi SNMP example** in the main menu: SSID, password, read community, and UDP port. The default community is `public`, and the default port is `161`. Set the chip target and serial port to match your board. The log reports the assigned IPv4 address.

`main/idf_component.yml` declares `leoribg/esp-snmp` with an `override_path` of `../../..`. This is relative to the manifest and selects the enclosing `components/esp-snmp` during local development.

If cloning the component repository separately, keep its default local directory name `esp-snmp` so that it matches the override dependency name:

```bash
git clone https://github.com/leoribg/esp-snmp.git
cd esp-snmp
```

Then run the example commands above. The GitHub repository must have been published first.

## Create from the Registry

After the component is published:

```bash
idf.py create-project-from-example "leoribg/esp-snmp^1.0.0:wifi_agent"
cd wifi_agent
idf.py set-target esp32c6
idf.py menuconfig
idf.py build
idf.py -p COM19 flash monitor
```

The downloaded example should resolve the published `leoribg/esp-snmp` dependency. If its manifest still contains a local `override_path`, remove that field and keep the version requirement before running `idf.py reconfigure`.

## OIDs

| OID | Type | Value |
| --- | --- | --- |
| `1.3.6.1.4.1.32473.1.1.0` | INTEGER | Seconds since boot, dynamic getter |
| `1.3.6.1.4.1.32473.1.2.0` | Gauge32 | Free heap in bytes, dynamic getter |
| `1.3.6.1.4.1.32473.1.3.0` | OCTET STRING | Firmware version `1.0.0`, static value |
| `1.3.6.1.4.1.32473.1.4.0` | Counter64 | `4294967297`, available only in v2c |

PEN `32473` is reserved for documentation. Replace it with your organization's PEN for production. The [source](main/wifi_agent.c) shows creation, registration, and network event handling using the public API.

## Query

Replace `192.168.1.123` with the IP reported by your board:

```bash
snmpget -v2c -c public -On udp:192.168.1.123:161 1.3.6.1.2.1.1.1.0
snmpwalk -v1 -c public -On udp:192.168.1.123:161 1.3.6.1
snmpwalk -v2c -c public -On udp:192.168.1.123:161 1.3.6.1
snmpbulkwalk -v2c -c public -Cr10 -On udp:192.168.1.123:161 1.3.6.1
```

A complete walk lists ten instances in v1 and eleven in v2c; Counter64 is hidden in v1. SET is rejected in both versions.

To create a project from this example, run:

idf.py create-project-from-example "leoribg/esp-snmp=1.0.0:wifi_agent"

or download archive (~3.72 KB)