6 Replies Latest reply: Jun 14, 2012 10:47 AM by Merlin128 RSS

    Scripting blackouts

    Merlin128
      cloud control 12.1.0.1

      with the agent emctl
      I can script the start of a blackout and for the blackout to stop..
      but when you look at blackouts in EM it shows a log of all of each time one was created.. (BLACKOUT_NAME-DATE_TIME_STAMP)
      from the gui you can delete them..

      is there a way to script deleting them?
        • 1. Re: Scripting blackouts
          Loc Nhan -Oracle
          You can write a script calling emcli (EM command line interface) to remove a blackout using the delete_blackout verb.

          For more information on the emcli verb, please see:
          http://docs.oracle.com/cd/E24628_01/em.121/e17786/cli_verb_ref.htm#autoId0

          Regards,
          - Loc
          • 2. Re: Scripting blackouts
            Merlin128
            Thanks, but It wont find the blackout...

            when a blackout is created with the agent using emctl the the owner of the blackout shows <SYSTEM>

            If I login to emcli with sysman or system it cannot find the blackout (I tried logging in with username: "<SYSTEM>" but that didn't work..
            • 3. Re: Scripting blackouts
              Loc Nhan -Oracle
              Here is an example of the emcli get_blackouts command showing a blackout created from the agent side using emctl.

              >
              $ emcli get_blackouts
              Name Created By Status Status ID Next Start Duration Reason Frequency Repeat Start Time End Time Previous End TZ Region TZ Offset
              agent_bo_2_2012-06-11 14:32:06 <SYSTEM> Ended 11 none -00:01 Added via emctl utility once none 2012-06-11 14:32:07 none 2012-06-11 14:34:30 PST8PDT +00:00
              >

              I used sysman to log on emcli.

              Regards,
              - Loc
              • 4. Re: Scripting blackouts
                Merlin128
                that helped me get it to work.. I was able to do:

                emcli login -username=sysman -password="my_password"
                emcli delete_blackout -name="NAME_DATE_TIME" -created="<SYSTEM>"

                that deleted the specified blackout

                one more issue..
                when the blackout is created by emctl I specify the name.. but it adds a date and time stamp to the name I give it..
                is there a way to either:
                keep emctl from time stamping the name of the blackout
                or use the delete_blackout -name= with a wildcard..
                I have already tried -name="NAME*" and -name="NAME%"
                • 5. Re: Scripting blackouts
                  Loc Nhan -Oracle
                  A blackout created by the emctl utility always have a date/time stamp in its name as you found out, and the emcli delete_blackout verb does not support the use of wildcards. However, if you use the "emcli create_blackout" to create a blackout, then you can specify an exact blackout name (e.g. without a date/time stamp in the name).

                  - Loc
                  • 6. Re: Scripting blackouts
                    Merlin128
                    Got it working.. Thanks for all the help...