### Example MQL Query with Custom Label Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md An example Monitoring Query Language (MQL) query that fetches VM egress bytes count, filters by location type, adds a synthetic label `remote_region` using regex extraction, groups by zone, instance name, and the new label, and then aligns and limits the results. This query demonstrates how labels are generated and used, which are then available for legend templates. ```MQL fetch gce_instance | metric 'networking.googleapis.com/vm_flow/egress_bytes_count' | filter metric.remote_location_type = 'CLOUD' | map add[remote_region: re_extract(metric.remote_zone, '([^-]+-[^-]+)-[^-]+', '\\1')] | group_by [resource.zone, metadata.system.name, remote_region] | align rate(1m) | top 5 | every 1m ``` -------------------------------- ### Example User Labels for Alert Policy Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/hbase/README.md Example JSON structure for adding user-defined labels to an alert policy configuration. These labels provide extra identification information about the firing alert, such as the datacenter. ```JSON "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Deploying BindPlane Agent with Terraform Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/agents/bindplane/README.md Initializes the Terraform working directory, generates an execution plan showing the actions Terraform will take, and applies the plan to create the resources, including the compute instances with the BindPlane Agent installed. ```Bash terraform init terraform plan \ -var project= \ -var secret_key= terraform apply \ -var project= \ -var secret_key= ``` -------------------------------- ### Example Notification Channels for Alert Policy Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/hbase/README.md Example JSON structure for specifying notification channels in an alert policy configuration. The array contains the resource names of the channels to be notified when the alert fires. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### JSON Example for User Labels in Monitoring Policy Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mysql/README.md This JSON snippet demonstrates the structure for adding user-defined labels to a monitoring policy configuration. Labels can be used for organizing and filtering policies. ```JSON { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Markdown Card with Documentation and Log Links Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md Example markdown content for a Google Cloud Monitoring dashboard card. It includes links to external documentation on configuring NGINX monitoring and direct links to NGINX access and error logs in the Cloud Logging console, using URL-encoded MQL queries. ```Markdown [How to configure NGINX Monitoring](https://cloud.google.com/monitoring/agent/ops-agent/third-party/nginx) [View NGINX Access Logs](https://console.cloud.google.com/logs/query?query=logName:%22nginx_default_access%22%0Aresource.type%3D%22gce_instance%22) [View NGINX Error Logs](https://console.cloud.google.com/logs/query?query=logName:%22nginx_default_error%22%0Aresource.type%3D%22gce_instance%22) ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/memcached/README.md Example JSON snippet showing how to include user-defined labels within an alert policy configuration for additional identification information. ```JSON { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Defining Sample Dashboard Metadata in YAML Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/README.md This YAML snippet provides an example structure for adding a dashboard entry to the `sample_dashboards` list in `metadata.yaml`. It includes fields for categorization, identification, display name, description, and optional related integrations. ```YAML sample_dashboards: - category: Nginx id: overview display_name: Nginx Overview description: |- This dashboard has charts for viewing Nginx when monitored by [Google's Ops Agent](https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/third-party/nginx#monitored-metrics), Request Rate, Current Connections, and Connections Rate from NGINX as well as charts of infrastructure related metrics for the running NGINX VMs: CPU % Top 5 VMs, Memory % Top 5 VMs, and NGINX VMs by Region for a count of VMs over time. There is also a card with links to docs and Nginx logs in Cloud Logging. related_integrations: - id: nginx platform: GCE ``` -------------------------------- ### Example JSON for User Labels in Alert Policy Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/apache/README.md This JSON snippet demonstrates how to include user-defined labels within an alerting policy configuration. User labels can be used to categorize or add context to policies. ```JSON { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Adding Notification Channels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/memcached/README.md Example JSON snippet demonstrating how to specify the list of notification channel IDs that should receive alerts when the policy condition is met. ```JSON [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Example User Labels for Alert Policy Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/tomcat/README.md This JSON snippet demonstrates how to add user-defined labels to the alert policies by modifying the 'userLabels' field. This allows for categorization or identification of policies, such as by datacenter. ```JSON { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Example User Labels Configuration (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/saphana/README.md Demonstrates how to include custom user labels within a monitoring policy configuration using the `userLabels` field in JSON format. These labels can help categorize and filter policies. ```JSON { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mssql-server/README.md Example JSON snippet showing how to include user-defined labels within an alert policy configuration. Labels provide additional context or identification for the alert. ```JSON "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Configuring User Labels for Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/active-directory/README.md Example JSON snippet demonstrating how to add user-defined labels to an alert policy configuration. These labels provide additional context and identification information when an alert fires. ```json "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Configuring User Labels for RabbitMQ Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/rabbitmq-gke/README.md Example JSON snippet showing how to add user-defined labels to an alert policy configuration. Labels are useful for categorization and adding context like severity levels. ```JSON "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Example User Labels for Alert Policies (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/nginx/README.md This JSON snippet demonstrates how to add user-defined labels to alert policies. User labels can be used for organizing or filtering policies based on custom criteria like datacenter location. ```JSON { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Configuring User Labels in JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/jenkins-gke/README.md This snippet shows an example of how to configure user labels within a JSON structure, typically used for adding metadata like severity to alerts. ```JSON "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Deploying Ops Agent with Terraform Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/agents/cloud-opts/README.md Initializes the Terraform working directory, generates an execution plan showing the actions Terraform will take, and applies the plan to create the resources, including compute instances with the Ops Agent installed. Replace with your actual Google Cloud project ID. ```bash terraform init terraform plan -var project= terraform apply -var project= ``` -------------------------------- ### Configuring Notification Channels for RabbitMQ Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/rabbitmq-gke/README.md Example JSON snippet demonstrating how to specify the notification channels that will receive alerts when the policy is triggered, using the channel's resource ID. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Specifying Notification Channels in Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mssql-server/README.md Example JSON snippet demonstrating how to list notification channel IDs within an alert policy configuration. These channels receive notifications when the alert fires. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567 ] ``` -------------------------------- ### Configuring Notification Channels in JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/jenkins-gke/README.md This snippet provides an example of how to specify notification channel IDs in a JSON array, used to direct alert notifications to specific destinations. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Converting and Uploading Dashboards using import.sh (Shell) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/scripts/dashboard-importer/README.md Explains how to use the import.sh script to convert Grafana dashboards (in .json files) to the Cloud Monitoring format and optionally upload them to a specified Google Cloud project. It details the required arguments (FILE_OR_DIRECTORY, PROJECT_ID) and provides examples demonstrating different use cases (single file upload, directory upload, directory conversion only). The output includes converted JSONs, a report file, and optionally an upload log. ```Shell ./import.sh ``` ```Shell ./import.sh ./foo/test.json test-project ``` ```Shell ./import.sh ./foo/ test-project ``` ```Shell ./import.sh ./foo/ ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/solr/README.md Example JSON snippet showing how to include user-defined labels within an alert policy configuration. User labels provide additional context or identification information for a firing alert. ```json "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Specifying Notification Channels for Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/active-directory/README.md Example JSON snippet showing how to link an alert policy to one or more notification channels. The value is an array containing the full resource names (IDs) of the desired notification channels. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### CouchDB Alert Policy User Labels JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/couchdb/README.md Provides an example JSON structure for adding user labels to CouchDB alert policies. User labels can be used for categorization or filtering of alerts. ```json { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Adding Notification Channels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/solr/README.md Example JSON snippet demonstrating how to specify notification channels in an alert policy configuration. The array contains the resource names of the channels to be notified when the alert condition is met. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Filtering Logs Panel by Instrumentation Source or Log ID (MQL Filter) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md Example filter for a Logs Panel in a Google Cloud Monitoring dashboard. It demonstrates how to filter log entries based on either the `logging.googleapis.com/instrumentation_source` label (preferred for newer Ops Agent versions) or the `log_id` function for backward compatibility, combined with filtering by resource type `gce_instance`. This approach avoids hardcoding project IDs. ```MQL Filter ( labels."logging.googleapis.com/instrumentation_source"="agent.googleapis.com/nginx_access" OR log_id("nginx_access") ) resource.type="gce_instance" ``` -------------------------------- ### Adding Notification Channels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/oracledb/README.md Example JSON snippet showing how to specify notification channels for a Google Cloud Monitoring alert policy. When the alert triggers, notifications will be sent to the listed channels. ```json [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Configuring User Labels for MongoDB Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mongodb/README.md Example JSON snippet showing how to define user labels within an alert policy configuration. User labels provide additional context and identification information for firing alerts, such as the datacenter location. ```json "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Configuring User Labels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/istio-proxy-gke/README.md User labels provide additional identification information for firing alerts, often used for categorization such as severity levels. This snippet shows an example of setting a 'Severity' label. ```JSON "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Configuring Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/istio-proxy-gke/README.md Notification channels define the destination where alerts are sent when an alert policy is triggered. This snippet shows an example of specifying a single notification channel ID. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/oracledb/README.md Example JSON snippet showing how to add user-defined labels to a Google Cloud Monitoring alert policy. Labels can be used for categorization, filtering, and indicating severity levels. ```json { "Severity": "Warning" } ``` -------------------------------- ### Applying User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/kafka/README.md This JSON snippet illustrates the structure for adding custom user labels to an alert policy configuration. User labels help categorize and organize policies, which can be useful for filtering and management. The example shows a 'datacenter' label set to 'central'. ```json { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/argo-server-gke/README.md This JSON snippet demonstrates how to add user-defined labels to an alert policy configuration. User labels provide additional context or categorization for the alert, such as severity level. This example shows setting a 'Severity' label to 'Warning'. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Configuring Notification Channels for MongoDB Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mongodb/README.md Example JSON snippet demonstrating how to specify notification channels for an alert policy. The array contains the resource names (IDs) of the channels that should receive notifications when the alert fires. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Adding User Labels to Google Cloud Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/iis/README.md This JSON snippet shows how to add user-defined labels to a Google Cloud Monitoring alert policy. Labels provide additional context and identification information for the alert, such as the datacenter location in this example. This helps in organizing and filtering alerts. ```JSON "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Configuring User Labels in Elasticsearch Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/elasticsearch/README.md This snippet provides an example of how to add user-defined labels to an Elasticsearch alert policy configuration. User labels are used within the 'userLabels' field to attach custom metadata, which can help in organizing, filtering, or categorizing policies. ```json { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Creating Deployment Manager Deployment with gcloud Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dm/README.md Run this command to create a Deployment Manager deployment named 'example-dashboard' using the specified configuration file 'dashboard.yaml'. Ensure that placeholders like [PROJECT-ID] and [JSON-FILE] in 'dashboard.yaml' are replaced before execution. ```Bash gcloud deployment-manager deployments create example-dashboard --config dashboard.yaml ``` -------------------------------- ### Initialize and Apply Terraform Configuration (Basic) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/README.md This sequence of commands initializes the Terraform working directory, creates an execution plan showing proposed changes, and applies the plan to create or update resources. It's the standard workflow for deploying infrastructure with Terraform. ```bash terraform init terraform plan terraform apply ``` -------------------------------- ### MQL Macro: Top 5 VM CPU Utilization by Metric Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md Defines an MQL macro `top_5_cpu_filtered_by_metric` that takes a metric name as input. It fetches `gce_instance`, joins CPU utilization with the specified filter metric, groups by instance details, calculates the mean utilization over 1 minute, and returns the top 5 instances by utilization. ```MQL def top_5_cpu_filtered_by_metric filter_metric = fetch gce_instance | { t_cpu: metric 'compute.googleapis.com/instance/cpu/utilization' ; t_filter_metric: metric $filter_metric } | join | value t_cpu.value.utilization | group_by [resource.project_id, resource.zone, metric.instance_name], 1m, [value_utilization_mean: mean(t_cpu.value.utilization)] | top 5 | every 1m; ``` -------------------------------- ### MQL Macro: VM Count by Region by Metric Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md Defines an MQL macro `vms_with_metric_count_by_region` that takes a metric name. It fetches `gce_instance`, filters by the metric, aligns points, groups by instance ID, then by zone, extracts the region from the zone name, groups by region, sums the counts, and reports every 1 minute. ```MQL def vms_with_metric_count_by_region metric = fetch gce_instance | metric $metric # Shift points forward from the past 2 minutes so a VM that misses a point # won't temporarily shift down the number of VMs. | align next_older(2m) | group_by [resource.project_id, resource.zone, resource.instance_id], 1m, .pick_any | group_by [resource.project_id, resource.zone], 1m, .count | map add[ region: re_extract(resource.zone, '([^-]+-[^-]+)-[^-]+', '\\1')] | group_by [region], .sum | every 1m; ``` -------------------------------- ### Import Dashboard using Script (Bash) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/README.md Executes the provided dashboard.sh script to import a dashboard into the specified Google Cloud project using the previously set environment variables for project ID and file name. ```bash scripts/dashboard/dashboard.sh import $PROJECT_ID $FILE_NAME ``` -------------------------------- ### Creating Monitoring Dashboard Type Provider with gcloud Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dm/README.md Use this gcloud beta command to create a custom type provider in Deployment Manager for the Cloud Monitoring API. It requires an options.yaml file and the discovery URL for the Monitoring v1 API. ```Bash gcloud beta deployment-manager type-providers create monitoring-dashboardv1type \ --api-options-file=options.yaml \ --descriptor-url='https://monitoring.googleapis.com/$discovery/rest?version=v1' ``` -------------------------------- ### JSON Legend Template for VM Instance and Zone Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md A JSON legend template string suitable for displaying the instance name and zone for time series data, often used with MQL queries that group by these labels, such as the top 5 CPU utilization macro. ```JSON "legendTemplate": "${labels.metric\.instance_name} (${labels.resource\.zone})" ``` -------------------------------- ### MQL Macro: Top 5 VM Memory Utilization by Metric Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md Defines an MQL macro `top_5_memory_filtered_by_metric` that takes a metric name. It fetches `gce_instance`, filters for 'used' memory percent, joins with the filter metric, groups by instance details (including metadata name), calculates the mean over 1 minute, and returns the top 5 instances by utilization. ```MQL def top_5_memory_filtered_by_metric filter_metric = fetch gce_instance | { t_memory: metric 'agent.googleapis.com/memory/percent_used' | filter metric.state = 'used' ; t_filter_metric: metric $filter_metric } | join | value val(0) | group_by [metadata.system.name, resource.project_id, resource.zone], 1m, .mean() | top 5 | every 1m; ``` -------------------------------- ### Create Dashboard via Curl and API (Bash) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/README.md Uses the curl command to make a POST request to the Cloud Monitoring Dashboards API, creating a new dashboard from a local JSON file. Requires authentication via gcloud and replaces placeholders for project ID and file name. ```bash curl -X POST -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ https://monitoring.googleapis.com/v1/projects/[project-id]/dashboards -d @[file-name.json] ``` -------------------------------- ### Describing Monitoring Dashboard Type Provider with gcloud Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dm/README.md This command shows how to view the details and configuration of the custom type provider named 'monitoring-dashboardv1type' using the gcloud beta tool. ```Bash gcloud beta deployment-manager type-providers describe monitoring-dashboardv1type ``` -------------------------------- ### JSON Legend Template for VM System Name and Zone Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md A JSON legend template string suitable for displaying the system name (often the instance name) and zone for time series data, often used with MQL queries that group by these labels, such as the top 5 memory utilization macro. ```JSON "${labels.metadata\.system\.name} (${labels.resource\.zone})" ``` -------------------------------- ### JSON Legend Template for VM System Name and Zone (Count Context) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md A JSON legend template string suitable for displaying the system name (often the instance name) and zone for time series data. While provided in the context of the VM count macro, this template is typically used for per-instance metrics rather than aggregated counts. ```JSON "${labels.metadata\.system\.name} (${labels.resource\.zone})" ``` -------------------------------- ### Cloning Repository and Changing Directory (Shell) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/scripts/dashboard-importer/README.md Instructions to clone the monitoring-dashboard-samples GitHub repository and navigate into the scripts/dashboard-importer directory where the importer scripts are located. This is the first step after prerequisites are met. ```Shell git clone https://github.com/GoogleCloudPlatform/monitoring-dashboard-samples.git && cd monitoring-dashboard-samples/scripts/dashboard-importer ``` -------------------------------- ### Export Dashboard using Script (Bash) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/README.md Executes the provided dashboard.sh script to export a dashboard from the specified Google Cloud project to a JSON file using the previously set environment variables for dashboard ID, project ID, and file name. ```bash scripts/dashboard/dashboard.sh export $DASH_ID $PROJECT_ID $FILE_NAME ``` -------------------------------- ### Configuring User Labels in JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/varnish/README.md This JSON snippet demonstrates how to include user-defined labels within a policy configuration. User labels allow for categorization and filtering of policies based on custom attributes like datacenter location. ```json { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Set Environment Variables for Dashboard Import (Bash) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/README.md Sets the PROJECT_ID and FILE_NAME environment variables required for importing a dashboard using the provided script. Replace the placeholder values with your specific project ID and the name of the dashboard JSON configuration file. ```bash export PROJECT_ID= export FILE_NAME= ``` -------------------------------- ### Import Google Cloud Monitoring Dashboard (Bash) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/scripts/dashboard/README.md Demonstrates how to import a Google Cloud Monitoring dashboard from a JSON file using the `dashboard.sh` script. Requires the target project ID and the input file path as arguments. ```Bash ./dashboard.sh import agent-analysis kpa.json ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/jvm/README.md Provides a JSON snippet demonstrating how to include user-defined labels within an alert policy configuration. These labels offer additional contextual information for identifying the source or nature of a firing alert. ```JSON "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Set Environment Variables for Dashboard Export (Bash) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/README.md Sets the DASH_ID, PROJECT_ID, and FILE_NAME environment variables required for exporting a dashboard using the provided script. Replace the placeholder values with your dashboard ID, project ID, and desired output file name. ```bash export DASH_ID= export PROJECT_ID= export FILE_NAME= ``` -------------------------------- ### Configuring User Labels for Monitoring Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/redis/README.md Demonstrates how to add user-defined labels to a monitoring alert configuration. These labels provide additional context or identification information for the alert when it fires. ```JSON "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Adding Legend Template to MQL Chart DataSet JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dev-docs/DASHBOARD_TIPS.md Demonstrates the JSON structure for adding a custom legend template to a DataSet object within a Google Cloud Monitoring dashboard definition for an MQL chart. It shows the `legendTemplate` field containing placeholder syntax for system metadata name and resource zone. ```JSON ... "dataSets": [ { "legendTemplate": "${labels.metadata\\.system\\.name} (${labels.resource\\.zone})", "timeSeriesQuery": { ... } ], ... ``` -------------------------------- ### Specifying Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/jvm/README.md Shows a JSON snippet for configuring the notification channels that should receive alerts when the policy conditions are met. It requires providing the full resource name (ID) of the desired notification channel(s) in an array. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Defining User Labels for Alert Policies (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/wildfly/README.md Illustrates how to include user-defined labels within an alert policy configuration to add custom metadata for better identification and organization of alerts. ```json "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Apply Terraform Configuration with Variables (CLI) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/README.md This command applies the Terraform configuration while overriding default variable values directly from the command line using the -var flag. It's useful for providing sensitive or dynamic inputs without modifying variable files. ```bash terraform apply -var 'dashboard_json_file=../dashboards/storage/cloud-storage-monitoring.json' \ -var 'project_id=[your_project_id]' ``` -------------------------------- ### Deleting Deployment Manager Deployment with gcloud Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dm/README.md Use this command to delete the Deployment Manager deployment named 'example-dashboard'. This action will also remove the resources created by the deployment, including the monitoring dashboard. ```Bash gcloud deployment-manager deployments delete example-dashboard ``` -------------------------------- ### Cleaning Up Resources with Terraform Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/agents/bindplane/README.md Destroys the infrastructure resources previously created by the Terraform configuration, including the compute instances and deployed agents. ```Bash terraform destroy \ -var project= \ -var secret_key= ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/scylla-gke/README.md Demonstrates how to include user-defined labels within an alert policy configuration using a JSON object. These labels provide additional context, such as severity, for a firing alert. ```JSON { "Severity": "Warning" } ``` -------------------------------- ### Adding User Labels to Alert Policy Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/jetty/README.md This JSON snippet demonstrates how to include user-defined labels within an alert policy configuration. User labels provide additional contextual information about the resource or environment related to the alert, such as the datacenter location, aiding in alert identification and management. ```JSON "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Adding User Labels to Alert Policy JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/google-cloudsql/README.md Demonstrates the JSON structure for adding user-defined labels to an alert policy configuration. These labels provide extra identification information about the alert when it fires. ```json "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Configuring Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mysql-gke/README.md This JSON snippet demonstrates how to specify the notification channels that should receive alerts when the policy is triggered. It uses an array of resource names for the notification channels. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Configuring User Labels for etcd Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/etcd-gke/README.md Demonstrates how to add user-defined labels to an alert policy configuration. These labels provide additional context, such as severity, for a firing alert. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Checking BindPlane Agent Status on Linux Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/agents/bindplane/README.md Checks the status of the BindPlane agent service (bpagent) on a Linux compute instance using the systemctl command. ```Bash sudo systemctl status bpagent ``` -------------------------------- ### Configuring User Labels for Policies (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/activemq/README.md This JSON snippet demonstrates the structure for adding custom key-value pairs as user labels to monitoring policies. User labels are useful for categorizing or filtering policies based on criteria like datacenter or environment. ```JSON { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Configuring User Labels for Alert Policies (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/redis-gke/README.md Demonstrates how to include user labels within an alert policy configuration. User labels provide additional identification or categorization for triggered alerts, such as indicating severity. ```JSON "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Export Google Cloud Monitoring Dashboard (Bash) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/scripts/dashboard/README.md Demonstrates how to export a Google Cloud Monitoring dashboard to a JSON file using the `dashboard.sh` script. Requires the dashboard ID, project ID, and desired output file path as arguments. ```Bash ./dashboard.sh export 11449921252968550000 test-project kpi.json ``` -------------------------------- ### Uploading Converted Dashboards using upload.sh (Shell) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/scripts/dashboard-importer/README.md Describes the upload.sh script, used for manually uploading dashboards that are already in the Cloud Monitoring JSON format. It requires the path to the file(s) or directory and the destination Google Cloud project ID. The script prompts for confirmation when uploading directories and outputs the URLs of the uploaded dashboards, also recording them in a file. ```Shell ./upload.sh ``` -------------------------------- ### Specifying Notification Channels for Alert Policies (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/wildfly/README.md Shows the JSON structure for specifying one or more notification channel IDs that will receive alerts when the policy's conditions are met. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Apache GCE Overview Dashboard (Ops Agent) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dashboards/apache/README.md This dashboard is based on metrics collected by the Google Cloud Ops Agent from Apache running on Compute Engine VMs. It includes charts for Apache request/traffic rates, connections, scoreboard, and workers, alongside VM infrastructure metrics like CPU and memory usage. It also provides links to documentation and Cloud Logging. ```JSON apache-gce-overview.json ``` -------------------------------- ### Defining User Labels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/couchbase/README.md Explains how to add custom user labels to a Google Cloud Monitoring alert policy configuration using JSON. These labels provide additional context for identifying the source or environment of the alert. ```json "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Configuring User Labels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mysql-gke/README.md This JSON snippet shows how to add user-defined labels, such as severity, to an alert policy configuration. These labels provide additional context when an alert is triggered. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/cassandra/README.md Supplying user labels provides additional identification information for a firing alert, allowing for easier categorization and filtering. ```JSON { "datacenter": "central" } ``` -------------------------------- ### Adding Notification Channels to Alert Policy JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/google-cloudsql/README.md Shows the JSON format for specifying one or more notification channels that should be alerted when the policy condition is met. The value is an array containing the full resource names of the notification channels. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/zookeeper/README.md This JSON snippet demonstrates how to include user-defined labels within a monitoring alert policy configuration. User labels provide additional context and identification information for firing alerts, such as the datacenter location. ```JSON "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Configuring User Labels in Monitoring Policy JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/rabbitmq/README.md This snippet demonstrates the structure for adding custom user labels to a monitoring policy configuration in JSON format. User labels are key-value pairs that can be used to organize, filter, or annotate policies. ```json { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Configuring User Labels for Google Cloud Monitoring Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/nginx-gke/README.md This JSON snippet demonstrates how to include user-defined labels within a Google Cloud Monitoring alert policy configuration. User labels provide additional context and categorization for alerts when they fire, such as indicating the severity level. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Configuring User Labels for Alert Policies (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/haproxy-gke/README.md This JSON snippet shows how to define user labels within an alert policy configuration. User labels provide additional context and identification for a firing alert, commonly used for categorization such as specifying the severity level. ```JSON "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Specifying Notification Channels in Alert Policy Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/jetty/README.md This JSON array shows how to list the resource IDs of notification channels that should receive alerts when the policy fires. Each string in the array is the full resource name of a notification channel, allowing alerts to be sent to specific destinations like email, Slack, or Pub/Sub. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Apache Prometheus Overview Dashboard Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dashboards/apache/README.md This dashboard visualizes metrics exposed by a Prometheus Apache exporter. It includes charts covering Apache version, server status, uptime, scoreboard, connections, processes, workers, CPU load, system load, sent request rate, and traffic rate. ```JSON apache-prometheus-overview.json ``` -------------------------------- ### Cleaning Up Terraform Deployment Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/agents/cloud-opts/README.md Destroys the infrastructure resources previously created by the Terraform apply command. This removes the compute instances and associated resources. Replace with your actual Google Cloud project ID. ```bash terraform destroy -var project= ``` -------------------------------- ### Specifying Notification Channels for Monitoring Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/redis/README.md Shows how to specify one or more notification channels that should receive alerts when the policy condition is met. The value is an array of resource names for the notification channels. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Specifying Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/couchbase/README.md Demonstrates how to specify one or more notification channel resource names in a Google Cloud Monitoring alert policy configuration using JSON. Alerts will be sent to the listed channels. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Defining User Labels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/postgres-gke/README.md This JSON snippet demonstrates how to define user labels within an alert policy configuration. User labels provide additional identification and categorization for triggered alerts, such as indicating the severity level. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Specifying Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/scylla-gke/README.md Illustrates how to specify one or more notification channels for an alert policy using a JSON array. Each element in the array is the resource ID of a notification channel that will receive alerts. ```JSON [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Specifying Notification Channels in Google Cloud Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/iis/README.md This JSON snippet demonstrates how to specify the notification channels that should receive alerts. It is an array containing the full resource path to the notification channel(s). Replace 'project-id' and '1234567' with your actual project ID and channel ID. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/hadoop/README.md This JSON snippet demonstrates how to add user-defined labels to an alert policy configuration. Labels can be used for categorization or filtering policies, such as specifying the datacenter where the monitored resource resides. ```json { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Specifying Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/postgres-gke/README.md This JSON snippet shows how to specify the notification channels that should receive alerts when the policy is triggered. It is an array containing the resource names (IDs) of the configured notification channels. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Checking BindPlane Agent Status on Windows Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/agents/bindplane/README.md Checks the status of the BindPlane agent service (bpagent) on a Windows compute instance using the Get-Service cmdlet in PowerShell. ```PowerShell Get-Service bpagent ``` -------------------------------- ### Configuring User Labels for Vault Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/vault/README.md This JSON snippet demonstrates how to include user-defined labels within a monitoring alert configuration. User labels provide additional context or identification information about the resource or condition triggering the alert, such as the datacenter location. This helps in organizing and filtering alerts. ```json { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Defining Jetty Access Log Failure Metric Filter Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/jetty/README.md This filter is used to create a log-based metric named `jetty.request.failed.count`. It selects log entries with `logName:"jetty_access"` and an `httpRequest.status` greater than 299, indicating failed requests. This metric is a prerequisite for the 'Access log failures' alert. ```Configuration logName:"jetty_access" httpRequest.status > 299 ``` -------------------------------- ### Adding Notification Channels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/node-exporter-gke/README.md This JSON snippet shows how to specify one or more notification channels that should receive alerts when the policy's conditions are met. The channels are identified by their full resource names. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/node-exporter-gke/README.md This JSON snippet demonstrates how to include user-defined labels within an alert policy configuration. User labels provide additional context or categorization for triggered alerts, such as indicating severity levels. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Configuring User Labels for Velero Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/velero-gke/README.md This snippet shows how to define user labels within an alert policy configuration. User labels provide additional context or categorization for the alert, such as severity level. ```JSON "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Log Query for HBase Server Stopped Alert Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/hbase/README.md Required log query to detect when the HBase regionserver is stopping, used as the condition for the 'HBase Server Stopped' alert policy. Replace with your actual Google Cloud Project ID. ```Log Query logName="projects//logs/hbase_system" jsonPayload.message="regionserver.HeapMemoryManager: Stopping" ``` -------------------------------- ### Configuring Notification Channels for Velero Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/velero-gke/README.md This snippet demonstrates how to specify notification channels for an alert policy. When the alert triggers, a notification will be sent to the listed channels. The value is a list of resource names for the notification channels. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/nginx-ingress-gke/README.md Configures user-defined labels for an alert policy, providing additional context or categorization like severity level. These labels help identify and manage alerts when they fire. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Specifying Notification Channels for Aerospike Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/aerospike/README.md This JSON snippet demonstrates the format for listing one or more notification channel resource names within an alert policy configuration. When the alert policy is triggered, notifications will be sent to the specified channels. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Specifying Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/cassandra/README.md This snippet shows how to specify the ID of a notification channel to receive alerts. The channel ID follows the format 'projects/project-id/notificationChannels/channel-id'. ```JSON [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Configuring User Labels for Alert Policy - JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/kafka-gke/README.md This snippet shows how to include user labels within a Google Cloud Monitoring alert policy configuration. User labels provide additional context and identification for triggered alerts, such as indicating the severity level. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Configuring Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/argo-server-gke/README.md This JSON snippet shows how to specify the notification channels that should receive alerts when the policy triggers. The value is an array of strings, where each string is the full resource name of a notification channel. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Adding User Labels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/flink/README.md Demonstrates the structure for adding custom user labels to a monitoring alert policy configuration. User labels provide metadata for organizing and identifying resources related to the alert. ```json { "userLabels": { "datacenter": "central" } } ``` -------------------------------- ### Specifying Notification Channels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/zookeeper/README.md This JSON snippet illustrates how to configure notification channels for a monitoring alert policy. It shows an array containing the resource ID of a single notification channel, indicating where alerts triggered by this policy will be sent. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Checking Ops Agent Status on Linux Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/terraform/agents/cloud-opts/README.md Checks the status of the Google Cloud Ops Agent service on a Linux compute instance using the systemctl command. This command requires root privileges (sudo). ```bash sudo systemctl status google-cloud-ops-agent* ``` -------------------------------- ### Defining User Labels in JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/kibana-gke/README.md This JSON snippet shows how to define user labels within an alert policy configuration. User labels provide additional metadata for categorization and identification, such as indicating the severity level of the alert. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Configuring Notification Channels for Alert Policies (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/redis-gke/README.md Shows the structure for specifying notification channels in an alert policy configuration. This setting determines where notifications are sent when the alert policy is triggered, using the channel's resource ID. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Configuring User Labels for GKE Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/kube-state-gke/README.md This snippet shows how to define user labels within a JSON configuration for a GKE alert policy. User labels provide additional context and categorization, such as severity level, for triggered alerts. ```JSON "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Configuring User Labels in Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/airflow-gke/README.md This JSON snippet shows how to add user-defined labels to a Google Cloud Monitoring alert policy. Labels like 'Severity' help categorize and provide additional context for triggered alerts. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Monitoring Filter for MySQL Slow Queries Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mysql/README.md This filter is designed to capture log entries from the 'mysql_slow' log stream. It specifically looks for messages containing common SQL DML/DDL keywords and filters for queries with a 'queryTime' greater than 1 second, used for counting slow queries. ```Monitoring Filter logName:"mysql_slow" jsonPayload.message:("SELECT" OR "INSERT" OR "UPDATE" OR "CREATE" OR "DELETE") jsonPayload.queryTime>1 ``` -------------------------------- ### Configuring Notification Channels for Alert Policies (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/haproxy-gke/README.md This JSON snippet demonstrates how to specify notification channels for an alert policy. The notification channel ID determines the destination where alerts will be sent when the policy is triggered. ```JSON "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Specifying Notification Channels for Google Cloud Monitoring Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/nginx-gke/README.md This JSON snippet shows the structure for specifying one or more notification channels in a Google Cloud Monitoring alert policy configuration. The array contains the full resource names (IDs) of the channels where notifications will be sent when the alert policy's conditions are met. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Deleting Monitoring Dashboard Type Provider with gcloud Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/dm/README.md This command deletes the custom type provider named 'monitoring-dashboardv1type' that was previously created for deploying monitoring dashboards. ```Bash gcloud beta deployment-manager type-providers delete monitoring-dashboardv1type ``` -------------------------------- ### Defining User Labels for Monitoring Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/memcached-gke/README.md This snippet shows how to define user labels within a monitoring alert policy configuration. User labels are used for categorization and can provide additional identification information, such as severity level, for a firing alert. ```JSON "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Defining User Labels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/zookeeper-gke/README.md This JSON snippet defines user labels for an alert policy. User labels provide additional context and categorization for triggered alerts, such as indicating the severity level. ```json "userLabels": { "Severity": "Warning" } ``` -------------------------------- ### Configuring User Labels for Aerospike Alerts (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/aerospike/README.md This JSON snippet shows how to include custom user labels within an alert policy configuration. User labels provide additional identifying information about the resource or context related to the alert, such as the datacenter location. ```JSON "userLabels": { "datacenter": "central" } ``` -------------------------------- ### Defining User Labels for Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/mongodb-gke/README.md This JSON snippet demonstrates how to define user labels within an alert policy configuration. User labels are used for categorizing alerts and providing additional identification information, such as severity level. ```JSON { "Severity": "Warning" } ``` -------------------------------- ### Adding Notification Channels to Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/nginx-ingress-gke/README.md Specifies the notification channels that will receive alerts when the policy is triggered. The value is an array of fully qualified notification channel resource IDs. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Specifying Notification Channels in Elasticsearch Alert Policy (JSON) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/elasticsearch-gke/README.md The `notificationChannels` field specifies a list of notification channel IDs that will receive alerts when the policy is triggered. The ID format includes the project and the specific channel identifier. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ``` -------------------------------- ### Filter for Apache Server Error Metric (5xx) Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/apache/README.md This filter is used to identify log entries corresponding to Apache server errors (HTTP status codes 500 or greater). It's a prerequisite for defining the `apache.server.error.count` metric used in the high server error rate alert. ```Google Cloud Monitoring Filter logName:"apache_access" httpRequest.status >= 500 ``` -------------------------------- ### Specifying Notification Channels in JSON Source: https://github.com/googlecloudplatform/monitoring-dashboard-samples/blob/master/alerts/kibana-gke/README.md This JSON snippet demonstrates how to specify the notification channels for an alert policy. The array contains the resource names of the channels that will receive notifications when the alert policy is triggered. ```json "notificationChannels": [ "projects/project-id/notificationChannels/1234567" ] ```