gcp.monitoring.Dashboard
Explore with Pulumi AI
A Google Stackdriver dashboard. Dashboards define the content and layout of pages in the Stackdriver web application.
To get more information about Dashboards, see:
- API documentation
- How-to Guides
Example Usage
Monitoring Dashboard Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const dashboard = new gcp.monitoring.Dashboard("dashboard", {dashboardJson: `{
"displayName": "Demo Dashboard",
"gridLayout": {
"widgets": [
{
"blank": {}
}
]
}
}
`});
import pulumi
import pulumi_gcp as gcp
dashboard = gcp.monitoring.Dashboard("dashboard", dashboard_json="""{
"displayName": "Demo Dashboard",
"gridLayout": {
"widgets": [
{
"blank": {}
}
]
}
}
""")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/monitoring"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := monitoring.NewDashboard(ctx, "dashboard", &monitoring.DashboardArgs{
DashboardJson: pulumi.String(`{
"displayName": "Demo Dashboard",
"gridLayout": {
"widgets": [
{
"blank": {}
}
]
}
}
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var dashboard = new Gcp.Monitoring.Dashboard("dashboard", new()
{
DashboardJson = @"{
""displayName"": ""Demo Dashboard"",
""gridLayout"": {
""widgets"": [
{
""blank"": {}
}
]
}
}
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.monitoring.Dashboard;
import com.pulumi.gcp.monitoring.DashboardArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var dashboard = new Dashboard("dashboard", DashboardArgs.builder()
.dashboardJson("""
{
"displayName": "Demo Dashboard",
"gridLayout": {
"widgets": [
{
"blank": {}
}
]
}
}
""")
.build());
}
}
resources:
dashboard:
type: gcp:monitoring:Dashboard
properties:
dashboardJson: |+
{
"displayName": "Demo Dashboard",
"gridLayout": {
"widgets": [
{
"blank": {}
}
]
}
}
Monitoring Dashboard GridLayout
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const dashboard = new gcp.monitoring.Dashboard("dashboard", {dashboardJson: `{
"displayName": "Grid Layout Example",
"gridLayout": {
"columns": "2",
"widgets": [
{
"title": "Widget 1",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\\"agent.googleapis.com/nginx/connections/accepted_count\\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "LINE"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
{
"text": {
"content": "Widget 2",
"format": "MARKDOWN"
}
},
{
"title": "Widget 3",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\\"agent.googleapis.com/nginx/connections/accepted_count\\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "STACKED_BAR"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
}
]
}
}
`});
import pulumi
import pulumi_gcp as gcp
dashboard = gcp.monitoring.Dashboard("dashboard", dashboard_json="""{
"displayName": "Grid Layout Example",
"gridLayout": {
"columns": "2",
"widgets": [
{
"title": "Widget 1",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "LINE"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
{
"text": {
"content": "Widget 2",
"format": "MARKDOWN"
}
},
{
"title": "Widget 3",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "STACKED_BAR"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
}
]
}
}
""")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/monitoring"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := monitoring.NewDashboard(ctx, "dashboard", &monitoring.DashboardArgs{
DashboardJson: pulumi.String(`{
"displayName": "Grid Layout Example",
"gridLayout": {
"columns": "2",
"widgets": [
{
"title": "Widget 1",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "LINE"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
{
"text": {
"content": "Widget 2",
"format": "MARKDOWN"
}
},
{
"title": "Widget 3",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "STACKED_BAR"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
}
]
}
}
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var dashboard = new Gcp.Monitoring.Dashboard("dashboard", new()
{
DashboardJson = @"{
""displayName"": ""Grid Layout Example"",
""gridLayout"": {
""columns"": ""2"",
""widgets"": [
{
""title"": ""Widget 1"",
""xyChart"": {
""dataSets"": [{
""timeSeriesQuery"": {
""timeSeriesFilter"": {
""filter"": ""metric.type=\""agent.googleapis.com/nginx/connections/accepted_count\"""",
""aggregation"": {
""perSeriesAligner"": ""ALIGN_RATE""
}
},
""unitOverride"": ""1""
},
""plotType"": ""LINE""
}],
""timeshiftDuration"": ""0s"",
""yAxis"": {
""label"": ""y1Axis"",
""scale"": ""LINEAR""
}
}
},
{
""text"": {
""content"": ""Widget 2"",
""format"": ""MARKDOWN""
}
},
{
""title"": ""Widget 3"",
""xyChart"": {
""dataSets"": [{
""timeSeriesQuery"": {
""timeSeriesFilter"": {
""filter"": ""metric.type=\""agent.googleapis.com/nginx/connections/accepted_count\"""",
""aggregation"": {
""perSeriesAligner"": ""ALIGN_RATE""
}
},
""unitOverride"": ""1""
},
""plotType"": ""STACKED_BAR""
}],
""timeshiftDuration"": ""0s"",
""yAxis"": {
""label"": ""y1Axis"",
""scale"": ""LINEAR""
}
}
}
]
}
}
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.monitoring.Dashboard;
import com.pulumi.gcp.monitoring.DashboardArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var dashboard = new Dashboard("dashboard", DashboardArgs.builder()
.dashboardJson("""
{
"displayName": "Grid Layout Example",
"gridLayout": {
"columns": "2",
"widgets": [
{
"title": "Widget 1",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "LINE"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
{
"text": {
"content": "Widget 2",
"format": "MARKDOWN"
}
},
{
"title": "Widget 3",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "STACKED_BAR"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
}
]
}
}
""")
.build());
}
}
resources:
dashboard:
type: gcp:monitoring:Dashboard
properties:
dashboardJson: |+
{
"displayName": "Grid Layout Example",
"gridLayout": {
"columns": "2",
"widgets": [
{
"title": "Widget 1",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "LINE"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
{
"text": {
"content": "Widget 2",
"format": "MARKDOWN"
}
},
{
"title": "Widget 3",
"xyChart": {
"dataSets": [{
"timeSeriesQuery": {
"timeSeriesFilter": {
"filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
"aggregation": {
"perSeriesAligner": "ALIGN_RATE"
}
},
"unitOverride": "1"
},
"plotType": "STACKED_BAR"
}],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
}
]
}
}
Create Dashboard Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Dashboard(name: string, args: DashboardArgs, opts?: CustomResourceOptions);
@overload
def Dashboard(resource_name: str,
args: DashboardArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Dashboard(resource_name: str,
opts: Optional[ResourceOptions] = None,
dashboard_json: Optional[str] = None,
project: Optional[str] = None)
func NewDashboard(ctx *Context, name string, args DashboardArgs, opts ...ResourceOption) (*Dashboard, error)
public Dashboard(string name, DashboardArgs args, CustomResourceOptions? opts = null)
public Dashboard(String name, DashboardArgs args)
public Dashboard(String name, DashboardArgs args, CustomResourceOptions options)
type: gcp:monitoring:Dashboard
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args DashboardArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args DashboardArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args DashboardArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DashboardArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DashboardArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var dashboardResource = new Gcp.Monitoring.Dashboard("dashboardResource", new()
{
DashboardJson = "string",
Project = "string",
});
example, err := monitoring.NewDashboard(ctx, "dashboardResource", &monitoring.DashboardArgs{
DashboardJson: pulumi.String("string"),
Project: pulumi.String("string"),
})
var dashboardResource = new Dashboard("dashboardResource", DashboardArgs.builder()
.dashboardJson("string")
.project("string")
.build());
dashboard_resource = gcp.monitoring.Dashboard("dashboardResource",
dashboard_json="string",
project="string")
const dashboardResource = new gcp.monitoring.Dashboard("dashboardResource", {
dashboardJson: "string",
project: "string",
});
type: gcp:monitoring:Dashboard
properties:
dashboardJson: string
project: string
Dashboard Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Dashboard resource accepts the following input properties:
- Dashboard
Json string - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Dashboard
Json string - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- dashboard
Json String - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- dashboard
Json string - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- dashboard_
json str - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- dashboard
Json String - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Outputs
All input properties are implicitly available as output properties. Additionally, the Dashboard resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Dashboard Resource
Get an existing Dashboard resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: DashboardState, opts?: CustomResourceOptions): Dashboard
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
dashboard_json: Optional[str] = None,
project: Optional[str] = None) -> Dashboard
func GetDashboard(ctx *Context, name string, id IDInput, state *DashboardState, opts ...ResourceOption) (*Dashboard, error)
public static Dashboard Get(string name, Input<string> id, DashboardState? state, CustomResourceOptions? opts = null)
public static Dashboard get(String name, Output<String> id, DashboardState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Dashboard
Json string - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Dashboard
Json string - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- dashboard
Json String - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- dashboard
Json string - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- dashboard_
json str - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- dashboard
Json String - The JSON representation of a dashboard, following the format at https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Import
Dashboard can be imported using any of these accepted formats:
projects/{{project}}/dashboards/{{dashboard_id}}
{{dashboard_id}}
When using the pulumi import
command, Dashboard can be imported using one of the formats above. For example:
$ pulumi import gcp:monitoring/dashboard:Dashboard default projects/{{project}}/dashboards/{{dashboard_id}}
$ pulumi import gcp:monitoring/dashboard:Dashboard default {{dashboard_id}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.