google-cloudmonitoring

4.1.5 • Public • Published

Google Cloud Monitoring Wrapper

A simple node.js wrapper arround the Google Cloud Monitoring API

Installation

npm install google-cloudmonitoring

Usage

  1. Enable Google Cloud Monitoring API in your Google Developer Console.
  2. The library will autodetect an existing GCloud installation or tries to pull the service account from the GCE instance metadata.
  3. Include it into your app!

Example

const GLM = require('google-cloudmonitoring')('v3');
 
// resource is optional, if not GLM will try to detect the
// resource information using GCE instance metadata
const resource = { 'type': 'gce_instance',
                   'labels': { 'instance_id': 'your-instance-id',
                               'zone': 'us-central1-a' }};
 
const glm = new GLM({ resource });
 
const value = 42;
 
glm.on('error', function (err) {
  console.log('Something bad happened:', err.message);
})
 
glm.setValue('/your/metric/name', value, { '/your/label': 'glm' });
 

Package Sidebar

Install

npm i google-cloudmonitoring

Weekly Downloads

1

Version

4.1.5

License

MIT

Last publish

Collaborators

  • jaclar