Alignak-monitoring-contrib / alignak-module-backend

Alignak modules (arbiter, broker, scheduler) for the backend
GNU Affero General Public License v3.0
0 stars 2 forks source link

Update daemons state is not correct (missing daemons) #59

Open mohierf opened 7 years ago

mohierf commented 7 years ago

When alignakdaemon is updated, there are several problems:

  1. all the daemons are not considered
  2. some daemons are _sub_realm and some others are not ...

As an example:

[
    {
        "_id": "5894fcbe6376e9aea4223464",
        "_realm": "5894fb9d6376e9aea42231ef",
        "_sub_realm": false,
        "address": "127.0.0.1",
        "alive": true,
        "last_check": 1486462940,
        "name": "scheduler-north",
        "passive": false,
        "port": 17768,
        "reachable": true,
        "spare": false,
        "type": "scheduler"
    },
    {
        "_id": "5894fcbe6376e9aea32233b8",
        "_realm": "5894fb9d6376e9aea42231ef",
        "_sub_realm": false,
        "address": "127.0.0.1",
        "alive": true,
        "last_check": 1486462940,
        "name": "poller-north",
        "passive": false,
        "port": 17771,
        "reachable": true,
        "spare": false,
        "type": "poller"
    },
    {
        "_id": "5894fcbe6376e9aea32233ba",
        "_realm": "5894fb076376e9ab7e669699",
        "_sub_realm": true,
        "address": "127.0.0.1",
        "alive": true,
        "last_check": 1486462940,
        "name": "receiver-master",
        "passive": false,
        "port": 7773,
        "reachable": true,
        "spare": false,
        "type": "receiver"
    },
    {
        "_id": "5894fcbe6376e9aea32233bb",
        "_realm": "5894fb9d6376e9aea42231ef",
        "_sub_realm": true,
        "address": "127.0.0.1",
        "alive": true,
        "last_check": 1486462940,
        "name": "receiver-north",
        "passive": false,
        "port": 17773,
        "reachable": true,
        "spare": false,
        "type": "receiver"
    },
    {
        "_id": "5894fcbe6376e9aea32233bc",
        "_realm": "5894fb9d6376e9aea42231ef",
        "_sub_realm": false,
        "address": "127.0.0.1",
        "alive": true,
        "last_check": 1486462940,
        "name": "broker-north",
        "passive": false,
        "port": 17772,
        "reachable": true,
        "spare": false,
        "type": "broker"
    },
    {
        "_id": "5894fcbe6376e9aea32233bd",
        "_realm": "5894fb076376e9ab7e669699",
        "_sub_realm": true,
        "address": "127.0.0.1",
        "alive": true,
        "last_check": 1486462940,
        "name": "broker-master",
        "passive": false,
        "port": 7772,
        "reachable": true,
        "spare": false,
        "type": "broker"
    }
]

Note missing daemons are: poller-master, scheduler-master, reactionner-master Note Also note that the arbiter is missing completely.

Relates to #53.

algorys commented 7 years ago

Seems related to this issue:

e.g.: On demo site:

from alignak_backend_client.client import Backend
backend = Backend('http://demo.alignak.net:6000')
backend.login('northman', 'north')
daemons = backend.get('alignakdaemon')
for daemon in daemons['_items']:
    print(daemon['name'])

will ouput:

arbiter-master
scheduler-north
poller-north
receiver-master
receiver-north
broker-master
broker-north

So Reactionners are missing.

mohierf commented 7 years ago

Fixed with today's alignak merged modifications

algorys commented 7 years ago

@mohierf I've tested on demo server and problem persists...

from alignak_backend_client.client import Backend
backend = Backend('http://demo.alignak.net:6000')
backend.login('southman', 'south')
daemons = backend.get('alignakdaemon')
for daemon in daemons['_items']:
    print(daemon['name'])

# Output
scheduler-south
scheduler-south-east
poller-south-east
poller-south
broker-master
broker-south-east
broker-south

Here with southman, Receivers are missing too (so with Arbiters and Reactionners).

mohierf commented 7 years ago

Hmmm ... ok. When the alignakdaemon items are updated most of them are _sub_realm False and some of them are _sub_realm True

For instance the broker-master status is in the realm All and has a _sub_realm=True. As of it, it should be visible from a user located in a sub realm, like the Southman user ... and it is ok!

What drives this _sub_realm property set or unset:

I do not really understand the logic behind this choice 😑 @ddurieux On my own, I would have set this property as True for all the daemons. As such, any user, whatever its realm, is able to see that the whole Alignak daemons are ok or not!

algorys commented 7 years ago

As such, any user, whatever its realm, is able to see that the whole Alignak daemons are ok or not!

I'm agree with that.

ddurieux commented 7 years ago

@mohierf I think _sub_realm sould be true only if the daemons has manage_sub_realms to true

mohierf commented 7 years ago

Ok, you think so, but why? Why restricting the view of the daemons state to the users that are not in the realm? If you do not want to make them visible, how the user can be informed that the monitoring system is well and running ?