Subscribe

Using Java NM API to collect event information

Hi! All,

I am writing a program to collect netapp information. When I try to find a way to collect the event, problem raised.

I would like to list the events from my UI but I cannot found sample codes to it. All I knew is accessing ems command in console, listing the events.

Is there a way to do it in Java using the API? Thanks!

Raymond

Re: Using Java NM API to collect event information

Are you using DATA ONTAP or OnCommand? which version?

-Aashray

Re: Using Java NM API to collect event information

Thanks for your reply, I am using netapp-manageability-sdk-4.1 and using ontap simulator 7.3.6.

Raymond

Re: Using Java NM API to collect event information

Raymond,

I dont have a very clear understanding of your question. But if you are looking to invoke an ems event from the Java API, then the API to be used would be ems-invoke.

Sample Code, taken from ZEDI (which can help automatically generate code)  :

public static void main(String[] args) {

                    try {

                              NaServer s = new NaServer("<IP>", 1 , 15);

                              s.setServerType(NaServer.SERVER_TYPE_FILER);

                              s.setTransportType(NaServer.TRANSPORT_TYPE_HTTPS);

                              s.setPort(443);

                              s.setStyle(NaServer.STYLE_LOGIN_PASSWORD);

                              s.setAdminUser("user", "<password>");

                              NaElement api = new NaElement("ems-invoke");

                              api.addNewChild("event-id","<event-id>");

                              api.addNewChild("event-version","<event-version>");

                              NaElement xi = new NaElement("params");

                              api.addNewChild(xi);

                              xi.addNewChild("param","<param>");

                              api.addNewChild("severity","<severity>");

                              api.addNewChild("snmp","<snmp>");

                              api.addNewChild("syslog","<syslog>");

                              NaElement xo = s.invokeElem(api);

                              System.out.println(xo.toPrettyString(""));

                    } catch (NaException e) {

                              handleException(e);

                    } catch (UnknownHostException e) {

                              handleException(e);

                    } catch (IOException e) {

                              handleException(e);

                    }

Let me know your query more descriptively incase I'm off track.

-Aashray

Re: Using Java NM API to collect event information

Thanks for your reply again. I have moved the sdk to version 5.0 and API to 8.1 (using manageontap-5.0.jar and ontap-api-8.1.jar).

I think the content I want to collect like this, just not know the API can do this or not and how.

netappsim> ems event status

Event:Priority                           Last Time       Indications  Drops        DupSuppr     TimerSuppr   AutoSuppr  

api.input.invalidSchema:WARN             21Nov2012 17:12:26      6            0            0            0            0          

cf.fm.missingAdapter:ERR                 21Nov2012 16:50:50      1            0            0            0            0          

cifs.startup.stats:INFO                  21Nov2012 16:50:50      1            0            0            0            0  

Raymond

Re: Using Java NM API to collect event information

Do you have a cluster mode setup or 7-mode?

Re: Using Java NM API to collect event information

If its Cluster Mode then the API you are looking for is "ems-status-get".

Re: Using Java NM API to collect event information

Also if you're working with events, OnCommand is a great NetApp Manageability product that can help you.http://www.netapp.com/in/products/management-software/oncommand/oncommand-overview-in.html. It will help you automate your management tasks.

Re: Using Java NM API to collect event information

I think I haven't setup cluster or 7-mode. What can I do if not using those setup to get the event information?

Re: Using Java NM API to collect event information

Thanks for the link, I am going to read through it.