Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
ibm-cloud-monitoring
Advanced tools
JavaScript library for the IBM Cloud Monitoring service.
Use the IBM® Cloud Monitoring service to expand your collection and retention capabilities when working with metrics, and to be able to define rules and alerts that notify you of conditions that require attention.
Provides a wrapper around the HTTP APIs for interacting with the service.
Supports listing, retrieving and savings metrics from the IBM Cloud Monitoring service.
const Monitoring = require('ibm-cloud-monitoring')
const client = new Monitoring({ scope: 's-XXX', api_key: 'API_KEY' })
// retrieve Node.js memory usage stats => { rss, heapTotal, heapUsed, external }
const memUsage = process.memoryUsage()
// metrics should use label name
const metricName = metric => `app.metric.${metric}`
// convert to memory usage stats to {key: '...', value: '...'}
const metrics = Object.entries(memUsage).map(
entry => ({key: metricName(entry[0]), value: entry[1]})
)
await client.save(metrics)
This example saves the current memory usage statistics for a Node.js application to the IBM Cloud Monitoring Service.
npm install ibm-cloud-monitoring
The following regional endpoints are available for the metrics service.
Region | Hostname |
---|---|
US-South | metrics.ng.bluemix.net |
UK | metrics.eu-gb.bluemix.net |
Germany | metrics.eu-de.bluemix.net |
Sydney | metrics.au-syd.bluemix.net |
scope
must be the GUID for the space being monitored.
Using the Bluemix CLI, the GUID for a space can be retrieved.
$ bx iam space SpaceName --guid
667fadfc-jhtg-1234-9f0e-cf4123451095
Space GUIDs must be prefixed with s-
to identify a space in the scope
parameter.
Passing this GUID as the scope
parameter would therefore use the following value.
s-667fadfc-jhtg-1234-9f0e-cf4123451095
The monitoring service supports using one of the following authentication tokens.
const Monitoring = require('ibm-cloud-monitoring')
const client = new Monitoring({
host: 'metrics.ng.bluemix.net'
scope: 's-<SPACE_GUID>',
// plus one of the following auth parameters...
api_key: 'API_KEY' // OR...
iam_token: 'IAM_TOKEN' // OR...
uaa_token: 'UAA_TOKEN'
})
The following constructor parameters are supported.
host
- Host name for the IBM Cloud Monitoring service.scope
- Scope identifier must be set to space GUID for monitoring instance.api_key
- IBM Cloud API Keyiam_token
- IBM Cloud IAM tokenuaa_token
- IBM Cloud UAA tokenclient.list()
client.list('metric.name.*')
parameters
The method takes a single string parameter for the metric query path to search. This value defaults to '*'.
returns
Promise with Array of metric labels from JSON response.
client.retrieve({
target: 'metric.name.*'
})
parameters
The method takes a single object parameter with values for the retrieval operation.
This parameter must have a target
property, containing metric labels to retrieve. It also supports the from
and until
properties to select the search time.
returns
Promise with Array of metrics and data points from JSON response.
// save single metric value
client.save({ name: 'metric.name.label', value: 0.05 })
// save multiple metric values
client.save([
{ name: 'metric.name.label', value: 0.05 },
{ name: 'metric.name.foo', value: 0.15 },
{ name: 'metric.name.bar', value: 0.25 }
])
parameters
This method takes a single parameter with metric values to save. Metric values must be an object with the name
and value
properties. An optional timestamp
property is also supported on metric values.
Multiple metric values can be saved by passing in an array of metric values.
returns
Promise with no content to indicate when save operation has finished.
Please open issues in the open-source repository on Github if you have problems.
FAQs
IBM Cloud Monitoring JavaScript Client Library
The npm package ibm-cloud-monitoring receives a total of 1 weekly downloads. As such, ibm-cloud-monitoring popularity was classified as not popular.
We found that ibm-cloud-monitoring demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.