greenstatic / bigbluebutton-monitoring

A simple web app with a list of all current meetings on BigBlueButton
MIT License
31 stars 18 forks source link

500 Internal server error #1

Closed SubjectXXX closed 4 years ago

SubjectXXX commented 4 years ago

Followed the instructions, page loads, but spins, console shows

jquery-3.4.1.min.js:2 GET http://195.47.197.49/_monitoring/api/meetings 500 (INTERNAL SERVER ERROR)

Are there any logs available? Any extra ports that needs to be open?

Could be a problem with line: HTTP server will listen on port: 5000 What exactly does that mean?

image

greenstatic commented 4 years ago

You are accessing the webpage, so it should not be an issue with any network port. I suspect some API errors in regard to BBB. Can you post the logs returned by the bbb-monitoring container?

sudo docker logs bbb-monitoring
SubjectXXX commented 4 years ago

Multiple:

KeyError: 'bbb-origin-server-name' 172.17.0.1 - - [25/Mar/2020 21:10:31] "GET /api/meetings HTTP/1.0" 500 - [2020-03-25 21:10:46,165] ERROR in app: Exception on /api/meetings [GET] Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functionsrule.endpoint File "bbb-mon/server.py", line 24, in api_meetings return jsonify(views.get_meetings()) File "/app/bbb-mon/views.py", line 58, in get_meetings "origin-server": meeting['metadata']['bbb-origin-server-name'],

greenstatic commented 4 years ago

I see. I suspect this is because you are not using the Moodle plugin, which our server had whilst developing the utility. Nonetheless the issue is with the utility. Fix coming shortly.

SubjectXXX commented 4 years ago

How would this monitor connect to Moodle plugin?

I tried triggering conf call via greenlight and Moodle plugin, both times I get 500..

SubjectXXX commented 4 years ago

Triggering call from Moodle returns this error I think:

[2020-03-25 21:20:25,331] ERROR in app: Exception on /api/meetings [GET] Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functionsrule.endpoint File "bbb-mon/server.py", line 24, in api_meetings return jsonify(views.get_meetings()) File "/app/bbb-mon/views.py", line 64, in get_meetings m['metadata']['origin-context'] = _bbb_context_convert_moodle(meeting['metadata']['bbb-context']) File "/app/bbb-mon/views.py", line 84, in _bbb_context_convert_moodle el = root['root'][element] TypeError: string indices must be integers

greenstatic commented 4 years ago

It's possible that the real issue is the API communication. Are you sure you entered the API URL and secret correctly? The URL should be like this: https://bbb.example.com/bigbluebutton/api/ - note the api endpoint and trailing slash.

The secret value you should copy from bbb-conf --secret

SubjectXXX commented 4 years ago

I did double check the docker run command and its correct. Using same secret from Moodle plugin and it works there..

Still this error persists:

[2020-03-25 21:30:41,020] ERROR in app: Exception on /api/meetings [GET] Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functionsrule.endpoint File "bbb-mon/server.py", line 24, in api_meetings return jsonify(views.get_meetings()) File "/app/bbb-mon/views.py", line 64, in get_meetings m['metadata']['origin-context'] = _bbb_context_convert_moodle(meeting['metadata']['bbb-context']) File "/app/bbb-mon/views.py", line 84, in _bbb_context_convert_moodle el = root['root'][element] TypeError: string indices must be integers 172.17.0.1 - - [25/Mar/2020 21:30:41] "GET /api/meetings HTTP/1.0" 500 -

SubjectXXX commented 4 years ago

Where do you pick out server name? From API response or parsed from URL? It is correct in my case..

Also, since error changed from when I triggered call from greenlight to different one when I triggered it from Moodle, API access seems correct?

Also, accessing that bbb api url gives:

SUCCESS 2.0

Tripple checked entered URL and secret, now via api-mate and its correct..

greenstatic commented 4 years ago

I have created a new branch with the possible fix: https://github.com/greenstatic/bigbluebutton-monitoring/tree/issue-1

I have also created a preview build to see if we have made any progress. Can you pull greenstatic/bigbluebutton-monitoring:version-0.3.1-beta1 and add to the docker run -e "DEBUG=true". This should enable more verbose logging.

greenstatic commented 4 years ago

The monitor receives "Moodle data" from the BBB API under metadata, specifically a context string which the Moodle plugin passes to BBB when creating the room. Within this string is the name of the corresponding Moodle course which is displayed on the monitor website.

SubjectXXX commented 4 years ago

It works now, altough few problems:

image

Bluring out stuff because of internet, not you per se :)

greenstatic commented 4 years ago

I think there are some major differences between your BBB/Moodle setup and ours in which case I made some invalid assumptions.

Since Origin Server to the best of my knowledge isn't dependent on the Moodle plugin I would say there is something weird going on.

After a short discussion with @matjazp, it seems we have a multilingual Moodle installation which makes the Moodle plugin return a XML context - one (course name) for each language. I assumed this is the same for monolingual installations of Moodle but I guess that was another wrong assumption.

Could you enable the DEBUG=true flag when running the docker container and paste the API responses you get from the server? If you have reservations regarding the contents of the response (names, IP's, domains) you can censor them out or email me the response (my email is on my GH profile/website).

No worries regarding the blurring, but I should mention you forgot the blur your IP from your initial issue post :sweat_smile: - not that it's a big deal, it's just an IP which can be found i.e. on Shodan.

SubjectXXX commented 4 years ago

Hehe, that IP is from this reusable testing machine, so no biggie there 🗡

Anyway, sent you email with api call and you can analyze it there.