Skip to content

Commit

Permalink
Add table azure_compute_disk_metric_read_ops_daily closes #148
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthaI committed Jul 1, 2021
1 parent be86b2e commit 1b11b21
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions azure/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"azure_compute_disk_encryption_set": tableAzureComputeDiskEncryptionSet(ctx),
"azure_compute_disk_metric_read_ops": tableComputeDisksReadOpsMetric(ctx),
"azure_compute_disk_metric_read_ops_hourly": tableComputeDisksReadOpsMetricHourly(ctx),
"azure_compute_disk_metric_read_ops_daily": tableComputeDisksReadOpsMetricDaily(ctx),
"azure_compute_image": tableAzureComputeImage(ctx),
"azure_compute_resource_sku": tableAzureResourceSku(ctx),
"azure_compute_snapshot": tableAzureComputeSnapshot(ctx),
Expand Down
39 changes: 39 additions & 0 deletions azure/table_azure_compute_disk_metric_read_ops_daily.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package azure

import (
"context"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute"
"github.com/turbot/steampipe-plugin-sdk/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/plugin"
"github.com/turbot/steampipe-plugin-sdk/plugin/transform"
)

//// TABLE DEFINITION

func tableComputeDisksReadOpsMetricDaily(_ context.Context) *plugin.Table {
return &plugin.Table{
Name: "azure_compute_disk_metric_read_ops_daily",
Description: "Azure Compute Disk Metrics - Read Ops Daily",
List: &plugin.ListConfig{
ParentHydrate: listAzureComputeDisks,
Hydrate: listComputeDiskMetricReadOpsDaily,
},
Columns: monitoringMetricColumns([]*plugin.Column{
{
Name: "name",
Description: "The name of the compute disk.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("DimensionValue"),
},
}),
}
}

//// LIST FUNCTION

func listComputeDiskMetricReadOpsDaily(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
diskInfo := h.Item.(compute.Disk)

return listAzureMonitorMetricStatistics(ctx, d, "DAILY", "Microsoft.Compute/disks", "Composite Disk Read Operations/sec", *diskInfo.ID)
}
40 changes: 40 additions & 0 deletions docs/tables/azure_compute_disk_metric_read_ops_daily.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Table: azure_compute_disk_metric_read_ops_daily

GCP Monitoring Metrics provide data about the performance of your systems. The `azure_compute_disk_metric_read_ops_daily` table provides metric statistics at 24 hours intervals for the most recent 1 year.

## Examples

### Basic info

```sql
select
name,
timestamp,
minimum,
maximum,
average,
sample_count
from
azure_compute_disk_metric_read_ops_daily
order by
name,
timestamp;
```

### CPU Over 10 Bytes average

```sql
select
name,
timestamp,
round(minimum::numeric,2) as min_read_ops,
round(maximum::numeric,2) as max_read_ops,
round(average::numeric,2) as avg_read_ops,
sample_count
from
azure_compute_disk_metric_read_ops_daily
where average > 10
order by
name,
timestamp;
```

0 comments on commit 1b11b21

Please sign in to comment.