diff --git a/csp-mixin/config.libsonnet b/csp-mixin/config.libsonnet index 1c58a21a4..0c89e2bb6 100644 --- a/csp-mixin/config.libsonnet +++ b/csp-mixin/config.libsonnet @@ -16,6 +16,8 @@ azurevm: (import './signals/azurevm.libsonnet')(this), azurevmOverview: (import './signals/azurevmOverview.libsonnet')(this), azurequeuestore: (import './signals/azurequeuestore.libsonnet')(this), + gcpce: (import './signals/gcpce.libsonnet')(this), + gcpceOverview: (import './signals/gcpceOverview.libsonnet')(this), }, blobStorage: { enableAvailability: false, diff --git a/csp-mixin/dashboards.libsonnet b/csp-mixin/dashboards.libsonnet index 1f1641c27..94a642be4 100644 --- a/csp-mixin/dashboards.libsonnet +++ b/csp-mixin/dashboards.libsonnet @@ -52,6 +52,21 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + csplib.grafana.rows.glb_traffic_metrics ) ), + [csplib.config.uid + '-computeengine.json']: + local variables = csplib.signals.gcpce.getVariablesMultiChoice(); + g.dashboard.new(csplib.config.dashboardNamePrefix + 'Compute Engine') + + g.dashboard.withUid(csplib.config.uid + '-computeengine') + + g.dashboard.withTags(csplib.config.dashboardTags) + + g.dashboard.withTimezone(csplib.config.dashboardTimezone) + + g.dashboard.withRefresh(csplib.config.dashboardRefresh) + + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) + + g.dashboard.withVariables(variables) + + g.dashboard.withPanels( + g.util.grid.wrapPanels( + csplib.grafana.rows.gce_overview + + csplib.grafana.rows.gce_instance + ) + ), } else {} + if csplib.config.uid == 'azure' then diff --git a/csp-mixin/panels/gcpce.libsonnet b/csp-mixin/panels/gcpce.libsonnet new file mode 100644 index 000000000..3c870a85e --- /dev/null +++ b/csp-mixin/panels/gcpce.libsonnet @@ -0,0 +1,612 @@ +local g = import '../g.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; +{ + new(this): { + gce_instance_count: + this.signals.gcpceOverview.instanceCount.asStat() + + g.panel.stat.standardOptions.color.withMode('fixed') + + g.panel.stat.standardOptions.color.withFixedColor('text') + + g.panel.table.standardOptions.withOverrides([ + { + matcher: { + id: 'byFrameRefID', + options: 'Instance count', + }, + properties: [ + { + id: 'mappings', + value: [], + }, + { + id: 'unit', + value: 'short', + }, + ], + }, + ]), + gce_system_problem_count: + this.signals.gcpceOverview.systemProblemCount.asStat() + + g.panel.stat.standardOptions.color.withMode('fixed') + + g.panel.stat.standardOptions.color.withFixedColor('text') + + g.panel.table.standardOptions.withOverrides([ + { + matcher: { + id: 'byFrameRefID', + options: 'System problem count', + }, + properties: [ + { + id: 'mappings', + value: [], + }, + { + id: 'unit', + value: 'short', + }, + ], + }, + ]), + gce_top5_cpu_utilization: + this.signals.gcpceOverview.top5CpuUtilization.asTable(format='table') + + g.panel.table.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'Time', + }, + properties: [ + { + id: 'custom.hidden', + value: true, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'instance_name', + }, + properties: [ + { + id: 'displayName', + value: 'Instance', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'job', + }, + properties: [ + { + id: 'displayName', + value: 'Job', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'project_id', + }, + properties: [ + { + id: 'displayName', + value: 'Project ID', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value', + }, + properties: [ + { + id: 'custom.width', + value: 100, + }, + { + id: 'unit', + value: 'percent', + }, + { + id: 'custom.cellOptions', + value: { + mode: 'basic', + type: 'gauge', + valueDisplayMode: 'text', + }, + }, + { + id: 'thresholds', + value: { + mode: 'absolute', + steps: [ + { + color: 'yellow', + value: null, + }, + { + color: 'green', + value: 30, + }, + { + color: 'red', + value: 85, + }, + ], + }, + }, + ], + }, + ]), + gce_top5_system_problem: + this.signals.gcpceOverview.top5SystemProblem.asTable(format='table') + + g.panel.table.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'Time', + }, + properties: [ + { + id: 'custom.hidden', + value: true, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'instance_name', + }, + properties: [ + { + id: 'displayName', + value: 'Instance', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'job', + }, + properties: [ + { + id: 'displayName', + value: 'Job', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'project_id', + }, + properties: [ + { + id: 'displayName', + value: 'Project ID', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value', + }, + properties: [ + { + id: 'custom.width', + value: 100, + }, + ], + }, + ]), + gce_top5_disk_read_bytes: + this.signals.gcpceOverview.top5DiskRead.asTable(format='table') + + g.panel.table.standardOptions.withUnit('bytes') + + g.panel.table.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'Time', + }, + properties: [ + { + id: 'custom.hidden', + value: true, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'instance_name', + }, + properties: [ + { + id: 'displayName', + value: 'Instance', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'job', + }, + properties: [ + { + id: 'displayName', + value: 'Job', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'project_id', + }, + properties: [ + { + id: 'displayName', + value: 'Project ID', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value', + }, + properties: [ + { + id: 'custom.width', + value: 100, + }, + ], + }, + ]), + gce_top5_disk_write_bytes: + this.signals.gcpceOverview.top5DiskWrite.asTable(format='table') + + g.panel.table.standardOptions.withUnit('bytes') + + g.panel.table.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'Time', + }, + properties: [ + { + id: 'custom.hidden', + value: true, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'instance_name', + }, + properties: [ + { + id: 'displayName', + value: 'Instance', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'job', + }, + properties: [ + { + id: 'displayName', + value: 'Job', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'project_id', + }, + properties: [ + { + id: 'displayName', + value: 'Project ID', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value', + }, + properties: [ + { + id: 'custom.width', + value: 100, + }, + ], + }, + ]), + + gce_instances: + g.panel.table.new('Instances') + + g.panel.table.queryOptions.withTargets( + [ + this.signals.gcpceOverview.tableCpuUtilization.asTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withFormat('table'), + this.signals.gcpceOverview.tableUptime.asTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withFormat('table'), + this.signals.gcpceOverview.tableSentPackets.asTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withFormat('table'), + this.signals.gcpceOverview.tableReceivedPackets.asTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withFormat('table'), + this.signals.gcpceOverview.tableNetworkSentBytes.asTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withFormat('table'), + this.signals.gcpceOverview.tableNetworkReceivedBytes.asTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withFormat('table'), + this.signals.gcpceOverview.tableDiskReadBytes.asTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withFormat('table'), + this.signals.gcpceOverview.tableDiskWriteBytes.asTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withFormat('table'), + ] + ) + + g.panel.table.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'Time', + }, + properties: [ + { + id: 'custom.hidden', + value: true, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'instance_name', + }, + properties: [ + { + id: 'displayName', + value: 'Instance', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'job', + }, + properties: [ + { + id: 'displayName', + value: 'Job', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'project_id', + }, + properties: [ + { + id: 'displayName', + value: 'Project ID', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value #tableCpuUtilization', + }, + properties: [ + { + id: 'displayName', + value: 'Cpu utilization', + }, + { + id: 'unit', + value: 'percent', + }, + { + id: 'custom.width', + value: 100, + }, + { + id: 'custom.cellOptions', + value: { + mode: 'basic', + type: 'gauge', + valueDisplayMode: 'text', + }, + }, + { + id: 'thresholds', + value: { + mode: 'absolute', + steps: [ + { + color: 'yellow', + value: null, + }, + { + color: 'green', + value: 30, + }, + { + color: 'red', + value: 85, + }, + ], + }, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value #tableUptime', + }, + properties: [ + { + id: 'unit', + value: 's', + }, + { + id: 'displayName', + value: 'Uptime', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value #tableSentPackets', + }, + properties: [ + { + id: 'displayName', + value: 'Sent packets [5m]', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value #tableReceivedPackets', + }, + properties: [ + { + id: 'displayName', + value: 'Received packets [5m]', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value #tableNetworkSentBytes', + }, + properties: [ + { + id: 'unit', + value: 'decbytes', + }, + { + id: 'displayName', + value: 'Network sent [5m]', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value #tableNetworkReceivedBytes', + }, + properties: [ + { + id: 'unit', + value: 'decbytes', + }, + { + id: 'displayName', + value: 'Network received [5m]', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value #tableDiskReadBytes', + }, + properties: [ + { + id: 'unit', + value: 'decbytes', + }, + { + id: 'displayName', + value: 'Disk read bytes [5m]', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Value #tableDiskWriteBytes', + }, + properties: [ + { + id: 'unit', + value: 'decbytes', + }, + { + id: 'displayName', + value: 'Disk write bytes [5m]', + }, + ], + }, + ]) + + g.panel.table.queryOptions.withTransformations([ + { + id: 'merge', + options: {}, + }, + ]), + + gce_memory_utilization: + this.signals.gcpceOverview.memoryUtilization.asTimeSeries() + + this.signals.gcpceOverview.memoryUsed.asPanelMixin(), + gce_total_packets_sent_received: + this.signals.gcpceOverview.packetsSent.asTimeSeries() + + this.signals.gcpceOverview.packetsReceived.asPanelMixin(), + gce_network_send_received: + this.signals.gcpceOverview.networkSent.asTimeSeries() + + this.signals.gcpceOverview.networkReceived.asPanelMixin(), + gce_bytes_read_write: + this.signals.gcpceOverview.diskBytesRead.asTimeSeries() + + this.signals.gcpceOverview.diskBytesWrite.asPanelMixin(), + + gce_text_instances: + g.panel.text.new('Instances') + + g.panel.text.options.withContent('Use this section to look at one instance at a time by picking a value in the *Instance* picker at the top of the dashboard.'), + gce_cpu_utilization: + this.signals.gcpce.cpuUtilization.asTimeSeries(), + gce_cpu_usage_time: + this.signals.gcpce.cpuUsageTime.asTimeSeries(), + gce_network_received: + this.signals.gcpce.networkReceived.asTimeSeries(), + gce_network_sent: + this.signals.gcpce.networkSent.asTimeSeries(), + gce_count_disk_read_bytes: + this.signals.gcpce.diskReadBytes.asTimeSeries(), + gce_count_disk_write_bytes: + this.signals.gcpce.diskWriteBytes.asTimeSeries(), + gce_count_disk_read_operations: + this.signals.gcpce.diskReadOperations.asTimeSeries(), + gce_count_disk_write_operations: + this.signals.gcpce.diskWriteOperations.asTimeSeries(), + }, +} diff --git a/csp-mixin/panels/main.libsonnet b/csp-mixin/panels/main.libsonnet index 9756e256d..b1c6485ab 100644 --- a/csp-mixin/panels/main.libsonnet +++ b/csp-mixin/panels/main.libsonnet @@ -8,5 +8,6 @@ azurevm: (import './azurevm.libsonnet').new(this), blobstore: (import './blobstore.libsonnet').new(this), gcploadbalancer: (import './gcploadbalancer.libsonnet').new(this), + gcpce: (import './gcpce.libsonnet').new(this), }, } diff --git a/csp-mixin/rows.libsonnet b/csp-mixin/rows.libsonnet index 1d1e410f8..e0ff24ef3 100644 --- a/csp-mixin/rows.libsonnet +++ b/csp-mixin/rows.libsonnet @@ -416,5 +416,98 @@ local g = import './g.libsonnet'; + g.panel.timeSeries.gridPos.withW(24) + g.panel.timeSeries.gridPos.withH(12), ], + + // Gcp Compute Engine + gce_overview: [ + g.panel.row.new('Overview'), + + this.grafana.panels.gcpce.gce_instance_count + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(5), + + this.grafana.panels.gcpce.gce_system_problem_count + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(5), + + this.grafana.panels.gcpce.gce_top5_cpu_utilization + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_top5_system_problem + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_top5_disk_read_bytes + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_top5_disk_write_bytes + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_instances + + g.panel.timeSeries.gridPos.withW(24) + + g.panel.timeSeries.gridPos.withH(12), + + this.grafana.panels.gcpce.gce_memory_utilization + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_total_packets_sent_received + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_network_send_received + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_bytes_read_write + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + ], + + gce_instance: [ + g.panel.row.new('Instance') + + g.panel.row.withCollapsed(true) + + g.panel.row.withPanels( + [ + this.grafana.panels.gcpce.gce_text_instances + + g.panel.timeSeries.gridPos.withW(24) + + g.panel.timeSeries.gridPos.withH(2), + + this.grafana.panels.gcpce.gce_cpu_utilization + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_cpu_usage_time + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_network_received + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_network_sent + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_count_disk_read_bytes + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_count_disk_write_bytes + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_count_disk_read_operations + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.gcpce.gce_count_disk_write_operations + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + ] + ), + ], }, } diff --git a/csp-mixin/signals/gcpce.libsonnet b/csp-mixin/signals/gcpce.libsonnet new file mode 100644 index 000000000..e1c377627 --- /dev/null +++ b/csp-mixin/signals/gcpce.libsonnet @@ -0,0 +1,119 @@ +local commonlib = import 'common-lib/common/main.libsonnet'; +function(this) + { + local s = self, + filteringSelector: 'job!=""', + groupLabels: ['job', 'project_id'], + instanceLabels: ['instance_name'], + aggLevel: 'instance', + discoveryMetric: { + stackdriver: 'stackdriver_gce_instance_compute_googleapis_com_instance_cpu_utilization', + }, + signals: { + cpuUtilization: { + name: 'CPU utilization', + description: 'Fractional utilization of allocated CPU on this instance.', + type: 'gauge', + unit: 'percentunit', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_cpu_utilization{%(queriesSelector)s}', + legendCustomTemplate: '{{instance_name}}', + }, + }, + }, + cpuUsageTime: { + name: 'Cpu usage time', + description: 'CPU usage, in seconds. For Container-Optimized OS, or Ubuntu running GKE.', + type: 'counter', + unit: 'seconds', + aggFunction: 'avg', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_cpu_usage_time{%(queriesSelector)s}', + legendCustomTemplate: '{{instance_name}}', + }, + }, + }, + networkReceived: { + name: 'Network received', + description: 'Bytes received from the network. Sampled every 60 seconds.', + type: 'counter', + unit: 'bytes', + aggFunction: 'avg', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_network_received_bytes_count{%(queriesSelector)s}', + legendCustomTemplate: '{{instance_name}}', + }, + }, + }, + networkSent: { + name: 'Network sent', + description: 'Bytes sent from the network. Sampled every 60 seconds.', + type: 'counter', + unit: 'bytes', + aggFunction: 'avg', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_network_sent_bytes_count{%(queriesSelector)s}', + legendCustomTemplate: '{{instance_name}}', + }, + }, + }, + + diskReadBytes: { + name: 'Disk read bytes', + description: 'Bytes read from disk. Sampled every 60 seconds.', + type: 'counter', + unit: 'bytes', + aggFunction: 'avg', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_disk_read_bytes_count{%(queriesSelector)s}', + legendCustomTemplate: '{{instance_name}}', + exprWrappers: [['', '> 0']], + }, + }, + }, + diskWriteBytes: { + name: 'Disk write bytes', + description: 'Bytes written to disk. Sampled every 60 seconds.', + type: 'counter', + unit: 'bytes', + aggFunction: 'avg', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_disk_write_bytes_count{%(queriesSelector)s}', + legendCustomTemplate: '{{instance_name}}', + }, + }, + }, + diskReadOperations: { + name: 'Disk read operations', + description: 'Disk read IO operations. Sampled every 60 seconds.', + type: 'counter', + unit: 'short', + aggFunction: 'avg', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_disk_read_ops_count{%(queriesSelector)s}', + legendCustomTemplate: '{{instance_name}}', + }, + }, + }, + diskWriteOperations: { + name: 'Disk write operations', + description: 'Disk write IO operations. Sampled every 60 seconds.', + type: 'counter', + unit: 'short', + aggFunction: 'avg', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_disk_write_ops_count{%(queriesSelector)s}', + legendCustomTemplate: '{{instance_name}}', + }, + }, + }, + }, + } diff --git a/csp-mixin/signals/gcpceOverview.libsonnet b/csp-mixin/signals/gcpceOverview.libsonnet new file mode 100644 index 000000000..553803050 --- /dev/null +++ b/csp-mixin/signals/gcpceOverview.libsonnet @@ -0,0 +1,301 @@ +local commonlib = import 'common-lib/common/main.libsonnet'; +function(this) + { + local s = self, + filteringSelector: 'job!=""', + groupLabels: ['job', 'project_id'], + instanceLabels: [], + aggLevel: 'instance', + discoveryMetric: { + stackdriver: 'stackdriver_gce_instance_compute_googleapis_com_instance_cpu_utilization', + }, + signals: { + instanceCount: { + name: 'Instance count', + description: 'Number of VM instances', + type: 'gauge', + aggFunction: 'sum', + unit: 'short', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_cpu_utilization{%(queriesSelector)s}', + legendCustomTemplate: 'Number of instances', + aggKeepLabels: ['instance_name'], + exprWrappers: [['count(', ')']], + }, + }, + }, + systemProblemCount: { + name: 'System problem count', + description: 'Number of errors fired on all instances.', + type: 'raw', + unit: 'short', + sources: { + stackdriver: { + expr: 'sum(increase(stackdriver_gce_instance_compute_googleapis_com_guest_system_problem_count{%(queriesSelector)s}[$__range]))', + legendCustomTemplate: 'Total errors', + }, + }, + }, + top5CpuUtilization: { + name: 'Top 5 Instances by CPU utilitization', + description: 'Fractional utilization of allocated CPU on an instance', + type: 'gauge', + aggFunction: 'sum', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_cpu_utilization{%(queriesSelector)s}', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + exprWrappers: [['topk(5, 100*', ')']], + }, + }, + }, + + top5SystemProblem: { + name: 'Top 5 Instances by System problem', + description: 'List of top 5 instances with system problems.', + type: 'gauge', + aggFunction: 'sum', + sources: { + stackdriver: { + expr: 'increase(stackdriver_gce_instance_compute_googleapis_com_guest_system_problem_count{%(queriesSelector)s}[$__range])', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + exprWrappers: [['topk(5,', ')']], + }, + }, + }, + + top5DiskRead: { + name: 'Top 5 Instances by Disk read bytes', + description: 'List of top 5 instances by disk read bytes', + type: 'gauge', + aggFunction: 'sum', + unit: 'bytes', + sources: { + stackdriver: { + expr: 'increase(stackdriver_gce_instance_compute_googleapis_com_instance_disk_read_bytes_count{%(queriesSelector)s}[$__range])', + aggKeepLabels: ['instance_name'], + legendCustomTemplate: '', + exprWrappers: [['topk(5,', ')']], + }, + }, + }, + + top5DiskWrite: { + name: 'Top 5 Instances by Disk write bytes', + description: 'List of top 5 instances by disk write bytes', + type: 'gauge', + aggFunction: 'sum', + unit: 'bytes', + sources: { + stackdriver: { + expr: 'increase(stackdriver_gce_instance_compute_googleapis_com_instance_disk_write_bytes_count{%(queriesSelector)s}[$__range])', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + exprWrappers: [['topk(5,', ')']], + }, + }, + }, + + // Table + tableCpuUtilization: { + name: 'tableCpuUtilization', + type: 'gauge', + aggFunction: 'sum', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_cpu_utilization{%(queriesSelector)s}', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + exprWrappers: [['100 *', '']], + }, + }, + }, + tableUptime: { + name: 'tableUptime', + type: 'gauge', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_uptime_total{%(queriesSelector)s}', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + }, + }, + }, + tableSentPackets: { + name: 'tableSentPackets', + type: 'gauge', + sources: { + stackdriver: { + expr: 'rate(stackdriver_gce_instance_compute_googleapis_com_instance_network_sent_packets_count{%(queriesSelector)s}[5m])', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + }, + }, + }, + tableReceivedPackets: { + name: 'tableReceivedPackets', + type: 'gauge', + sources: { + stackdriver: { + expr: 'rate(stackdriver_gce_instance_compute_googleapis_com_instance_network_received_packets_count{%(queriesSelector)s}[5m])', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + }, + }, + }, + tableNetworkSentBytes: { + name: 'tableNetworkSentBytes', + type: 'gauge', + sources: { + stackdriver: { + expr: 'rate(stackdriver_gce_instance_compute_googleapis_com_instance_network_sent_bytes_count{%(queriesSelector)s}[5m])', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + }, + }, + }, + tableNetworkReceivedBytes: { + name: 'tableNetworkReceivedBytes', + type: 'gauge', + sources: { + stackdriver: { + expr: 'rate(stackdriver_gce_instance_compute_googleapis_com_instance_network_received_bytes_count{%(queriesSelector)s}[5m])', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + }, + }, + }, + tableDiskReadBytes: { + name: 'tableDiskReadBytes', + type: 'gauge', + sources: { + stackdriver: { + expr: 'rate(stackdriver_gce_instance_compute_googleapis_com_instance_disk_read_bytes_count{%(queriesSelector)s}[5m])', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + }, + }, + }, + tableDiskWriteBytes: { + name: 'tableDiskWriteBytes', + type: 'gauge', + sources: { + stackdriver: { + expr: 'rate(stackdriver_gce_instance_compute_googleapis_com_instance_disk_write_bytes_count{%(queriesSelector)s}[5m])', + legendCustomTemplate: '', + aggKeepLabels: ['instance_name'], + }, + }, + }, + // end table + + memoryUtilization: { + name: 'Memory utilization', + description: 'Memory utilization', + type: 'raw', + unit: 'bytes', + sources: { + stackdriver: { + expr: 'sum(stackdriver_gce_instance_compute_googleapis_com_instance_memory_balloon_ram_size{%(queriesSelector)s}) + sum(stackdriver_gce_instance_compute_googleapis_com_guest_memory_bytes_used{%(queriesSelector)s})', + legendCustomTemplate: 'Total Memory Capacity', + }, + }, + }, + + memoryUsed: { + name: 'Memory utilization2', + description: 'Memory used', + type: 'raw', + unit: 'bytes', + sources: { + stackdriver: { + expr: 'sum(stackdriver_gce_instance_compute_googleapis_com_instance_memory_balloon_ram_used{%(queriesSelector)s}) + sum(stackdriver_gce_instance_compute_googleapis_com_guest_memory_bytes_used{%(queriesSelector)s, state!="free"})', + legendCustomTemplate: 'Total Memory Used', + }, + }, + }, + + packetsSent: { + name: 'Sent/received packets', + description: 'Packets sent/received over the network. Sampled every 60 seconds', + type: 'counter', + unit: 'sishort', + aggFunction: 'sum', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_network_sent_packets_count{%(queriesSelector)s}', + legendCustomTemplate: 'Sent', + }, + }, + }, + + packetsReceived: { + name: 'Received packets', + description: 'Packets received over the network. Sampled every 60 seconds', + type: 'counter', + unit: 'sishort', + aggFunction: 'sum', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_network_received_packets_count{%(queriesSelector)s}', + legendCustomTemplate: 'Received', + }, + }, + }, + + networkSent: { + name: 'Network throughput sent/received', + description: 'Count of bytes sent/received over the network. Sampled every 60 seconds', + type: 'counter', + unit: 'bytes', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_network_sent_bytes_count{%(queriesSelector)s}', + legendCustomTemplate: 'Sent', + }, + }, + }, + + networkReceived: { + name: 'Network throughput received', + description: 'Count of bytes sent/received over the network. Sampled every 60 seconds', + type: 'counter', + unit: 'bytes', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_network_received_bytes_count{%(queriesSelector)s}', + legendCustomTemplate: 'Received', + }, + }, + }, + + diskBytesRead: { + name: 'Disk read/write bytes', + description: 'Total count of bytes read/write from disk. Sampled every 60 seconds', + type: 'counter', + unit: 'bytes', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_disk_read_bytes_count{%(queriesSelector)s}', + legendCustomTemplate: 'Read', + }, + }, + }, + + diskBytesWrite: { + name: 'Disk write bytes', + description: 'Total count of bytes read/write from disk. Sampled every 60 seconds', + type: 'counter', + unit: 'bytes', + sources: { + stackdriver: { + expr: 'stackdriver_gce_instance_compute_googleapis_com_instance_disk_write_bytes_count{%(queriesSelector)s}', + legendCustomTemplate: 'Write', + }, + }, + }, + }, + }