vp->magic and OID passed by snmpd

This is a discussion on vp->magic and OID passed by snmpd within the SNMP Coders forums, part of the Networking and Network Related category; --===============1221004500== Content-Type: multipart/alternative; boundary="----=_Part_88742_31190690.1182423907177" ------=_Part_88742_31190690.1182423907177 Content-Type: text/plain; charset=ISO-8859-1; ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-21-2007
Shivani Garg
 
Posts: n/a
Default vp->magic and OID passed by snmpd

--===============1221004500==
Content-Type: multipart/alternative;
boundary="----=_Part_88742_31190690.1182423907177"

------=_Part_88742_31190690.1182423907177
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Greetings to all.

I am using the code generated by mib2c for my MIB file. It contains an array
like this.. :

*oid systemInfo_variables_oid[] = { 1, 3, 6, 1, 4, 1, 6305, 1, 10, 1, 2, 1
};*
*struct variable7 systemInfo_variables[] = {*
*.*
*.*
*.*
*/* Out of all the elements of array, one is below, pasting only relevant
code here */*

*#define OVERALLDISKOCCUPANCYINKB 276*

* {OVERALLDISKOCCUPANCYINKB, ASN_UNSIGNED, RONLY,
var_systemDiskStatsNotfyAttrTable, 4, {2, 18, 1, 1}},*

*.*

*.*

*.*

*}*



When I fire a snmpget for OID 1.3.6.1.4.1.6305.1.10.1.2.1.2.18.1.1.1, I get
an error like this:

RFC1155-SMI::enterprises.6305.1.10.1.2.1.2.18.1.2.1 = No Such Instance
currently exists at this OID

In my function, when I print OID and vp->magic, OID passed is correct
whereas vp->magic is not 276 and hence the relevant case for the switch
statement is not hit. snmpd calls var_systemDiskStatsNotfyAttrTable with
incorrect vp->magic. Any anyone give me some pointers on this... I have
copied the relevant code below:

*/*
* var_systemDiskStatsNotfyAttrTable():
* Handle this table separately from the scalar value case.
* The workings of this are basically the same as for var_systemInfo
above.
*/
unsigned char *
var_systemDiskStatsNotfyAttrTable (struct variable *vp,
oid * name,
size_t * length,
int exact,
size_t * var_len,
WriteMethod ** write_method)
{
..*

*.*

*switch (vp->magic)
{
case OVERALLDISKOCCUPANCYINKB:
VAR = (int*)&p_resp->overall_disk_occupancy; /* XXX **

* default:*

* ERROR_MSG(" ");*

* }*

*.*

*.*

*}*

Thanks a lot in advance for your help.

Shivani

------=_Part_88742_31190690.1182423907177
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div>Greetings to all.</div>
<div>&nbsp;</div>
<div>I am using the code generated by mib2c for my MIB file. It contains an array like this.. :</div>
<div>
<p><strong>oid systemInfo_variables_oid[] = { 1, 3, 6, 1, 4, 1, 6305, 1, 10, 1, 2, 1 };</strong></p></div>
<div><strong>struct variable7 systemInfo_variables[] = {</strong></div>
<div><strong>.</strong></div>
<div><strong>.</strong></div>
<div><strong>.</strong></div>
<div><strong>/* Out of all the elements of array, one is below, pasting only relevant code here&nbsp;*/</strong></div>
<div>
<p><strong><font color="#ff6666">#define OVERALLDISKOCCUPANCYINKB&nbsp;&nbsp;276</font></strong></p>
<p><strong>&nbsp;&nbsp;&nbsp; {OVERALLDISKOCCUPANCYINKB, ASN_UNSIGNED, RONLY,<br>&nbsp;&nbsp; var_systemDiskStatsNotfyAttrTable, 4, {2, 18, 1, 1}},</strong></p>
<p><strong>.</strong></p>
<p><strong>.</strong></p>
<p><strong>.</strong></p>
<p><strong>}</strong></p>
<p>&nbsp;</p>
<p>When I fire a snmpget for OID 1.3.6.1.4.1.6305.1.10.1.2.1.2.18.1.1.1, I get an error like this:</p><font face="Helv" size="2">
<p>RFC1155-SMI::enterprises.6305.1.10.1.2.1.2.18.1.2.1 = No Such Instance currently exists at this OID</p></font>
<p>In my function, when I print OID and&nbsp;vp-&gt;magic, OID passed is correct whereas vp-&gt;magic is&nbsp;not 276 and hence the relevant case for the switch statement is not hit. snmpd calls var_systemDiskStatsNotfyAttrTable with incorrect vp-&gt;magic. Any anyone give me some pointers on this... I have copied the relevant code below:
</p>
<p><strong>/*<br>&nbsp;* var_systemDiskStatsNotfyAttrTable():<br>&nbsp;*&nb sp;&nbsp; Handle this table separately from the scalar value case.<br>&nbsp;*&nbsp;&nbsp; The workings of this are basically the same as for var_systemInfo above.<br>&nbsp;*/<br>unsigned char *
<br>var_systemDiskStatsNotfyAttrTable (struct variable *vp,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oid * name,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size_t * length,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int exact,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size_t * var_len,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WriteMethod ** write_method)<br>{<br>.</strong></p>
<p><strong>.</strong></p>
<p><strong>switch (vp-&gt;magic)<br>&nbsp;&nbsp;&nbsp;&nbsp; {<br><font color="#ff0000">&nbsp;&nbsp;&nbsp;&nbsp; case OVERALLDISKOCCUPANCYINKB:<br>&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAR = (int*)&amp;p_resp-&gt;overall_disk_occupancy;&nbsp;/* XXX *</font></strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp; default:</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;ERROR_MSG(&quot; &quot;);</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</strong></p>
<p><strong>.</strong></p>
<p><strong>.</strong></p>
<p><strong>}</strong></p>
<p>Thanks a lot in advance for your help.</p>
<p>Shivani</p></div>

------=_Part_88742_31190690.1182423907177--


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

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
--===============1221004500==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders

--===============1221004500==--

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:34 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0