Browse Source

added rest but strange

master
Raphael Roberts 7 years ago
parent
commit
e536b90936
  1. 62
      .gitignore
  2. 21
      LICENSE.md
  3. 4
      MANIFEST.in
  4. 162
      README.rst
  5. 0
      example/example/__init__.py
  6. 135
      example/example/settings.py
  7. 4
      example/example/urls.py
  8. 14
      example/example/wsgi.py
  9. 10
      example/manage.py
  10. 1
      example/pydash
  11. 1
      requirements.txt
  12. 39
      setup.py

62
.gitignore

@ -1,60 +1,6 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
build/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
*.pyc
._*
*.sqlite3

21
LICENSE.md

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Florian Neagu - michaelneagu@gmail.com - https://github.com/k3oni/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

4
MANIFEST.in

@ -0,0 +1,4 @@
include LICENSE.md
include README.rst
recursive-include pydash/static *
recursive-include pydash/templates *

162
README.rst

@ -0,0 +1,162 @@
pyDash - v1.4.6
===============
A reusable django app for monitoring your linux server.
Supported Python versions:
::
Python 2.x
Python 3.x
Requirements:
::
Django >= 1.5
Installation
============
Clone the repository to your pc and, assuming that ``pip`` is installed,
run the following commands:
- ``python setup.py sdist``
- ``pip install dist/django-pydash-app-*.tar.gz``
Make sure that ``django.contrib.auth`` is installed and working.
Open your project’s ``settings.py`` and add ``pydash`` to
``INSTALLED_APPS``:
::
INSTALLED_APPS = (
'pydash',
)
Open your project’s ``urls.py`` and include the ``pydash`` urls.
::
urlpatterns = patterns('',
(r'^pydash/', include('pydash.urls')),
)
Make sure ``AppDirectoriesFinder`` is enabled in your
``STATICFILES_FINDERS``:
::
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
Before deploying to a live server, run the following command in order to
collect the static files stored in pydash’s directory:
::
$ python manage.py collectstatic
Settings
========
There are 3 different refresh settings which are measured in
``miliseconds``:
::
TIME_JS_REFRESH = 30000 #30 seconds
TIME_JS_REFRESH_LONG = 120000 #120 seconds
TIME_JS_REFRESH_NET = 2000 #2 seconds
If you wish to override the default settings, simply set those fields
with the new values in your application’s ``settings.py`` file.
The refresh settings for each table are as follows:
::
Memory Usage - TIME_JS_REFRESH
Load Average - TIME_JS_REFRESH
CPU Usage - TIME_JS_REFRESH
Traffic Usage - TIME_JS_REFRESH_NET
Disk Reads/Writes - TIME_JS_REFRESH_NET
Uptime - TIME_JS_REFRESH_LONG
Disk Usage - TIME_JS_REFRESH_LONG
Online Users - TIME_JS_REFRESH_LONG
Processes - TIME_JS_REFRESH_LONG
Netstat - TIME_JS_REFRESH_LONG
Remote data retrieval
=====================
pyDash allows you to retrieve data remotely.
Data is returned in JSON and can be easily retrieved as long as the user
agent has been authenticated by the web application.
pyDash has a list of short URLs which you can use to retrieve the
specific data:
::
/info/uptime/ - Uptime
/info/platform/hostname/ - Hostname
/info/platform/osname/ - OS Name
/info/platform/kernel/ - Kernel
/info/getcpus/cpucount/ - Number of CPU cores
/info/getcpus/cputype/ - Type/Name of CPU
/info/memory/ - Memory Usage
/info/cpuusage/ - CPU Usage in percentage(%), free and used
/info/getdisk/ - Disk Usage
/info/getusers/ - Online Users
/info/getips/ - IP Addresses
/info/gettraffic/ - Internet Traffic
/info/getdiskio/ - Disk Reads/Writes
/info/proc/ - Running Processes
/info/loadaverage/ - Load Average
/info/getnetstat/ - Netstat
To see the format of the JSON returned datasets or data you can access any of the URLs from your browser
as http://youpydaship/url , ex. http://demo.pydash.net/info/uptime/ .
OS Support
==========
pyDash was tested and runs under the following OSes:
::
- Centos
- Fedora
- Ubuntu
- Debian
- Raspbian
- Pidora
- Arch Linux
It might work under others, but it hasn’t been tested yet.
Contributors
============
George Zografos - george.p.zografos@gmail.com
License
=======
`MIT <https://github.com/k3oni/pydash-django-app/blob/master/LICENSE.md>`_
Issues
======
Report any issues/bugs at `https://github.com/k3oni/pydash-django-app <https://github.com/k3oni/pydash-django-app>`_
Credits
=======
`Dashboard Template <http://www.egrappler.com/templatevamp-free-twitter-bootstrap-admin-template/>`_, `Bootstrap <http://getbootstrap.com/>`_, `Font Awesome <http://fontawesome.io/>`_

0
example/example/__init__.py

135
example/example/settings.py

@ -0,0 +1,135 @@
"""
Django settings for pydash project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SITE_ID = 1
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '1)$crmowu-23tz@i2-d=7tb3t+1u&(pm!lnjyuarki^72h!3af'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ADMINS = (
)
MANAGERS = ADMINS
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Add pydash here
'pydash'
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'example.urls'
WSGI_APPLICATION = 'example.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3')
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'),)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '..', 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
try:
from local_settings import *
except ImportError:
pass

4
example/example/urls.py

@ -0,0 +1,4 @@
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^pydash/', include('pydash.urls')))

14
example/example/wsgi.py

@ -0,0 +1,14 @@
"""
WSGI config for example project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

10
example/manage.py

@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

1
example/pydash

@ -0,0 +1 @@
../pydash

1
requirements.txt

@ -0,0 +1 @@
django>=1.5

39
setup.py

@ -0,0 +1,39 @@
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-pydash-app',
version='1.4.6',
packages=['pydash'],
include_package_data=True,
license='MIT',
description='A reusable django app for monitoring your linux server.',
long_description=README,
url='https://github.com/k3oni/pydash-django-app',
author='Florian N.',
author_email='michaelneagu@gmail.com',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.0',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)
Loading…
Cancel
Save