6 Replies Latest reply: Feb 27, 2013 6:59 AM by MARTIN_NETAPP RSS

Custom events for scripts - How do you create in DFM 5.0?

MARTIN_NETAPP Novice
Currently Being Moderated

Ive got a custom script that triggers a custom event.

I cant find how you create these custom events - anyone got any instructions/ doc locations?

I cant remember the last time i found such a poorly doucmented product :-(

 

 

This is an example:

 

dfm eventtype list

Event Name                                                            Severity   Class

--------------------------------------------------                           ------------   ------------------

SnapMirror_Lag:MY-Snapmirror-Lag:Snapmirror-Lag  Error        SnapMirror_Lag:MY-Snapmirror-Lag

 

 

Thanks

Martin

  • Re: Custom events for scripts - How do you create in DFM 5.0?
    beverley NetApp Employee Novice
    Currently Being Moderated

    It looks like info in a couple of other Community discussions might help you:

    https://communities.netapp.com/message/82477#82477

    https://communities.netapp.com/message/92172#92172

     

    bev

  • Re: Custom events for scripts - How do you create in DFM 5.0?
    adaikkap NetApp Employee Grand Marshal
    Currently Being Moderated

    Hi Martin,

         As Beverly pointed out there are two ways of creating a custom events.

    1. One way is to create it using the NMSDK api eventclass-add-custom.
    2. Use the script plugin xml definition to create the custom event.

     

    The above two links should help you in creating the custom events, Pls note you will have to write the logic and trigger the custom event using dfm event generate cli. They wont get generated automatically.

     

    Regards

    adai

    • Re: Custom events for scripts - How do you create in DFM 5.0?
      MARTIN_NETAPP Novice
      Currently Being Moderated

      Hi Bev and Adai,

       

      I see the posts but they mean nothing/ just refer to the generate command which I can laready use.

       

      How do i create a custom event type? , where does the XML go?

      Can you put up an example perhaps of setting up a custom class/ event called "SnapMirror_Lag:MY-Snapmirror-Lag:Snapmirror-Lag " Like the one i appear to have inherited?

       

      I generate the msgs using this line in my script for my current custom event:

        dfm event generate 'SnapMirror_Lag:MY-Snapmirror-Lag:Snapmirror-Lag' "$filer" "$msg"

       

       

      Thats not a problem :-)  Its how to create new custom types I need to work out.

       

      Thanks

      Martin

       

       

       

       

       

      • Re: Custom events for scripts - How do you create in DFM 5.0?
        adaikkap NetApp Employee Grand Marshal
        Currently Being Moderated

        Hi Martin,

             I have already given you how to do that. Pls use the ZEDI and the following api eventclass-add-custom to create a new custom event.

         

        The ZEDI tool has the api, documentation and means to run it on your dfm server.

        https://communities.netapp.com/community/interfaces_and_tools/developer/zedi

         

        Regards

        adai

        • Re: Custom events for scripts - How do you create in DFM 5.0?
          MARTIN_NETAPP Novice
          Currently Being Moderated

          error.bmpHi Adai,

           

          I took your advice and tried Zexplorer.

          its sdk v5.1, im running with dfm 5.0 but it gives the error in the attached image, but it lets me continue. Should i be adding other docs for dfm 5.0? if i should be adding docs where are they and what are they called?

           

          Im still not making any progress. I dont understand what the "source" is, in this case its invalid (its not invalid f i make it "1" like some other examples, but what does 1 refer to?).

          Im looking for an idiots guide to this stuff, Im pretty much starting from 0. Any help appreciated.

           

          Thanks

          Martin

           

          This is the xml i generated as a test:

          <?xml version="1.0" encoding="UTF-8"?>

          <netapp  xmlns="http://www.netapp.com/filer/admin" version="1.0">

            <event-generate>

              <event-message>Martins_event-message</event-message>

              <event-name>Martins_event-name</event-name>

              <source>Martins_Source</source>

              <timestamp></timestamp>

            </event-generate>

          </netapp>

           

          This is the error i get:

          <?xml version='1.0' encoding='UTF-8' ?>
          <netapp version='1.0' xmlns='http://www.netapp.com/filer/admin'>

              <!-- Output of event-generate [Execution Time: 749 ms] -->
          <results errno='21012' status='failed' reason='Specified source is invalid.'/>
          </netapp>

        • Re: Custom events for scripts - How do you create in DFM 5.0?
          MARTIN_NETAPP Novice
          Currently Being Moderated

          msg.pngHi Adai,

           

          Ive got a bit further with some trial and error and cmd line!

           

          First I need to Create a custome eventtype:

           

          <?xml version="1.0" encoding="UTF-8"?>

          <netapp  xmlns="http://www.netapp.com/filer/admin" version="1.0">

            <!--Supports adding custom event classes.-->

            <eventclass-add-custom>

              <!--Custom event class description.-->

              <about-message>martinsdescription</about-message>

              <!--Custom event class name.-->

              <event-class-name>martinscustomclass</event-class-name>

              <!--List of event names for this event class.-->

              <event-names>

                <!--Information about an event name.-->

                <event-name-info>

                  <!--Display name of the event name.-->

                  <event-name-pretty>martinseventnamelong</event-name-pretty>

                  <!--Short name of the event name.-->

                  <event-name-short>martinseventnameshort</event-name-short>

                  <!--Severity of the event name. Possible values: Emergency, Critical, Error, Warning, Information, Normal.-->

                  <severity>warning</severity>

                </event-name-info>

              </event-names>

              <!--Namespace in which the event types are defined-->

              <event-namespace-name>Global</event-namespace-name>

              <!--Event service will not drop duplicate events of this event class if is-allow-duplicates is true. Event is duplicate if it has same event-name as previous event with same event-class and the same event-source. It is false by default. If an invalid value is provided, it will be considered as true.-->

              <is-allow-duplicates></is-allow-duplicates>

              <!--Event service should keep multiple current events of this event class for each event-source. Valid only with is-allow-duplicates. It is false by default. If an invalid value is provided, it will be considered as true.-->

              <is-multi-current></is-multi-current>

            </eventclass-add-custom>

          </netapp>

           

          Result

          <?xml version='1.0' encoding='UTF-8' ?>
          <netapp version='1.0' xmlns='http://www.netapp.com/filer/admin'>

              <!-- Output of eventclass-add-custom [Execution Time: 32 ms] -->
          <results status='passed'>
            <event-class-id>29</event-class-id>
          </results>
          </netapp>

           

          Then I can create a custom Event

           

          Create Event:

          <?xml version="1.0" encoding="UTF-8"?>

          <netapp  xmlns="http://www.netapp.com/filer/admin" version="1.0">

            <!--The event-generate API helps clients to generate events in the DFM system-->

            <event-generate>

              <!--A message specific to this event. This message will be displayed in the Event Details page. If not specified, nothing will be shown in the condition field of Event Details page.-->

              <event-message>MartinsTestEventMessage</event-message>

              <!--The event name that is being generated. Currently this can be only the event names corresponding to user-defined event added to DFM.-->

              <event-name>Global:martinscustomclass:martinseventnameshort</event-name>

              <!--The id/name of the source object of the event. This is the object id/short name/long name DFM generates for an object. Suppose, for a host, a host id/name can be found by using the CLI "dfm host list".-->

              <source>whyfil04</source>

              <!--The date-time when the event is generated This is the number of seconds elapsed since midnight on January 1, 1970.(UTC) If not specified or invalid timestamp specified , the time on the DFM server when the api is invoked is used.-->

              <timestamp></timestamp>

            </event-generate>

          </netapp>

           

          Completion Status:

          <?xml version='1.0' encoding='UTF-8' ?>
          <netapp version='1.0' xmlns='http://www.netapp.com/filer/admin'>

              <!-- Output of event-generate [Execution Time: 531 ms] -->
          <results status='passed'/>
          </netapp>

           

          If I want to create a custom event on a current custom eventtype I need to run "dfm eventtype list" from the dfm server cmd line to see the list of eventtypes. I dont seem to be able to list all eventtypes in the Zapi program.

           

          The msg is displayed (as per inserted image).

           

          Thanks for the pointers, all i need to do now is work out how to trigger 64-bit powershell scritps from DFM as a custom script :-)

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points