Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Bulk silencing not working for some clients #677

Closed
narcistesa opened this issue Apr 18, 2017 · 4 comments
Closed

Bulk silencing not working for some clients #677

narcistesa opened this issue Apr 18, 2017 · 4 comments
Assignees
Labels
Milestone

Comments

@narcistesa
Copy link

Expected Behavior

The Bulk silencing UI dialog should show a list of the clients being silenced and should silence the selected clients.

Current Behavior

Some but not all clients seem to be affected by this issue when I try to use the bulk silencing feature. Individual client silencing works when clicking on the silencing icon.

If I select one of the clients affected by this bug and try to use bulk silencing on it, a different client name will show up in the UI dialog for silencing.

If I select two of the clients that are affected by this bug, none of them will show up in the UI silencing dialog and I get an angular error in the browser console (I decoded the URL already):

[Error] [ngRepeat:dupes] http://errors.angularjs.org/1.6.4/ngRepeat/dupes?p0=item in items | filter:{silenced: false}&p1=object:12650&p2={"_id":"DataCenter/client1","address":"10.114.185.134","dc":"DataCenter","keepalive":{"handler":"mailer"},"name":"client1","silenced":false,"status":0,"subscriptions":["all","appservers","client:client1"],"timestamp":1492543202,"version":"0.26.5","$$hashKey":"object:12650"}
https://sensu.company.com/bower_components/angular/angular.min.js?rel=1492113233617:6
	(anonymous function) (angular.min.js:95)
	$digest (angular.min.js:146:345)
	$apply (angular.min.js:149:121)
	(anonymous function) (angular.min.js:284:246)
	hg (angular.min.js:39:304)
	d (angular.min.js:39:248)

[Error] TypeError: null is not an object (evaluating 'href.match')
	(anonymous function) (injection.js:90)

I asked a UI developer to quickly look at this with me and he said it looks like there are duplicate keys in angular, which would make sense since it looks like the affected clients might be using the same key for some reason (I'm guessing that's object:12650 in this case). That could cause the previous error when selecting two clients with the same key and could also cause the UI to return the wrong client name in the bulk silencing dialog.

Environment

  • Uchiwa version used: 0.24.0-1
  • Sensu version used: 0.26.5-2
  • Operating System and version: Ubuntu 14.04.5 LTS
  • Redis version used: 2.8.4-2
  • RabbitMQ version used: 3.6.9-1
@palourde
Copy link
Contributor

palourde commented May 4, 2017

Hi @narcistesa,

Sorry for the delay. I just pushed a fix (https://github.com/sensu/uchiwa-web/pull/161) but I'm not 100% sure it will fix your particular problem.

Do you have an easy way to identify which clients are affected without trying first? Do you have at least two clients with the same name on different datacenters? Could you show me, as an example, a client that can be bulk silenced and another one that can't?

Thanks

@palourde palourde self-assigned this May 4, 2017
@palourde palourde added the Bug label May 4, 2017
@narcistesa
Copy link
Author

narcistesa commented May 4, 2017

Hi @palourde, what seems to be happening is that uchiwa gets confused between two clients with similar names at the same data center, server and server2 in this case. If I select just the client named server and use the bulk silencing feature, I get the client named server2 in the bulk silencing UI dialog, and it will silence server2 instead. If I select both server and server2 and use the bulk silencing feature, none of them are listed in the bulk silencing UI and only one silencing entry is created for server2 (and angular throws the duplicate keys error). So for some reason uchiwa thinks that the client named server is actually server2. I can silence the clients named server1 and server2 together or individually using bulk silencing with no problems.

I've downloaded the latest uchiwa-web master and replaced it in my uchiwa install and it doesn't seem to fix my issue.

I've added the json for my 3 clients with similar names below, please let me know if there's anything else I can provide.

{
    "_id": "DataCenter/server",
    "address": "xx.xx.xxx.xxx",
    "dc": "DataCenter",
    "keepalive": {
        "handler": "mailer"
    },
    "name": "server",
    "silenced": false,
    "status": 0,
    "subscriptions": ["all", "webservers", "appservers", "dbservers", "client:server"],
    "timestamp": 1493914577,
    "version": "0.26.5"
}

{
    "_id": "DataCenter/server1",
    "address": "xx.xxx.xx.xxx",
    "dc": "DataCenter",
    "keepalive": {
        "handler": "mailer"
    },
    "name": "server1",
    "silenced": false,
    "status": 0,
    "subscriptions": ["all", "appservers", "client:server1"],
    "timestamp": 1493914591,
    "version": "0.26.5"
}

{
    "_id": "DataCenter/server2",
    "address": "xx.xx.xx.xxx",
    "dc": "DataCenter",
    "keepalive": {
        "handler": "mailer"
    },
    "name": "server2",
    "silenced": false,
    "status": 0,
    "subscriptions": ["all", "appservers", "client:server2"],
    "timestamp": 1493914591,
    "version": "0.26.5"
}

Thanks for looking into this.

@palourde
Copy link
Contributor

palourde commented May 5, 2017

Hey @narcistesa

Thank you for providing me this information, I was able to reproduce the issue with it and add a unit test to cover this specific issue. Turns out a simple function didn't performed strict comparison when filtering, which consequently made the id DataCenter/server valid when looking for DataCenter/server1 or DataCenter/server2.

It has been resolved through https://github.com/sensu/uchiwa-web/pull/164 and will be available in the next release.

Thanks!

@palourde palourde added this to the 0.25.0 milestone May 5, 2017
@palourde palourde closed this as completed May 5, 2017
@narcistesa
Copy link
Author

Thanks @palourde for the fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants