본문 바로가기
2. 기본 인프라 IaaS

ShowOCI 무료 툴 - OCI 자원 보고서 만들기

by MY잭슨 2023. 7. 12.

사전준비

2023.06.21 - [4. 개발 플랫폼 Low Code] - Usage2ADW 무료 툴 - OCI 사용량 확인 with APEX

2023.06.21 - [4. 개발 플랫폼 Low Code] - Usage2ADW 무료 툴 - OCI 사용량 DBCS로 저장

 

실행(백그라운드)

nohup python3 /home/opc/showoci/showoci.py -ip -d -csv /home/opc/showoci/report/local/csv/local >> /home/opc/showoci/report/local/csv/a.log &

 

데이터로드 to ADB

ls -ltr /home/opc/showoci/report/local/csv/
/home/opc/usage_reports_to_adw/shell_scripts/run_load_showoci_csv_to_adw.sh

 

예시

# Run report for all resources except identity from Cloud Shell
python3 showoci.py -dt -ani

# Run Report for all compute resources and produce CSV file using Cloud Shell
python3 showoci.py -dt -c -csv $HOME/output

# Run Report for all compute and database resources and produce CSV file using Cloud Shell
python3 showoci.py -dt -c -d -csv $HOME/output

# Run Report for all compute resources filter by compartment=AdiZohar and region=us-ashburn-1 using instance principle
python3 showoci.py -ip -c -cp AdiZohar -rg us-ashburn-1

# Run Report for PaaS Services filter by region us-phoenix-1 using user authentication profile=Adi and produce CSV
python3 showoci.py -paas -rg us-phoenix-1 -t Adi -csv $HOME/output

# Run Report for PaaS Services and produce JSON file
python3 showoci.py -paas -js

 

 

 ShowOCI VM 수동 설치

https://github.com/oracle/oci-python-sdk/tree/1b6b062130c02314716ed818af4f84793e57eeac/examples/showoci

 

VM 생성

VM OCID 복사

Dynamic Group 생성 (복사한 OCID 입력)

 

정책생성

 

필수 요소 설치(Python 3.9, GIT, OCI Package)

sudo yum -y update
sudo yum -y install git
sudo dnf -y module install python39
sudo dnf -y install python39-pip
sudo dnf -y install python39-setuptools
sudo alternatives --set python3 /usr/bin/python3.9
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade oci oci-cli
python3 -m pip install --upgrade oracledb

 

Instance Principal 테스트

oci os ns get --auth instance_principal

 

GIT 복제

git clone https://github.com/oracle/oci-python-sdk
ln -s oci-python-sdk/examples/showoci .

 

실행

cd showoci
python3 showoci.py -ip -ani

 

mkdir -p /home/opc/showoci/report/local/csv/
nohup python3 /home/opc/showoci/showoci.py -ip -api -c -cn -d -f -l -paas -dataai -csv /home/opc/showoci/report/local/csv/local >> /home/opc/showoci/report/local/csv/a.log &

 

 

 

참고

https://github.com/oracle/oci-python-sdk/tree/master/examples/showoci

댓글