|
1 | 1 | [//]: # "This README.md file is auto-generated, all changes to this file will be lost."
|
2 |
| -[//]: # "To regenerate it, use `npm run generate-scaffolding`." |
| 2 | +[//]: # "To regenerate it, use `python -m synthtool`." |
3 | 3 | <img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
|
4 | 4 |
|
5 |
| -# Stackdriver Monitoring: Node.js Samples |
| 5 | +# [Stackdriver Monitoring: Node.js Samples](https://github.com/googleapis/nodejs-monitoring) |
6 | 6 |
|
7 | 7 | [![Open in Cloud Shell][shell_img]][shell_link]
|
8 | 8 |
|
9 |
| -[Stackdriver Monitoring](https://cloud.google.com/monitoring/docs) 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. |
| 9 | +[Stackdriver Monitoring](https://cloud.google.com/monitoring/docs) collects metrics, events, and metadata from |
| 10 | +Google Cloud Platform, Amazon Web Services (AWS), hosted uptime probes, application instrumentation, |
| 11 | +and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch and many others. |
10 | 12 |
|
11 | 13 | ## Table of Contents
|
12 | 14 |
|
13 | 15 | * [Before you begin](#before-you-begin)
|
14 | 16 | * [Samples](#samples)
|
15 |
| - * [Alert Policies](#alert-policies) |
| 17 | + * [Alerts](#alerts) |
16 | 18 | * [Metrics](#metrics)
|
17 |
| - * [Uptime Config](#uptime-config) |
| 19 | + * [Quickstart](#quickstart) |
| 20 | + * [Uptime](#uptime) |
18 | 21 |
|
19 | 22 | ## Before you begin
|
20 | 23 |
|
21 |
| -Before running the samples, make sure you've followed the steps in the |
22 |
| -[Before you begin section](../README.md#before-you-begin) of the client |
23 |
| -library's README. |
| 24 | +Before running the samples, make sure you've followed the steps outlined in |
| 25 | +[Using the client library](https://github.com/googleapis/nodejs-monitoring#using-the-client-library). |
24 | 26 |
|
25 | 27 | ## Samples
|
26 | 28 |
|
27 |
| -### Alert Policies |
28 | 29 |
|
29 |
| -View the [source code][alerts_0_code]. |
| 30 | + |
| 31 | +### Alerts |
| 32 | + |
| 33 | +View the [source code](https://github.com/googleapis/nodejs-monitoring/blob/master/samples/alerts.js). |
30 | 34 |
|
31 | 35 | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-monitoring&page=editor&open_in_editor=samples/alerts.js,samples/README.md)
|
32 | 36 |
|
33 |
| -__Usage:__ `node alerts.js --help` |
34 |
| - |
35 |
| -``` |
36 |
| -alerts.js <command> |
37 |
| -
|
38 |
| -Commands: |
39 |
| - alerts.js backup <projectId> Save alert policies to a ./policies_backup.json file. |
40 |
| - alerts.js restore <projectId> Restore alert policies from a ./policies_backup.json file. |
41 |
| - alerts.js replace <alertPolicyName> <channelNames..> Replace the notification channels of the specified alert policy. |
42 |
| - alerts.js disable <projectId> [filter] Disables policies that match the given filter. |
43 |
| - alerts.js enable <projectId> [filter] Enables policies that match the given filter. |
44 |
| - alerts.js list <projectId> Lists alert policies in the specified project. |
45 |
| -
|
46 |
| -Options: |
47 |
| - --version Show version number [boolean] |
48 |
| - --alertPolicyName [string] |
49 |
| - --help Show help [boolean] |
50 |
| -
|
51 |
| -Examples: |
52 |
| - node alerts.js backup my-project-id Backup policies. |
53 |
| - node alerts.js restore my-project-id Restore policies. |
54 |
| - node alerts.js replace Replace the notification channels of the specified alert |
55 |
| - projects/my-project-id/alertPolicies/12345 channel-1 policy. |
56 |
| - channel-2 channel-3 |
57 |
| - node alerts.js disable my-project-id "(NOT Disables policies that match the given filter. |
58 |
| - display_name.empty OR NOT description.empty) AND |
59 |
| - user_labels='active'" |
60 |
| - node alerts.js disable my-project-id "description:'cloud'" Disables policies that match the given filter. |
61 |
| - node alerts.js disable my-project-id Disables policies that match the given filter. |
62 |
| - "display_name=monitoring.regex.full_match('Temp \d{4}')" |
63 |
| - node alerts.js enable my-project-id "(NOT display_name.empty Enables policies that match the given filter. |
64 |
| - OR NOT description.empty) AND user_labels='active'" |
65 |
| - node alerts.js enable my-project-id "description:'cloud'" Enables policies that match the given filter. |
66 |
| - node alerts.js enable my-project-id Enables policies that match the given filter. |
67 |
| - "display_name=monitoring.regex.full_match('Temp \d{4}')" |
68 |
| -
|
69 |
| -For more information, see https://cloud.google.com/monitoring/docs/ |
70 |
| -``` |
71 |
| - |
72 |
| -[alerts_0_docs]: https://cloud.google.com/monitoring/docs |
73 |
| -[alerts_0_code]: alerts.js |
| 37 | +__Usage:__ |
| 38 | + |
| 39 | + |
| 40 | +`node alerts.js` |
| 41 | + |
| 42 | + |
| 43 | +----- |
| 44 | + |
| 45 | + |
| 46 | + |
74 | 47 |
|
75 | 48 | ### Metrics
|
76 | 49 |
|
77 |
| -View the [source code][metrics_1_code]. |
| 50 | +View the [source code](https://github.com/googleapis/nodejs-monitoring/blob/master/samples/metrics.js). |
78 | 51 |
|
79 | 52 | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-monitoring&page=editor&open_in_editor=samples/metrics.js,samples/README.md)
|
80 | 53 |
|
81 |
| -__Usage:__ `node metrics.js --help` |
82 |
| - |
83 |
| -``` |
84 |
| -metrics.js <command> |
85 |
| -
|
86 |
| -Commands: |
87 |
| - metrics.js create [projectId] Creates an example 'custom.googleapis.com/stores/daily_sales' |
88 |
| - custom metric descriptor. |
89 |
| - metrics.js list [projectId] Lists metric descriptors. |
90 |
| - metrics.js get <metricId> [projectId] Get a metric descriptor. |
91 |
| - metrics.js delete <metricId> [projectId] Deletes a custom metric descriptor. |
92 |
| - metrics.js write [projectId] Writes example time series data to |
93 |
| - 'custom.googleapis.com/stores/daily_sales'. |
94 |
| - metrics.js read <filter> [projectId] Reads time series data that matches the given filter. |
95 |
| - metrics.js read-fields [projectId] Reads headers of time series data that matches |
96 |
| - 'compute.googleapis.com/instance/cpu/utilization'. |
97 |
| - metrics.js read-aggregate [projectId] Aggregates time series data that matches |
98 |
| - 'compute.googleapis.com/instance/cpu/utilization'. |
99 |
| - metrics.js read-reduce [projectId] Reduces time series data that matches |
100 |
| - 'compute.googleapis.com/instance/cpu/utilization'. |
101 |
| - metrics.js list-resources [projectId] Lists monitored resource descriptors. |
102 |
| - metrics.js get-resource <resourceType> [projectId] Get a monitored resource descriptor. |
103 |
| -
|
104 |
| -Options: |
105 |
| - --version Show version number [boolean] |
106 |
| - --projectId, -p [string] [default: "nodejs-docs-samples"] |
107 |
| - --help Show help [boolean] |
108 |
| -
|
109 |
| -Examples: |
110 |
| - node metrics.js create |
111 |
| - node metrics.js list |
112 |
| - node metrics.js get logging.googleapis.com/log_entry_count |
113 |
| - node metrics.js delete custom.googleapis.com/stores/daily_sales |
114 |
| - node metrics.js list-resources |
115 |
| - node metrics.js get-resource cloudsql_database |
116 |
| - node metrics.js write |
117 |
| - node metrics.js read 'metric.type="compute.googleapis.com/instance/cpu/utilization"' |
118 |
| - node metrics.js read-fields |
119 |
| - node metrics.js read-aggregate |
120 |
| - node metrics.js read-reduce |
121 |
| -
|
122 |
| -For more information, see https://cloud.google.com/monitoring/docs |
123 |
| -``` |
124 |
| - |
125 |
| -[metrics_1_docs]: https://cloud.google.com/monitoring/docs |
126 |
| -[metrics_1_code]: metrics.js |
127 |
| - |
128 |
| -### Uptime Config |
129 |
| - |
130 |
| -View the [source code][uptime_2_code]. |
| 54 | +__Usage:__ |
| 55 | + |
| 56 | + |
| 57 | +`node metrics.js` |
| 58 | + |
| 59 | + |
| 60 | +----- |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +### Quickstart |
| 66 | + |
| 67 | +View the [source code](https://github.com/googleapis/nodejs-monitoring/blob/master/samples/quickstart.js). |
| 68 | + |
| 69 | +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-monitoring&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
| 70 | + |
| 71 | +__Usage:__ |
| 72 | + |
| 73 | + |
| 74 | +`node quickstart.js` |
| 75 | + |
| 76 | + |
| 77 | +----- |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +### Uptime |
| 83 | + |
| 84 | +View the [source code](https://github.com/googleapis/nodejs-monitoring/blob/master/samples/uptime.js). |
131 | 85 |
|
132 | 86 | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-monitoring&page=editor&open_in_editor=samples/uptime.js,samples/README.md)
|
133 | 87 |
|
134 |
| -__Usage:__ `node uptime.js --help` |
| 88 | +__Usage:__ |
| 89 | + |
135 | 90 |
|
136 |
| -``` |
137 |
| -uptime.js <command> |
| 91 | +`node uptime.js` |
138 | 92 |
|
139 |
| -Commands: |
140 |
| - uptime.js create <hostname> [projectId] Creates an uptime check config. |
141 |
| - uptime.js list [projectId] Lists uptime check configs. |
142 |
| - uptime.js list-ips Lists uptime check config IPs. |
143 |
| - uptime.js get <uptimeCheckConfigId> [projectId] Gets an uptime check config. |
144 |
| - uptime.js delete <uptimeCheckConfigId> [projectId] Deletes an uptime check config. |
145 | 93 |
|
146 |
| -Options: |
147 |
| - --version Show version number [boolean] |
148 |
| - --projectId, -p [string] [default: "nodejs-docs-samples"] |
149 |
| - --help Show help [boolean] |
150 | 94 |
|
151 |
| -Examples: |
152 |
| - node uptime.js create mydomain.com Create an uptime check. |
153 |
| - node uptime.js list List all uptime check configs. |
154 |
| - node uptime.js list "resource.type = gce_instance AND List all uptime check configs for a specific GCE |
155 |
| - resource.label.instance_id = mongodb" instance. |
156 |
| - node uptime.js list-ips |
157 |
| - node uptime.js get My-Uptime-Check |
158 |
| - node uptime.js delete My-Uptime-Check |
159 | 95 |
|
160 |
| -For more information, see https://cloud.google.com/monitoring/uptime-checks/ |
161 |
| -``` |
162 | 96 |
|
163 |
| -[uptime_2_docs]: https://cloud.google.com/monitoring/docs |
164 |
| -[uptime_2_code]: uptime.js |
165 | 97 |
|
166 | 98 | [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
|
167 | 99 | [shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-monitoring&page=editor&open_in_editor=samples/README.md
|
| 100 | +[product-docs]: https://cloud.google.com/monitoring/docs |
0 commit comments