Code Monkey home page Code Monkey logo

psdash's Introduction

psdash

Build Status Coverage Status

psdash is a system information web dashboard for linux using data mainly served by psutil - hence the name.

Features

  • Overview
    Dashboard overview of the system displaying data on cpu, disks, network, users, memory, swap and network.

  • Processes
    List processes (top like) and view detailed process information about each process.

    Apart from a detailed process overview this is also available for each process:

    • Open files
    • Open connections
    • Memory maps
    • Child processes
    • Resource limits
  • Disks
    List info on all disks and partitions.

  • Network
    List info on all network interfaces and the current throughput. System-wide open connections listing with filtering. Somewhat like netstat.

  • Logs
    Tail and search logs. The logs are added by patterns (like /var/log/*.log) which are checked periodically to account for new or deleted files.

  • Multi-node/Cluster Support for multiple agent nodes that is either specified by a config or will register themselves on start-up to a common psdash node that runs the web interface.

  • All data is updated automatically, no need to refresh

The GUI is pretty much a modified bootstrap example as I'm no designer at all. If you got a feel for design and like to improve the UI parts of psdash, please create a pull request with your changes. It would be much appreciated as there's much room for improvements.

Installation

Make sure your system is able to build Python C extensions. On Debian derivatives such as Ubuntu this should translate to installing the build-essential and python-dev packages using apt-get:

# apt-get install build-essential python-dev

And on RHEL (Fedora, CentOS etc.) distributions:

# yum groupinstall "Development Tools"
# yum install python-devel

Installation using pip:
$ pip install psdash

Since pip 1.5.1 you are forced to add --allow-external argparse since the latest argparse is hosted on google code.

Installation from source:
$ python setup.py install

Getting started

Starting psdash:
$ psdash

Starting a psdash agent:
$ psdash -a --register-to [http|https]://[host]:[port] --register-as my-agent-node

This will start psdash in agent mode and try to register the node to the main psdash node pointed to by the --register-to option. An agent node will setup an RPC server rather than a webserver at the host and port specified by -p/--port and -b/--bind respectively. The main psdash node (serving HTTP) will present a list of registered nodes that are available to switch between.

Available command-line arguments:

$ psdash --help
usage: psdash [-h] [-l path] [-b host] [-p port] [-d] [-a]
              [--register-to host:port] [--register-as name]

psdash [version] - system information web dashboard

optional arguments:
  -h, --help            show this help message and exit
  -l path, --log path   log files to make available for psdash. Patterns (e.g.
                        /var/log/**/*.log) are supported. This option can be
                        used multiple times.
  -b host, --bind host  host to bind to. Defaults to 0.0.0.0 (all interfaces).
  -p port, --port port  port to listen on. Defaults to 5000.
  -d, --debug           enables debug mode.
  -a, --agent           Enables agent mode. This launches a RPC server, using
                        zerorpc, on given bind host and port.
  --register-to host:port
                        The psdash node running in web mode to register this
                        agent to on start up. e.g 10.0.1.22:5000
  --register-as name    The name to register as. (This will default to the
                        node's hostname)

Configuration

psdash uses the configuration handling offered by Flask. The configuration file pointed to by the environment varible PSDASH_CONFIG will be read on startup.
e.g: $ PSDASH_CONFIG=/home/user/config.py psdash

In addition to the built-in configuration values that comes with Flask there's a number of psdash specific ones as well:

Name Description
PSDASH_AUTH_USERNAME When this value and PSDASH_AUTH_PASSWORD is set, Basic Authentication will be enabled with the provided credentials. The username of the basic authentication
PSDASH_AUTH_PASSWORD The password of the basic authentication
PSDASH_ALLOWED_REMOTE_ADDRESSES If this is set, only provided ip addresses will be allowed to access psdash. Addresses is separated by a comma. e.g: PSDASH_ALLOWED_REMOTE_ADDRESSES = "10.0.0.2, 192.29.20.2"
PSDASH_URL_PREFIX This can be used to make psdash serve from a non-root location. e.g: PSDASH_URL_PREFIX = "/psdash" would make psdash serve it's pages from /psdash
PSDASH_LOG_LEVEL The log level set for psdash (passed in to logging.basicConfig). Defaults to logging.INFO.
PSDASH_LOG_LEVEL The log format set for psdash (passed in to logging.basicConfig). *Defaults to `%(levelname)s
PSDASH_NODES A list of psDash agent nodes (a dict per node) to register on startup. e.g [{'name': 'mywebnode', 'host': '10.0.0.2', 'port': 5000}]
PSDASH_NET_IO_COUNTER_INTERVAL The interval in seconds to update the counters used for calculating network traffic. Defaults to 3.
PSDASH_LOGS_INTERVAL The interval in seconds to reapply the log patterns to make sure that file-system changes are applied (log files being created or removed). Defaults to 60.
PSDASH_REGISTER_INTERVAL The interval in seconds to register the agent to the host psdash node. This is done periodically to be able to determine if any node has gone away and at what time. Defaults to 60
PSDASH_LOGS Log patterns to apply at startup. e.g ['/var/log/*.log']. To override this option using the command-line use the -l/--log arg option.
PSDASH_REGISTER_TO When running in agent mode, this is used to set which psdash node to register the agent node to. e.g http://10.0.20.2:5000.
PSDASH_REGISTER_AS When running in agent mode, this is used to set the name to register as to the host psdash node specified by PSDASH_REGISTER_TO.
PSDASH_HTTPS_KEYFILE Path to the SSL key file to use to enable starting the psdash webserver in HTTPS mode. e.g /home/user/private.key
PSDASH_HTTPS_CERTFILE Path to the SSL certificate file to use to enable starting the psdash webserver in HTTPS mode. e.g /home/user/certificate.crt
PSDASH_ENVIRON_WHITELIST If set, only the env vars in this list will be displayed with value. e.g ['HOME']

Screenshots

Overview: Overview Listing processes: Processes Overview of a process: Process overview Connections of a process: Process connections Environment of a process: Process environment Network: Network Disks: Network Tailing a log: Log Searching a log: Log search

License

Released under CC0 (Public Domain Dedication).

http://creativecommons.org/publicdomain/zero/1.0/

psdash's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psdash's Issues

Error starting psdash on ArkOS

I install psdash and follow these steps:

python setup.py install
psdash --log /var/log/myapp.log --log /var/log/mydb.log

When i try to start psdash, i recieve this error:

File "/usr/bin/psdash", line 5, in
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2749, in
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 444, in _build_master
ws.require(requires)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 725, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 628, in resolve
raise DistributionNotFound(req)

Sort log files in /logs page

Hi Joakim --

I noticed that the log files are displayed in some random order, as opposed to alphabetically. I think a simple sorted() on line 326 of web.py would do the trick:

for l in sorted(logs.get_available()):

Also, it might be good to periodically re-load the list of log files, so that if additional log files are created after startup of psdash, they get included in the list.

-Jeff

Not working if installed from pip in ubuntu 15.10

This is what I get after installing it with pip under ubuntu 15.10, and trying to run it:

Traceback (most recent call last):
  File "/usr/local/bin/psdash", line 9, in <module>
    load_entry_point('psdash==0.6.1', 'console_scripts', 'psdash')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/psdash/run.py", line 3, in <module>
    patch_all()
  File "/usr/local/lib/python2.7/dist-packages/gevent/monkey.py", line 185, in patch_all
    patch_socket(dns=dns, aggressive=aggressive)
  File "/usr/local/lib/python2.7/dist-packages/gevent/monkey.py", line 124, in patch_socket
    from gevent import socket
  File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line 659, in <module>
    from gevent.ssl import sslwrap_simple as ssl, SSLError as sslerror, SSLSocket as SSLType
  File "/usr/local/lib/python2.7/dist-packages/gevent/ssl.py", line 386, in <module>
    def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv3, ca_certs=None):
NameError: name 'PROTOCOL_SSLv3' is not defined

Aliased network interfaces cause a crash

psdash can't handle aliased network interfaces:

Here's an extract from my ifconfig output:

eth1 Link encap:Ethernet HWaddr e0:69:95:88:a5:6c
inet addr:192.168.42.110 Bcast:192.168.42.255 Mask:255.255.255.0
inet6 addr: fe80::e269:95ff:fe88:a56c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:45606 errors:0 dropped:0 overruns:0 frame:0
TX packets:31806 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:54025486 (54.0 MB) TX bytes:3494120 (3.4 MB)
Interrupt:20 Memory:fe500000-fe520000

eth1:1 Link encap:Ethernet HWaddr e0:69:95:88:a5:6c
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fe500000-fe520000

The "eth1:1" interface results in a traceback that terminates with:

File "/usr/local/lib/python2.7/dist-packages/psdash-0.1.1-py2.7.egg/psdash/templates/network.html", line 35, in block "content"

<td>{{ io.rx_per_sec|filesizeformat }}</td>

File "/usr/local/lib/python2.7/dist-packages/jinja2/filters.py", line 378, in do_filesizeformat

bytes = float(value)

UndefinedError: 'dict object' has no attribute 'rx_per_sec'

If I don't create eth1:1 then all is well.

Is there something wrong with PSDASH_NODES in Readme?

A list of psDash agent nodes to register on startup. e.g ['10.0.0.2:5000', '10.0.20.1:5000']

and I set the nodes IP:port like this

PSDASH_NODES=['10.0.0.2:5000']

and then It crashed...

I saw the code is:

def _setup_nodes(self):
    self.add_node(LocalNode())
    nodes = self.app.config.get('PSDASH_NODES', [])
    logger.info("Registering %d nodes", len(nodes))
    for n in nodes:
        self.register_node(n['name'], n['host'], int(n['port']))

I think it should be dict rather than list....
Then I set the nodes like this:

PSDASH_NODES=[{name:node1,host:'10.0.20.1',port:'5000'}]

It work fine...

So I think you have somethting wrong with PSDASH_NODES in Readme....

Sorry for my poor English

Got an error, on my ubuntu13.10, python2.7.

Got an error, on my ubuntu13.10, python2.7
Use `pip install psdash'

WARNING | psdash.web | Could not read log file '/var/log/myapp.log' ([Errno 2] No such file or directory: '/var/log/myapp.log')
WARNING | psdash.web | Could not read log file '/var/log/mydb.log' ([Errno 2] No such file or directory: '/var/log/mydb.log')
ERROR | psdash.web | Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/psdash/web.py", line 149, in index
    return render_template("index.html", **data)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 128, in render_template
    context, ctx.app)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 110, in _render
    rv = template.render(context)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/psdash/templates/index.html", line 2, in top-level template code
    {% block content %}
  File "/usr/local/lib/python2.7/dist-packages/psdash/templates/base.html", line 44, in top-level template code
    {% block content %}{% endblock %}
  File "/usr/local/lib/python2.7/dist-packages/psdash/templates/index.html", line 182, in block "content"
    <td>{{ part.mountpoint }}</td>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 14: ordinal not in range(128)

