1- # showoci
2- ##### README.md, last updated 4/2/2019
3- ### Oracle Cloud Infrastructure Reporting Tool
1+ ## showoci - Oracle Cloud Infrastructure Reporting Tool
42
5- ##### Generate OCI resources of your tenancy using Python OCI SDK
3+ SHOWOCI is an reporting tool which uses the Python SDK to extract list of resources from your tenant. It covers more than 80% of OCI components, Output can be printer friendly or JSON file.
64
7- ##### Modules Included:
5+ Modules Included:
86- oci.core.VirtualNetworkClient
97- oci.core.ComputeClient
108- oci.core.ComputeManagementClient
1614- oci.load_balancer.LoadBalancerClient
1715- oci.email.EmailClient
1816- oci.container_engine.ContainerEngineClient
17+ - oci.streaming.StreamAdminClient
1918
20- ##### Required OCI IAM user with read only privileges:
21- ##### Inspect privilege will have some limitations especially on object storage sizes
19+
20+ ## OCI User Requirement
21+ Required OCI IAM user with read only privileges:
22+
23+ Inspect privilege will have some limitations especially on object storage sizes
2224```
2325ALLOW GROUP ReadOnlyUsers to read all-resources IN TENANCY
2426```
25- ##### ** DISCLAIMER – This is not official Oracle application
27+ ** DISCLAIMER – This is not official Oracle application
2628
27- ## Installation Guide for Python 3.7.2 with OCI SDK
29+ ## Installation Guide for Python 3 with OCI SDK
2830
2931### Installation on Windows
3032
31- Download Python 3.7.2 - https://www.python.org/ftp/python/3.7.2/python-3.7.2-amd64.exe
32-
3333```
34+ Download Python 3 from https://www.python.org/
3435setup.exe
3536pip install oci oci-cli
3637```
38+
3739### Installation on Mac using Brew
3840```
3941brew install python3
4042pip3 install oci oci-cli
4143```
4244
4345### Installation on OCI VM with Oracle Cloud Developer Image
44- ##### All Installed, just run the config below
46+ ```
47+ All Installed, just run the config below
48+ ```
4549
4650### Installation on OCI VM with Oracle Linux 7
4751
48- ##### Login as opc and install python3 locally
4952```
53+ # Login as opc and install python3 locally
5054sudo yum -y install gcc libffi-devel openssl-devel python-devel sqlite-devel
55+
56+ # example on python 3.7.2, list of python versions can be found here - https://www.python.org/ftp/python/
5157wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
5258tar zxf Python-3.7.2.tgz
5359cd Python-3.7.2
5460./configure --prefix=$HOME/python --enable-loadable-sqlite-extensions
5561make
5662make install
5763cd $HOME
58- ```
5964
60- ##### Add python to path
61- ```
65+ # Add python to path
6266echo 'export PATH=$HOME/python/bin:$PATH' >> ~/.bash_profile
6367echo 'export PYTHONPATH=$HOME/python' >> ~/.bash_profile
6468source ~/.bash_profile
65- ```
6669
67- ##### Check
68- ```
70+ # check
6971which python3
70- ```
72+ python3 --version
7173
72- ##### install oci and oci-cli
73- ```
74+ # install oci and oci-cli
7475pip3 install --upgrade pip
7576pip3 install oci oci-cli
7677```
7778
7879## Setup OCI CLI connectivity
7980
80- ##### Cloud: login to your OCI Cloud
8181```
82- 1. Create new group : ReadOnlyGroup
83- 2. Create new Policy: ReadOnlyGroupPolicy with Statement - ALLOW GROUP ReadOnlyGroup to read all-resources IN TENANCY
84- 3. Create new User : readonly.user -> Add to ReadOnlyGroup group
85- ```
82+ 1. Login to your OCI Cloud console
83+ 2. Create new group : ReadOnlyGroup
84+ 3. Create new Policy: ReadOnlyGroupPolicy with Statement - ALLOW GROUP ReadOnlyGroup to read all-resources IN TENANCY
85+ 4. Create new User : readonly.user -> Add to ReadOnlyGroup group
86+
87+ # Config OCI
88+ # Login as opc
8689
87- #### Config OCI
88- ##### Unix: Login as opc
89- ```
9090oci setup config
9191--> config location - /home/opc/.oci/config
9292--> Enter a user OCID - copy from the created user
@@ -95,51 +95,55 @@ oci setup config
9595--> Do you want to generate a new RSA key pair? Y
9696
9797Copy the /home/opc/.oci/oci_api_key_public.pem and add it to the OCI User under API Key
98- ```
9998
100- ##### Test it:
101- ```
99+ # Test it:
102100$ oci os ns get
103101{
104102 "data": "tenant_name_xxx"
105103}
106104```
107105
108- Download the showoci.py from this project
106+ Download the showoci* .py from this project
109107
110- ##### Execute
108+ Execute
111109
112110```
113111$ ./showoci.py
114112
115- usage: showoci [-h] [-a] [-ani] [-n] [-i] [-c] [-o] [-l] [-k] [-d] [-f] [-e]
116- [-so] [-mc] [-nr] [-t PROFILE] [-p PROXY] [-rg REGION]
117- [-cp COMPART] [-cf CONFIG] [-jf JOUTFILE] [-js] [--version]
113+ usage: showoci [-h] [-a] [-ani] [-n] [-i] [-c] [-cn] [-o] [-l] [-d] [-f] [-e]
114+ [-s] [-rm] [-so] [-mc] [-nr] [-t PROFILE] [-p PROXY]
115+ [-rg REGION] [-cp COMPART] [-cf CONFIG] [-jf JOUTFILE] [-js]
116+ [-cachef SERVICEFILE] [-caches] [--version]
118117
119118optional arguments:
120- -h, --help show this help message and exit
121- -a Print All Resources
122- -ani Print All Resources but identity
123- -n Print Network
124- -i Print Identity
125- -c Print Compute
126- -o Print Object Storage
127- -l Print Load Balancer
128- -k Print Key Management
129- -d Print Database
130- -f Print File Storage
131- -e Print EMail
132- -so Print Summary Only
133- -mc Include ManagedCompartmentForPaaS
134- -nr Not include root compartment
135- -t PROFILE Config file section to use (tenancy profile)
136- -p PROXY Set Proxy (i.e. www-proxy-server:80)
137- -rg REGION Filter by Region
138- -cp COMPART Filter by Compartment
139- -cf CONFIG Config File, default=~/.oci/config
140- -jf JOUTFILE Output to file (JSON format)
141- -js Output to screen (JSON format)
142- --version show program's version number and exit
119+ -h, --help show this help message and exit
120+ -a Print All Resources
121+ -ani Print All Resources but identity
122+ -n Print Network
123+ -i Print Identity
124+ -c Print Compute
125+ -cn Print Containers
126+ -o Print Object Storage
127+ -l Print Load Balancer
128+ -d Print Database
129+ -f Print File Storage
130+ -e Print EMail
131+ -s Print Streams
132+ -rm Print Resource management
133+ -so Print Summary Only
134+ -mc exclude ManagedCompartmentForPaaS
135+ -nr Not include root compartment
136+ -t PROFILE Config file section to use (tenancy profile)
137+ -p PROXY Set Proxy (i.e. www-proxy-server.com:80)
138+ -rg REGION Filter by Region
139+ -cp COMPART Filter by Compartment
140+ -cf CONFIG Config File
141+ -jf JOUTFILE Output to file (JSON format)
142+ -js Output to screen (JSON format)
143+ -cachef SERVICEFILE Output Cache to file (JSON format)
144+ -caches Output Cache to screen (JSON format)
145+ --version show program's version number and exit
146+
143147
144148```
145149
@@ -255,9 +259,9 @@ Extracting Region us-ashburn-1
255259 Compartment NetworkCompartment...
256260
257261
258- ############################################################
259- # Tenancy #
260- ############################################################
262+ ##########################################################################################
263+ # Tenancy #
264+ ##########################################################################################
261265Name - CUST
262266OCID - ocid1.tenancy.oc1..aaaaaaaae5u57gqxs5qas5f33qnge63sdoi7s2ji6bk5slscblmxxxxxxx
263267Home Region - IAD
@@ -518,30 +522,26 @@ Compartment gse00000000 (root):
518522##############################
519523# Databases #
520524##############################
521- --> ADIDB02 - VM.Standard1 .1 - AVAILABLE
522- AD : fHBa:US-ASHBURN-AD-3
525+ --> ADI18C - VM.Standard2 .1 - AVAILABLE
526+ AD : fHBa:US-ASHBURN-AD-1
523527 Cores : 1
524528 Nodes : 1
525- Version : 18.3 .0.0.180717 - ENTERPRISE_EDITION_EXTREME_PERFORMANCE - BRING_YOUR_OWN_LICENSE
529+ Version : 18.4 .0.0.181016 - ENTERPRISE_EDITION_EXTREME_PERFORMANCE - BYOL
526530 Host : dbhost
527- Domain : sub3 .vcn.oraclevcn.com
531+ Domain : sub1 .vcn.oraclevcn.com
528532 Data : 256gb - 80%
529- DataSub : 10.1.0.192/27 sub3 (Public)
530- Scan DNS: ocid1.vcndnsrecord.oc1.iad.abuwcljszsvrzlpytvykn4oqoskub6qqebk4wkpkesfa7gdgvf2nomqyrclq
533+ DataSub : sub1
534+ Scan DNS: ocid1.vcndnsrecord.oc1.iad.abuwcljrt2ctwqn4x4khlkjq7kczhghdv5dnckvrgcxmdzytdcwwzn7caama
531535 Port : 1521
532- Patches : Jul 2018 18c Db System patch - 18.3.0.0.180717 - 2018-07-30 - Last Action: APPLY
533- Node : dbhost - AVAILABLE - 10.1.0.196 (Priv) , 129.213.32.183 (Pub) , Subnet sub3
534- Home : dbhome20181026162225 - 18.2.0.0.180417
535- PT : Apr 2018 18c Database patch - 18.2.0.0.180417 - 2018-04-25 - Last Action: None
536- PT : Jul 2018 18c Database patch - 18.3.0.0.180717 - 2018-07-30 - Last Action: None
537- DB : ADIDB02 - ADIDB02_iad3n9 - OLTP - AL32UTF8 - AVAILABLE - AutoBck=Y
538- Automatic Backup - INCREMENTAL - FAILED - 2018-11-02 05:25 - 2018-11-02 05:39 - None
539- Automatic Backup - INCREMENTAL - ACTIVE - 2018-11-01 05:25 - 2018-11-01 05:39 - 3.5gb
540- Automatic Backup - INCREMENTAL - ACTIVE - 2018-10-31 05:25 - 2018-10-31 05:46 - 3.5gb
541- Automatic Backup - INCREMENTAL - ACTIVE - 2018-10-30 05:24 - 2018-10-30 05:30 - 3.4gb
542- Automatic Backup - INCREMENTAL - ACTIVE - 2018-10-29 05:26 - 2018-10-29 05:34 - 3.3gb
543- Automatic Backup - INCREMENTAL - ACTIVE - 2018-10-28 05:25 - 2018-10-28 05:34 - 3.2gb
544- Automatic Backup - INCREMENTAL - ACTIVE - 2018-10-27 05:25 - 2018-10-27 05:46 - 3.0gb
536+ Patches : Jan 2019 18c Db System patch - 18.5.0.0.190115 - 2019-02-20 - Last Action: None
537+ : ------------------------------------------------------------------------------------------
538+ Node : dbhost - AVAILABLE - 10.1.0.31 (Prv), 129.213.22.165 (Pub) - Primary , Subnet (sub1 10.1.0.0/26), VCN (vcn) - FAULT-DOMAIN-2
539+ Home : dbhome20190410131530 - 18.4.0.0.181016
540+ PT : Jan 2019 18c Database patch - 18.5.0.0.190115 - 2019-02-20 - Last Action: None
541+ PT : Oct 2018 18c Database patch - 18.4.0.0.181016 - 2019-01-10 - Last Action: None
542+ DB : ADIDB - ADIDB_iad1m7 - OLTP - AL32UTF8 - AVAILABLE - AutoBck=N
543+ Dataguard: PRIMARY, MAXIMUM_PERFORMANCE (ASYNC), Peer DB: ADIDG:ADIDB_iad1pz
544+ Automatic Backup - INCREMENTAL - ACTIVE - 2019-04-10 14:32 - 2019-04-10 14:51 - 3.0gb
545545
546546--> npappdb - BM.DenseIO1.36 - AVAILABLE
547547 AD : iQAs:US-ASHBURN-AD-2
@@ -664,6 +664,12 @@ Compartment gse00000000 (root):
664664 oke-subnet-quick-K8S Cluster-20190306130828-dKrR:US-ASHBURN-AD-3 10.0.12.0/24, VCN (oke-vcn-quick-K8S Cluster-20190306130828)
665665 oke-subnet-quick-K8S Cluster-20190306130828-dKrR:US-ASHBURN-AD-2 10.0.11.0/24, VCN (oke-vcn-quick-K8S Cluster-20190306130828)
666666 oke-subnet-quick-K8S Cluster-20190306130828-dKrR:US-ASHBURN-AD-1 10.0.10.0/24, VCN (oke-vcn-quick-K8S Cluster-20190306130828)
667+
668+ ##############################
669+ # Streams #
670+ ##############################
671+ --> AdiStream, partitions (1), Created: 2019-04-10 20:42
672+ URL : https://api.cell-1.us-ashburn-1.streaming.oci.oraclecloud.com
667673
668674##########################################################################################
669675# Summary - us-ashburn-1 #
@@ -1393,4 +1399,4 @@ Processing...
13931399# Completed Successfully at 2019-04-05 08:15:16 #
13941400##########################################################################################
13951401
1396- ```
1402+ ```
0 commit comments