Grafana dashboard: GCP Asset Inventory
Description: This  dashboard provides a high level view of all your Google Cloud Platform resources across all accounts accounts and regions

# GCP Cloud Asset Inventory

This  dashboard provides a high level view of all your resources across all accounts accounts and regions. This works with PostgreSQL as the storage layer and [CloudQuery](https://github.com/cloudquery/cloudquery) as the ingestion layer.

## How to Install

 1. Install [CloudQuery](https://www.cloudquery.io/docs/quickstart/) and fetch your resources
 2. [Follow the instructions for installing the view and dashboard](https://github.com/cloudquery/cloudquery/tree/main/plugins/source/gcp/dashboards)

## GitHub

Feel free to contribute or open an [issue](https://github.com/cloudquery/cloudquery)

{
  "__inputs": [
    {
      "name": "DS_CLOUDSQL",
      "label": "CloudSQL",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.4.7"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1655294390321,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_CLOUDSQL}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 7,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_CLOUDSQL}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select count(*) from gcp_resources where project_id in (${project_ids}) and cq_table in (${cq_tables})",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "data_transfer_progress_current_rate_in_mega_bytes_per_second"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "aws_redshift_clusters",
          "timeColumn": "cluster_create_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Total Resources",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_CLOUDSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 7,
        "x": 7,
        "y": 0
      },
      "id": 4,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom"
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_CLOUDSQL}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select project_id, count(*) from gcp_resources where cq_table in (${cq_tables}) group by project_id order by count desc",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "data_transfer_progress_current_rate_in_mega_bytes_per_second"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "aws_redshift_clusters",
          "timeColumn": "cluster_create_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Total Resource by Account",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_CLOUDSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 9,
        "x": 14,
        "y": 0
      },
      "id": 8,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_CLOUDSQL}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select cq_table, count(*) from gcp_resources where project_id in (${project_ids}) group by cq_table order by count desc",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "data_transfer_progress_current_rate_in_mega_bytes_per_second"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "aws_redshift_clusters",
          "timeColumn": "cluster_create_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Resource Type",
      "type": "table"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_CLOUDSQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 13,
        "w": 24,
        "x": 0,
        "y": 11
      },
      "id": 6,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_CLOUDSQL}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select * from gcp_resources where project_id in (${project_ids}) and cq_table in (${cq_tables});",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "data_transfer_progress_current_rate_in_mega_bytes_per_second"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "aws_redshift_clusters",
          "timeColumn": "cluster_create_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "All Resources",
      "type": "table"
    }
  ],
  "schemaVersion": 35,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_CLOUDSQL}"
        },
        "definition": "select distinct(project_id) from gcp_resources",
        "description": "Google Project ID to filter by",
        "hide": 0,
        "includeAll": true,
        "label": "project_ids",
        "multi": true,
        "name": "project_ids",
        "options": [],
        "query": "select distinct(project_id) from gcp_resources",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_CLOUDSQL}"
        },
        "definition": "select distinct(cq_table) from gcp_resources",
        "description": "CQ Tables to filter by",
        "hide": 0,
        "includeAll": true,
        "label": "cq_tables",
        "multi": true,
        "name": "cq_tables",
        "options": [],
        "query": "select distinct(cq_table) from gcp_resources",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "GCP Asset Inventory",
  "uid": "cCpTRPC7z",
  "version": 12,
  "weekStart": "",
  "gnetId": 16452,
  "description": "This  dashboard provides a high level view of all your Google Cloud Platform resources across all accounts accounts and regions"
}