Coder Social home page Coder Social logo

monner's Introduction

Monner

Author: Colin Howe (@colinhowe)

License: Apache 2.0

About

Allows you to monitor the CPU, memory and network usage when running a program.

Output is tab-separated for easy loading into spreadsheet programs.

Requirements

It requires Python Version 3.3+. Python development headers. For example, in Ubuntu install this with sudo apt-get install libpython-dev.

Installation

Install from pypi:

pip install monner

Install from source:

python setup.py install

Run:

monner --target-output /dev/null wget http://www.google.com

The option --target-output will redirect stdout and stderr for the target program.

Sample output:

CPU (%)     Memory used (mb)        Network in (kb) Network out (kb)
   99.5               3470.4                    1.2              0.0
  100.0               3470.9                   50.7              0.0
  100.0               3470.8                    2.2              0.0

If you need command line arguments for the target:

monner -- wget -V

Fields Available

There are multiple fields available to monitor. Including: CPU usage, memory usage, network usage, disk usage and more. For the full list see monner -h

Feedback

Feedback is always welcome! Github or twitter (@colinhowe) are the best places to reach me.

monner's People

Contributors

akshitmehra1 avatar colinhowe avatar ftorto avatar jamesandres avatar matsuu avatar

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

monner's Issues

Loads more stats

There's obviously a lot that this could monitor...

Adding arguments to make this easy would be awesome.

Proposed syntax:

monner --fields "disk_in,disk_out,cpu,rss" target_program ...

In favour of this style of fields as it is somewhat easier to remember than cryptic -di -do style options.

'module' object has no attribute 'cached_phymem'

Installation looks okay but running fails. I'm using OSX 10.7.4 with, I believe, the default Python install.

Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin

[jjohnson@jjohnson ~]$ monner.py --target-output /dev/null wget http://www.google.com
CPU (%) Memory used (mb) Network in (kb) Network out (kb)
Traceback (most recent call last):
File "/usr/local/bin/monner.py", line 5, in
pkg_resources.run_script('monner==0.2.0', 'monner.py')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 489, in run_script
Process Process-1:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 232, in _bootstrap
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 88, in run
self._target(_self._args, *_self._kwargs)
File "/Library/Python/2.7/site-packages/monner-0.2.0-py2.7.egg/EGG-INFO/scripts/monner.py", line 63, in _monitor
File "/Library/Python/2.7/site-packages/monner-0.2.0-py2.7.egg/EGG-INFO/scripts/monner.py", line 38, in output_stats
File "/Library/Python/2.7/site-packages/monner-0.2.0-py2.7.egg/EGG-INFO/scripts/monner.py", line 11, in _get_memory_used
AttributeError: 'module' object has no attribute 'cached_phymem'
self.require(requires)[0].run_script(script_name, ns)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1214, in run_script
exec script_code in namespace, namespace
File "/Library/Python/2.7/site-packages/monner-0.2.0-py2.7.egg/EGG-INFO/scripts/monner.py", line 104, in

File "/Library/Python/2.7/site-packages/monner-0.2.0-py2.7.egg/EGG-INFO/scripts/monner.py", line 86, in go

File "/Library/Python/2.7/site-packages/monner-0.2.0-py2.7.egg/EGG-INFO/scripts/monner.py", line 77, in run_target

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 486, in call
return Popen(_popenargs, *_kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

psutil.error.AccessDenied, using psutil 0.5.1

v84-207:~ ming$ monner --target-output /dev/null -c wget http://www.google.com
CPU (%) Memory RSS (mb) Network in (kb) Network out (kb) Disk in (kb) Disk out (kb)
Traceback (most recent call last):
File "/usr/local/bin/monner", line 8, in
load_entry_point('monner==0.4.1', 'console_scripts', 'monner')()
File "/Library/Python/2.7/site-packages/monner-0.4.1-py2.7.egg/EGG-INFO/scripts/monner.py", line 115, in main

File "/Library/Python/2.7/site-packages/monner-0.4.1-py2.7.egg/EGG-INFO/scripts/monner.py", line 67, in go

File "/Library/Python/2.7/site-packages/monner-0.4.1-py2.7.egg/EGG-INFO/scripts/monner.py", line 54, in init_stats

File "/Library/Python/2.7/site-packages/monner-0.4.1-py2.7.egg/EGG-INFO/scripts/monner.py", line 12, in get_mem_rss

File "/Library/Python/2.7/site-packages/monner-0.4.1-py2.7.egg/EGG-INFO/scripts/monner.py", line 10, in

File "build/bdist.macosx-10.8-intel/egg/psutil/init.py", line 498, in get_memory_info
File "build/bdist.macosx-10.8-intel/egg/psutil/_psosx.py", line 113, in wrapper
psutil.error.AccessDenied: (pid=995)

Errors running example - import: unable to open X server `'.

I tried running it:

tre@local [/home/tre/monner]# ./monner.py --target-output /dev/null wget http://www.google.com
import: unable to open X server '. import: unable to open X server'.
./monner.py: line 4: KILOBYTES: command not found
./monner.py: line 5: MEGABYTES: command not found
./monner.py: line 7: syntax error near unexpected token (' ./monner.py: line 7:def _get_cpu_stats():'

psutil dependency >= 4.0

Installation failure:

Installed /usr/local/py2.6/lib/python2.6/site-packages/monner-0.2.0-py2.6.egg
Processing dependencies for monner==0.2.0
Searching for psutil>=4.0
Reading http://pypi.python.org/simple/psutil/
Reading http://code.google.com/p/psutil/
No local packages or download links found for psutil>=4.0
Best match: None
Traceback (most recent call last):
File "setup.py", line 26, in
long_description=long_desc,
File "/usr/local/py2.6/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/local/py2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/local/py2.6/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "build/bdist.linux-x86_64/egg/setuptools/command/install.py", line 76, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/install.py", line 104, in do_egg_install
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 211, in run
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 427, in easy_install
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 478, in install_item
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 519, in process_distribution
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 563, in resolve
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 799, in best_match
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 811, in obtain
File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 434, in easy_install
File "build/bdist.linux-x86_64/egg/setuptools/package_index.py", line 475, in fetch_distribution
AttributeError: 'NoneType' object has no attribute 'clone'

I tried installing psutil separately using pip:

Downloading/unpacking psutil
Downloading psutil-0.5.1.tar.gz (125Kb): 125Kb downloaded
Running setup.py egg_info for package psutil
warning: no files found matching '.html' under directory 'docs'
warning: no files found matching '
.dia' under directory 'docs'
warning: no files found matching '_.png' under directory 'docs'
Installing collected packages: psutil
Running setup.py install for psutil
building '_psutil_linux' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/py2.6/include/python2.6 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.6/psutil/_psutil_linux.o
gcc -pthread -shared build/temp.linux-x86_64-2.6/psutil/_psutil_linux.o -o build/lib.linux-x86_64-2.6/_psutil_linux.so
building '_psutil_posix' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/py2.6/include/python2.6 -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-2.6/psutil/psutil_posix.o
gcc -pthread -shared build/temp.linux-x86_64-2.6/psutil/psutil_posix.o -o build/lib.linux-x86_64-2.6/psutil_posix.so
warning: no files found matching '
.html' under directory 'docs'
warning: no files found matching '
.dia' under directory 'docs'
warning: no files found matching '
.png' under directory 'docs'
Successfully installed psutil
Cleaning up...

But the error persists. What is the minimum requirement? I have Python 2.6.

Thank you for this, looks like a super useful tool.

Regards,
Theresia Tanzil

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.