NET-SNMP-EXTEND-MIB not showing command output

"Hamilton, Alexander" <[email protected]> Wed, 23 Apr 2025 19:00:53 +0000
Newsgroups gmane.network.net-snmp.user
Message-ID <CH4PR14MB7674C322546F3E1E59FB731EC5BA2@CH4PR14MB7674.namprd14.prod.outlook.com>
--===============5993340512491549302==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_CH4PR14MB7674C322546F3E1E59FB731EC5BA2CH4PR14MB7674namp_"

--_000_CH4PR14MB7674C322546F3E1E59FB731EC5BA2CH4PR14MB7674namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi everyone,

I'm very new to SNMP, Net-SNMP, and the field in general, so please have pa=
tience if there is an obvious fix to this.

I'm trying to configure an extend directive in the net-snmp/27/snmpd.conf f=
ile; I've set it up thus:

extend classmonitor /tmp/classmonitor.sh

I'm just having the script be a simple echo at this point to rule out any s=
cript errors. It looks like:

#!/bin/bash
echo Test

After restarting the daemon with a sudo snap restart net-snmp, the output o=
f the snmpwalk for 1.3.6.1.4.1.8072.1.3.2 has the nsExtendOutFull line show=
 an empty string, and nsExtendResult gives an exit code of 1. The nsExtendC=
ommand line, however, points correctly to /tmp/classmonitor.sh. It seems li=
ke the daemon is somehow not able to get to the file or its output, but the=
 permissions for reading/executing the file and directory align with what I=
 have set for the user. Doing a su with the user running the daemon also sh=
ows that the script outputs fine into the terminal when run by itself.

Any troubleshooting would be much appreciated. Thanks!

-AH


D'YOUVILLE CONFIDENTIALITY NOTICE: This communication, including any attach=
ments, may contain sensitive and/or confidential information and is intende=
d only for the individual or entity to which it is addressed. Any unauthori=
zed review, dissemination, distribution, or copying of this communication i=
s strictly prohibited. If you are not the intended recipient, please contac=
t the sender by reply email and delete and destroy all copies of the origin=
al message.

--_000_CH4PR14MB7674C322546F3E1E59FB731EC5BA2CH4PR14MB7674namp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"#0563C1" vlink=3D"#954F72" style=3D"word-wrap:=
break-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hi everyone,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I&#8217;m very new to SNMP, Net-SNMP, and the field =
in general, so please have patience if there is an obvious fix to this.<o:p=
></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I&#8217;m trying to configure an extend directive in=
 the net-snmp/27/snmpd.conf file; I&#8217;ve set it up thus:<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">extend classmonitor /tmp/classmonitor.sh<o:p></o:p><=
/p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I&#8217;m just having the script be a simple echo at=
 this point to rule out any script errors. It looks like:<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">#!/bin/bash<o:p></o:p></p>
<p class=3D"MsoNormal">echo Test<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">After restarting the daemon with a sudo snap restart=
 net-snmp, the output of the snmpwalk for 1.3.6.1.4.1.8072.1.3.2 has the ns=
ExtendOutFull line show an empty string, and nsExtendResult gives an exit c=
ode of 1. The nsExtendCommand line,
 however, points correctly to /tmp/classmonitor.sh. It seems like the daemo=
n is somehow not able to get to the file or its output, but the permissions=
 for reading/executing the file and directory align with what I have set fo=
r the user. Doing a su with the
 user running the daemon also shows that the script outputs fine into the t=
erminal when run by itself.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Any troubleshooting would be much appreciated. Thank=
s!<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">-AH<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
D&#8217;YOUVILLE CONFIDENTIALITY NOTICE: This communication, including any =
attachments, may contain sensitive and/or confidential information and is i=
ntended only for the individual or entity to which it is addressed. Any una=
uthorized review, dissemination, distribution,
 or copying of this communication is strictly prohibited. If you are not th=
e intended recipient, please contact the sender by reply email and delete a=
nd destroy all copies of the original message.
</body>
</html>

--_000_CH4PR14MB7674C322546F3E1E59FB731EC5BA2CH4PR14MB7674namp_--


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


--===============5993340512491549302==
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

--===============5993340512491549302==--