appending custom command to snmp daemon

Lokesh Chakka <[email protected]> Mon, 14 Jul 2025 16:04:24 +0530
Newsgroups gmane.network.net-snmp.user
Message-ID <CACh--sj358c4i2KN9=_dCyrX2AGGYdQ=C1WeNHf5g8-NAHeGZA@mail.gmail.com>
--===============6778661985469283037==
Content-Type: multipart/alternative; boundary="000000000000c47fd80639e134c6"

--000000000000c47fd80639e134c6
Content-Type: text/plain; charset="UTF-8"

Hello,

I want to extend snmp with one command. I added one line to
/etc/snmp/snmpd.configuration
============================================================================
root@officelaptop:~# tail /etc/snmp/snmpd.conf
#
# rouser: a SNMPv3 read-only access username
#    arguments: username [noauth|auth|priv [OID | -V VIEW [CONTEXT]]]
rouser authPrivUser authpriv -V systemonly

# include a all *.conf files in a directory

rocommunity  public
extend my_own_cmd /usr/bin/echo Hello Lokesh
includeDir /etc/snmp/snmpd.conf.d
root@officelaptop:~#
============================================================================
After that, I did
 sudo systemctl restart snmpd

snmpd started and is active

If I try to execute the command my_own_cmd, I'm seeing the following error.

============================================================================
root@officelaptop:~# sudo snmpwalk -v2c -c public localhost
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."my_own_cmd"
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line.my_own_cmd: Unknown Object
Identifier (Index out of range: my_own_cmd (nsExtendToken))
============================================================================

Can someone help me understand how to fix the issue ?


Thanks & Regards
--
Lokesh Chakka.

--000000000000c47fd80639e134c6
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello,</div><div><br></div><div>I want to extend snmp=
 with one command. I added one line to=C2=A0 /etc/snmp/snmpd.configuration<=
/div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D</div><div><div dir=3D"ltr" class=3D"gmail_signature" data-s=
martmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><d=
iv dir=3D"ltr"><div><div dir=3D"ltr"><div><div>root@officelaptop:~# tail /e=
tc/snmp/snmpd.conf<br>#<br># rouser: a SNMPv3 read-only access username<br>=
# =C2=A0 =C2=A0arguments: username [noauth|auth|priv [OID | -V VIEW [CONTEX=
T]]]<br>rouser authPrivUser authpriv -V systemonly<br><br># include a all *=
.conf files in a directory<br><br>rocommunity =C2=A0public<br>extend my_own=
_cmd /usr/bin/echo Hello Lokesh<br>includeDir /etc/snmp/snmpd.conf.d<br>roo=
t@officelaptop:~#</div><div dir=3D"ltr">
<div></div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D</div>After that, I did=C2=A0<br>=C2=A0sudo systemctl =
restart snmpd</div><div dir=3D"ltr"><br></div><div>snmpd started and is act=
ive</div><div><br></div><div>If I try to execute the command my_own_cmd, I&=
#39;m seeing the following error.</div><div><br>
<div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D</div>

root@officelaptop:~# sudo snmpwalk -v2c -c public localhost NET-SNMP-EXTEND=
-MIB::nsExtendOutput1Line.&quot;my_own_cmd&quot;<br>NET-SNMP-EXTEND-MIB::ns=
ExtendOutput1Line.my_own_cmd: Unknown Object Identifier (Index out of range=
: my_own_cmd (nsExtendToken))</div><div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><br></div><div>Can so=
meone help me understand how to fix the issue ?</div><div><br></div><div di=
r=3D"ltr"><br></div><div dir=3D"ltr">Thanks &amp; Regards<br>--<br>Lokesh C=
hakka.</div></div></div></div></div></div></div></div></div></div></div></d=
iv>

--000000000000c47fd80639e134c6--


--===============6778661985469283037==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============6778661985469283037==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

--===============6778661985469283037==--