Skip to content

Commit

Permalink
Updates include:
Browse files Browse the repository at this point in the history
* Update RDS Dashboard response ID key
* Debug output
* Update SDK
  • Loading branch information
powersj committed Mar 25, 2022
1 parent 21cf9fe commit 90a862e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/Shopify/sarama v1.32.0
github.com/aerospike/aerospike-client-go/v5 v5.7.0
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1483
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1529
github.com/amir/raidman v0.0.0-20170415203553-1ccc43bfb9c9
github.com/antchfx/jsonquery v1.1.5
github.com/antchfx/xmlquery v1.3.9
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:C
github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE=
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1483 h1:J8HaD+Zpfi1gcel3HCKpoHHEsrcuRrZlSnx7R9SCf5I=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1483/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1529 h1:qAt5MZ3Ukwx/JMAiaagQhNQMBZLcmJbnweBoK3EeHxI=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1529/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU=
github.com/amir/raidman v0.0.0-20170415203553-1ccc43bfb9c9 h1:FXrPTd8Rdlc94dKccl7KPmdmIbVh/OjelJ8/vgMRzcQ=
github.com/amir/raidman v0.0.0-20170415203553-1ccc43bfb9c9/go.mod h1:eliMa/PW+RDr2QLWRmLH1R1ZA4RInpmvOzDDXtaIZkc=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
Expand Down
5 changes: 5 additions & 0 deletions plugins/inputs/aliyuncms/aliyuncms.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ func (s *AliyunCMS) gatherMetric(acc telegraf.Accumulator, metricName string, me
req.Dimensions = metric.requestDimensionsStr
req.RegionId = region

fmt.Println("Making the following request:")
fmt.Println(req)
fmt.Println("Request Dimensions:")
fmt.Println(req.Dimensions)

for more := true; more; {
resp, err := s.client.DescribeMetricList(req)
if err != nil {
Expand Down
5 changes: 4 additions & 1 deletion plugins/inputs/aliyuncms/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aliyuncms

import (
"encoding/json"
"fmt"
"reflect"
"regexp"
"strconv"
Expand Down Expand Up @@ -115,7 +116,7 @@ func newDiscoveryTool(regions []string, project string, lg telegraf.Logger, cred
responseObjectIDKey = "InstanceId"
case "acs_rds_dashboard":
dscReq[region] = rds.CreateDescribeDBInstancesRequest()
responseObjectIDKey = "DBInstanceId"
responseObjectIDKey = "Items"
case "acs_slb_dashboard":
dscReq[region] = slb.CreateDescribeLoadBalancersRequest()
responseObjectIDKey = "LoadBalancerId"
Expand Down Expand Up @@ -295,6 +296,8 @@ func (dt *discoveryTool) parseDiscoveryResponse(resp *responses.CommonResponse)
return nil, errors.Errorf("Can't parse JSON from discovery response: %v", err)
}

fmt.Printf("discovery response output:\n%s\n", data)
fmt.Printf("loking for root key: '%s' or 'Items'\n", dt.respRootKey)
for key, val := range fullOutput {
switch key {
case dt.respRootKey:
Expand Down

0 comments on commit 90a862e

Please sign in to comment.