GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — nodejs-docs-samples/monitoring at master · enterstudio/nodejs-docs-samples

Expand file tree

/

monitoring

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

monitoring

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
system-test
system-test
 
 
README.md
README.md
 
 
create_custom_metric.js
create_custom_metric.js
 
 
list_resources.js
list_resources.js
 
 
metrics.js
metrics.js
 
 
package.json
package.json
 
 
quickstart.js
quickstart.js
 
 
yarn.lock
yarn.lock
 
 

README.md

Outline

Google Cloud Platform logo

Stackdriver Monitoring Node.js samples

Stackdriver Monitoring collects metrics, events, and metadata from Google Cloud Platform, Amazon Web Services (AWS), hosted uptime probes, application instrumentation, and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch and many others.

Table of Contents

  • Setup
  • Samples
    • Listing resources
    • Custom metrics

Setup

  1. Read Prerequisites and How to run a sample first.

  2. Install dependencies:

     npm install
    

Samples

Metrics

View the documentation or the source code.

Usage: node metrics.js --help

Commands:
  create [projectId]                       Creates an example 'custom.googleapis.com/stores/daily_sales' custom metric
                                           descriptor.
  list [projectId]                         Lists metric descriptors.
  get <metricId> [projectId]               Get a metric descriptor.
  delete <metricId> [projectId]            Deletes a custom metric descriptor.
  write [projectId]                        Writes example time series data to
                                           'custom.googleapis.com/stores/daily_sales'.
  read <filter> [projectId]                Reads time series data that matches the given filter.
  read-fields [projectId]                  Reads headers of time series data that matches
                                           'compute.googleapis.com/instance/cpu/utilization'.
  read-aggregate [projectId]               Aggregates time series data that matches
                                           'compute.googleapis.com/instance/cpu/utilization'.
  read-reduce [projectId]                  Reduces time series data that matches
                                           'compute.googleapis.com/instance/cpu/utilization'.
  list-resources [projectId]               Lists monitored resource descriptors.
  get-resource <resourceType> [projectId]  Get a monitored resource descriptor.

Options:
  --help           Show help                                                                                   [boolean]
  --projectId, -p                                                                                               [string]

Examples:
  node metrics.js create
  node metrics.js list
  node metrics.js get logging.googleapis.com/log_entry_count
  node metrics.js delete
  custom.googleapis.com/stores/daily_sales
  node metrics.js list-resources
  node metrics.js get-resource cloudsql_database
  node metrics.js write
  node metrics.js read
  'metric.type="compute.googleapis.com/instance/cpu/utilizatio
  n"'
  node metrics.js read-fields
  node metrics.js read-aggregate
  node metrics.js read-reduce

For more information, see https://cloud.google.com/monitoring/docs

List resources

list_resources.js is a command-line program to demonstrate connecting to the Google Monitoring API to retrieve API data.

View the documentation or the source code.

Run the sample:

node list_resources <your-project-id>

Custom metric

create_custom_metric.js demonstrates how to create a custom metric, write a timeseries value to it, and read it back.

View the documentation or the source code.

Run the sample:

node create_custom_metric <your-project-id>
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.