Thursday, March 11, 2021

Grafana for OCI Monitoring in Docker running on Windows

 Grafana for OCI Monitoring in Docker on Windows


Step 1: Install Docker Desktop on Windows

https://docs.docker.com/docker-for-windows/install/


Step 2: Download and Install WSL 2

https://docs.microsoft.com/en-us/windows/wsl/install-win10


Step 3: Make Sure Docker Desktop on Windows is Running


Step 4: Sign-in to Docker [ optional ]


Step 5: Install Grafana on Docker

https://grafana.com/docs/grafana/latest/administration/configure-docker/


Run Grafana container with persistent storage (recommended)

# create a persistent volume for your data in /var/lib/grafana (database and plugins)

docker volume create grafana-storage


# start grafana

docker run -d -p 3000:3000 --name=grafana -v grafana-storage:/var/lib/grafana grafana/grafana



Step 6 : Launch URL and Validate



Step 7 : Launch CLI



Install the Data Source Plugin. From the command line, use grafana-cli to install the plugin

# grafana-cli plugins install oci-metrics-datasource



Step 8 : Setup OCI - CLI on Docker


Follow Instruction

https://blogs.oracle.com/developers/get-going-quickly-with-command-line-interface-for-oracle-cloud-infrastructure-using-docker-container


Step 9 : Move the .oci folder from host to grafana docker image


PS C:\Users\skrajend> docker ps

CONTAINER ID   IMAGE             COMMAND     CREATED             STATUS          PORTS                    NAMES

e647e4022bc0   grafana/grafana   "/run.sh"   About an hour ago   Up 17 minutes   0.0.0.0:3000->3000/tcp   grafana

PS C:\Users\skrajend>


PS C:\Users\skrajend> docker cp .oci e647e4022bc0:/home/grafana


Step 10 : Configure the key_file in OCI config file


Login into the docker container as root user


PS C:\Users\skrajend> docker exec -it --user root e647e4022bc0 /bin/sh

/usr/share/grafana # cd /home/grafana


Use vi editor and \uUpdate key_file with the correct path and save the config file


/home/grafana/.oci # cat config|grep -i key

key_file=/home/grafana/.oci/oci_api_key.pem

/home/grafana/.oci #


Step 11 : Change Owner of the .oci folder to grafana


/home/grafana/ # chown -Rf grafana:root .oci



Step 12: Restart grafana docker



Step 13 : Login into Grafana and Validate OCI Data Source


Step 14 : Configure the Tenancy in the Data Source


 

Step 15 : Loading OCI Compute Instance Monitoring Plugin from Grafana Plugin Website




Import the Plugin via the ID 


Select the data source as Oracle Cloud Infrastructure Metric



Validate the Grafana Dashboard




Happy Learning with Grafana






Popular Posts