今天发现了一个比较有意思的监控工具,是基于Django开发的,开发大牛已经开放了源代码,向大牛致敬,同时研究研究,目前感觉这个监控比较直观,可以针对个人服务器使用,同时涉及的环境比较简单,部署起来很方便。

安装pyDash

安装python、pip、git

  首先工具是基于python开发的,所以我们需要python以及pip工具,简单的是,一般情况下我们的服务器在安装系统时就已经安装好python2.x环境了,python2.x已经完全可以支撑此监控工具的运行了,所以这点我们不需要担心太多,安装git是因为我们需要克隆源码。

yum -y install epel-release python pip git

克隆pyDash源码

git clone https://gitlab.com/k3oni/pydash.git

安装相应版本的Django

  不难理解,因为是基于Django开发,所以我们必须有相应的环境,才能支持软件的运行。

cd pydash

pip install -r requirements.txt

需要相应的Django版本号,作者已经写入requirements.txt配置文件,我们只需要使用pip指定文件进行安装即可。

修改加密文件

vi pydash/settings.py

"""
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 = '111aaa...'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False TEMPLATE_DEBUG = False ADMINS = (
) MANAGERS = ADMINS #All refresh values are in miliseconds, 1 second = 1000 miliseconds
#Adjust accordingly as you wish
TIME_JS_REFRESH = 30000
TIME_JS_REFRESH_LONG = 120000
TIME_JS_REFRESH_NET = 2000 VERSION = "1.4.6" ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = (
#'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
#'django.contrib.sites',
'django.contrib.staticfiles',
) 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 = 'pydash.urls' WSGI_APPLICATION = 'pydash.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

  修改配置文件中SECRET_KEY = '111aaa...'配置即可,修改后保存退出。

创建管理员账户

python manage.py syncdb

Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): admin
Email address: federicosun@163.com
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

  根据相关提示设置即可。

启动pyDash服务

nohup python manage.py runserver 0.0.0.0:1234 &

查看展示界面

  使用我们刚刚设置的账号密码进行登录。

  麻雀虽小五脏俱全,向大牛学习,争取自己早日可以自己编出实用程序。

Django开发Web监控工具-pyDash的更多相关文章

  1. 用pycharm+django开发web项目

    pycharm是python的一个商业的集成开发工具,本人感觉做python开发还是很好用的,django是一个很流行的python web开源框架,本文就是使用pycharm+django来开发py ...

  2. Django开发web环境搭建的简单方法(CentOS6.5环境)

    这几天跟Linux下的Python + Django环境搭建卯上了.经过几天的琢磨,找到了一条自己认为给力的路径. 这里给出命令行,过程如下: 首次登陆,切换管理员: [web@bogon ~]$ s ...

  3. pycharm环境下用Python+Django开发web搭建

    1.安装pycharm: 2.安装Python: 3.安装mysql: 4.安装Django; pip3 install django 5.创建Django工程命令方式: # 创建Django程序 d ...

  4. [Python] 利用Django进行Web开发系列(一)

    1 写在前面 在没有接触互联网这个行业的时候,我就一直很好奇网站是怎么构建的.现在虽然从事互联网相关的工作,但是也一直没有接触过Web开发之类的东西,但是兴趣终归还是要有的,而且是需要自己动手去实践的 ...

  5. [Python] 利用Django进行Web开发系列(二)

    1 编写第一个静态页面——Hello world页面 在上一篇博客<[Python] 利用Django进行Web开发系列(一)>中,我们创建了自己的目录mysite. Step1:创建视图 ...

  6. Nginx+Python+uwsgi+Django的web开发环境安装及配置

    Nginx+Python+uwsgi+Django的web开发环境安装及配置 nginx安装 nginx的安装这里就略过了... python安装 通常系统已经自带了,这里也略过 uwsgi安装 官网 ...

  7. 利用Django进行Web开发

    Web就是用来表示Internet主机上供外界访问的资源的.网页也统称为web资源.Internet上供外界访问的Web资源主要分为如下两类: 静态web资源:指web页面中供人们浏览的数据始终是不变 ...

  8. pycharm+python+Django之web开发环境的搭建(windows)

    转载:https://blog.csdn.net/yjx2323999451/article/details/53200243/ pycharm+python+Django之web开发环境的搭建(wi ...

  9. PyCharm社区版+Django搭建web开发环境-2

    接上一篇:PyCharm社区版+Django搭建web开发环境-1 1. 创建好django项目并建立app应用:web 2. setting.py:配置app应用 INSTALLED_APPS = ...

随机推荐

  1. eclipse zg项目学习

    一.基本知识 1.新增测试系统: xx/jsp:用于摆放jsp xx/src:放置java source 2.在项目上,右键,New-Folder,新建xx文件夹. 同样的方法,在xx文件夹上,右键N ...

  2. datagrid数据表格的维护

    想想刚开始学jsp, 用application做一个简单的数据库, 简单的注册页面, 跟这个相比就是过家家 <%@ page language="java" contentT ...

  3. cmd命令 从C盘转到D盘

        点开始 点运行.输入 CMD 回车.进入DOS提示符状态下.输入 cd\ 回车 表示进入 c:\> 也就是C盘根目录下.输入d: 回车 是进入D盘当前目录,并不一定是根目录.然后cd\ ...

  4. poj1661 (DP)

    题目链接:http://poj.org/problem?id=1661 思路: 把初始位置看成左,右端点均为x0,即长度为0,高度为y0的一个平台,按照平台高度从低到高排序.用dp[i][0],dp[ ...

  5. Python globals() 函数

    Python globals() 函数  Python 内置函数 描述 globals() 函数会以字典类型返回当前位置的全部全局变量. 语法 globals() 函数语法: globals() 参数 ...

  6. android mapView

    1.Because the Maps library is not a part of the standard Android library, you must declare it in the ...

  7. 控制span的width属性及display属性值的选择

    给span设置width样式,会发现并没有改变它的宽度,但有时候我们需要给它设置固定的宽度,那么就可以设置它的display样式,改变span的显示模式就好了. span默认显示模式是inline,无 ...

  8. [leetcode]173. Binary Search Tree Iterator 二叉搜索树迭代器

    Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the ro ...

  9. discuz回贴通知插件实现-页面嵌入点(钩子)

    1.如何保证主题被回复时业务代码被执行. 2.获得主题,主题发布者,贴子等信息. 3.discuz发送email邮件.   discuz使用嵌入点(钩子)来处理代码的执行时机. 当用户开启插件开发者模 ...

  10. .NET中CORS跨域访问WebApi

    我这里只写基本用法以作记录,具体为什么看下面的文章: http://www.cnblogs.com/landeanfen/p/5177176.html http://www.cnblogs.com/m ...