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.
-
Read Prerequisites and How to run a sample first.
-
Install dependencies:
With npm:
npm installWith yarn:
yarn install
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:
--version Show version number [boolean]
--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/utilization"'
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
View the documentation or the source code.
Usage: node uptime.js --help
Commands:
create <gceInstanceId> [projectId] Creates an uptime check config.
list [projectId] Lists uptime check configs.
list-ips Lists uptime check config IPs.
get <uptimeCheckConfigId> [projectId] Gets an uptime check config.
delete <uptimeCheckConfigId> [projectId] Deletes an uptime check config.
Options:
--version Show version number [boolean]
--help Show help [boolean]
--projectId, -p [string]
Examples:
node uptime.js create my-instance Create an uptime check for a "my-instance" GCE instance.
node uptime.js list List all uptime check configs.
node uptime.js list-ips
node uptime.js get My-Uptime-Check
node uptime.js delete My-Uptime-Check
For more information, see https://cloud.google.com/monitoring/uptime-checks/
-
Set the GCLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS environment variables.
-
Run the tests:
With npm:
npm testWith yarn:
yarn test