Contains the total number of infrastructure hosts reporting
during a given hour that were running the Datadog Agent.
alibaba_host_count
int64
Contains the total number of hosts that reported through Alibaba integration
(and were NOT running the Datadog Agent).
apm_azure_app_service_host_count
int64
Contains the total number of Azure App Services hosts using APM.
apm_host_count
int64
Shows the total number of hosts using APM during the hour,
these are counted as billable (except during trial periods).
aws_host_count
int64
Contains the total number of hosts that reported through the AWS integration
(and were NOT running the Datadog Agent).
azure_host_count
int64
Contains the total number of hosts that reported through Azure integration
(and were NOT running the Datadog Agent).
container_count
int64
Shows the total number of containers reported by the Docker integration during the hour.
gcp_host_count
int64
Contains the total number of hosts that reported through the Google Cloud integration
(and were NOT running the Datadog Agent).
heroku_host_count
int64
Contains the total number of Heroku dynos reported by the Datadog Agent.
host_count
int64
Contains the total number of billable infrastructure hosts reporting during a given hour.
This is the sum of agent_host_count, aws_host_count, and gcp_host_count.
hour
date-time
The hour for the usage.
infra_azure_app_service
int64
Contains the total number of hosts that reported through the Azure App Services integration
(and were NOT running the Datadog Agent).
opentelemetry_apm_host_count
int64
Contains the total number of hosts using APM reported by Datadog exporter for the OpenTelemetry Collector.
opentelemetry_host_count
int64
Contains the total number of hosts reported by Datadog exporter for the OpenTelemetry Collector.
org_name
string
The organization name.
public_id
string
The organization public ID.
vsphere_host_count
int64
Contains the total number of hosts that reported through vSphere integration
(and were NOT running the Datadog Agent).
"""
Get hourly usage for hosts and containers returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_hosts(start_hr=(datetime.now()+relativedelta(days=-5)),end_hr=(datetime.now()+relativedelta(days=-3)),)print(response)
# Get hourly usage for hosts and containers returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_hosts((Time.now+-5*86400),opts)
// Get hourly usage for hosts and containers returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""time""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewUsageMeteringApi(apiClient)resp,r,err:=api.GetUsageHosts(ctx,time.Now().AddDate(0,0,-5),*datadogV1.NewGetUsageHostsOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageHosts`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageHosts`:\n%s\n",responseContent)}
// Get hourly usage for hosts and containers returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.UsageMeteringApi;importcom.datadog.api.client.v1.api.UsageMeteringApi.GetUsageHostsOptionalParameters;importcom.datadog.api.client.v1.model.UsageHostsResponse;importjava.time.OffsetDateTime;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{UsageHostsResponseresult=apiInstance.getUsageHosts(OffsetDateTime.now().plusDays(-5),newGetUsageHostsOptionalParameters().endHr(OffsetDateTime.now().plusDays(-3)));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getUsageHosts");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get hourly usage for hosts and containers returns "OK" response
usechrono::{DateTime,Utc};usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_usage_metering::GetUsageHostsOptionalParams;usedatadog_api_client::datadogV1::api_usage_metering::UsageMeteringAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsageMeteringAPI::with_config(configuration);letresp=api.get_usage_hosts(DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00").expect("Failed to parse datetime").with_timezone(&Utc),GetUsageHostsOptionalParams::default().end_hr(DateTime::parse_from_rfc3339("2021-11-08T11:11:11+00:00").expect("Failed to parse datetime").with_timezone(&Utc),),).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get hourly usage for hosts and containers returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.UsageMeteringApi(configuration);constparams: v1.UsageMeteringApiGetUsageHostsRequest={startHr: newDate(newDate().getTime()+-5*86400*1000),endHr: newDate(newDate().getTime()+-3*86400*1000),};apiInstance.getUsageHosts(params).then((data: v1.UsageHostsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));