| 12 # /opt/autoscaling/autoscaling.bin help │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ Autoscaling for OCI DB Systems - Version: 2.0.1-22 Copyright (c) 2017-2021 Oracle and/or its affiliates. ---------------------------------------------------------- Author: Ruggero Citton <[email protected]> RAC Pack, Cloud Innovation and Solution Engineering Team │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ Following additional operations are possible: getocpu - to get current OCPU setocpu - to set current OCPU status - to get autoscalling status stop|shutdown|alt|kill - to stop autoscalling Version 2.0.1-22
2021, Oracle and/or its affiliates | 36 #!/bin/bash # ---------------------------------------------------------------------------# # Autoscaling 'CPU_USAGE' plugin example # File_name: autoscaling_CPU_USAGE_plugin.sh # # Author: Ruggero Citton - # RAC Pack, Cloud Innovation and Solution Engineering Team # --------------------------------------------------------------------------- # The 1st iteration of top in batch mode (-b) returns the percentages since boot, then we need # at least two iterations (-n 2) to get the current percentage. To speed up the measure # we set the delay (-d 0.01). # Top return CPU usage as user, system processes and nice processes, we sum all three. CPU_USAGE=$(top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 | gawk '{print $2+$4+$6}'| cut -d. -f1) echo $CPU_USAGE # ------------------------------------------------ # EndOfFile # ------------------------------------------------
its affiliates | 46 # systemctl daemon-reload # systemctl enable autoscaling.service Created symlink from /etc/systemd/system/multi-user.target.wants/autoscaling.service to /etc/systemd/system/autoscaling.service. # systemctl start autoscaling.service # systemctl status autoscaling.service • autoscaling.service - Autoscaling Loaded: loaded (/etc/systemd/system/autoscaling.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2021-03-17 03:15:48 JST; 7s ago Main PID: 246010 (/opt/autoscalin) CGroup: /system.slice/autoscaling.service └─246010 /opt/autoscaling/autoscaling.bin --vm-cluster-id ocid1.vmcluster.oc1.ap-tokyo-1.XXX... Mar 17 03:15:48 ecc2c8n2 systemd[1]: Started Autoscaling. Mar 17 03:15:48 ecc2c8n2 sh[245985]: │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ Mar 17 03:15:48 ecc2c8n2 sh[245985]: Autoscaling for OCI DB Systems - Version: 2.0.1-15 Mar 17 03:15:48 ecc2c8n2 sh[245985]: Copyright (c) 2017-2021 Oracle and/or its affiliates. Mar 17 03:15:48 ecc2c8n2 sh[245985]: ---------------------------------------------------------- Mar 17 03:15:48 ecc2c8n2 sh[245985]: Author: Ruggero Citton <[email protected]> Mar 17 03:15:48 ecc2c8n2 sh[245985]: RAC Pack, Cloud Innovation and Solution Engineering Team Mar 17 03:15:48 ecc2c8n2 sh[245985]: │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ Hint: Some lines were ellipsized, use -l to show in full. # systemctl stop autoscaling.service 停⽌ 起動