Dostupná řešení
Oracle Cloud Costs by HTTP
Overview
This template monitors Oracle Cloud Infrastructure (OCI) costs and budgets.
For communication with OCI, this template utilizes script items which execute HTTP GET requests.
Requirements
Zabbix version: 8.0 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 usage-reports in tenancy Allow group 'zabbix_api' to read usage-budgets 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. -
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 Costs 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.BUDGET.HOST}- Budgets API endpoint, for example,usage.eu-stockholm-1.oraclecloud.com; -
{$OCI.API.USAGE.HOST}- Usage API endpoint, for example,usageapi.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 budgets, services, compartments and region and monitor their cost related metrics.
Optional setup
LLD resource filtering
All discoveries has include and exclude filters to avoid discovering unwanted or unnecessary entities.
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.
Threshold macros
Threshold macros could be used with a context to fine tune threshold for different services, compartments, region and budgets.
Macros used
| Name | Description | Default |
|---|---|---|
| {$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 Costs", e.g. {$HTTP.TLS.VERIFY:"Oracle Cloud Costs"}. |
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 |
| {$OCI.SCRIPT.TIMEOUT} | Set a JavaScript timeout. |
10s |
| {$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.API.USAGE.HOST} | Host for OCI usage API endpoint. |
|
| {$OCI.API.BUDGET.HOST} | Host for OCI budget API endpoint. |
|
| {$OCI.COST.BUDGET.DISCOVERY.STATE.MATCHES} | Sets the regex string of budget states to allow in discovery. |
.* |
| {$OCI.COST.BUDGET.DISCOVERY.STATE.NOT_MATCHES} | Sets the regex string of budget states to exclude in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.COST.BUDGET.DISCOVERY.NAME.MATCHES} | Sets the regex string of budget names to allow in discovery. |
.* |
| {$OCI.COST.BUDGET.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of budget names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.COST.SERVICE.DISCOVERY.NAME.MATCHES} | Sets the regex string of service names to allow in discovery. |
.* |
| {$OCI.COST.SERVICE.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of service names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.COST.REGION.DISCOVERY.NAME.MATCHES} | Sets the regex string of region names to allow in discovery. |
.* |
| {$OCI.COST.REGION.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of region names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.COST.COMPARTMENT.DISCOVERY.NAME.MATCHES} | Sets the regex string of compartment names to allow in discovery. |
.* |
| {$OCI.COST.COMPARTMENT.DISCOVERY.NAME.NOT_MATCHES} | Sets the regex string of compartment names to ignore in discovery. |
CHANGE_IF_NEEDED |
| {$OCI.COST.SERVICE.MONTHLY.DELTA.PERCENTAGE.WARN} | Service warning threshold for current month percentage excess, comparing to previous. Could be used with a context to define specific service. |
110 |
| {$OCI.COST.SERVICE.DAILY.DELTA.PERCENTAGE.WARN} | Service warning threshold for current day percentage excess, comparing to previous. Could be used with a context to define specific service. |
125 |
| {$OCI.COST.REGION.MONTHLY.DELTA.PERCENTAGE.WARN} | Region warning threshold for current month percentage excess, comparing to previous. Could be used with a context to define specific region. |
110 |
| {$OCI.COST.REGION.DAILY.DELTA.PERCENTAGE.WARN} | Region warning threshold for current day percentage excess, comparing to previous. Could be used with a context to define specific region. |
125 |
| {$OCI.COST.COMPARTMENT.MONTHLY.DELTA.PERCENTAGE.WARN} | Compartment warning threshold for current month percentage excess, comparing to previous. Could be used with a context to define specific compartment. |
110 |
| {$OCI.COST.COMPARTMENT.DAILY.DELTA.PERCENTAGE.WARN} | Compartment warning threshold for current day percentage excess, comparing to previous. Could be used with a context to define specific compartment. |
125 |
| {$OCI.COST.TOTAL.MONTHLY.DELTA.PERCENTAGE.WARN} | Total warning threshold for current month percentage excess, comparing to previous. |
105 |
| {$OCI.COST.TOTAL.DAILY.DELTA.PERCENTAGE.WARN} | Total warning threshold for current day percentage excess, comparing to previous. |
110 |
| {$OCI.COST.BUDGET.PERCENTAGE.WARN} | Budget warning threshold for spend percentage excess. Could be used with a context to define specific budget. |
80 |
Items
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Get month cost | Collects Oracle month cost. |
Dependent item | oci_cost.month.cost.get Preprocessing
|
| Daily average cost | Oracle daily average cost. |
Calculated | oci_cost.daily.average.cost Preprocessing
|
| Usage, get data | Master item to get usage info. |
Script | oci_cost.usage.get |
| Budgets, get data | Master item to get budget info. |
Script | oci_cost.budget.get |
| Total: Hourly cost | The hourly cost of the total. |
Dependent item | oci_cost.usage.total.cost.hourly Preprocessing
|
| Total: Monthly cost, current | The current month total cost of the total. |
Dependent item | oci_cost.usage.total.cost.monthly.current Preprocessing
|
| Total: Monthly cost, previous | The previous month total cost of the service. |
Dependent item | oci_cost.usage.total.cost.monthly.previous Preprocessing
|
| Total: Daily cost, current | The current day total cost. |
Dependent item | oci_cost.usage.total.cost.daily.current Preprocessing
|
| Total: Daily cost, previous | The previous day total cost of the service. |
Dependent item | oci_cost.usage.total.cost.daily.previous Preprocessing
|
| Total: Monthly delta | The monthly delta of the total. |
Calculated | oci_cost.usage.total.cost.monthly.delta Preprocessing
|
| Total: Monthly delta, in percentage | The monthly total delta for the service, in percentage. |
Calculated | oci_cost.usage.total.cost.monthly.delta.percentage Preprocessing
|
| Total: Daily delta | The daily delta of the total. |
Calculated | oci_cost.usage.total.cost.daily.delta Preprocessing
|
| Total: Daily delta, in percentage | The daily delta for the total, in percentage. |
Calculated | oci_cost.usage.total.cost.daily.delta.percentage Preprocessing
|
| Service: Count | Number of services. |
Dependent item | oci_cost.service.count Preprocessing
|
| Compartment: Count | Number of compartments. |
Dependent item | oci_cost.compartment.count Preprocessing
|
| Region: Count | Number of regions. |
Dependent item | oci_cost.region.count Preprocessing
|
| Budget: Total amount | The amount sum of all budgets. |
Dependent item | oci_cost.budget.amount.total Preprocessing
|
| Budget: Total actual spend | The actual spend sum of all budgets. |
Dependent item | oci_cost.budget.actual.total Preprocessing
|
| Budget: Total forecasted spend | The forecasted spend sum of all budgets. |
Dependent item | oci_cost.budget.forecast.total Preprocessing
|
| Budget: Total actual spend, in percentage | The actual total spend for the current budget cycle, expressed in percentage. |
Calculated | oci_cost.budget.actual.percentage.total Preprocessing
|
Triggers
| Name | Description | Expression | Severity | Dependencies and additional info |
|---|---|---|---|---|
| OCI Costs: Current month costs exceeded previous | Current month costs exceeded previous. |
last(/Oracle Cloud Costs by HTTP/oci_cost.usage.total.cost.monthly.delta.percentage)>{$OCI.COST.TOTAL.MONTHLY.DELTA.PERCENTAGE.WARN} |
Warning | Manual close: Yes |
| OCI Costs: Current day costs exceeded previous | Current day costs exceeded previous. |
last(/Oracle Cloud Costs by HTTP/oci_cost.usage.total.cost.daily.delta.percentage)>{$OCI.COST.TOTAL.DAILY.DELTA.PERCENTAGE.WARN} |
Warning | Manual close: Yes |
| OCI Costs: Number of compartments has changed | Number of compartments has changed. |
change(/Oracle Cloud Costs by HTTP/oci_cost.compartment.count)<>0 |
Info | Manual close: Yes |
| OCI Costs: Number of regions has changed | Number of regions has changed. |
change(/Oracle Cloud Costs by HTTP/oci_cost.region.count)<>0 |
Warning | Manual close: Yes |
LLD rule Month discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Month discovery | Discovers month cost history. |
Dependent item | oci_cost.month.discovery |
Item prototypes for Month discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Month [{#OCI.MONTH}]: Get data | Collects month cost history. |
Dependent item | oci_cost.month.cost.data.get[{#OCI.MONTH}] Preprocessing
|
| Month [{#OCI.MONTH}]: Total cost | Oracle |
Dependent item | oci_cost.month.total.cost[{#OCI.MONTH}] Preprocessing
|
LLD rule Budget discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Budget discovery | Discover budget in your tenancy. |
Dependent item | oci_cost.budget.discovery Preprocessing
|
Item prototypes for Budget discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Budget [{#NAME}]: State | The current state of the budget. |
Dependent item | oci_cost.budget.state[{#ID}] Preprocessing
|
| Budget [{#NAME}]: Amount | The amount of the budget. |
Dependent item | oci_cost.budget.amount[{#ID}] Preprocessing
|
| Budget [{#NAME}]: Actual spend | The actual spend for the current budget cycle. |
Dependent item | oci_cost.budget.actual[{#ID}] Preprocessing
|
| Budget [{#NAME}]: Forecasted spend | The forecasted spend by the end of the current budget cycle. |
Dependent item | oci_cost.budget.forecast[{#ID}] Preprocessing
|
| Budget [{#NAME}]: Forecast spend, in percentage | The forecast spend for the current budget cycle, expressed in percentage. |
Calculated | oci_cost.budget.forecast.percentage[{#ID}] Preprocessing
|
| Budget [{#NAME}]: Actual spend, in percentage | The actual spend for the current budget cycle, expressed in percentage. |
Calculated | oci_cost.budget.actual.percentage[{#ID}] Preprocessing
|
Trigger prototypes for Budget discovery
| Name | Description | Expression | Severity | Dependencies and additional info |
|---|---|---|---|---|
| OCI Costs: Budget become inactive | Budget is not in active state. |
last(/Oracle Cloud Costs by HTTP/oci_cost.budget.state[{#ID}])<>1 |
Warning | Manual close: Yes |
| OCI Costs: Budget forecast spend amount too big | Budget forecast spent amount exceed threshold. |
last(/Oracle Cloud Costs by HTTP/oci_cost.budget.forecast.percentage[{#ID}])>{$OCI.COST.BUDGET.PERCENTAGE.WARN:"{#ID}"} |
Warning | Manual close: Yes |
| OCI Costs: Budget spend amount too big | Budget spent amount exceed threshold. |
last(/Oracle Cloud Costs by HTTP/oci_cost.budget.actual.percentage[{#ID}])>{$OCI.COST.BUDGET.PERCENTAGE.WARN:"{#ID}"} |
Warning | Manual close: Yes |
LLD rule Service discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Service discovery | Discover services in your tenancy. |
Dependent item | oci_cost.usage.service.discovery Preprocessing
|
Item prototypes for Service discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Service [{#NAME}]: Hourly cost | The hourly cost of the service. |
Dependent item | oci_cost.usage.service.cost.hourly[{#NAME}] Preprocessing
|
| Service [{#NAME}]: Monthly cost, current | The current monthly cost of the service. |
Dependent item | oci_cost.usage.service.cost.monthly.current[{#NAME}] Preprocessing
|
| Service [{#NAME}]: Monthly cost, previous | The previous monthly cost of the service. |
Dependent item | oci_cost.usage.service.cost.monthly.previous[{#NAME}] Preprocessing
|
| Service [{#NAME}]: Daily cost, current | The current daily cost of the service. |
Dependent item | oci_cost.usage.service.cost.daily.current[{#NAME}] Preprocessing
|
| Service [{#NAME}]: Daily cost, previous | The previous daily cost of the service. |
Dependent item | oci_cost.usage.service.cost.daily.previous[{#NAME}] Preprocessing
|
| Service [{#NAME}]: Monthly delta | The monthly delta of the service. |
Calculated | oci_cost.usage.service.cost.monthly.delta[{#NAME}] Preprocessing
|
| Service [{#NAME}]: Monthly delta, in percentage | The monthly delta for the service, in percentage. |
Calculated | oci_cost.usage.service.cost.monthly.delta.percentage[{#NAME}] Preprocessing
|
| Service [{#NAME}]: Daily delta | The daily delta of the service. |
Calculated | oci_cost.usage.service.cost.daily.delta[{#NAME}] Preprocessing
|
| Service [{#NAME}]: Daily delta, in percentage | The daily delta for the service, in percentage. |
Calculated | oci_cost.usage.service.cost.daily.delta.percentage[{#NAME}] Preprocessing
|
Trigger prototypes for Service discovery
| Name | Description | Expression | Severity | Dependencies and additional info |
|---|---|---|---|---|
| OCI Costs: Current month costs for service exceeded previous | Current month costs for service exceeded previous. |
last(/Oracle Cloud Costs by HTTP/oci_cost.usage.service.cost.monthly.delta.percentage[{#NAME}])>{$OCI.COST.SERVICE.MONTHLY.DELTA.PERCENTAGE.WARN:"{#NAME}"} |
Warning | Manual close: Yes |
| OCI Costs: Current day costs exceeded previous | Current day costs exceeded previous. |
last(/Oracle Cloud Costs by HTTP/oci_cost.usage.service.cost.daily.delta.percentage[{#NAME}])>{$OCI.COST.SERVICE.DAILY.DELTA.PERCENTAGE.WARN:"{#NAME}"} |
Warning | Manual close: Yes |
LLD rule Region discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Region discovery | Discover regions in your tenancy. |
Dependent item | oci_cost.usage.region.discovery Preprocessing
|
Item prototypes for Region discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Region [{#NAME}]: Hourly cost | The hourly cost of the region. |
Dependent item | oci_cost.usage.region.cost.hourly[{#NAME}] Preprocessing
|
| Region [{#NAME}]: Monthly cost, current | The current monthly cost of the region. |
Dependent item | oci_cost.usage.region.cost.monthly.current[{#NAME}] Preprocessing
|
| Region [{#NAME}]: Monthly cost, previous | The previous monthly cost of the region. |
Dependent item | oci_cost.usage.region.cost.monthly.previous[{#NAME}] Preprocessing
|
| Region [{#NAME}]: Daily cost, current | The current daily cost of the region. |
Dependent item | oci_cost.usage.region.cost.daily.current[{#NAME}] Preprocessing
|
| Region [{#NAME}]: Daily cost, previous | The previous daily cost of the region. |
Dependent item | oci_cost.usage.region.cost.daily.previous[{#NAME}] Preprocessing
|
| Region [{#NAME}]: Monthly delta | The monthly delta of the region. |
Calculated | oci_cost.usage.region.cost.monthly.delta[{#NAME}] Preprocessing
|
| Region [{#NAME}]: Daily delta | The daily delta of the region. |
Calculated | oci_cost.usage.region.cost.daily.delta[{#NAME}] Preprocessing
|
| Region [{#NAME}]: Monthly delta, in percentage | The monthly delta for the region, in percentage. |
Calculated | oci_cost.usage.region.cost.monthly.delta.percentage[{#NAME}] Preprocessing
|
| Region [{#NAME}]: Daily delta, in percentage | The daily delta for the region, in percentage. |
Calculated | oci_cost.usage.region.cost.daily.delta.percentage[{#NAME}] Preprocessing
|
Trigger prototypes for Region discovery
| Name | Description | Expression | Severity | Dependencies and additional info |
|---|---|---|---|---|
| OCI Costs: Current month costs for region exceeded previous | Current month costs for region exceeded previous. |
last(/Oracle Cloud Costs by HTTP/oci_cost.usage.region.cost.monthly.delta.percentage[{#NAME}])>{$OCI.COST.REGION.MONTHLY.DELTA.PERCENTAGE.WARN:"{#NAME}"} |
Warning | Manual close: Yes |
| OCI Costs: Current day costs exceeded previous | Current day costs exceeded previous. |
last(/Oracle Cloud Costs by HTTP/oci_cost.usage.region.cost.daily.delta.percentage[{#NAME}])>{$OCI.COST.REGION.DAILY.DELTA.PERCENTAGE.WARN:"{#NAME}"} |
Warning | Manual close: Yes |
LLD rule Compartment discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Compartment discovery | Discover compartments in your tenancy. |
Dependent item | oci_cost.usage.compartment.discovery Preprocessing
|
Item prototypes for Compartment discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Compartment [{#NAME}]: Hourly cost | The hourly cost of the compartment. |
Dependent item | oci_cost.usage.compartment.cost.hourly[{#NAME}] Preprocessing
|
| Compartment [{#NAME}]: Monthly cost, current | The current monthly cost of the compartment. |
Dependent item | oci_cost.usage.compartment.cost.monthly.current[{#NAME}] Preprocessing
|
| Compartment [{#NAME}]: Monthly cost, previous | The previous monthly cost of the compartment. |
Dependent item | oci_cost.usage.compartment.cost.monthly.previous[{#NAME}] Preprocessing
|
| Compartment [{#NAME}]: Daily cost, current | The current daily cost of the compartment. |
Dependent item | oci_cost.usage.compartment.cost.daily.current[{#NAME}] Preprocessing
|
| Compartment [{#NAME}]: Daily cost, previous | The previous daily cost of the compartment. |
Dependent item | oci_cost.usage.compartment.cost.daily.previous[{#NAME}] Preprocessing
|
| Compartment [{#NAME}]: Monthly delta | The monthly delta of the compartment. |
Calculated | oci_cost.usage.compartment.cost.monthly.delta[{#NAME}] Preprocessing
|
| Compartment [{#NAME}]: Daily delta | The daily delta of the compartment. |
Calculated | oci_cost.usage.compartment.cost.daily.delta[{#NAME}] Preprocessing
|
| Compartment [{#NAME}]: Monthly delta, in percentage | The monthly delta for the compartment, in percentage. |
Calculated | oci_cost.usage.compartment.cost.monthly.delta.percentage[{#NAME}] Preprocessing
|
| Compartment [{#NAME}]: Daily delta, in percentage | The daily delta for the compartment, in percentage. |
Calculated | oci_cost.usage.compartment.cost.daily.delta.percentage[{#NAME}] Preprocessing
|
Trigger prototypes for Compartment discovery
| Name | Description | Expression | Severity | Dependencies and additional info |
|---|---|---|---|---|
| OCI Costs: Current month costs for compartment exceeded previous | Current month costs for compartment exceeded previous. |
last(/Oracle Cloud Costs by HTTP/oci_cost.usage.compartment.cost.monthly.delta.percentage[{#NAME}])>{$OCI.COST.COMPARTMENT.MONTHLY.DELTA.PERCENTAGE.WARN:"{#NAME}"} |
Warning | Manual close: Yes |
| OCI Costs: Current day costs exceeded previous | Current day costs exceeded previous. |
last(/Oracle Cloud Costs by HTTP/oci_cost.usage.compartment.cost.daily.delta.percentage[{#NAME}])>{$OCI.COST.COMPARTMENT.DAILY.DELTA.PERCENTAGE.WARN:"{#NAME}"} |
Warning | Manual close: Yes |