Updated OCI-AutoScale Script – Changing Flex Shapes

By | November 5, 2022

Support for changing the CPU and/or Memory Count for Compute Flex shapes has been added to the OCI-AutoScale Script.

By specifying a (cpu:memory) value in the schedule, the compute instances will be update accordingly.

IMPORTANT: This will reboot the instance!

9 thoughts on “Updated OCI-AutoScale Script – Changing Flex Shapes

  1. Jim

    Script seems very promising but unfortunately running into a problem. It works great to take an instance down per the schedule for some reason for me (obviously not a widespread issue) it isn’t bringing a compute instance back online for a non-zero hour entry. Any idea what might be causing this? I’d appreciate any help/thoughts you can provide on this. I’m glad it’s working well for many others and help I can so leverage it too 🙂

    # Running Down actions
    ## python3 /home/ubuntu/OCI-AutoScale/AutoScaleALL.py -a Down -ip -ignrtime -printocid
    Starting Auto Scaling script on region us-gov-ashburn-1, executing Down actions
    Ignoring Region Datetime, Using local time
    Day of week: Thursday, Nth day in Month: 3, IsWeekday: True, Current hour: 21, Current DayOfMonth: 19
    Getting all resources supported by the search function…
    Finding MySQL instances in 2 Compartments…
    ee

    Checking 1 Resources for Auto Scale…
    Checking dsop006_test (Instance) – ocid1.instance.oc3.us-gov-ashburn-REDACTED
    – Active schedule for dsop006_test: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,2,2,[0],2,0,
    – Initiate Compute VM shutdown for dsop006_test
    Waiting for all threads to complete…
    Region us-gov-ashburn-1 Completed.
    All scaling tasks done, checked 1 resources.

    # Running Up actions (no message showing bring up and confirmed in OCI Console)
    ## /home/ubuntu/OCI-AutoScale/AutoScaleALL.py -a Up -ip -ignrtime -printocid
    Starting Auto Scaling script on region us-gov-ashburn-1, executing Up actions
    Ignoring Region Datetime, Using local time
    Day of week: Thursday, Nth day in Month: 3, IsWeekday: True, Current hour: 22, Current DayOfMonth: 19
    Getting all resources supported by the search function…
    Finding MySQL instances in 2 Compartments…
    ee

    Checking 1 Resources for Auto Scale…
    Checking dsop006_test (Instance) – ocid1.instance.oc3.us-gov-ashburn-REDACTED
    – Active schedule for dsop006_test: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,2,2,0,[2],0,
    Waiting for all threads to complete…
    Region us-gov-ashburn-1 Completed.
    All scaling tasks done, checked 1 resources.

    Reply
    1. richard Post author

      what size is the VM in amount of OCPUs? If it is a none flex shape, you should only use the value 0 for off and 1 for on (independent of the size)

      Reply
      1. Jim

        Thanks. The compute instance is using an AMD flex shape (VM.Standard.E3.Flex) but for some reason it doesn’t treat it as such. Changing to use 1/on brought the instance up right on schedule and did not reduce OCPU count which is exactly what I needed. I really appreciate your scaling script and other articles you’ve done.

        Also, an article topic you might consider at some point is one on the OCI CLI helper script “Project O” — I really like O but would be surprised if I didn’t learn some new tricks from such an article.

        Reply
          1. Jim

            It seems for what I was trying to do should always be using just 0, 1 or * regardless of actual CPU count. I haven’t tried it but I’d bet had I used the ‘(cpu:ram)’ notation it would have done a reboot/resize. From some of the explanatory content though it seemed it was necessary to use the desired (if CPU higher >1 count) for CPUs in the schedules but that doesn’t seem to be the case — at least for me. Really great script. Super helpful!!

  2. Derrick M

    For the tag value, does the first position indicate the midnight hour? or the 1:00 AM hour?

    Reply
  3. MartinA

    Hello!, VERY nice litle script you have done 🙂

    I have got the most functions to work, except one thing. It cant find our AutonomousTP Database on dedicated Exadata. Is it supposed to find that? i see in the logs that if finds all other scheduels. except that one.

    Best Regards Martin

    Reply
    1. richard Post author

      No I do not think the script support that. I would need to look into that, if I can test that in my own account. I assume it does allow power on/off and scaling thru the OCI Console?

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.