[SNMP4J] Re: subclassing Variable

Jeff Ramin ramin at berbee.com
Mon Jun 23 21:56:29 CEST 2008


Thanks Frank. It seems VariantVariableCallback.updateVariable() is
the hook I was looking for.


Frank Fock wrote:
> Hi Jeff,
> 
> You can use http://www.snmp4j.org/doc/org/snmp4j/smi/VariantVariable.html
> However, depending on your requirements other instrumentation
> approaches may fit better. See the AgenPro
> SNMP4J-Instrumentation-HowTo for more details. The PDF is part
> of the AgenPro distribution ZIP (http://www.agentpp.com).
> 
> Best regards,
> Frank
> 
> 
> Jeff Ramin wrote:
>>
>> I've been looking at the javadoc some more, looking for a Variable class
>> that I could extend...
>>
>> I was hoping to see an abstract method for all Variables that could be 
>> used
>> for retrieving a value, but one doesn't seem to exist.
>>
>> Is my only option here to create my own direct descendant of Variable, 
>> which
>> would implement all abstract methods?
>>
>>
>>  > Hi folks.
>>  >
>>  > I want to be able to monitor an application, so I'm using SNMP4J-agent
>>  > to provide that functionality (from within the application).
>>  >
>>  > My question is - how would I subclass Variable (or maybe 
>> ManagedObject?)
>>  > do provide data that changes over time? My plan is to create a 
>> ManagedObject
>>  > using MOFactory.createScalar() and handing it a Variable.
>>  >
>>  > Let's say I want to provide an OID that returns the number of rows in
>>  > a DB table. I'd like to have a Variable that grabs that number when a
>>  > request for it is made; in other words, it would support polling. As
>>  > opposed to having a Variable that is updated every X seconds.
>>  >
>>  > Is there a clean way to do this? Thanks!
>>
> 

-- 
Jeffrey Ramin
Berbee
ramin at berbee.com
608.298.1024



More information about the SNMP4J mailing list