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

SIGSEGV: segmentation violation code when running backup alertsconditions #9

Open ramneetm opened 5 years ago

ramneetm commented 5 years ago

SIGSEGV: segmentation violation code $ ./nr backup alertsconditions -d /Users/rmalhotra Start to backup all alertsconditions to '/Users/rmalhotra' folder panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1378246]

goroutine 1 [running]: github.com/IBM/newrelic-cli/cmd/get.GetMonitorByID(0xc00018d140, 0x24, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/rmalhotra/go/src/github.com/IBM/newrelic-cli/cmd/get/get_monitor.go:89 +0x3c6 github.com/IBM/newrelic-cli/cmd/backup.glob..func1(0x18b2c60, 0xc00007a8c0, 0x0, 0x2) /Users/rmalhotra/go/src/github.com/IBM/newrelic-cli/cmd/backup/backup_alertsconditions.go:145 +0x526 github.com/spf13/cobra.(Command).execute(0x18b2c60, 0xc00007a880, 0x2, 0x2, 0x18b2c60, 0xc00007a880) /Users/rmalhotra/go/src/github.com/spf13/cobra/command.go:766 +0x2cc github.com/spf13/cobra.(Command).ExecuteC(0x18b2080, 0x18b2540, 0x18b7ac0, 0x0) /Users/rmalhotra/go/src/github.com/spf13/cobra/command.go:852 +0x2fd github.com/spf13/cobra.(*Command).Execute(0x18b2080, 0x1005390, 0xc00007e058) /Users/rmalhotra/go/src/github.com/spf13/cobra/command.go:800 +0x2b github.com/IBM/newrelic-cli/cmd.Execute() /Users/rmalhotra/go/src/github.com/IBM/newrelic-cli/cmd/root.go:56 +0x2d main.main() /Users/rmalhotra/IBM/newrelic-cli/nr.go:20 +0x20

gaochan-1 commented 5 years ago

Hi @ramneetm

Thank for your requesting, I will take a look at it.

Thanks! Chan Gao

gaochan-1 commented 5 years ago

Hi @ramneetm

I can not reproduce this backup alertsconditions problem in my testing env. It may be caused by some specific data in your NewRelic account.

The error occurred while calling GetMonitorByID(), can you please backup the all Synthetics monitors and send me to take a look if how are different?

Thanks! Chan Gao

asomensari commented 5 years ago

@ramneetm Can you share the New Relic account (account number) you are using for this test? I will try to replicate the problem

ramneetm commented 5 years ago

@gaochan-1 Synthetic.monitors.txt

gaochan-1 commented 5 years ago

@ramneetm

I restored the monitors you sent me and I created alert conditions,did the backup alertsconditions, although there are some error output, but it still succeed.

So far, It seems that it was difficult to identify root cause.

Start to backup all alertsconditions to 'bak_conditions' folder
invalid character '<' looking for beginning of value
invalid character '<' looking for beginning of value
invalid character '<' looking for beginning of value
invalid character '<' looking for beginning of value

OperationName           StatusCode   Description   Message
Get Alert Channels      200          Success       pageCount:1
Get Alert Channels      200          Success       pageCount:2
Get Alert Policies      200          Success       pageCount:1
Get Alert Policies      200          Success       pageCount:2
Get Monitor By ID       200          Success       monitor id: 16dd9c4a-56c4-4718-8439-a4b34eaad5ea, monitor name: Scripted broswer test using se builder
Get Labels              200          Success       pageCount:1
Get Labels              200          Success       pageCount:2
Get Monitors By Label   200          Success       pageSize:20,pageOffset:0
Get Monitors By Label   200          Success       pageSize:20,pageOffset:0
Get Monitor Script      200          Success       monitor id: 16dd9c4a-56c4-4718-8439-a4b34eaad5ea, monitor name: Scripted broswer test using se builder
Get Monitor By ID       200          Success       monitor id: 7c1aec59-025e-49eb-8333-b80fd2c15359, monitor name: Test Monitor
Get Labels              200          Success       pageCount:1
Get Labels              200          Success       pageCount:2
Get Monitors By Label   200          Success       pageSize:20,pageOffset:0
Get Monitors By Label   200          Success       pageSize:20,pageOffset:0
Get Monitor By ID       200          Success       monitor id: 44256f55-fefc-4a5f-88b6-4ce232ce4c7d, monitor name: example login pwd
Get Labels              200          Success       pageCount:1
Get Labels              200          Success       pageCount:2
Get Monitors By Label   200          Success       pageSize:20,pageOffset:0
Get Monitors By Label   200          Success       pageSize:20,pageOffset:0
Get Monitor Script      200          Success       monitor id: 44256f55-fefc-4a5f-88b6-4ce232ce4c7d, monitor name: example login pwd
Get Monitor By ID       200          Success       monitor id: b95957b9-0c0a-4f33-b18a-26bbba567d9e, monitor name: testclimonitor
Get Labels              200          Success       pageCount:1
Get Labels              200          Success       pageCount:2
Get Monitors By Label   200          Success       pageSize:20,pageOffset:0
Get Monitors By Label   200          Success       pageSize:20,pageOffset:0

FileName                                                              OperationStatus
bak_conditions/Test Policy-367484.alert-conditions.bak   success

Backup alert conditions, total: 1, success: 1, fail: 0