IBM / newrelic-cli

New Relic CLI is a command line tool which is used to operate New Relic objects(Synthetic monitors, alert policies, conditions, account users etc). You can use it easily to list/get/create/delete these objects. It can be used to backup your New Relic configuration data and restore in the future. It is easy to be used other than calling different REST API endpoints.
Apache License 2.0
62 stars 30 forks source link

Windows version #6

Closed Swati365 closed 5 years ago

Swati365 commented 5 years ago

Issues seen with windows version: get Users:

C:\swati\IBM_CLI>nr-windows-amd64.exe get users panic: reflect: call of reflect.Value.Interface on zero Value goroutine 1 [running]: reflect.valueInterface(0x0, 0x0, 0x0, 0x1, 0xc042228280, 0xc0422620c0) /Users/gaochan/Documents/zwork/software/Golang/go/src/reflect/value.go:9 reflect.Value.Interface(0x0, 0x0, 0x0, 0x1, 0x2) /Users/gaochan/Documents/zwork/software/Golang/go/src/reflect/value.go:9 github.com/IBM/newrelic-cli/utils.(*TablePrinter).Print(0xb982c8, 0x840420, 0xc0 /Users/gaochan/Documents/zwork/workspace-go/src/github.com/IBM/newrelic- github.com/IBM/newrelic-cli/cmd/get.glob..func16(0xb71540, 0xb982c8, 0x0, 0x0)

Get Dashboards: C:\swati\IBM_CLI>nr-windows-amd64.exe get dashboards Response status code: 401. Get one page dashboards, pageCount '1' Status code is not 2XX calling NewRelic REST

Get Alert Conditions C:\swati\IBM_CLI>nr-windows-amd64 get alertsconditions -t all -o json length of [flags] should be 1 instead of 0

C:\swati\IBM_CLI>nr-windows-amd64 get alertsconditions -t all length of [flags] should be 1 instead of 0

Get AlertsChannels

C:\swati\IBM_CLI>nr-windows-amd64 get alertschannels [WARNING] unsupported data format.

gaochan-1 commented 5 years ago

Hi @Swati365,

Thanks for your request, I'll debug it.

Thanks! Chan Gao

gaochan-1 commented 5 years ago

Hi @Swati365,

What's the Windows version you tested on? My platform is Windows7 Professional 64-bit.

Below is the output of get dashbords:

C:\newrelic-cli>nr-windows-amd64.exe get dashboards
{
  "dashboards": [
    {
      "id": 764400,
      "title": "Test dashboard 1",
      "description": null,
      "icon": "bar-chart",
      "created_at": "2018-11-02T03:18:57Z",
      "updated_at": "2018-11-02T03:20:38Z",
      "visibility": "all",
      "editable": "editable_by_all",
      "ui_url": "https://insights.newrelic.com/accounts/2098892/dashboards/764400",
      "api_url": "https://api.newrelic.com/v2/dashboards/764400",
      "owner_email": "bjgchan@cn.ibm.com",
      "filter": null
    },
    {
      "id": 764403,
      "title": "Test dashboard 2",
      "description": null,
      "icon": "bar-chart",
      "created_at": "2018-11-02T03:21:02Z",
      "updated_at": "2018-11-02T03:21:22Z",
      "visibility": "all",
      "editable": "editable_by_all",
      "ui_url": "https://insights.newrelic.com/accounts/2098892/dashboards/764403",
      "api_url": "https://api.newrelic.com/v2/dashboards/764403",
      "owner_email": "bjgchan@cn.ibm.com",
      "filter": null
    }
  ]
}

Thanks!

Chan Gao

Swati365 commented 5 years ago

Hi Chan, Thank you, I still get same error on windows and mac when calling dashboards

C02TK03SH03Y:IBM_CLI swatijoshi$ ./nr-cli get dashboards Response status code: 401. Get one page dashboards, pageCount ‘1’ Status code is not 2XX calling NewRelic REST

gaochan-1 commented 5 years ago

Hi @Swati365 ,

Sorry for late response.

I saw that the error you pasted was "status code: 401". I checked the newrelic REST API guide for dashboards, the 401 means that "Invalid API key", this is the doc link: https://rpm.newrelic.com/api/explore/dashboards/list

Can you please double check if your API key is valid?

How to get NewRelic API key, reference this link: https://docs.newrelic.com/docs/apis/getting-started/intro-apis/understand-new-relic-api-keys

Thanks! Chan Gao