simplificator / monitoring-dashboard

Monitoring Dashboard (Master Thesis by Helga & Marion)
3 stars 0 forks source link

Send data to widgets #9

Open marionschleifer opened 7 years ago

marionschleifer commented 7 years ago

On branch: phoenix_app

I have included the notifier class from kitto: https://github.com/kittoframework/kitto/blob/master/lib/kitto/notifier.ex

I tried to use it in the following file: monitoring_dashboard/lib/jobs/semaphore. There is no error message anymore, but the data is not displayed in the widget.

Other question: Where should I start (start_link) the notifier class?

crackofdusk commented 7 years ago

@marionschleifer There is no need for the Notifier module. We have replaced it by the Phoenix PubSub library. To publish the data, use MonitoringDashboard.Web.Endpoint.broadcast!, like you already do in the polling GenServers.

marionschleifer commented 7 years ago

@crackofdusk Thank you. Where should I do that? In the send_message method in the event_controller? because there, I subscribe for this data and also receive it. I suppose the broadcast! will look exactly like I use it in the polling GenServers (PubSub.broadcast!("new_relic", "status_check", %{items: list}))?

crackofdusk commented 7 years ago

No: for polling, the data is already connected. If something is wrong, I would debug what the value of message is in the send_message function

If the data data is not valid json, you will have to use Poision.encode to transform the elixir structs to json.