shinken-solutions / shinken

Flexible and scalable monitoring framework
http://www.shinken-monitoring.org
GNU Affero General Public License v3.0
1.13k stars 336 forks source link

webui2: cannot see hosts #1973

Open mrechte opened 6 years ago

mrechte commented 6 years ago

Hello, On the webui2 dashboard, I cannot see my 3 hosts. When trying to add a host It says "What a bummer! We couldn't find anything." However the hosts are active (from the scheduler.log and emails notifications). Attached webui2.cfg + brokerd.log Thanks webui2.zip

danirod commented 6 years ago

If you're sure that the hosts are properly registered and working by looking at schedulerd.log, I think you'd get better help on mod-webui2's issue tracker, as that issue tracker is specifically targeted towards WebUI.

mrechte commented 6 years ago

Not 100% sure, being a new (not yet happy) user to Shinken. I have messages like [Thu Sep 13 08:48:52 2018] INFO: [Shinken] A new broker just connected : broker-master [Thu Sep 13 08:48:52 2018] INFO: [Shinken] [scheduler-master] Created 39 initial Broks for broker broker-master [1536828833] HOST ALERT: dummy;DOWN;SOFT;1;PING CRITICAL - Packet loss = 100% [1536829133] HOST ALERT: dummy;DOWN;HARD;2;PING CRITICAL - Packet loss = 100% [1536829133] HOST NOTIFICATION: admin;dummy;DOWN;notify-host-by-email;PING CRITICAL - Packet loss = 100% in schedulerd.log. And some lines like: [Thu Sep 13 09:03:48 2018] WARNING: [Shinken] We drop 0 checks, 103 broks and 0 actions May I consider my setup is OK for webui2 ? Thanks

mohierf commented 6 years ago

Unfortunately not ...

The first log message only explains that some 'initial status' broks were created for the broker. If everything is ok, these broks are catched by the WebUI, which is a broker module, to create the corresponding hosts/services.

But, all do not seem to be ok ... else you would see the hosts in the UI!

How is your configuration, do you have some Web UI log in the broker log file ?

And, please copy all this issue stuiff in the WebUI dedicated repo as @danirod suggested 😉

mrechte commented 6 years ago

Hello, Plenty of WebUI messages in the broker log file. I set up livestatus,simple-log module in broker-master.cfg livelogs.db got created, but it does not get fed:

$ sqlite3 var/log/shinken/livelogs.db
sqlite> .tables
logs
sqlite> select count(*) from logs;
0

Did you notice in my former post the message: [Thu Sep 13 09:03:48 2018] WARNING: [Shinken] We drop 0 checks, 103 broks and 0 actions that I get often in schedulerd.log ? It seems the broker does not get the "broks" sent by the scheduler. However in brokerd.log I get messages of its connection OK: [1537182286] INFO: [broker-master] Connection OK to the scheduler scheduler-master This does not plead for a WebUI problem, does it ?

mohierf commented 6 years ago

The message for the dropped broks is awkward ... it means that the scheduler must delete some broks. As far as I remember, it is the broker that gets its broks from the scheduler. Are you sure that your broker is able to join the scheduler ? Have a look in the configuration for the scheduler address and port ...

mrechte commented 5 years ago

When starting-up the broker-master complains (from borkerd.log):

[1537879850] INFO: [Shinken] Shinken 2.4.3
...
[1537879852] INFO: [broker-master] Connection problem to the scheduler scheduler-master: Connection error to http://localhost:7768/ : The requested URL returned error: 404 Not Found

But after a few seconds: [1537879857] INFO: [broker-master] Connection OK to the scheduler scheduler-master

etc/shinken/schedulers/scheduler-master.cfg:

