[SNMP4J] Re: Basic Question

Petro Peter petropeter at gmail.com
Tue May 8 07:07:16 CEST 2007


Hi,

Since, notifications / traps are sent from Agent to the Manager. Mib should
be registered to some agent so that traps can be sent to the manager.

Can u elaborate your scenario ? then i will be able to help u out.

Regards,
petro


On 5/8/07, sitakanta hotta <skhotta at gmail.com> wrote:
>
> Thanks for the information.
> I could generate the .java file.
>
> I  have few more question:
>
> 1. How do I  send the notifications without being an agent, but still
> using all the generated managed objects?
>
> thanks,
> Hotta
>
> On 5/7/07, Petro Peter <petropeter at gmail.com> wrote:
> >
> > a word or phrase that particular people use in particular situations [x]
> > Hi ,
> >
> > By user guide i meant, AgenPro2Manual_2.6.pdf.
> >
> > For creating the Java File, we can use the AgenPro UI tool. please find
> > the attached document for the steps.
> >
> > After successfully creating the java file, the next step is to register
> > the Java Mib file into snmp4j agent, for this u can refer the TestAgent
> > exxample.
> >
> > Regards,
> > petro
> >
> > On 5/7/07, sitakanta hotta < skhotta at gmail.com> wrote:
> > >
> > > Do I have to pass all the following ones as the command line
> > > parameters(java -cp .;agenpro2.jar com.agentpp.agenpro.AgenPro %*)?
> > > I did that but with no success.
> > >
> > >
> > > agenpro.FileTemplate0=templates\\snmp4j-agent_1_0\\java_filename.vm
> > > agenpro.ExecutionPerModule0=2
> > > agenpro.InputDir0=..\\snmp4j\\src
> > > agenpro.OutputDir0=..\\snmp4j\\src
> > > agenpro.Modules0=My-MIB
> > > agenpro.GenerationTemplate0=templates\\snmp4j-agent_1_0\\java_code.vm
> > >
> > > agenpro.attributes.key.1.3.6.1.4.1.4976.10.1.1.42.2.1.2.1.7.0=noValueValidator
> > > agenpro.attributes.value.1.3.6.1.4.1.4976.10.1.1.42.2.1.2.1.7.0=yes
> > >
> > > agenpro.attributes.key.1.3.6.1.4.1.4976.10.1.1.42.2.0=constructorAccess
> > > agenpro.attributes.value.1.3.6.1.4.1.4976.10.1.1.42.2.0=private
> > >
> > > agenpro.attributes.key.1.3.6.1.4.1.4976.10.1.1.42.2.1.2.1.8.0=noValueValidator
> > > agenpro.attributes.value.1.3.6.1.4.1.4976.10.1.1.42.2.1.2.1.8.0=yes
> > >
> > > agenpro.SelectionTemplate0=templates\\snmp4j-agent_1_0\\select_1module1file.vm
> > >
> > > Do you mean the user guide for agentPro is
> > > SNMP4J-Agent-Instrumentation-HowTo.pdf or some other document?
> > >
> > > thanks,
> > > Hotta
> > >
> > >
> > >
> > > On 5/5/07, Petro Peter < petropeter at gmail.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > Its simple, give some time to go thru AgenPro User Guide. There is
> > > > some problem i faced, in compiling the .java file using the tool. So,
> > > > compile it using java.exe
> > > >
> > > > I prepared the documnt, but I will be able to provide u only on
> > > > Monday. So, u can try till that time, i know u can do it.
> > > >
> > > > regards,
> > > > petro
> > > >
> > > > On 5/5/07, sitakanta hotta < skhotta at gmail.com> wrote:
> > > > >
> > > > > Hi Peter,
> > > > >
> > > > > Great informtaion.
> > > > > I tried creating .java file using AgentPro using the
> > > > > snmp4J-NOTIFICTION_MIB sample file which is there in one of the
> > > > > sub-directories in the agentPro .
> > > > > I do not see any .java file.
> > > > >
> > > > > I followed the steps mentioned in the agentPro pdf doc for
> > > > > creating java file from MIB. I used  GUI tool  instead of any command line.
> > > > > I do not know what steps I am missing . Could you help on this
> > > > > one?
> > > > > If you can send any dummy MIB notification file and steps to
> > > > > create .java file using agentPro, that will be great.
> > > > >
> > > > > I appriciate your help.
> > > > >
> > > > > thanks,
> > > > > Hotta
> > > > >
> > > > >
> > > > > On 5/5/07, Petro Peter <petropeter at gmail.com> wrote:
> > > > > >
> > > > > > Hi,
> > > > > > I used notification using in my project. please follow the below
> > > > > > steps.
> > > > > >
> > > > > > - Create Java file for the new MIB file created usinf AgenPro
> > > > > > tool.
> > > > > > - Then create the SNMP4J agent, please refer the TestAgent code
> > > > > > for example.
> > > > > > - Load the newly created Mib file into the agent.
> > > > > > - While creating the istance of Mib, pass the reference of
> > > > > > Notification Originator
> > > > > > - Now, whenever a value is set on a given mib object, Mib
> > > > > > class's validation class methods will be called.
> > > > > > - We can send the notification from the validation class, using
> > > > > > the reference.
> > > > > >
> > > > > > Find below the code snippet fromm the Mib file.
> > > > > >
> > > > > > [code]
> > > > > >     public class NotificationLevel extends MOScalar
> > > > > >     {
> > > > > >         NotificationLevel(OID oid, MOAccess access)
> > > > > >         {
> > > > > >             super(oid, access, new Integer32());
> > > > > > //--AgentGen BEGIN=notificationLevel
> > > > > > //--AgentGen END
> > > > > >         }
> > > > > >
> > > > > >         public int isValueOK(SubRequest request)
> > > > > >         {
> > > > > >             Variable newValue =
> > > > > >                     request.getVariableBinding().getVariable();
> > > > > >             int valueOK = super.isValueOK(request);
> > > > > >             if (valueOK != SnmpConstants.SNMP_ERROR_SUCCESS)
> > > > > >             {
> > > > > >                 return valueOK;
> > > > > >             }
> > > > > >             //--AgentGen BEGIN=notificationLevel::isValueOK
> > > > > >             //--AgentGen END
> > > > > >             return valueOK;
> > > > > >         }
> > > > > >
> > > > > >         public Variable getValue()
> > > > > >         {
> > > > > >             //--AgentGen BEGIN=notificationLevel::getValue
> > > > > >             //--AgentGen END
> > > > > >             return super.getValue();
> > > > > >         }
> > > > > >
> > > > > >         public int setValue(Variable newValue)
> > > > > >         {
> > > > > >            //Using the NotificationOriginator reference, sends
> > > > > > notification
> > > > > >            //whenever this value is set
> > > > > >             sendNotification();
> > > > > >             return super.setValue(newValue);
> > > > > >         }
> > > > > >
> > > > > >         //--AgentGen BEGIN=notificationLevel::_METHODS
> > > > > >         //--AgentGen END
> > > > > >
> > > > > >     }
> > > > > > [/code]
> > > > > >
> > > > > > For any queries, kindly let me know
> > > > > >
> > > > > > --
> > > > > > regards,
> > > > > > petro
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > regards,
> > > > petro
> > >
> > >
> > >
> >
> >
> > --
> > regards,
> > petro
> >
>
>


-- 
regards,
petro



More information about the SNMP4J mailing list