Available solutions
Oracle Cloud by HTTP
Overview
This template is designed to monitor Oracle Cloud by HTTP. It works without any external scripts and uses the script item. Currently, the template supports the discovery of Compute instances, Autonomous Databases, Virtual Cloud Networks (VCNs), Block Volumes, Boot Volumes, and Object Storage resources.
Included Monitoring Templates
- Oracle Cloud Autonomous Database by HTTP
- Oracle Cloud Block Volume by HTTP
- Oracle Cloud Boot Volume by HTTP
- Oracle Cloud Compute by HTTP
- Oracle Cloud Networking by HTTP
- Oracle Cloud Object Storage by HTTP
For communication with OCI, this template utilizes script items which execute HTTP GET and POST requests.
POST requests are required for OCI Monitoring API as it utilizes Monitoring Query Language (MQL) which uses an
HTTP request body for queries.
Requirements
Zabbix version: 7.4 and higher.
Tested versions
This template has been tested on:
- Oracle Cloud Infrastructure
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
Required setup
For this template to work, it needs authentication details to use in requests. To acquire this information, see the following steps:
-
Log into your administrator account in Oracle Cloud Console.
-
Create a new user that will be used by Zabbix for monitoring. Optionally, create a new group and assign the monitoring user to this group.
-
Create a new security policy and assign a previously created user or group to it.
-
This policy will contain a set of rules that will give monitoring user/group access to specific resources in your OCI. Make sure to add the following rules to the policy:
Allow group 'zabbix_api' to read metrics in tenancy Allow group 'zabbix_api' to read instances in tenancy Allow group 'zabbix_api' to read subnets in tenancy Allow group 'zabbix_api' to read vcns in tenancy Allow group 'zabbix_api' to read vnic-attachments in tenancy Allow group 'zabbix_api' to read volumes in tenancy Allow group 'zabbix_api' to read objectstorage-namespaces in tenancy Allow group 'zabbix_api' to read buckets in tenancy Allow group 'zabbix_api' to read autonomous-databases in tenancyIn the example above, the name of the monitoring group is
zabbix_api. In your setup, replace it with the name of your monitoring user/group.In some cases, these rules might not be enough for the monitoring user to be able to access all resources in your environment. To fix that, replace the previous rules with this single rule:
Allow group 'zabbix_api' to read all-resources in tenancy -
Generate an API key pair for your monitoring user - open your monitoring user profile and on the left side, press
API keysand then,Add API key(if generating a new key pair, do not forget to save the private key). -
After this, Oracle Cloud Console will provide additional information that is required for access, such as:
-
Tenancy OCID;
-
User OCID;
-
Fingerprint;
-
Region.
Save this information somewhere or keep this window open. This information will be required in later steps.
-
-
In Zabbix, create a new host and assign this template to it (Oracle Cloud by HTTP).
-
Open the
Macrossection of the host you created and set the following user macro values according to the OCI configuration file (from step #6):-
{$OCI.API.TENANCY}- set the tenancy OCID value; -
{$OCI.API.USER}- set the user OCID value; -
{$OCI.API.FINGERPRINT}- set the fingerprint value; -
{$OCI.API.PRIVATE.KEY}- copy and paste the contents of private key file here.
-
-
After the authentication credentials are entered, you need to identify the OCI API endpoints that match your region (as provided by Oracle Cloud Console in step #6). To do so, you can use the OCI API Reference and Endpoints list, where each API service has a dedicated page with the respective API endpoints.
The required API service endpoints are:
-
When the API endpoints are identified, you need to set them in Zabbix as user macros to the host that the template is attached to (similarly to step #8):
-
{$OCI.API.CORE.HOST}- Core Services API endpoint, for example,iaas.eu-stockholm-1.oraclecloud.com; -
{$OCI.API.AUTONOMOUS.DB.HOST}- Database Service API endpoint, for example,database.eu-stockholm-1.oraclecloud.com; -
{$OCI.API.OBJECT.STORAGE.HOST}- Object Storage Service API endpoint, for example,objectstorage.eu-stockholm-1.oraclecloud.com; -
{$OCI.API.TELEMETRY.HOST}- Monitoring API endpoint, for example,telemetry.eu-stockholm-1.oraclecloud.com;
IMPORTANT! API Endpoint URLs need to be entered without the HTTP scheme (
https://). -
-
Once you've completed adding the host to Zabbix, and it will automatically discover services and monitor them.
Optional setup
LLD resource filtering by free-form tags of OCI resources
Every LLD rule has pre-added filtering options to avoid discovering unwanted resources, such as terminated OCI
compute instances. Most of these filters use specific service item names and states, and values of these filters
are defined by the user macros {$....MATCHES} and {$....NOT_MATCHES}.
To add additional filtering options, every discovery script (except VCN discovery), gathers free-form tag data about a specific resource. Since free-form tags are completely custom and format or usage will vary between users, free-from tag filters are not included under LLD filters by default, but can be easily added as they are already being collected by scripts.
Example
-
In Oracle Cloud Console, add a free-form tag to a resource, for example, a compute instance. The tag key will be
location_groupand the tag value will beeu-north-1. -
Open the Oracle Cloud by HTTP template in Zabbix and go to "Discovery rules". Find "Compute instances discovery" and open it.
-
Under "LLD macros", add a new macro that will represent this location group tag, for example:
{#LOCATION_GROUP}$.tags.location_group. -
Under the "Filters" tab, there will already be filters regarding the compute instance name and state. Click "Add" to add a new filter and define the previously created LLD macro and add a matching pattern and value, for example,
{#LOCATION_GROUP}matcheseu-north-*. -
The next time
Compute instances discoveryis executed, it will only discover OCI compute instances that have the free-form taglocation_groupthat matches the regex ofeu-north-*. You can also experiment with the LLD filter pattern matching value to receive different matching results for a specified value.
HTTP proxy usage
If needed, you can specify an HTTP proxy for the template by changing the value of the {$OCI.HTTP.PROXY} user
macro.
Custom OK HTTP response
If using a proxy, the returned OK HTTP response could change from "200" to a different value.
In that case, please adjust the user macro {$OCI.HTTP.RETURN.CODE.OK}.
LLD filter value changing
LLD filter values and trigger threshold values can be changed with the respective user macros.
Macros used
| Name | Description | Default |
|---|---|---|
| {$OCI.API.CORE.HOST} | Host for OCI Core Services API endpoint. |
|
| {$OCI.API.TELEMETRY.HOST} | Host for OCI Monitoring API endpoint. |
|
| {$OCI.API.OBJECT.STORAGE.HOST} | Host for OCI Object Storage API endpoint. |
|
| {$OCI.API.AUTONOMOUS.DB.HOST} | Host for OCI Autonomous Database API endpoint. |
|
| {$OCI.API.COMPARTMENT.COMPUTE} | Compartment OCIDs for compute instances. Can be a single value or a comma separated list of values. |
|
| {$OCI.API.COMPARTMENT.VCN} | Compartment OCIDs for virtual cloud networks. Can be a single value or a comma separated list of values. |
|
| {$OCI.API.COMPARTMENT.VOLUME.BLOCK} | Compartment OCIDs for block volumes. Can be a single value or a comma separated list of values. |
|
| {$OCI.API.COMPARTMENT.VOLUME.BOOT} | Compartment OCIDs for boot volumes. Can be a single value or a comma separated list of values. |
|
| {$OCI.API.COMPARTMENT.OBJECT.STORAGE} | Compartment OCIDs for object storage buckets. Can be a single value or a comma separated list of values. |
|
| {$OCI.API.COMPARTMENT.AUTONOMOUS.DB} | Compartment OCIDs for autonomous databases. Can be a single value or a comma separated list of values. |
|
| {$OCI.API.TENANCY} | OCID of tenancy. |
|
| {$OCI.API.USER} | OCID of user. |
|
| {$OCI.API.PRIVATE.KEY} | Entire private key for API access. |
|
| {$OCI.API.FINGERPRINT} | Fingerprint of private key. |
|
| {$OCI.COMPUTE.DISCOVERY.STATE.MATCHES} | Sets the regex string of compute instance states to allow in discovery. |
.* |
| {$OCI.COMPUTE.DISCOVERY.STATE.NOT_MATCHES} | Sets the regex string of compute instance states to ignore in discovery. |
TERMINATED |
| {$OCI.COMPUTE.DISCOVERY.NAME.MATCHES} | Sets the regex string of compute instance names to allow in discovery. |
.* |
| {$OCI.COMPUTE.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of compute instance names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.VCN.DISCOVERY.STATE.MATCHES} | Sets the regex string of virtual cloud network states to allow in discovery. |
.* |
| {$OCI.VCN.DISCOVERY.STATE.NOT_MATCHES} | Sets the regex string of virtual cloud network states to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.VCN.DISCOVERY.NAME.MATCHES} | Sets the regex string of virtual cloud network names to allow in discovery. |
.* |
| {$OCI.VCN.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of virtual cloud network names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.VOLUME.BLOCK.DISCOVERY.STATE.MATCHES} | Sets the regex string of block volume states to allow in discovery. |
.* |
| {$OCI.VOLUME.BLOCK.DISCOVERY.STATE.NOT_MATCHES} | Sets the regex string of block volume states to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.VOLUME.BLOCK.DISCOVERY.NAME.MATCHES} | Sets the regex string of block volume names to allow in discovery. |
.* |
| {$OCI.VOLUME.BLOCK.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of block volume names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.VOLUME.BOOT.DISCOVERY.STATE.MATCHES} | Sets the regex string of boot volume states to allow in discovery. |
.* |
| {$OCI.VOLUME.BOOT.DISCOVERY.STATE.NOT_MATCHES} | Sets the regex string of boot volume states to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.VOLUME.BOOT.DISCOVERY.NAME.MATCHES} | Sets the regex string of boot volume names to allow in discovery. |
.* |
| {$OCI.VOLUME.BOOT.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of boot volume names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.OBJECT.STORAGE.DISCOVERY.NAME.MATCHES} | Sets the regex string of storage names to allow in discovery. |
.* |
| {$OCI.OBJECT.STORAGE.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of storage names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.AUTONOMOUS.DB.DISCOVERY.STATE.MATCHES} | Sets the regex string of autonomous database states to allow in discovery. |
.* |
| {$OCI.AUTONOMOUS.DB.DISCOVERY.STATE.NOT_MATCHES} | Sets the regex string of autonomous database states to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.AUTONOMOUS.DB.DISCOVERY.NAME.MATCHES} | Sets the regex string of autonomous database names to allow in discovery. |
.* |
| {$OCI.AUTONOMOUS.DB.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of autonomous database names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.HTTP.PROXY} | Set an HTTP proxy for OCI API requests if needed. |
|
| {$HTTP.TLS.VERIFY} | TLS certificate verification for script items: "none" - disabled, "peer" - verify the certificate chain and expiration, "full" - full verification. Any other value enables full verification. To override the setting for this template only, define the macro with the context "Oracle Cloud", e.g. {$HTTP.TLS.VERIFY:"Oracle Cloud"}. |
full |
| {$OCI.HTTP.RETURN.CODE.OK} | Set the HTTP return code that represents an OK response from the API. The default is "200", but can vary, for example, if a proxy is used. |
200 |
LLD rule Compute instances discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Compute instances discovery | Discover compute instances. |
Script | oci.compute.discovery |
LLD rule Virtual cloud networks discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Virtual cloud networks discovery | Discover virtual cloud networks (VCNs). |
Script | oci.vcn.discovery |
LLD rule Block volumes discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Block volumes discovery | Discover block volumes. |
Script | oci.block.volumes.discovery |
LLD rule Boot volumes discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Boot volumes discovery | Discover boot volumes. |
Script | oci.boot.volumes.discovery |
LLD rule Object storage discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Object storage discovery | Discover object storage. |
Script | oci.object.storage.discovery |
LLD rule Autonomous database discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Autonomous database discovery | Discover autonomous databases. |
Script | oci.object.autonomous.db.discovery |