Deploy psdash on remote VPS

Hello, I wanna know how can I deploy the psdash on a VPS.

Because I have some VPS running nginx. I wanna whether I need use a wsgi to run psdash. Or just write a nginx config file to point at port which psdash listening is OK.

Thank you very much.

No host on mac breaks view

I decided to fire this up to try it out on my mac and it broke at web.py#L38 because the host value returns as None instead of a string giving AttributeError: 'NoneType' object has no attribute 'decode'.

"OSError: [Errno 2] No such file or directory" when log file is deleted

Hi Joakim,

Looks like there's a missing try/catch block for when a file gets deleted from the log list.

-Jeff

ERROR | psdash.web | Exception on /psdash/logs [GET]
Traceback (most recent call last):
File "/mnt/test/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/mnt/test/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/mnt/test/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/mnt/test/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/mnt/test/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/mnt/test/lib/python2.7/site-packages/psdash/web.py", line 328, in view_logs
stat = os.stat(l.filename)
OSError: [Errno 2] No such file or directory: '/mnt/logs/system/controller.log.2014-04-09-15'

install error 'Request' object has no attribute 'is_xhr'

INFO | psdash.run | Starting psdash v0.6.2
INFO | psdash.run | Listening on 0.0.0.0:5000
INFO | psdash.run | Starting web server
ERROR | psdash.run | Exception on / [GET]
Traceback (most recent call last):
File "/home/wjia/.local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/wjia/.local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/wjia/.local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/wjia/.local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/wjia/.local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/usr/local/lib/python2.7/dist-packages/psdash/web.py", line 123, in index
'is_xhr': request.is_xhr
File "/home/wjia/.local/lib/python2.7/site-packages/werkzeug/local.py", line 347, in getattr
return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr'