define scheduler {
    scheduler_name      scheduler-master ; Just the name
    address             localhost   ; IP or DNS address of the daemon
    port                7768        ; TCP port of the daemon
...
$ netstat -t -l -n | grep 7768
tcp        0      0 0.0.0.0:7768            0.0.0.0:*               LISTEN  

Is the broker doing its job ?

mohierf commented 5 years ago

Not sure that the broker really got the "initial status broks" that are needed by the Web UI ... :/

You should try starting the scheduler before the broker

mrechte commented 5 years ago

Started the daemons by hand: no change (however the connection error has gone). I also noticed in broked.log, before initial connection to the scheduler:

1537966485] INFO: [Shinken] Waiting for initial configuration
[1537966536] INFO: [broker-master] We have our schedulers: {0: {'broks': [], 'data_timeout': 120, 'name': u'scheduler-master',
 'last_connection': 0, 'hard_ssl_name_check': False, 'uri': u'http://localhost:7768/', 'instance_id': 0, 'running_id': 0, 'tim
eout': 3, 'address': u'localhost', 'active': True, 'use_ssl': False, 'push_flavor': 853561, 'port': 7768}} 
[1537966536] INFO: [broker-master] We have our arbiters: {0: {'broks': [], 'last_connection': 0, 'name': u'arbiter-master', 'h
ard_ssl_name_check': False, 'uri': u'http://localhost:7770/', 'instance_id': 0, 'running_id': 0, 'address': u'localhost', 'use
_ssl': False, 'port': 7770}} 
[1537966536] INFO: [broker-master] We have our pollers: {0: {'broks': [], 'instance_id': 0, 'last_connection': 0, 'name': u'po
ller-master', 'poller_tags': ['None'], 'hard_ssl_name_check': False, 'uri': u'http://localhost:7771/', 'passive': False, 'secr
et': '', 'reactionner_tags': [], 'running_id': 0, 'address': u'localhost', 'active': True, 'use_ssl': False, 'api_key': '', 'p
ort': 7771}}
[1537966536] INFO: [broker-master] We have our reactionners: {0: {'broks': [], 'instance_id': 0, 'last_connection': 0, 'name':
 u'reactionner-master', 'poller_tags': [], 'hard_ssl_name_check': False, 'uri': u'http://localhost:7769/', 'passive': False, '
secret': '', 'reactionner_tags': ['None'], 'running_id': 0, 'address': u'localhost', 'active': True, 'use_ssl': False, 'api_key': '', 'port': 7769}}

I don't know whether it is interesting, but one can see 'broks': []...

mohierf commented 5 years ago

Hmmm... sorry but it is not of any- interest. And it looks like your broker knows the scheduler. As such, the scheduler should build the initial hosts and services statuses broks ! And the broker should get them to forward to the WebUI module ... sure there is something weird on the way!

If you are aware, you should add some log in the source code to track the 'initial_host_status' broks ... first in the Web UI module.py file, As far as i remember, you should find a manage_brok function ...

mrechte commented 5 years ago

Thanks for your help. I switched broker daemon log level to DEBUG. Here follow some messages that may hopefully help (most of them occur several times)...

[1538119612] DEBUG: [broker-master] 45 Broks get in 0.164526939392
...
[1538119613] DEBUG: [broker-master] [WebUI] manage_brok_thread got 606 broks, queue length: 0
...
[1538119613] DEBUG: [broker-master] [Livestatus Log Lines] Does not match
...
[1538119613] DEBUG: [broker-master] REGEN: manage brok initial_broker_status:347
...
[1538119617] DEBUG: [broker-master] 0 Broks get in 0.0026969909668
[1538119617] DEBUG: [broker-master] [Broks] Time to send [0] broks to module ([0.000] secs)
[1538119617] DEBUG: [broker-master] [WebUI] manage_brok_thread got 0 broks, queue length: 0
...
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] get_hostgroups, name: None
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] got 0 hostgroups
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] get_servicegroups, name: {'service_notifications_enabled': True, 'can_submit_commands': True, 'contact_name': u'admin', 'id': 3, 'modified_attributes': 0L, 'password': u'admin', 'expert': True, 'downtimes': [], 'retain_status_information': True, 'service_notification_options': [''], 'hash': '', 'tags': [u'generic-contact'], 'address1': 'none', 'address2': 'none', 'address3': 'none', 'address4': 'none', 'address5': 'none', 'address6': 'none', 'customs': {}, 'contactgroups': [u'admin', u'users'], 'configuration_warnings': [], 'pager': u'0600000000', 'configuration_errors': [], 'notificationways': [<shinken.objects.notificationway.NotificationWay object at 0x7f4f9c06c5d0>], 'host_notifications_enabled': True, 'min_business_impact': 0, 'email': u'marc.rechte@meteo.fr', 'instance_id': 0, 'alias': 'none', 'plus': {}, 'is_admin': True, 'host_notification_options': ['']}

[1538119626] DEBUG: [broker-master] [WebUI - datamanager] got 0 servicegroups
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] search_hosts_and_services, search for type:host isnot:UP in 0 items
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] search patterns: [('type', 'host'), ('isnot', 'UP')]
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] searching for type host
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] type:host, 0 matching items
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] searching for isnot UP
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] search_hosts_and_services, found 0 matching items
...
[1538119626] INFO: [broker-master] [WebUI - datamanager] get_contact, name: admin, user: None
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] get_contacts, name: admin
[1538119626] DEBUG: [broker-master] [WebUI - datamanager] got 2 contacts
...
mohierf commented 5 years ago

Not any useful information in this log ... 😞

The only thing we can say is that the Web UI got some contacts: the last log line ... so it should have received the initial status broks for all the other objects; including the hosts and services ! As such, you should see the in the UI ...

Please stop and restart your borker in debug mode and send me the log file by email. I will try to have a look ... you will get my mail in my github profile

geektophe commented 5 years ago

This is surely related to a bug described (and fixed) in #1971 (but not merged).

As a workaround, could you try to add this parameter to your broker configuration ?

define broker {
    ...
    broks_batch         1024
    ....
}
drewby08 commented 4 years ago

Experiencing an identical issue on my systems, unfortunately the broks_batch workaround did not address it for us.