{"id":41661,"library":"oci-monitoring","title":"OCI Monitoring Client for Node.js","description":"Official Oracle Cloud Infrastructure (OCI) Monitoring client for Node.js, part of the OCI TypeScript SDK (v2.132.0). Allows managing monitoring metrics, alarms, and retrieval of metric data. Requires OCI account, user with policy grants, and API signing key. Updates follow OCI SDK release cadence. Distinguishes from generic cloud monitoring SDKs by its tight integration with OCI IAM, compartment-based access control, and native support for OCI Monitoring APIs (listMetrics, postMetricData, etc.).","status":"active","version":"2.132.0","language":"javascript","source_language":"en","source_url":"https://github.com/oracle/oci-typescript-sdk","tags":["javascript","typescript"],"install":[{"cmd":"npm install oci-monitoring","lang":"bash","label":"npm"},{"cmd":"yarn add oci-monitoring","lang":"bash","label":"yarn"},{"cmd":"pnpm add oci-monitoring","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core OCI SDK for auth, HTTP, and request signing","package":"oci-common","optional":false},{"reason":"Optional for fetching resource principals in some auth flows","package":"oci-identity","optional":true}],"imports":[{"note":"Named export, not default. CommonJS: const { MonitoringClient } = require('oci-monitoring').","wrong":"import MonitoringClient from 'oci-monitoring'","symbol":"MonitoringClient","correct":"import { MonitoringClient } from 'oci-monitoring'"},{"note":"models is a namespace, not a named export. Access e.g. models.Metric.","wrong":"import { models } from 'oci-monitoring'","symbol":"models","correct":"import * as models from 'oci-monitoring/lib/model'"},{"note":"requests is a namespace export. Use for type definitions of request objects.","wrong":"import { requests } from 'oci-monitoring'","symbol":"requests","correct":"import * as requests from 'oci-monitoring/lib/request'"}],"quickstart":{"code":"import { MonitoringClient } from 'oci-monitoring';\nimport { Region, SimpleAuthenticationDetailsProvider } from 'oci-common';\n\n// Set up auth provider using config file (~/.oci/config)\nimport { ConfigFileAuthenticationDetailsProvider } from 'oci-common';\nconst provider = new ConfigFileAuthenticationDetailsProvider();\n\nconst client = new MonitoringClient({ authenticationDetailsProvider: provider });\nclient.region = Region.US_ASHBURN_1;\n\nasync function listMetrics() {\n  const compartmentId = process.env.COMPARTMENT_ID ?? '';\n  const request = {\n    compartmentId: compartmentId,\n    name: 'cpu_utilization',\n    namespace: 'oci_computeagent',\n    dimensionFilters: {}\n  };\n  const response = await client.listMetrics(request);\n  console.log(response.items);\n}\n\nlistMetrics().catch(console.error);","lang":"typescript","description":"Lists metrics for a given compartment using OCI Monitoring SDK. Sets up auth from config, creates client, and calls listMetrics."},"warnings":[{"fix":"Pass an AuthenticationDetailsProvider instance, e.g., from ConfigFileAuthenticationDetailsProvider.","message":"In v2.x, MonitoringClient constructor requires authenticationDetailsProvider object (not just config file)","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use typed dimension arrays instead of plain objects for dimensions in MetricDataDetails.","message":"MetricDataDetails in postMetricData now prefers explicit dimension fields instead of free-form dimensions","severity":"deprecated","affected_versions":">=2.100.0"},{"fix":"Always include compartmentId in listMetrics, postMetricData, etc.","message":"Requests often require compartmentId even when not explicitly documented in request type","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Check error.statusCode for OCI-specific status codes (e.g., 404).","message":"Error handling: many operations return Error with statusCode field, not standard HTTP error","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Switch to ConfigFileAuthenticationDetailsProvider or ResourcePrincipalAuthenticationDetailsProvider.","message":"Usage of RawAuthenticationDetailsProvider without proper key id","severity":"deprecated","affected_versions":"<2.50.0"},{"fix":"Use import syntax or dynamic import(). For CommonJS: const { MonitoringClient } = await import('oci-monitoring').","message":"OCI SDK migrated from CommonJS to ESM in v2.132.0, breaking require() imports","severity":"breaking","affected_versions":">=2.132.0"}],"env_vars":null,"search_vec":"'access':65 'account':34 'alarm':26 'allow':22 'api':40,73 'base':64 'cadenc':48 'client':3,12 'cloud':8,52 'compart':63 'compartment-bas':62 'control':66 'data':31 'distinguish':49 'etc':76 'follow':44 'generic':51 'grant':38 'iam':61 'infrastructur':9 'integr':58 'javascript':77 'key':42 'listmetr':74 'manag':23 'metric':25,30 'monitor':2,11,24,53,72 'nativ':68 'node.js':5,14 'oci':1,10,18,33,45,60,71 'offici':6 'oracl':7 'part':15 'polici':37 'postmetricdata':75 'releas':47 'requir':32 'retriev':28 'sdk':20,46 'sdks':54 'sign':41 'support':69 'tight':57 'typescript':19,78 'updat':43 'user':35 'v2.132.0':21","created_at":"2026-06-04T18:53:29.729563+00:00","updated_at":"2026-06-04T18:53:29.729563+00:00","problems":[{"fix":"Ensure authenticationDetailsProvider is properly created, e.g., new ConfigFileAuthenticationDetailsProvider().","cause":"Missing or misconfigured auth provider passed to MonitoringClient constructor.","error":"TypeError: Cannot read properties of undefined (reading 'authenticationDetailsProvider')"},{"fix":"Add compartmentId to the request object, e.g., { compartmentId: 'ocid1.compartment.oc1..example' }.","cause":"compartmentId not provided in request object for listMetrics/postMetricData.","error":"Error: Missing required parameter 'compartmentId'"},{"fix":"Verify the fingerprint in your config file (~/.oci/config) matches the one of the uploaded public key.","cause":"OCI API key fingerprint mismatch between private key and public key uploaded in OCI console.","error":"Error: The provided key does not match the fingerprint"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/oracle/oci-typescript-sdk#readme","github":"https://github.com/oracle/oci-typescript-sdk","docs":null,"changelog":null,"pypi":null,"npm":"oci-monitoring","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}