Available solutions
OpenAI Platform by HTTP
Overview
This template is designed for the effortless deployment of OpenAI Platform monitoring by Zabbix via HTTP and doesn't require any external scripts.
Please consult the OpenAI API documentation for more details.
Requirements
Zabbix version: 8.0 and higher.
Tested versions
This template has been tested on:
- OpenAI Platform
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
- Create an API token (admin key) on the OpenAI Platform page.
- Enter the API token into the
{$OPENAI.API.TOKEN}macro.
Macros used
| Name | Description | Default |
|---|---|---|
| {$OPENAI.API.URL} | OpenAI API URL. |
https://api.openai.com/v1 |
| {$OPENAI.TOKEN} | OpenAI API token. |
|
| {$OPENAI.TOTAL_EXPENSES.MAX} | Limit on total daily expenses for the entire organization. |
1000 |
| {$OPENAI.EXPENSES.MAX} | Limit on daily expenses per project. |
100 |
| {$OPENAI.PROJECT.NAME.MATCHES} | This macro is used in OpenAI Platform project discovery. Can be overridden on the host or linked template level. |
.* |
| {$OPENAI.PROJECT.NAME.NOT_MATCHES} | This macro is used in OpenAI Platform project discovery. Can be overridden on the host or linked template level. |
CHANGE_IF_NEEDED |
| {$OPENAI.MODEL.NAME.MATCHES} | This macro is used in OpenAI Platform model discovery. Can be overridden on the host or linked template level. |
.* |
| {$OPENAI.MODEL.NAME.NOT_MATCHES} | This macro is used in OpenAI Platform model discovery. Can be overridden on the host or linked template level. |
CHANGE_IF_NEEDED |
| {$OPENAI.DATA.TIMEOUT} | Response timeout for an API. |
15s |
| {$OPENAI.HTTP_PROXY} | HTTP proxy for API requests. You can specify it using the format [protocol://][username[:password]@]proxy.example.com[:port]. See the documentation at https://www.zabbix.com/documentation/8.0/manual/config/items/itemtypes/http |
|
| {$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 "OpenAI Platform", e.g. {$HTTP.TLS.VERIFY:"OpenAI Platform"}. |
full |
Items
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Daily project count | Total daily project count. |
Dependent item | openai.daily.project.count Preprocessing
|
| Get data | Item for gathering OpenAI Platform data. |
Script | openai.platform_data.get |
| Get data item errors | Item for gathering all the data item errors. |
Dependent item | openai.platform_data.errors Preprocessing
|
| Get costs | Item for gathering cost data from the OpenAI Platform. |
Script | openai.costs_data.get |
| Get cost item errors | Item for gathering all the data item errors. |
Dependent item | openai.costs_data.errors Preprocessing
|
| Get completions | Item for gathering completion data from the OpenAI Platform. |
Script | openai.completions_data.get |
| Get completion item errors | Item for gathering all the data item errors. |
Dependent item | openai.completions_data.errors Preprocessing
|
| Version | REST API version used for requests. |
Dependent item | openai.version Preprocessing
|
| Total daily expenses | Total amount of expenses for the past day. |
Dependent item | openai.expenses.total Preprocessing
|
Triggers
| Name | Description | Expression | Severity | Dependencies and additional info |
|---|---|---|---|---|
| OpenAI Platform: There are errors in the 'Get data' metric | An error occurred while attempting to retrieve values for the 'Get data' item. |
length(last(/OpenAI Platform by HTTP/openai.platform_data.errors))>0 |
Warning | |
| OpenAI Platform: There are errors in the 'Get costs' metric | An error occurred while attempting to retrieve values for the 'Get costs' item. |
length(last(/OpenAI Platform by HTTP/openai.costs_data.errors))>0 |
Warning | |
| OpenAI Platform: There are errors in the 'Get completions' metric | An error occurred while attempting to retrieve values for the 'Get completions' item. |
length(last(/OpenAI Platform by HTTP/openai.completions_data.errors))>0 |
Warning | |
| OpenAI Platform: Total daily expenses exceeded | The daily expense limit is higher than the maximum. |
last(/OpenAI Platform by HTTP/openai.expenses.total)>{$OPENAI.TOTAL_EXPENSES.MAX} |
Warning | Manual close: Yes |
LLD rule Project discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| Project discovery | Used for discovering projects on the OpenAI Platform. |
Dependent item | openai.project.discovery Preprocessing
|
Item prototypes for Project discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| {#NAME}: Get expense data | Item for gathering expense data for the {#NAME} project. |
Dependent item | openai.expenses.get[{#ID}] Preprocessing
|
| {#NAME}: Daily expenses | Amount of expenses for the past day. |
Dependent item | openai.expenses.amount[{#ID}] Preprocessing
|
| {#NAME}: Get completion data | Item for gathering completion data for the {#NAME} project. |
Dependent item | openai.completions.get[{#ID}] Preprocessing
|
| {#NAME}: Input tokens | Total number of input tokens received by all models in the project. |
Dependent item | openai.tokens.input[{#ID}] Preprocessing
|
| {#NAME}: Output tokens | Total number of output tokens sent by all models in the project. |
Dependent item | openai.tokens.output[{#ID}] Preprocessing
|
| {#NAME}: Input cached tokens | Total number of input cached tokens sent by all models in the project. |
Dependent item | openai.tokens.input_cached[{#ID}] Preprocessing
|
| {#NAME}: Input audio tokens | Total number of input audio tokens sent by all models in the project. |
Dependent item | openai.tokens.input_audio[{#ID}] Preprocessing
|
| {#NAME}: Output audio tokens | Total number of output audio tokens sent by all models in the project. |
Dependent item | openai.tokens.output_audio[{#ID}] Preprocessing
|
| {#NAME}: Model request number | Total number of requests to all models in the project. |
Dependent item | openai.requests.number[{#ID}] Preprocessing
|
Trigger prototypes for Project discovery
| Name | Description | Expression | Severity | Dependencies and additional info |
|---|---|---|---|---|
| OpenAI Platform: {#NAME}: Daily expenses exceeded | The daily expense limit for the {#NAME} ({#ID}) project is higher than the maximum. |
last(/OpenAI Platform by HTTP/openai.expenses.amount[{#ID}])>{$OPENAI.EXPENSES.MAX:"{#ID}"} |
Warning | Manual close: Yes |
LLD rule {#NAME}: Model discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| {#NAME}: Model discovery | Used for discovering models used in the {#NAME} project on the OpenAI Platform. |
Dependent item | openai.model.discovery[{#ID}] Preprocessing
|
Item prototypes for {#NAME}: Model discovery
| Name | Description | Type | Key and additional info |
|---|---|---|---|
| {#NAME} [{#MODEL}]: Get model data | Item for gathering data of the {#MODEL} model. |
Dependent item | openai.model.get[{#ID},"{#MODEL}"] Preprocessing
|
| {#NAME} [{#MODEL}]: Input tokens | Total number of input tokens received by the model {#MODEL} in the {#NAME} project. |
Dependent item | openai.tokens.input[{#ID},"{#MODEL}"] Preprocessing
|
| {#NAME} [{#MODEL}]: Output tokens | Total number of output tokens sent by the model {#MODEL} in the {#NAME} project. |
Dependent item | openai.tokens.output[{#ID},"{#MODEL}"] Preprocessing
|
| {#NAME} [{#MODEL}]: Input cached tokens | Total number of input cached tokens sent by the model {#MODEL} in the {#NAME} project. |
Dependent item | openai.tokens.input_cached[{#ID},"{#MODEL}"] Preprocessing
|
| {#NAME} [{#MODEL}]: Input audio tokens | Total number of input audio tokens sent by the model {#MODEL} in the {#NAME} project. |
Dependent item | openai.tokens.input_audio[{#ID},"{#MODEL}"] Preprocessing
|
| {#NAME} [{#MODEL}]: Output audio tokens | Total number of output audio tokens sent by the model {#MODEL} in the {#NAME} project. |
Dependent item | openai.tokens.output_audio[{#ID},"{#MODEL}"] Preprocessing
|
| {#NAME} [{#MODEL}]: Model request number | Total number of requests to the model {#MODEL} in the {#NAME} project. |
Dependent item | openai.requests.number[{#ID},"{#MODEL}"] Preprocessing
|
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums