Repository navigation
LAB ‐ TestD
The objective of this lab is to create an OCI Native Dashboard to monitor multiple virtual machines (VMs) across different compartments from a single dashboard.
Using this dashboard, we can view resource information, check VM lifecycle states, and automatically refresh the dashboard at a configured interval.
- Created a custom OCI Native Dashboard.
- Added Resource Explorer widgets for different compartments.
- Viewed Compute instances across multiple compartments.
- Added a Resource Query widget to display VM lifecycle states.
- Verified Running, Stopped, and Terminated instance states.
- Enabled automatic refresh every 5 minutes.
- Verified automatic dashboard refresh without manually refreshing the browser page.
An OCI Native Dashboard is a customizable interface in Oracle Cloud Infrastructure (OCI) that allows us to display cloud resource information and monitoring data in one place.
Instead of opening multiple OCI services and compartments separately, we can create a dashboard containing different widgets.
- View Compute instances and other OCI resources.
- Display resource information from selected compartments.
- Display metrics using Monitoring widgets.
- Query cloud resources using Resource Query widgets.
- View instance lifecycle states such as Running, Stopped, and Terminated when returned by the query.
- Configure automatic dashboard refresh.
- Create a centralized view of resources for operational monitoring.
Note: A dashboard does not replace OCI Monitoring, Logging, Cloud Guard, or other security services. It brings selected resource information and metrics together in one interface.
| Setting | Value |
|---|---|
| Cloud Provider | Oracle Cloud Infrastructure (OCI) |
| Region | US East (Ashburn) |
| Region Identifier | us-ashburn-1 |
| Parent Compartment | swiggy-dev-compartment |
| Dashboard Name | Swiggy-Multi-VM-Monitoring |
| Auto Refresh | Every 5 minutes |
The lab uses the following compartment structure:
-
swiggy-dev-compartment-
swiggy-dev-compute-and-storage-compartmentdev-app-serverdev-db-server
-
swiggy-dev-network-compartmentdev-web-server
-
The instances are distributed across two child compartments. This demonstrates how we can view resources from different parts of an OCI environment using a centralized dashboard.
- Log in to the OCI Console.
- Open the Dashboards service.
- Create a new dashboard.
- Enter the dashboard name:
Swiggy-Multi-VM-Monitoring. - Save the dashboard.
The dashboard provides a workspace where we can add widgets for resource information and monitoring metrics.
We added a Resource Explorer widget to view resources from the Compute and Storage compartment.
- Widget Type: Resource Explorer
- Region: US East (Ashburn)
- Compartment:
swiggy-dev-compute-and-storage-compartment
The widget displayed:
- Compute - Instances: 2
The two instances configured in this compartment were:
dev-app-serverdev-db-server
This widget helps us view the resource count for the selected compartment without navigating to the Compute service separately.
We added another Resource Explorer widget for the Network compartment.
- Widget Type: Resource Explorer
- Region: US East (Ashburn)
- Compartment:
swiggy-dev-network-compartment
The widget displayed:
- Compute - Instances: 1
- Virtual Cloud Networks - VCNs: 1
The instance in this compartment was:
dev-web-server
This widget helps us view the web server and relevant network resource counts in the Network compartment.
A Resource Explorer widget for the root compartment, cloudtenant26, was also present on the dashboard.
It displayed resources such as:
- Application Integration - Notifications
- Events Service - Rules
This widget was not specifically configured to monitor our three VMs.
The root compartment widget displays resources within its selected scope. It does not automatically provide the lifecycle status of every instance in every child compartment.
For VM lifecycle monitoring, we used a separate Resource Query widget.
We added a Monitoring widget named:
Swiggy-Web-Server-Health
- Widget Type: Monitoring
- Region: US East (Ashburn)
- Namespace:
oci_compute_instance_health - Metric Name:
InstanceAccessibilityStatus - Dimension:
resourceDisplayName = dev-web-server - Description: Monitor Web Server accessibility health metrics in the Swiggy Network compartment.
This widget is intended to display the selected Compute instance accessibility health metric.
The chart did not display a clear Running or Stopped lifecycle state because instance accessibility health and instance lifecycle state are different concepts.
- Lifecycle state tells us whether an instance is Running, Stopped, Terminated, or in another lifecycle state.
- Accessibility health metrics provide information about the instance's accessibility according to the metric definition.
For lifecycle-state monitoring, we used the Resource Query widget in the next step.
This was the main step in our multi-VM monitoring lab.
We added a Resource Query widget and named it:
Swiggy-All-VM-Lifecycle-Status
This widget displays the results of a resource query in a table.
- Open the dashboard.
- Click Add widget.
- Select the Resource Query widget.
- Enter the widget name:
Swiggy-All-VM-Lifecycle-Status. - Open the query editor.
- Enter the resource query.
- Click Search to execute the query.
- Review the Resource Preview and results.
- Save the widget and dashboard.
The main query used in the lab was:
query instance resources
This query searches instance resources within the applicable query scope. The results can include lifecycle status and other resource information.
Initially, we used a query that filtered for Running instances:
query instance resources where lifeCycleState = 'RUNNING'
This query returns instances whose lifecycle state matches RUNNING.
To return only Running and Stopped instances, we tested the following query:
query instance resources where lifeCycleState = 'RUNNING' || lifeCycleState = 'STOPPED'
The || operator means OR.
This query filters the results to instances whose lifecycle state is either Running or Stopped. Terminated instances are excluded by this filter.
Note: The unfiltered query is more suitable when we want to inspect all available lifecycle states, including Terminated instances when they are still returned by the query.
After configuring the Resource Query widget, we verified the results in the dashboard.
The widget displayed a table with the following columns:
- Display name
- Resource Type
- Status
- OCID
- Compartment
- Time created
During the lab, the table displayed the following states:
| Instance Name | Observed Status |
|---|---|
dev-web-server |
Running |
dev-app-server |
Stopped |
dev-db-server |
Terminated |
These are the states observed during the practical test, not permanent states for these resources.
Running: The instance is running.
Stopped: The instance is stopped but has not been terminated. It can generally be started again.
Terminated: The instance has been terminated. It cannot be restarted as the same instance.
Important: Stopping and terminating an instance are different operations. Termination can be destructive, so verify the instance and its associated resources before selecting Terminate.
After verifying the lifecycle query, we configured automatic refresh.
- Open the
Swiggy-Multi-VM-Monitoringdashboard. - Locate the Auto refresh option.
- Select Every 5 minutes.
- Leave the dashboard open.
- Do not manually refresh the browser page.
- Wait for the next automatic refresh.
We waited for the five-minute interval to complete.
The dashboard refreshed automatically without manually refreshing the browser page.
The terminated instance continued to appear with the Terminated status in the Resource Query table.
This verified that automatic dashboard refresh was working.
Important: Auto refresh updates the dashboard view, but it does not change an instance's lifecycle state. The resource query and underlying inventory must return the latest available information for a state change to appear. Some resource updates may take time to become visible.
Our dashboard contains the following widgets:
| Widget Name | Purpose |
|---|---|
| Resource Explorer - Compute and Storage | View resource counts in the Compute and Storage compartment |
Swiggy-Web-Server-Health |
Display the selected web server accessibility health metric |
| Resource Explorer - Network | View Compute instances and VCN counts in the Network compartment |
| Resource Explorer - Root Compartment | View selected resources within the root compartment |
Swiggy-All-VM-Lifecycle-Status |
Display instance lifecycle states in a table |
Automatic refresh is configured to run every 5 minutes.
The dashboard architecture is as follows:
- OCI Console
-
Swiggy-Multi-VM-Monitoringdashboard - Resource Explorer widgets for Compute and Storage, Network, and Root compartments
- Monitoring widget for the web server accessibility metric
- Resource Query widget for VM lifecycle states
- Instances displayed in the lifecycle table:
-
dev-web-server- Running -
dev-app-server- Stopped -
dev-db-server- Terminated
-
The instance states shown above represent the observed lab results and can change as resources are started, stopped, or terminated.
- OCI Native Dashboards provide a centralized view of selected cloud resources and metrics.
- Resource Explorer widgets help display resource information for selected compartments.
- Separate Resource Explorer widgets can be used to view resources from different child compartments.
- A Resource Query widget can display instance lifecycle states in a table.
- The query
query instance resourcescan be used to inspect instance resources within the applicable query scope. - The
whereclause filters query results by lifecycle state. - The
||operator represents OR in the tested query. - Monitoring metrics and Compute lifecycle states serve different purposes.
- Automatic refresh can update the dashboard without manually refreshing the browser page.
- Terminated instances are different from stopped instances and cannot be restarted as the same instance.
Question: How have you used OCI Native Dashboards to monitor multiple VMs?
Answer:
"I created an OCI Native Dashboard named Swiggy-Multi-VM-Monitoring to view resources from different compartments in one place. I added Resource Explorer widgets for the Compute and Storage compartment and the Network compartment. I also added a Resource Query widget using query instance resources to display VM lifecycle states such as Running, Stopped, and Terminated in a table. Finally, I enabled automatic refresh every five minutes and verified that the dashboard refreshed without manually refreshing the browser page."
- The dashboard is a visualization interface. Review OCI pricing for any underlying services and resources used by the lab.
- Compute instances, boot volumes, block volumes, public IPs, and other associated resources may incur charges depending on their configuration and billing rules.
- Stopping an instance does not necessarily stop all charges associated with its attached resources.
- Terminating an instance may not automatically remove every associated resource, depending on the termination options selected.
- Review associated volumes, IP addresses, and other resources before cleaning up the lab.
- Check OCI Cost Analysis and usage details to verify any charges.
In this lab, we created an OCI Native Dashboard to centralize resource visibility and VM lifecycle monitoring across multiple compartments.
We used Resource Explorer widgets to view resource counts, a Monitoring widget to display a web server accessibility metric, and a Resource Query widget to display instance lifecycle states. We then configured automatic refresh every five minutes and verified that the dashboard refreshed without a manual browser refresh.
This practical exercise demonstrates how OCI dashboards can support day-to-day cloud administration and resource monitoring.