Re: netsnmp_register_table_iterator() failing

bps tech <[email protected]> Sat, 9 Nov 2024 13:04:19 +0530
Newsgroups gmane.network.net-snmp.user
Message-ID <CADsii7de4-dHFsdkgUqHKfhKAUEGiYWNNe_WAqFOr1=WzoXitg@mail.gmail.com>
--===============5348645340254901020==
Content-Type: multipart/alternative; boundary="000000000000e8ad6c062675e5a6"

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

Thanks Brian. No problem.

Anyone else can help please.

Regards,
Bhashkar

On Sat, Nov 9, 2024 at 1:10=E2=80=AFAM Atkins, Brian <[email protected]=
om>
wrote:

> Hi Bhashkar,
>
>
>
> Ok, that makes sense.  Unfortunately, I don=E2=80=99t have any experience=
 using
> the C AgentX API bindings with Net-SNMP.   The Python bindings for AgentX
> that I have used look very different.
>
>
>
> Sorry I couldn=E2=80=99t be more help.
>
> Brian
>
>
>
> *From:* bps tech <[email protected]>
> *Sent:* Friday, November 8, 2024 12:26 PM
> *To:* Atkins, Brian <[email protected]>
> *Cc:* [email protected]
> *Subject:* Re: netsnmp_register_table_iterator() failing
>
>
>
> You don't often get email from [email protected]. Learn why this is
> important <https://aka.ms/LearnAboutSenderIdentification>
>
>
>
> *EXTERNAL EMAIL - USE CAUTION when clicking links or attachments *
>
>
>
> Hi Brian,
>
>
>
> Thanks for the quick reply. I understand your point, however it will take
> it's own time if I am going with private enterprise  number, controlled b=
y
> IANA.
>
>
>
> But for now, could you help me what mistake I might be doing.
>
>
>
> I hope it is possible to extend MIB-2 standard interface, I found this
> example to extend standard MIB-2 interface over internet.
>
>
>
> Thanks & Regards,
>
> Bhashkar
>
>
>
> On Sat, Nov 9, 2024 at 12:43=E2=80=AFAM Atkins, Brian <Brian.Atkins@netap=
p.com>
> wrote:
>
> First, you shouldn=E2=80=99t be adding things to MIB-2, it is standards
> controlled. If you want to add a MIB branch, you should do it under the
> enterprise branch (1.3.6.1.4.1).  You=E2=80=99ll need a private enterpris=
e number,
> which are controlled by the IANA:
> https://www.iana.org/assignments/enterprise-numbers/
> <https://urldefense.com/v3/__https:/www.iana.org/assignments/enterprise-n=
umbers/__;!!Nhn8V6BzJA!QOK9FXfZ00Z3S9NS7Jn4Ip44cbX6yiGOcaBYN9wGKtw929klwBHZ=
p_3qUfPAiWZR6dhBgU_PCOxvyeUQWVp-$>
>
>
>
> You might be able to use the experimental branch (
> http://oid-info.com/get/1.3.6.1.3
> <https://urldefense.com/v3/__http:/oid-info.com/get/1.3.6.1.3__;!!Nhn8V6B=
zJA!QOK9FXfZ00Z3S9NS7Jn4Ip44cbX6yiGOcaBYN9wGKtw929klwBHZp_3qUfPAiWZR6dhBgU_=
PCOxvySQy32Z2$>).
> I=E2=80=99m not sure what=E2=80=99s involved in avoiding collisions on th=
at branch.
>
>
>
> There might be other branches or subbranches that are appropriate that I=
=E2=80=99m
> not aware of.
>
>
>
> Regards,
>
> Brian
>
>
>
> *From:* bps tech <[email protected]>
> *Sent:* Friday, November 8, 2024 11:50 AM
> *To:* [email protected]
> *Subject:* netsnmp_register_table_iterator() failing
>
>
>
> You don't often get email from [email protected]. Learn why this is
> important
> <https://urldefense.com/v3/__https:/aka.ms/LearnAboutSenderIdentification=
__;!!Nhn8V6BzJA!QOK9FXfZ00Z3S9NS7Jn4Ip44cbX6yiGOcaBYN9wGKtw929klwBHZp_3qUfP=
AiWZR6dhBgU_PCOxvyVr1_jF_$>
>
>
>
> *EXTERNAL EMAIL - USE CAUTION when clicking links or attachments *
>
>
>
> Hi,
>
>
>
> I am writing my first code for SNMP. I am trying to extend the MIB-2
> standard interface table. During this process table iterator registration
> function    netsnmp_register_table_iterator(reg, iinfo)   is failing.
>
>
>
> Here is my code:
>
>
>
> void init_myCustomIfTable(void) {
>
>     static oid ifTable_oid[] =3D {1, 3, 6, 1, 2, 1, 2, 99};  // Base OID =
for
> custom table extension
>
>     size_t ifTable_oid_len =3D OID_LENGTH(ifTable_oid);
>
>
>
>     netsnmp_handler_registration *reg;
>
>     netsnmp_table_registration_info *table_info;
>
>     netsnmp_iterator_info *iinfo;
>
>
>
>     AIM_LOG_INFO("init_myCustomIfTable \n");
>
>     // Register the table with the SNMP agent
>
>     reg =3D netsnmp_create_handler_registration("myCustomIfTable",
>
>                                               get_custom_metric_data,
> ifTable_oid,
>
>                                               ifTable_oid_len,
>
>                                               HANDLER_CAN_RONLY);
>
>
>
>     // Error checking for handler registration
>
>     if (!reg) {
>
>
>
>         AIM_LOG_INFO("Failed to create handler registration for
> myCustomIfTable \n");
>
>         return;
>
>     }
>
>
>
>     // Define table structure and columns (e.g., index for ifIndex and
> custom metrics)
>
>     table_info =3D SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
>
>     if (!table_info) {
>
>         AIM_LOG_INFO("Failed to allocate memory for table registration
> info \n");
>
>         return;
>
>     }
>
>
>
>     netsnmp_table_helper_add_index(table_info, ASN_INTEGER, 0);  // Index
> for ifIndex
>
>     table_info->min_column =3D COLUMN_CUSTOM_METRIC1;           // Starti=
ng
> column for custom data
>
>     table_info->max_column =3D COLUMN_CUSTOM_METRIC2;           // Ending
> column for custom data
>
>
>
>     // Define iterator information for table walking
>
>     iinfo =3D SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
>
>     if (!iinfo) {
>
>         AIM_LOG_INFO("Failed to allocate memory for iterator info \n");
>
>         free(table_info);  // Free memory before returning
>
>         return;
>
>     }
>
> iinfo->get_first_data_point =3D get_first_data_point;
>
>     iinfo->get_next_data_point =3D get_next_data_point;
>
>     iinfo->table_reginfo =3D table_info;
>
>
>
>     // Register the table iterator handler
>
>     if (!netsnmp_register_table_iterator(reg, iinfo)) {
>
>         AIM_LOG_INFO("Failed to register table iterator handler for
> myCustomIfTable \n");
>
>         free(iinfo);  // Clean up allocated memory
>
>         free(table_info);  // Clean up allocated memory
>
>         return;
>
>     }
>
> I am attaching my MIB file also.
>
>
>
> Any help in this regard would be highly appreciated.
>
>
>
> Thanks & Regards,
>
> Bhashkar
>
>

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

<div dir=3D"ltr">Thanks Brian. No problem.<div><br></div><div>Anyone else c=
an help please.</div><div><br></div><div>Regards,</div><div>Bhashkar</div><=
/div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">O=
n Sat, Nov 9, 2024 at 1:10=E2=80=AFAM Atkins, Brian &lt;<a href=3D"mailto:B=
[email protected]">[email protected]</a>&gt; wrote:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex"><div class=3D"msg-6079808915=
190651261">





<div lang=3D"EN-US" style=3D"overflow-wrap: break-word;">
<div class=3D"m_-6079808915190651261WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Hi </span>Bhashkar,<u=
></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">Ok, that makes sense.=C2=A0 Unfortunately, I don=E2=
=80=99t have any experience using the C AgentX API bindings with Net-SNMP.=
=C2=A0=C2=A0 The Python bindings for AgentX that I have used look very diff=
erent.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">Sorry I couldn=E2=80=99t be more help.<u></u><u></u>=
</p>
<p class=3D"MsoNormal">Brian<u></u><u></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
<div>
<div style=3D"border-right:none;border-bottom:none;border-left:none;border-=
top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class=3D"MsoNormal"><b><span style=3D"font-size:11pt;font-family:Calibri=
,sans-serif">From:</span></b><span style=3D"font-size:11pt;font-family:Cali=
bri,sans-serif"> bps tech &lt;<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>&gt;
<br>
<b>Sent:</b> Friday, November 8, 2024 12:26 PM<br>
<b>To:</b> Atkins, Brian &lt;<a href=3D"mailto:[email protected]" tar=
get=3D"_blank">[email protected]</a>&gt;<br>
<b>Cc:</b> <a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a><br>
<b>Subject:</b> Re: netsnmp_register_table_iterator() failing<u></u><u></u>=
</span></p>
</div>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<table border=3D"0" cellspacing=3D"0" cellpadding=3D"0" align=3D"left" widt=
h=3D"100%" style=3D"width:100%">
<tbody>
<tr>
<td width=3D"0" style=3D"width:0.3pt;background:rgb(166,166,166);padding:5.=
25pt 1.5pt">
</td>
<td width=3D"100%" style=3D"background:revert;border:revert;color:revert;di=
rection:revert;display:revert;font-size:revert;height:revert;letter-spacing=
:revert;line-height:revert;margin:revert;opacity:revert;outline:revert;over=
flow:revert;padding:revert;table-layout:revert;text-align:revert;text-inden=
t:revert;text-orientation:revert;text-overflow:revert;text-transform:revert=
;vertical-align:revert;white-space:revert;width:revert;word-break:revert;wo=
rd-spacing:revert;writing-mode:revert;zoom:revert">
<div>
<p class=3D"MsoNormal">
<span style=3D"font-size:9pt;font-family:&quot;Segoe UI&quot;,sans-serif;co=
lor:rgb(33,33,33)">You don&#39;t often get email from
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
m</a>. <a href=3D"https://aka.ms/LearnAboutSenderIdentification" target=3D"=
_blank">
Learn why this is important</a> <u></u><u></u></span></p>
</div>
</td>
<td width=3D"75" style=3D"background:revert;border:revert;color:revert;dire=
ction:revert;display:revert;font-size:revert;height:revert;letter-spacing:r=
evert;line-height:revert;margin:revert;opacity:revert;outline:revert;overfl=
ow:revert;padding:revert;table-layout:revert;text-align:revert;text-indent:=
revert;text-orientation:revert;text-overflow:revert;text-transform:revert;v=
ertical-align:revert;white-space:revert;width:revert;word-break:revert;word=
-spacing:revert;writing-mode:revert;zoom:revert">
</td>
</tr>
</tbody>
</table>
<div>
<p class=3D"MsoNormal"><span style=3D"display:none"><u></u>=C2=A0<u></u></s=
pan></p>
<table border=3D"1" cellspacing=3D"0" cellpadding=3D"0" align=3D"left" styl=
e=3D"background:rgb(243,109,109)">
<tbody>
<tr>
<td style=3D"padding:7.5pt">
<p class=3D"MsoNormal">
<b><span style=3D"font-family:Arial,sans-serif;color:black">EXTERNAL EMAIL =
- USE CAUTION when clicking links or attachments
</span></b><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class=3D"MsoNormal" style=3D"margin-bottom:12pt"><br>
<br>
<u></u><u></u></p>
<div>
<div>
<div>
<p class=3D"MsoNormal">Hi Brian, <u></u><u></u></p>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Thanks for the quick reply. I understand your point,=
 however it will take it&#39;s own time if I am going with private=C2=A0ent=
erprise=C2=A0 number, controlled by IANA.<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">But for now, could you help me what mistake I might =
be doing.=C2=A0<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">I hope it is possible to extend MIB-2 standard inter=
face, I found this example to extend standard MIB-2 interface over internet=
.<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Thanks &amp;=C2=A0Regards,<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Bhashkar<u></u><u></u></p>
</div>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div>
<div>
<p class=3D"MsoNormal">On Sat, Nov 9, 2024 at 12:43<span style=3D"font-fami=
ly:Arial,sans-serif">=E2=80=AF</span>AM Atkins, Brian &lt;<a href=3D"mailto=
:[email protected]" target=3D"_blank">[email protected]</a>&gt;=
 wrote:<u></u><u></u></p>
</div>
<blockquote style=3D"border-top:none;border-right:none;border-bottom:none;b=
order-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4=
.8pt;margin-right:0in">
<div>
<div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">First, you shouldn=E2=
=80=99t be adding things to MIB-2, it is standards controlled. If you want =
to add a MIB branch, you should do it under the enterprise
 branch (1.3.6.1.4.1).=C2=A0 You=E2=80=99ll need a private enterprise numbe=
r, which are controlled by the IANA:
<a href=3D"https://urldefense.com/v3/__https:/www.iana.org/assignments/ente=
rprise-numbers/__;!!Nhn8V6BzJA!QOK9FXfZ00Z3S9NS7Jn4Ip44cbX6yiGOcaBYN9wGKtw9=
29klwBHZp_3qUfPAiWZR6dhBgU_PCOxvyeUQWVp-$" target=3D"_blank">
https://www.iana.org/assignments/enterprise-numbers/</a></span><u></u><u></=
u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">You might be able to =
use the experimental branch (<a href=3D"https://urldefense.com/v3/__http:/o=
id-info.com/get/1.3.6.1.3__;!!Nhn8V6BzJA!QOK9FXfZ00Z3S9NS7Jn4Ip44cbX6yiGOca=
BYN9wGKtw929klwBHZp_3qUfPAiWZR6dhBgU_PCOxvySQy32Z2$" target=3D"_blank">http=
://oid-info.com/get/1.3.6.1.3</a>).=C2=A0
 I=E2=80=99m not sure what=E2=80=99s involved in avoiding collisions on tha=
t branch.</span><u></u><u></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">There might be other =
branches or subbranches that are appropriate that I=E2=80=99m not aware of.=
</span><u></u><u></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Regards,</span><u></u=
><u></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Brian</span><u></u><u=
></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
<div>
<div style=3D"border-right:none;border-bottom:none;border-left:none;border-=
top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class=3D"MsoNormal"><b><span style=3D"font-size:11pt;font-family:Calibri=
,sans-serif">From:</span></b><span style=3D"font-size:11pt;font-family:Cali=
bri,sans-serif"> bps tech &lt;<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>&gt;
<br>
<b>Sent:</b> Friday, November 8, 2024 11:50 AM<br>
<b>To:</b> <a href=3D"mailto:[email protected]" target=
=3D"_blank">
[email protected]</a><br>
<b>Subject:</b> netsnmp_register_table_iterator() failing</span><u></u><u><=
/u></p>
</div>
</div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
<table border=3D"0" cellspacing=3D"0" cellpadding=3D"0" align=3D"left" widt=
h=3D"100%" style=3D"width:100%">
<tbody>
<tr>
<td width=3D"0" style=3D"width:0.3pt;background:rgb(166,166,166);padding:5.=
25pt 1.5pt">
</td>
<td width=3D"100%" style=3D"background:revert;border:revert;color:revert;di=
rection:revert;display:revert;font-size:revert;height:revert;letter-spacing=
:revert;line-height:revert;margin:revert;opacity:revert;outline:revert;over=
flow:revert;padding:revert;table-layout:revert;text-align:revert;text-inden=
t:revert;text-orientation:revert;text-overflow:revert;text-transform:revert=
;vertical-align:revert;white-space:revert;width:revert;word-break:revert;wo=
rd-spacing:revert;writing-mode:revert;zoom:revert">
<div>
<p class=3D"MsoNormal">
<span style=3D"font-size:9pt;font-family:&quot;Segoe UI&quot;,sans-serif;co=
lor:rgb(33,33,33)">You don&#39;t often get email from
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
m</a>. <a href=3D"https://urldefense.com/v3/__https:/aka.ms/LearnAboutSende=
rIdentification__;!!Nhn8V6BzJA!QOK9FXfZ00Z3S9NS7Jn4Ip44cbX6yiGOcaBYN9wGKtw9=
29klwBHZp_3qUfPAiWZR6dhBgU_PCOxvyVr1_jF_$" target=3D"_blank">
Learn why this is important</a> </span><u></u><u></u></p>
</div>
</td>
<td width=3D"75" style=3D"background:revert;border:revert;color:revert;dire=
ction:revert;display:revert;font-size:revert;height:revert;letter-spacing:r=
evert;line-height:revert;margin:revert;opacity:revert;outline:revert;overfl=
ow:revert;padding:revert;table-layout:revert;text-align:revert;text-indent:=
revert;text-orientation:revert;text-overflow:revert;text-transform:revert;v=
ertical-align:revert;white-space:revert;width:revert;word-break:revert;word=
-spacing:revert;writing-mode:revert;zoom:revert">
</td>
</tr>
</tbody>
</table>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
<table border=3D"1" cellspacing=3D"0" cellpadding=3D"0" align=3D"left" styl=
e=3D"background:rgb(243,109,109)">
<tbody>
<tr>
<td style=3D"padding:7.5pt">
<p class=3D"MsoNormal">
<b><span style=3D"font-family:Arial,sans-serif;color:black">EXTERNAL EMAIL =
- USE CAUTION when clicking links or attachments
</span></b><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class=3D"MsoNormal" style=3D"margin-bottom:12pt"><u></u>=C2=A0<u></u></p=
>
<div>
<div>
<p class=3D"MsoNormal">Hi,
<u></u><u></u></p>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">I am writing my first code for SNMP. I am trying to =
extend the MIB-2 standard interface table. During this process table iterat=
or registration function=C2=A0 =C2=A0 netsnmp_register_table_iterator(reg,
 iinfo)=C2=A0=C2=A0=C2=A0is failing.=C2=A0<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Here is my code:<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">void init_myCustomIfTable(void) {<br>
<br>
=C2=A0 =C2=A0 static oid ifTable_oid[] =3D {1, 3, 6, 1, 2, 1, 2, 99}; =C2=
=A0// Base OID for custom table extension<br>
<br>
=C2=A0 =C2=A0 size_t ifTable_oid_len =3D OID_LENGTH(ifTable_oid);<br>
<br>
<br>
<br>
=C2=A0 =C2=A0 netsnmp_handler_registration *reg;<br>
<br>
=C2=A0 =C2=A0 netsnmp_table_registration_info *table_info;<br>
<br>
=C2=A0 =C2=A0 netsnmp_iterator_info *iinfo;<br>
<br>
<br>
<br>
=C2=A0 =C2=A0 AIM_LOG_INFO(&quot;init_myCustomIfTable \n&quot;);<br>
<br>
=C2=A0 =C2=A0 // Register the table with the SNMP agent<br>
<br>
=C2=A0 =C2=A0 reg =3D netsnmp_create_handler_registration(&quot;myCustomIfT=
able&quot;,<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 get_custom_metric_data, ifTable_oid,<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 ifTable_oid_len,<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 HANDLER_CAN_RONLY);<br>
<br>
<br>
<br>
=C2=A0 =C2=A0 // Error checking for handler registration<br>
<br>
=C2=A0 =C2=A0 if (!reg) {<br>
<br>
<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 AIM_LOG_INFO(&quot;Failed to create handler reg=
istration for myCustomIfTable \n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;<br>
<br>
=C2=A0 =C2=A0 }<br>
<br>
<br>
<br>
=C2=A0 =C2=A0 // Define table structure and columns (e.g., index for ifInde=
x and custom metrics)<br>
<br>
=C2=A0 =C2=A0 table_info =3D SNMP_MALLOC_TYPEDEF(netsnmp_table_registration=
_info);<br>
<br>
=C2=A0 =C2=A0 if (!table_info) {<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 AIM_LOG_INFO(&quot;Failed to allocate memory fo=
r table registration info \n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;<br>
<br>
=C2=A0 =C2=A0 }<br>
<br>
<br>
<br>
=C2=A0 =C2=A0 netsnmp_table_helper_add_index(table_info, ASN_INTEGER, 0); =
=C2=A0// Index for ifIndex<br>
<br>
=C2=A0 =C2=A0 table_info-&gt;min_column =3D COLUMN_CUSTOM_METRIC1; =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Starting column for custom data<br>
<br>
=C2=A0 =C2=A0 table_info-&gt;max_column =3D COLUMN_CUSTOM_METRIC2; =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Ending column for custom data<br>
<br>
<br>
<br>
=C2=A0 =C2=A0 // Define iterator information for table walking<br>
<br>
=C2=A0 =C2=A0 iinfo =3D SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);<br>
<br>
=C2=A0 =C2=A0 if (!iinfo) {<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 AIM_LOG_INFO(&quot;Failed to allocate memory fo=
r iterator info \n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 free(table_info); =C2=A0// Free memory before r=
eturning<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;<br>
<br>
=C2=A0 =C2=A0 }<br>
<br>
iinfo-&gt;get_first_data_point =3D get_first_data_point;<br>
<br>
=C2=A0 =C2=A0 iinfo-&gt;get_next_data_point =3D get_next_data_point;<br>
<br>
=C2=A0 =C2=A0 iinfo-&gt;table_reginfo =3D table_info;<br>
<br>
<br>
<br>
=C2=A0 =C2=A0 // Register the table iterator handler<br>
<br>
=C2=A0 =C2=A0 if (!netsnmp_register_table_iterator(reg, iinfo)) {<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 AIM_LOG_INFO(&quot;Failed to register table ite=
rator handler for myCustomIfTable \n&quot;);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 free(iinfo); =C2=A0// Clean up allocated memory=
<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 free(table_info); =C2=A0// Clean up allocated m=
emory<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;<br>
<br>
=C2=A0 =C2=A0 }<br>
<br>
I am attaching my MIB file also.<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Any help in this regard would be highly appreciated.=
<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Thanks &amp; Regards,<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal">Bhashkar<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>

</div></blockquote></div>

--000000000000e8ad6c062675e5a6--


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


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

--===============5348645340254901020==--