Hi,

 

Thanks for the response.

 

Perhaps I'm not explaining myself properly.

 

There will only be ever one instance of the smtpd process we are getting the
variables from.

 

However, the counters are returned with different commands.

 

The 'status' command would return status counters.  These increase over time
and show  total values  since the process was running.

 

The performance counters would be returned using a 'performance get'
command.  These counters relate to a counter  in a period of time, i.e. ten
seconds, 1 minute, one hour etc.

 

So, I thought that it would make sense to have a table with each row
representing a different counter type.

 

The colunns in the row would hold the values  for each counter variable
returned from  the relevant command.

 

Then, if I want to get the value of all counters I could use snmptable.

 

If I wanted a specific value I could use snmpget.

 

Do you still think that its sensible to use a table to represent the data in
this way?

 

 

If so, can I create an index with a string type and call one 'status' and
the other 'performance' and then use that when doing a  get operation.

 

Thanks,

 

Tim

 

 

From: Fulko Hew [mailto:fulko....@gmail.com] 
Sent: 19 February 2015 16:16
To: Tim Culhane
Cc: Net-SNMP Coders
Subject: Re: accessing a specific row in a mib table

 

 

On Thu, Feb 19, 2015 at 7:06 AM, Tim Culhane <tim.j.culh...@gmail.com
<mailto:tim.j.culh...@gmail.com> > wrote:

Hi,

Can anybody explain to me the correct way of setting and retrieving details
for  a specific row in a mib table.

For example, I want to create a shared object to manage a table which holds
rows of data relating to counter values produced by a mail server.

Row 1 would hold status counters, such as total number of messages delivered
Row 2 would contain performance counters such as total number of messages
delivered in the last 10 seconds.


I'm not sure you want a table to hold these items the way you think.
You only want a table if you have multiple instance of each counter.

Let me use your 'email' example and invent some mythical variables.

razorgateSmtpStatusBadHeader
razorgateSmtpStatusUnsupportedMimeType
razorgateSmtpStatusMsgTooLong

razorgateSmtpPerformanceTookTooLong
razorgateSmtpPerformancePeakSimultaneousMsgs

These counters/variables would be the columns in the table.
Each row would represent an instance of the set of variables.
(like each SMTP process)

If you only EVER have a single instance of the variables, then you don't
need (or want) a table containing the variables, (because a single row
would suffice).  Not having a table would then simplify the indexing.

If you need a table then it would look like this:

1.2.3        razorgate
1.2.3.1      razorgateSmtpCountersTable
1.2.3.1.1    razorgateSmtpStatusCountersEntry

1.2.3.1.1.1  razorgateSmtpStatusBadHeader
1.2.3.1.1.2  razorgateSmtpStatusUnsupportedMimeType
1.2.3.1.1.3  razorgateSmtpStatusMsgTooLong
1.2.3.1.1.4  razorgateSmtpPerformanceTookTooLong
1.2.3.1.1.5  razorgateSmtpPerformancePeakSimultaneousMsgs

and the value of MsgTooLong' in row 1 would be located at: 1.2.3.1.1.3.1
the value in row 15 would be located at: 1.2.3.1.1.3.1.15
[Indexes always come last in the OID]

On the other hand, if you only have one instance of each counter/variable,
then
you don't need a table (and probably don't want a table).  In which case
your variables
would look like this:


1.2.3      razorgate
1.2.3.1    razorgateSmtpCounters

1.2.3.1.1  razorgateSmtpStatusBadHeader
1.2.3.1.2  razorgateSmtpStatusUnsupportedMimeType
1.2.3.1.3  razorgateSmtpStatusMsgTooLong
1.2.3.1.4  razorgateSmtpPerformanceTookTooLong
1.2.3.1.5  razorgateSmtpPerformancePeakSimultaneousMsgs

so accessing the value of (you one and only) MsgTooLong' variable would be
at: 1.2.3.1.3.0
[i.e. index  = 0 ]

I want to be able to use snmpget to access just the performance counters
(i.e. all entries in the performance row), and also to access a specific
column value in that row.

So, lets say I define two entry objects in my table:


        razorgateSmtpStatusCountersEntry        OBJECT-TYPE
                SYNTAX          RazorgateSmtpCountersEntry
                MAX-ACCESS      not-accessible
                STATUS          current
                DESCRIPTION     "row holding values of status counters"
                INDEX           {  razorgateTableIndex  }
                ::=  { razorgateSmtpCountersTable 1 }


        razorgateSmtpPerformanceCountersEntry   OBJECT-TYPE
                SYNTAX          RazorgateSmtpCountersEntry
                MAX-ACCESS      not-accessible
                STATUS          current
                DESCRIPTION     "Row to hold values of performance counters"
                INDEX           {  razorgateTableIndex  }
                ::=  { razorgateSmtpCountersTable 2 }

So, the way we index rows in the table is by the razorgateTableIndex field.

For simplicity lets say my top level oid is 1.2.3

If I want to access the smtpdCountersTable I would use 1.2.3.1

If I wanted to access the first row in this table is it just a case of
using:

1.2.3.1.1

?

How then to I access a particular value in the first row, lets say total
number of messages delivered?

If I wanted to use names instead of numbers, how do I refer to a row in a
table?  What name matches the index value?


Rows in tables are identified by their index.
If you have a numeric index, then its a number,
but if you define the index as a string value then you would use a string.

Lastly, when loading my data into the table in the data access functions of
my shared object, how do I distinguish between the individual rows in the
table.  In other words, if I get a get request for just the status counters
how do I decide that this should go in row 1 of the table.

 

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to