Plain pip install not working for me

Hi,

I needed to use

sudo pip2.7 install --allow-external argparse psdash

to get psdash installed.
(I'm on arch linux x64, but that should not matter to pip).
The key here was to add --allow-external psdash so that pip can pull argparse from an external site (1.2.1 is not available on pypi itself, it seems).

I'm not sure this is a problem on my system, or if the instructions need to be updated.

Whitelisting of environment variables

Environment variables often contain sensitive information like API keys and other secrets. It would be nice if there was a way to whitelist which environment variable values are allowed to be displayed. Displaying the variable name is probably fine in all cases, its the value that needs to be hidden (even when behind HTTP basic auth).

The other option is blacklisting but that makes it easy to miss things. Would it be possible to add this?

Error on OS X

psdash yields a 500 error immediately after installing on OS X:

○ sudo psdash
ERROR | psdash.web | Exception on / [GET]
Traceback (most recent call last):
  File "/Users/dan/.pyenv/versions/2.7.6/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/dan/.pyenv/versions/2.7.6/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/dan/.pyenv/versions/2.7.6/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/dan/.pyenv/versions/2.7.6/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/dan/.pyenv/versions/2.7.6/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/dan/.pyenv/versions/2.7.6/lib/python2.7/site-packages/psdash/web.py", line 130, in index
    netifs = get_network_interfaces()
  File "/Users/dan/.pyenv/versions/2.7.6/lib/python2.7/site-packages/psdash/web.py", line 47, in get_network_interfaces
    addresses = get_interface_addresses()
  File "/Users/dan/.pyenv/versions/2.7.6/lib/python2.7/site-packages/psdash/net.py", line 86, in get_interface_addresses
    ifconf_res = fcntl.ioctl(sock.fileno(), SIOCGIFCONF, ifconf_val)
IOError: [Errno 6] Device not configured
^C⏎

psdash does not detect new logfiles when pattern is being used

Consider the setup, where psdash ist being started at the beginning of a chef run with a pattern matching /var/og/*/.log, then we need to the trick to restart the service with timing delayed to catch all the logfiles being added during the run.

It would be nice if psdash could reevaluate the pattern on a regular basis.

[Question]the question about updating the data on the web

Thank you for providing the best tool to monitor my server!
I have read all the code of this project in order to learn Flask.
But now I have an issue that I don't know the way you update the performance data to web in real time.
Thank you in advance!

Can't get network addresses

On my mac this line net.py#L88 throws an error. I got around this by catching the exception and returning an empty list.

Traceback (most recent call last):
  File "/dash/env/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/dash/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/dash/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/dash/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/dash/env/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/dash/env/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/dash/env/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/dash/env/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/dash/env/lib/python2.7/site-packages/psdash/web.py", line 163, in index
    netifs = get_network_interfaces()
  File "/dash/env/lib/python2.7/site-packages/psdash/web.py", line 47, in get_network_interfaces
    addresses = get_interface_addresses()
  File "/dash/env/lib/python2.7/site-packages/psdash/net.py", line 86, in get_interface_addresses
    ifconf_res = fcntl.ioctl(sock.fileno(), SIOCGIFCONF, ifconf_val)
IOError: [Errno 102] Operation not supported on socket

Downloading of logfiles

Do you think it would be possible to add a feature to download the logfiles from the server. This way one could easily analyze the whole logfile.

We use psdash in all our development deployments and this is what most of our developers miss.

PSDASH_LOGS in config.py file are not taken into account.

I had a look to code and seems like overwriting config is messed from my point of view.

psdash/run.py line 203

    def _setup_context(self):
        self.get_local_node().net_io_counters.update()
        if 'PSDASH_LOGS' in self.app.config:
            self.get_local_node().logs.add_patterns(self.app.config['PSDASH_LOGS'])

Seems to me that at this point self.app.config has already been overwritten by some default values, that is why if I print self.app.config['PSDASH_LOGS']) is always an empty list [], also,

if 'PSDASH_LOGS' in self.app.config:

evaluates always to True.

Don't know how to fix it or better, what is the expected overwritting strategy.

Cheers

Is there someting wrong with --register-to

if I use --register-to [host]:[port] , there will be some error:

Traceback (most recent call last):
  File "run.py", line 314, in <module>
    main()
  File "run.py", line 310, in main
    r.run()
  File "run.py", line 303, in run
    return self._run_rpc()
  File "run.py", line 261, in _run_rpc
    self._register_agent()
  File "run.py", line 253, in _register_agent
    urllib2.urlopen(register_url)
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 427, in _open
    'unknown_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1247, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: psdash>

After investigate the code. I use --register-to http://[host]:[port], everything is OK.

So I think there may be something wrong with Get statted or code

Sorry for my poor English.

/processes returns 401

Hello,

Whenever I try to access the "/processes" page, I get an error:

$ sudo psdash -d
/usr/lib/python2.7/dist-packages/pkg_resources.py:1031: UserWarning: /home/baboon/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
  warnings.warn(msg, UserWarning)
INFO | psdash.run | Starting psdash v0.6.0
INFO | psdash.run | Listening on 0.0.0.0:5000
INFO | psdash.run | Starting web server
DEBUG | psdash.run | Updating net io counters...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.0.1-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 508, in handle_one_response
    self.run_application()
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.0.1-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 494, in run_application
    self.result = self.application(self.environ, self.start_response)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/psdash-0.6.0-py2.7.egg/psdash/web.py", line 134, in processes
    procs = current_service.get_process_list()
  File "/usr/local/lib/python2.7/dist-packages/psdash-0.6.0-py2.7.egg/psdash/node.py", line 164, in get_process_list
    'user': p.username(),
  File "build/bdist.linux-x86_64/egg/psutil/__init__.py", line 566, in username
    return pwd.getpwuid(self.uids().real).pw_name
KeyError: 'getpwuid(): uid not found: 999'
{'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
 'HTTP_AUTHORIZATION': 'Basic YmFib29uOmNyb2M=',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'session=eyJjbGllbnRfaWQiOnsiIHUiOiJjZjUxMWIwNmJiYTA0ZDI0YWIwOWU0OWIyM2Y1MjE2YSJ9fQ.Bzr6pg.kDDse_FIZTonFBCicxeuiDSjo80',
 'HTTP_HOST': '192.168.1.16:5000',
 'HTTP_PRAGMA': 'no-cache',
 'HTTP_REFERER': 'http://192.168.1.16:5000/',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0',
 'PATH_INFO': '/processes',
 'QUERY_STRING': 'node=localhost',
 'REMOTE_ADDR': '192.168.1.3',
 'REMOTE_PORT': '33640',
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'lilith',
 'SERVER_PORT': '5000',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7',
 'werkzeug.request': <Request 'http://192.168.1.16:5000/processes?node=localhost' [GET]>,
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f58fdced1e0>,
 'wsgi.input': <gevent.pywsgi.Input object at 0x7f58f71d1d50>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)} failed with KeyError

192.168.1.3 - - [2014-11-05 01:05:14] "GET /processes?node=localhost HTTP/1.1" 500 161 0.020687
DEBUG | psdash.run | Updating net io counters...
DEBUG | psdash.run | Updating net io counters...

any ideas?

Regards,
LK

psdash errors out on first connect

When I try to access psdash on my browser running on osx 10.9.4 it errors out trying to figure out my hostname I presume. Installed psdash with pip install -U psdash, so everything is at the latest version possible. Here is the traceback:

$ psdash
INFO | psdash.log | Added 0 log file(s)
INFO | psdash.run | Starting psdash v0.4.0
INFO | psdash.run | Listening on 0.0.0.0:5000
ERROR | psdash.run | Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/site-packages/psdash/web.py", line 110, in index
    users = get_users()
  File "/usr/local/lib/python2.7/site-packages/psdash/helpers.py", line 23, in get_users
    'host': u.host.decode('utf-8')
AttributeError: 'NoneType' object has no attribute 'decode'

running psdash.web.get_users() in pdb I get that u is:
suser(name='santagada', terminal='console', host=None, started=1407690752.0)

pip install broken with Python 3 (zerorpc version issue)

I wanted to pip install psdash with Python 3.6 and got this error:

(school18) hfm-1804a:profile deil$ pip install psdash
Collecting psdash
  Downloading https://files.pythonhosted.org/packages/1a/cc/6f450c0c76f8fcf76bcdbb9d3c0e18cf222cd452886aa242fc1499fc58eb/psdash-0.6.2.tar.gz (169kB)
    100% |████████████████████████████████| 174kB 4.1MB/s 
Collecting Flask==0.10.1 (from psdash)
  Downloading https://files.pythonhosted.org/packages/db/9c/149ba60c47d107f85fe52564133348458f093dd5e6b57a5b60ab9ac517bb/Flask-0.10.1.tar.gz (544kB)
    100% |████████████████████████████████| 552kB 5.3MB/s 
Collecting psutil==2.1.3 (from psdash)
  Downloading https://files.pythonhosted.org/packages/fe/a3/7cf43f28bbb52c4d680378f99e900ced201ade5073ee3a7b30e7f09e3c66/psutil-2.1.3.tar.gz (224kB)
    100% |████████████████████████████████| 225kB 5.9MB/s 
Collecting glob2==0.4.1 (from psdash)
  Downloading https://files.pythonhosted.org/packages/9c/38/e0fb3ff759614ceea6d2c28265a253062842e37a116ad644fbeae669d42f/glob2-0.4.1.tar.gz
Collecting gevent==1.0.2 (from psdash)
  Downloading https://files.pythonhosted.org/packages/8a/71/9bb13513d39c513fa71344d57a11affd6ccad775575458f435ff9142daf5/gevent-1.0.2.tar.gz (1.7MB)
    100% |████████████████████████████████| 1.7MB 6.0MB/s 
Collecting zerorpc==0.4.4 (from psdash)
  Downloading https://files.pythonhosted.org/packages/6b/09/38b0e73200f674c9bbf88b91cf658928e6eb76382a285c0a5aea019a9375/zerorpc-0.4.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/t_/_mywtcj146lbk2c99bnxw7z40000gp/T/pip-install-u8_g5j1f/zerorpc/setup.py", line 25, in <module>
        execfile('zerorpc/version.py')
    NameError: name 'execfile' is not defined
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/t_/_mywtcj146lbk2c99bnxw7z40000gp/T/pip-install-u8_g5j1f/zerorpc/

Installing a recent version (see https://pypi.org/project/zerorpc/#history) of zerorpc works fine:

(school18) hfm-1804a:profile deil$ pip install zerorpc
Collecting zerorpc
  Downloading https://files.pythonhosted.org/packages/35/47/ff12dc8225cfd3334209bae2cc320c67f3e045c88c23436e364bea924092/zerorpc-0.6.1.tar.gz
Collecting msgpack-python>=0.4.0 (from zerorpc)
  Downloading https://files.pythonhosted.org/packages/8a/20/6eca772d1a5830336f84aca1d8198e5a3f4715cd1c7fc36d3cc7f7185091/msgpack-python-0.5.6.tar.gz (138kB)
    100% |████████████████████████████████| 143kB 5.7MB/s 
Requirement already satisfied: pyzmq>=13.1.0 in /Users/deil/software/anaconda3/envs/school18/lib/python3.6/site-packages (from zerorpc) (17.0.0)
Requirement already satisfied: future in /Users/deil/software/anaconda3/envs/school18/lib/python3.6/site-packages (from zerorpc) (0.16.0)
Collecting gevent>=1.1rc5 (from zerorpc)
  Downloading https://files.pythonhosted.org/packages/16/df/9593212da1a1ec942aef83dc8fb4b979ebab3bc995afc17d3782bcdc1264/gevent-1.3.2.post0-cp36-cp36m-macosx_10_6_intel.whl (3.1MB)
    100% |████████████████████████████████| 3.1MB 6.8MB/s 
Collecting greenlet>=0.4.13; platform_python_implementation == "CPython" (from gevent>=1.1rc5->zerorpc)
  Downloading https://files.pythonhosted.org/packages/13/de/ba92335e9e76040ca7274224942282a80d54f85e342a5e33c5277c7f87eb/greenlet-0.4.13.tar.gz (58kB)
    100% |████████████████████████████████| 61kB 8.6MB/s 
Building wheels for collected packages: zerorpc, msgpack-python, greenlet
  Running setup.py bdist_wheel for zerorpc ... done
  Stored in directory: /Users/deil/Library/Caches/pip/wheels/64/40/dc/1849671601cdefb686279c01adce34614b02cfee73b3f8b070
  Running setup.py bdist_wheel for msgpack-python ... done
  Stored in directory: /Users/deil/Library/Caches/pip/wheels/d5/de/86/7fa56fda12511be47ea0808f3502bc879df4e63ab168ec0406
  Running setup.py bdist_wheel for greenlet ... done
  Stored in directory: /Users/deil/Library/Caches/pip/wheels/33/3c/78/f4dba4d41091d2cf0b99e93118fafc869cf31bb242b5559ddf
Successfully built zerorpc msgpack-python greenlet
Installing collected packages: msgpack-python, greenlet, gevent, zerorpc
Successfully installed gevent-1.3.2.post0 greenlet-0.4.13 msgpack-python-0.5.6 zerorpc-0.6.1

The problem is that you pin to the old version of zerorpc here:

'zerorpc==0.4.4',

Do you support Python 3?
Can you fix this or would consider accepting a PR to change something about the dependency versions?

warnings for dir entries under log paths (or: request for recursive log dir option?)

Just updated to the latest version (it's been a while! nice updates! Works on OS X now!), and seeing this:

WARNING | psdash.log | Could not read log file "/mnt/service/logs/graphite" ([Errno 21] Is a directory: u'/mnt/service/logs/graphite')

Our log files are nested, and log files come and go (rotated out), so I start psdash with "--log /mnt/service/logs/* --log /mnt/service/logs// --log /mnt/service/logs///*". This gets us three levels, quite nicely.

Can the warnings for dir entries be ignored? Or maybe as a feature request, adding a --recurssive-log-dir option might be generally useful?

Thanks!
-Jeff

Feature Request: Show complete logfile

Tailing a logfile is nice but the ability to show and search the complete logfile would be great. This would allow us to install psdash on all test systems, giving fast insight. Currently we are using log.io but they dropped complete log searching in its newer version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.