---
type: Sensor Reference
title: "Custom SNMP OIDs: extend, pass & AgentX (How-To)"
description: "Expose a script's output over SNMP using the net-snmp extend directive, read under the NET-SNMP-EXTEND-MIB."
resource: "https://snmp-monitoring.info/sensors/custom-oid/"
tags: [sensors]
timestamp: 2026-07-11T00:00:00Z
---

# Custom SNMP OIDs: extend, pass & AgentX (How-To)

Expose a script's output over SNMP using the net-snmp extend directive, read under the NET-SNMP-EXTEND-MIB.

## Related concepts

- Up: [SNMP Sensors & OID Catalog: Every Metric You Can Monitor](/sensors/index.md)

## Frequently asked questions

### How do I add a custom SNMP OID?

Use one of Net-SNMP's three mechanisms: extend to run a script and expose its output under the NET-SNMP-EXTEND-MIB, pass/pass_persist to hand a whole OID subtree to a script, or an AgentX subagent for a compiled/persistent module. For most needs, extend is the simplest — add one line to snmpd.conf and read the result.

### What is snmpd extend?

extend is a snmpd.conf directive that runs a named command and publishes its stdout and exit code over SNMP under the NET-SNMP-EXTEND-MIB (1.3.6.1.4.1.8072.1.3.2). It's the standard way to expose a script's output — a queue depth, a health check, a custom count — as a pollable OID without writing a full subagent.

### Where does extend output appear?

Under nsExtendOutputLine in the NET-SNMP-EXTEND-MIB at 1.3.6.1.4.1.8072.1.3.2, keyed by the name you gave the extend entry. The first line of the command's output is nsExtendOutputLine."name".1, and the command's exit code is available as nsExtendResult."name".

### Which OID should I use for custom metrics?

Put them under your enterprise arc 1.3.6.1.4.1.<PEN>, using a Private Enterprise Number registered to your organisation so they never collide with standard or other-vendor objects. Net-SNMP's extend output uses Net-SNMP's own PEN (8072); for your own MIB objects, use your assigned PEN.

## Source

Concept generated from https://snmp-monitoring.info/sensors/custom-oid/ — the SNMP Monitoring vendor-neutral knowledge base. Content is limited to what that page states (no external claims added here).
