hagsteel / swampdragon

swampdragon
Other
557 stars 74 forks source link

No route named "sys" #178

Open D-3lf opened 8 years ago

D-3lf commented 8 years ago

Trying to follow the server monitor tutorial and I'm receiving this error in the "server.py" terminal when attempting to access http://127.0.0.1:8000

 File "/home/anon/servermon/django18py3xswamp/lib/python3.4/site-packages/swampdragon/connections/sockjs_connection.py", line 86, in on_message
    handler = route_handler.get_route_handler(data['route'])
  File "/home/anon/servermon/django18py3xswamp/lib/python3.4/site-packages/swampdragon/route_handler.py", line 334, in get_route_handler
    raise RouteException('No route named "{}"'.format(name))
swampdragon.route_handler.RouteException: No route named "sys"

Redis is running and swampdragon_host shows http://localhost:9999

Monitor.js is:

var sent = document.getElementById("sent");
var rcvd = document.getElementById("rcvd");
var cpu = document.getElementById("cpu");

swampdragon.onChannelMessage(function (channels, message) {
    sent.innerText = message.data.kb_sent;
    rcvd.innerText = message.data.kb_received;
    cpu.innerText = message.data.cpu + '%';
});

swampdragon.ready(function() {
    swampdragon.subscribe('sys', 'sysinfo', null);
});

and routers.py:

from swampdragon import route_handler
from swampdragon.route_handler import BaseRouter
from .system_info import broadcast_sys_info

class SysInfoRouter(BaseRouter):
    route_name = 'sys'

    def get_subscription_channels(self, **kwargs):
        broadcast_sys_info()
        return ['sysinfo']

route_handler.register(SysInfoRouter)
shdwpuppet commented 8 years ago

ensure that the app your routers.py is in (I believe the tutorial calls it "monitor"), is included in the installed apps in your settings.py

abdulwahid24 commented 8 years ago

@mwgreenjr I am also getting the similar problem, Did you get any solution ?

D-3lf commented 8 years ago

No. What you see here is what I got. We ended up just using a different product instead.

oluyinkos commented 8 years ago

To fix this issue, you need to add 'servermon.monitor' to your INSTALLED_APPS