├── .idea
├── .name
├── dictionaries
│ └── jieli.xml
├── encodings.xml
├── vcs.xml
├── misc.xml
├── modules.xml
├── dataSources.local.xml
├── CrazyMonitor.iml
└── dataSources.xml
├── monitor
├── __init__.py
├── migrations
│ ├── __init__.py
│ └── 0002_auto_20170407_1608.py
├── backends
│ ├── __init__.py
│ ├── dump.rdb
│ ├── host_status.py
│ ├── redis_conn.py
│ ├── perpetual_machine.py
│ └── management.py
├── templatetags
│ ├── __init__.py
│ └── custom_tags.py
├── apps.py
├── tests.py
├── api_urls.py
├── urls.py
├── auth.py
├── admin.py
├── views.py
└── graphs.py
├── CrazyMonitor
├── __init__.py
├── wsgi.py
├── urls.py
└── settings.py
├── statics
├── unity
│ └── img
│ │ ├── flags
│ │ ├── united-kingdom.png.tmp
│ │ ├── italy.png
│ │ ├── spain.png
│ │ ├── france.png
│ │ ├── germany.png
│ │ └── united-kingdom.png
│ │ ├── av1.png
│ │ ├── av2.png
│ │ ├── av4.png
│ │ ├── error.jpg
│ │ ├── login.jpg
│ │ ├── logo.png
│ │ ├── balloon.jpg
│ │ ├── expanded.jpg
│ │ ├── login-bg.jpg
│ │ ├── slidein.jpg
│ │ ├── collapsed.jpg
│ │ ├── offcanvas.jpg
│ │ └── revealing.jpg
├── plugins
│ └── highstock
│ │ ├── js
│ │ ├── adapters
│ │ │ ├── standalone-framework.js
│ │ │ └── standalone-framework.src.js
│ │ ├── modules
│ │ │ ├── no-data-to-display.js
│ │ │ ├── funnel.js
│ │ │ ├── solid-gauge.js
│ │ │ ├── offline-exporting.js
│ │ │ ├── no-data-to-display.src.js
│ │ │ └── boost.js
│ │ └── themes
│ │ │ ├── grid-light.js
│ │ │ ├── skies.js
│ │ │ ├── sand-signika.js
│ │ │ ├── grid.js
│ │ │ ├── dark-unica.js
│ │ │ ├── dark-green.js
│ │ │ ├── dark-blue.js
│ │ │ └── gray.js
│ │ ├── graphics
│ │ ├── snow.png
│ │ ├── sun.png
│ │ ├── search.png
│ │ ├── skies.jpg
│ │ ├── highslide
│ │ │ ├── close.png
│ │ │ ├── closeX.png
│ │ │ ├── resize.gif
│ │ │ ├── zoomout.cur
│ │ │ └── outlines
│ │ │ │ └── rounded-white.png
│ │ └── meteogram-symbols-30px.png
│ │ ├── examples
│ │ ├── .DS_Store
│ │ ├── basic-line
│ │ │ └── index.htm
│ │ ├── spline
│ │ │ └── index.htm
│ │ ├── step-line
│ │ │ └── index.htm
│ │ ├── navigator-disabled
│ │ │ └── index.htm
│ │ ├── scrollbar-disabled
│ │ │ └── index.htm
│ │ ├── markers-only
│ │ │ └── index.htm
│ │ ├── line-markers
│ │ │ └── index.htm
│ │ ├── arearange
│ │ │ └── index.htm
│ │ ├── columnrange
│ │ │ └── index.htm
│ │ ├── areasplinerange
│ │ │ └── index.htm
│ │ ├── ohlc
│ │ │ └── index.htm
│ │ ├── column
│ │ │ └── index.htm
│ │ ├── candlestick
│ │ │ └── index.htm
│ │ ├── styled-scrollbar
│ │ │ └── index.htm
│ │ ├── intraday-candlestick
│ │ │ └── index.htm
│ │ ├── area
│ │ │ └── index.htm
│ │ ├── areaspline
│ │ │ └── index.htm
│ │ ├── yaxis-reversed
│ │ │ └── index.htm
│ │ ├── flags-placement
│ │ │ └── index.htm
│ │ ├── intraday-area
│ │ │ └── index.htm
│ │ ├── dynamic-update
│ │ │ └── index.htm
│ │ ├── compare
│ │ │ └── index.htm
│ │ ├── yaxis-plotbands
│ │ │ └── index.htm
│ │ ├── intraday-breaks
│ │ │ └── index.htm
│ │ ├── flags-general
│ │ │ └── index.htm
│ │ ├── yaxis-plotlines
│ │ │ └── index.htm
│ │ ├── data-grouping
│ │ │ └── index.htm
│ │ ├── candlestick-and-volume
│ │ │ └── index.htm
│ │ ├── flags-shapes
│ │ │ └── index.htm
│ │ └── lazy-loading
│ │ │ └── index.htm
│ │ ├── gfx
│ │ └── vml-radial-gradient.png
│ │ ├── readme.txt
│ │ └── index.htm
├── fonts
│ ├── FontAwesome.otf
│ ├── fontawesome-webfont.eot
│ ├── fontawesome-webfont.ttf
│ ├── fontawesome-webfont.woff
│ ├── fontawesome-webfont.woff2
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
├── css
│ ├── custom.css
│ └── dashboard.css
└── js
│ ├── npm.js
│ ├── holder.min.js
│ ├── ie10-viewport-bug-workaround.js
│ ├── custom.js
│ └── ie-emulation-modes-warning.js
├── CrazyMonitorClient
├── __init__.py
├── bin
│ ├── __init__.py
│ └── CrazyClient.py
├── conf
│ ├── __init__.py
│ └── settings.py
├── core
│ ├── __init__.py
│ ├── main.py
│ └── client.py
└── plugins
│ ├── __init__.py
│ ├── linux
│ ├── __init__.py
│ ├── MegaCli
│ ├── host_alive.py
│ ├── network.py
│ ├── cpu_mac.py
│ ├── mac_load.py
│ └── memory.py
│ ├── windows
│ ├── __init__.py
│ └── sysinfo.py
│ └── plugin_api.py
├── monitor_db.sqlite3
├── share
└── screeshots
│ ├── flow.png
│ ├── monitor1.png
│ └── monitor2.png
├── templates
├── dashboard.html
├── monitor
│ ├── triggers.html
│ ├── dashboard.html
│ ├── trigger_list.html
│ ├── base.html
│ └── host_groups.html
├── hosts.html
└── base.html
├── manage.py
├── MonitorServer.py
├── README.md
└── .gitignore
/.idea/.name:
--------------------------------------------------------------------------------
1 | CrazyMonitor
--------------------------------------------------------------------------------
/monitor/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CrazyMonitor/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/monitor/migrations/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/statics/unity/img/flags/united-kingdom.png.tmp:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/adapters/standalone-framework.js:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/adapters/standalone-framework.src.js:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
--------------------------------------------------------------------------------
/monitor/backends/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
--------------------------------------------------------------------------------
/monitor/templatetags/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/bin/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/conf/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/core/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'jieli'
3 |
--------------------------------------------------------------------------------
/monitor_db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/monitor_db.sqlite3
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/linux/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/windows/__init__.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
--------------------------------------------------------------------------------
/monitor/backends/dump.rdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/monitor/backends/dump.rdb
--------------------------------------------------------------------------------
/share/screeshots/flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/share/screeshots/flow.png
--------------------------------------------------------------------------------
/statics/unity/img/av1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/av1.png
--------------------------------------------------------------------------------
/statics/unity/img/av2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/av2.png
--------------------------------------------------------------------------------
/statics/unity/img/av4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/av4.png
--------------------------------------------------------------------------------
/statics/unity/img/error.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/error.jpg
--------------------------------------------------------------------------------
/statics/unity/img/login.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/login.jpg
--------------------------------------------------------------------------------
/statics/unity/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/logo.png
--------------------------------------------------------------------------------
/share/screeshots/monitor1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/share/screeshots/monitor1.png
--------------------------------------------------------------------------------
/share/screeshots/monitor2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/share/screeshots/monitor2.png
--------------------------------------------------------------------------------
/statics/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/statics/unity/img/balloon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/balloon.jpg
--------------------------------------------------------------------------------
/statics/unity/img/expanded.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/expanded.jpg
--------------------------------------------------------------------------------
/statics/unity/img/login-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/login-bg.jpg
--------------------------------------------------------------------------------
/statics/unity/img/slidein.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/slidein.jpg
--------------------------------------------------------------------------------
/.idea/dictionaries/jieli.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/statics/unity/img/collapsed.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/collapsed.jpg
--------------------------------------------------------------------------------
/statics/unity/img/flags/italy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/flags/italy.png
--------------------------------------------------------------------------------
/statics/unity/img/flags/spain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/flags/spain.png
--------------------------------------------------------------------------------
/statics/unity/img/offcanvas.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/offcanvas.jpg
--------------------------------------------------------------------------------
/statics/unity/img/revealing.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/revealing.jpg
--------------------------------------------------------------------------------
/monitor/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class MonitorConfig(AppConfig):
5 | name = 'monitor'
6 |
--------------------------------------------------------------------------------
/statics/unity/img/flags/france.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/flags/france.png
--------------------------------------------------------------------------------
/statics/unity/img/flags/germany.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/flags/germany.png
--------------------------------------------------------------------------------
/statics/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/statics/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/statics/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/templates/dashboard.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 |
3 | {% block right-panel-content %}
4 | dfdfdfsddddddddddd
5 | {% endblock %}
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/linux/MegaCli:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/CrazyMonitorClient/plugins/linux/MegaCli
--------------------------------------------------------------------------------
/monitor/backends/host_status.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 |
5 |
6 | def update_host_status():
7 | pass
--------------------------------------------------------------------------------
/statics/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/templates/monitor/triggers.html:
--------------------------------------------------------------------------------
1 | {% extends 'monitor/index.html' %}
2 |
3 | {% block page-title %}
4 |
5 | 触发器
6 | {% endblock %}
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/snow.png
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/sun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/sun.png
--------------------------------------------------------------------------------
/statics/unity/img/flags/united-kingdom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/unity/img/flags/united-kingdom.png
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/examples/.DS_Store
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/search.png
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/skies.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/skies.jpg
--------------------------------------------------------------------------------
/templates/monitor/dashboard.html:
--------------------------------------------------------------------------------
1 | {% extends 'monitor/index.html' %}
2 |
3 | {% block page-title %}
4 |
5 | 监控大盘
6 | {% endblock %}
7 |
8 |
--------------------------------------------------------------------------------
/statics/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/statics/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/statics/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/statics/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/statics/plugins/highstock/gfx/vml-radial-gradient.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/gfx/vml-radial-gradient.png
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/highslide/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/highslide/close.png
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/highslide/closeX.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/highslide/closeX.png
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/highslide/resize.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/highslide/resize.gif
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/highslide/zoomout.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/highslide/zoomout.cur
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/meteogram-symbols-30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/meteogram-symbols-30px.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/graphics/highslide/outlines/rounded-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devops/CrazyMonitor/master/statics/plugins/highstock/graphics/highslide/outlines/rounded-white.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/readme.txt:
--------------------------------------------------------------------------------
1 | 产品名称: Highstock
2 |
3 | 版本: 4.2.4
4 |
5 | 发布时间: 2016-04-15
6 |
7 | 使用方法:直接打开 index.htm 即可看到我们提供的离线例子清单;所有需要的 js 文件在 /js/ 目录里。
8 |
9 | power by Highcharts中文网(http://wwww.hcharts.cn/)
10 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/statics/css/custom.css:
--------------------------------------------------------------------------------
1 |
2 | .graph-container {
3 |
4 | margin-top: 25px;
5 | }
6 |
7 | .severity-5{
8 | background-color: red;
9 | }
10 | .severity-4{
11 | background-color: orangered;
12 | }
13 | .severity-3{
14 | background-color: yellow;
15 | }
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CrazyMonitor.settings")
7 |
8 | from django.core.management import execute_from_command_line
9 |
10 | execute_from_command_line(sys.argv)
11 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MonitorServer.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 | import os
4 | import sys
5 |
6 | if __name__ == "__main__":
7 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CrazyMonitor.settings")
8 |
9 | from monitor.backends.management import execute_from_command_line
10 |
11 | execute_from_command_line(sys.argv)
12 |
--------------------------------------------------------------------------------
/monitor/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
5 |
6 | # if cpu.idle < 10 or cpu.iowait > 30 and mem.usage > 90 = warning
7 | #
8 | #
9 | # 10:10:00 10:11:00
10 | # 10:09:10 10:10:10
11 |
12 |
13 | from django.db import models
14 |
15 | class Host(models.Model):
16 | pass
17 |
18 | class
--------------------------------------------------------------------------------
/CrazyMonitorClient/bin/CrazyClient.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 | import sys
5 | import os
6 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
7 | sys.path.append(BASE_DIR)
8 |
9 | from core import main
10 |
11 | if __name__ == "__main__":
12 | client = main.command_handler(sys.argv)
13 |
14 |
15 |
--------------------------------------------------------------------------------
/monitor/backends/redis_conn.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 | import redis
5 |
6 | def redis_conn(django_settings):
7 | #print(django_settings.REDIS_CONN)
8 | pool = redis.ConnectionPool(host=django_settings.REDIS_CONN['HOST'], port=django_settings.REDIS_CONN['PORT'])
9 | r = redis.Redis(connection_pool=pool)
10 | return r
--------------------------------------------------------------------------------
/CrazyMonitor/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for CrazyMonitor project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CrazyMonitor.settings")
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/conf/settings.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 |
5 | configs ={
6 | 'HostID': 1,
7 | "Server": "localhost",
8 | "ServerPort": 9000,
9 | "urls":{
10 |
11 | 'get_configs' :['api/client/config','get'], #acquire all the services will be monitored
12 | 'service_report': ['api/client/service/report/','post'],
13 |
14 | },
15 | 'RequestTimeout':30,
16 | 'ConfigUpdateInterval': 300, #5 mins as default
17 |
18 | }
--------------------------------------------------------------------------------
/monitor/api_urls.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | from django.conf.urls import url
4 |
5 | from monitor import views
6 |
7 | urlpatterns = [
8 |
9 | url(r'client/config/(\d+)/$',views.client_configs ),
10 | url(r'client/service/report/$',views.service_data_report ),
11 | url(r'hosts/status/$',views.hosts_status,name='get_hosts_status' ),
12 | url(r'groups/status/$',views.hostgroups_status,name='get_hostgroups_status' ),
13 | url(r'graphs/$',views.graphs_generator,name='get_graphs' )
14 |
15 | ]
16 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/linux/host_alive.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 |
5 | import subprocess
6 |
7 | def monitor(frist_invoke=1):
8 | value_dic = {}
9 | shell_command = 'uptime'
10 | result = subprocess.Popen(shell_command,shell=True,stdout=subprocess.PIPE).stdout.read()
11 |
12 | #user,nice,system,iowait,steal,idle = result.split()[2:]
13 | value_dic= {
14 | 'uptime': result,
15 |
16 | 'status': 0
17 | }
18 | return value_dic
19 |
20 |
21 | print monitor()
22 |
--------------------------------------------------------------------------------
/statics/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/linux/network.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 | import subprocess
5 |
6 | def monitor(frist_invoke=1):
7 | shell_command = 'sar -n DEV 1 5 |grep -v IFACE |grep Average'
8 | result = subprocess.Popen(shell_command,shell=True,stdout=subprocess.PIPE).stdout.readlines()
9 | #print(result)
10 | value_dic = {'status':0, 'data':{}}
11 | for line in result:
12 | line = line.split()
13 | nic_name,t_in,t_out = line[1],line[4],line[5]
14 | value_dic['data'][nic_name] = {"t_in":line[4], "t_out":line[5]}
15 | #print(value_dic)
16 | return value_dic
--------------------------------------------------------------------------------
/monitor/backends/perpetual_machine.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 | import sys,os
5 | import django
6 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
7 | sys.path.append(BASE_DIR)
8 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CrazyMonitor.settings")
9 | from CrazyMonitor import settings
10 |
11 | django.setup()
12 | from monitor import models
13 | from monitor.backends import data_processing
14 |
15 |
16 |
17 | if __name__ == '__main__':
18 | reactor = data_processing.DataHandler(settings)
19 | reactor.looping()
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/statics/js/holder.min.js:
--------------------------------------------------------------------------------
1 |
2 |
404 Not Found
3 |
4 | 404 Not Found
5 |
nginx
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/monitor/urls.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | from django.conf.urls import url
4 |
5 | from monitor import views
6 |
7 | urlpatterns = [
8 |
9 | #url(r'^$',views.dashboard ),
10 | #url(r'^dashboard/$',views.dashboard ,name='dashboard' ),
11 | url(r'^triggers/$',views.triggers,name='triggers' ),
12 | url(r'hosts/$',views.hosts ,name='hosts'),
13 | url(r'host_groups/$',views.host_groups ,name='host_groups'),
14 | url(r'hosts/(\d+)/$',views.host_detail ,name='host_detail'),
15 | #url(r'graph/$',views.graph ,name='get_graph'),
16 | url(r'trigger_list/$',views.trigger_list ,name='trigger_list'),
17 | #url(r'client/service/report/$',views.service_data_report )
18 |
19 | ]
20 |
--------------------------------------------------------------------------------
/statics/js/ie10-viewport-bug-workaround.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * IE10 viewport hack for Surface/desktop Windows 8 bug
3 | * Copyright 2014-2015 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 |
7 | // See the Getting Started docs for more information:
8 | // http://getbootstrap.com/getting-started/#support-ie10-width
9 |
10 | (function () {
11 | 'use strict';
12 |
13 | if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
14 | var msViewportStyle = document.createElement('style')
15 | msViewportStyle.appendChild(
16 | document.createTextNode(
17 | '@-ms-viewport{width:auto!important}'
18 | )
19 | )
20 | document.querySelector('head').appendChild(msViewportStyle)
21 | }
22 |
23 | })();
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CrazyMonitor
2 | 用python写的强大的分布式监控软件
3 | 参考zabbix,openfalcon架构,前端、后端、监控插件、画图、数据优化存储等全部自己实现,通过学习本项目可以了解复杂自动化项目的架构设计、程序解耦原则、前后端数据交互等多项实战技能。
4 |
5 |
6 | ## 启动
7 |
8 | python3 manage.py runserver 0.0.0.0:9000 启动监控服务web端
9 |
10 | python3 MonitorServer.py start 启动监控主程序
11 |
12 | python3 MonitorServer.py trigger_watch 启动报警监听程序
13 |
14 |
15 | # 项目讲解视频
16 | http://edu.51cto.com/course/course_id-6208.html
17 | # python自动化交流群
18 | Python开发之路 304154367
19 |
20 |
21 | # 项目截图
22 | 
23 | 
24 | 
25 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/plugin_api.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 | from linux import sysinfo,load,cpu_mac,cpu,memory,network,host_alive
5 |
6 |
7 |
8 | def LinuxSysInfo():
9 | #print __file__
10 | return sysinfo.collect()
11 |
12 |
13 | def WindowsSysInfo():
14 | from windows import sysinfo as win_sysinfo
15 | return win_sysinfo.collect()
16 |
17 | def get_linux_cpu():
18 | return cpu.monitor()
19 |
20 | def host_alive_check():
21 | return host_alive.monitor()
22 |
23 | def GetMacCPU():
24 | #return cpu.monitor()
25 | return cpu_mac.monitor()
26 |
27 | def GetNetworkStatus():
28 | return network.monitor()
29 |
30 | def get_memory_info():
31 | return memory.monitor()
32 |
33 |
34 | def get_linux_load():
35 | return load.monitor()
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/linux/cpu_mac.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding:utf-8
3 |
4 | #apt-get install sysstat
5 |
6 | import commands
7 |
8 | def monitor(frist_invoke=1):
9 | shell_command = 'sar 1 3| grep "^Average:"'
10 | status,result = commands.getstatusoutput(shell_command)
11 | if status != 0:
12 | value_dic = {'status': status}
13 | else:
14 | value_dic = {}
15 | #print('---res:',result)
16 | user,nice,system,idle = result.split()[1:]
17 | value_dic= {
18 | 'user': user,
19 | 'nice': nice,
20 | 'system': system,
21 | 'idle': idle,
22 | 'status': status
23 | }
24 | return value_dic
25 |
26 | if __name__ == '__main__':
27 | print monitor()
28 |
--------------------------------------------------------------------------------
/.idea/dataSources.local.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | false
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/linux/mac_load.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding:utf-8
3 |
4 |
5 | import commands
6 |
7 |
8 | def monitor():
9 | shell_command = 'uptime'
10 |
11 | status,result = commands.getstatusoutput(shell_command)
12 | if status != 0: #cmd exec error
13 | value_dic = {'status':status}
14 | else:
15 | value_dic = {}
16 | uptime = result.split(',')[:1][0]
17 | print(result)
18 | #load1,load5,load15 = result.split('load averages:')[1].split(',')
19 | load1,load5,load15 = result.split('load averages:')[1].split()
20 | value_dic= {
21 | #'uptime': uptime,
22 | 'load1': load1,
23 | 'load5': load5,
24 | 'load15': load15,
25 | 'status': status
26 | }
27 | return value_dic
28 |
29 |
30 |
31 | print(monitor())
32 |
--------------------------------------------------------------------------------
/statics/js/custom.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by jieli on 4/29/16.
3 | */
4 |
5 |
6 | Date.prototype.format = function(format) {
7 | var o = {
8 | "M+": this.getMonth() + 1,
9 | // month
10 | "d+": this.getDate(),
11 | // day
12 | "h+": this.getHours(),
13 | // hour
14 | "m+": this.getMinutes(),
15 | // minute
16 | "s+": this.getSeconds(),
17 | // second
18 | "q+": Math.floor((this.getMonth() + 3) / 3),
19 | // quarter
20 | "S": this.getMilliseconds()
21 | // millisecond
22 | };
23 | if (/(y+)/.test(format) || /(Y+)/.test(format)) {
24 | format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
25 | }
26 | for (var k in o) {
27 | if (new RegExp("(" + k + ")").test(format)) {
28 | format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
29 | }
30 | }
31 | return format;
32 | };
33 |
34 | //usage: timestamp = (new Date(parseFloat(rData[7]))).format("yyyy-MM-dd hh:mm:ss");
--------------------------------------------------------------------------------
/CrazyMonitor/urls.py:
--------------------------------------------------------------------------------
1 | """CrazyMonitor URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/1.9/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.conf.urls import url, include
14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15 | """
16 | from django.conf.urls import url,include
17 | from django.contrib import admin
18 | from monitor import views
19 | from monitor import api_urls
20 |
21 | urlpatterns = [
22 | url(r'^admin/', admin.site.urls),
23 | url(r'^api/',include('monitor.api_urls')),
24 | url(r'^$',views.dashboard,name='dashboard' ),
25 | url(r'^monitor/',include('monitor.urls')),
26 |
27 | ]
28 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/core/main.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 | import client
5 | class command_handler(object):
6 |
7 | def __init__(self, sys_args):
8 | self.sys_args = sys_args
9 | if len(self.sys_args)<2:exit(self.help_msg())
10 | self.command_allowcator()
11 |
12 |
13 | def command_allowcator(self):
14 | '''分捡用户输入的不同指令'''
15 | print(self.sys_args[1])
16 |
17 | if hasattr(self,self.sys_args[1]):
18 | func= getattr(self,self.sys_args[1])
19 | return func()
20 | else:
21 | print("command does not exist!")
22 | self.help_msg()
23 |
24 | def help_msg(self):
25 | valid_commands = '''
26 | start start monitor client
27 | stop stop monitor client
28 |
29 | '''
30 | exit(valid_commands)
31 |
32 |
33 | def start(self):
34 | print("going to start the monitor client")
35 | #exit_flag = False
36 |
37 | Client = client.ClientHandle()
38 | Client.forever_run()
39 |
40 | def stop(self):
41 | print("stopping the monitor client")
--------------------------------------------------------------------------------
/.idea/CrazyMonitor.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/monitor/auth.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'jieli'
3 |
4 |
5 | from django.db import models
6 | from django.contrib.auth.models import (
7 | BaseUserManager, AbstractBaseUser,Group,PermissionsMixin
8 | )
9 | import django
10 |
11 | class UserManager(BaseUserManager):
12 | def create_user(self, email, name, password=None):
13 | """
14 | Creates and saves a User with the given email, date of
15 | birth and password.
16 | """
17 | if not email:
18 | raise ValueError('Users must have an email address')
19 |
20 | user = self.model(
21 | email=self.normalize_email(email),
22 | name=name,
23 |
24 | )
25 |
26 | user.set_password(password)
27 | user.save(using=self._db)
28 | return user
29 |
30 | def create_superuser(self, email, name ,password):
31 | """
32 | Creates and saves a superuser with the given email, date of
33 | birth and password.
34 | """
35 | user = self.create_user(email,
36 | password=password,
37 | name=name,
38 | )
39 | user.is_admin = True
40 | user.save(using=self._db)
41 | return user
42 |
43 |
44 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/basic-line/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/spline/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/step-line/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/monitor/migrations/0002_auto_20170407_1608.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Generated by Django 1.10.2 on 2017-04-07 08:08
3 | from __future__ import unicode_literals
4 |
5 | from django.db import migrations, models
6 | import django.db.models.deletion
7 |
8 |
9 | class Migration(migrations.Migration):
10 |
11 | dependencies = [
12 | ('monitor', '0001_initial'),
13 | ]
14 |
15 | operations = [
16 | migrations.CreateModel(
17 | name='EventLog',
18 | fields=[
19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20 | ('event_type', models.SmallIntegerField(choices=[(0, '报警事件'), (1, '维护事件')], default=0)),
21 | ('log', models.TextField(blank=True, null=True)),
22 | ('date', models.DateTimeField(auto_now_add=True)),
23 | ('host', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='monitor.Host')),
24 | ('trigger', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='monitor.Trigger')),
25 | ],
26 | ),
27 | migrations.AlterField(
28 | model_name='actionoperation',
29 | name='step',
30 | field=models.SmallIntegerField(default=1, help_text='当trigger触发次数小于这个值时就执行这条记录里报警方式', verbose_name='第n次告警'),
31 | ),
32 | ]
33 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | env/
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 |
27 | # PyInstaller
28 | # Usually these files are written by a python script from a template
29 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
30 | *.manifest
31 | *.spec
32 |
33 | # Installer logs
34 | pip-log.txt
35 | pip-delete-this-directory.txt
36 |
37 | # Unit test / coverage reports
38 | htmlcov/
39 | .tox/
40 | .coverage
41 | .coverage.*
42 | .cache
43 | nosetests.xml
44 | coverage.xml
45 | *,cover
46 | .hypothesis/
47 |
48 | # Translations
49 | *.mo
50 | *.pot
51 |
52 | # Django stuff:
53 | *.log
54 | local_settings.py
55 |
56 | # Flask stuff:
57 | instance/
58 | .webassets-cache
59 |
60 | # Scrapy stuff:
61 | .scrapy
62 |
63 | # Sphinx documentation
64 | docs/_build/
65 |
66 | # PyBuilder
67 | target/
68 |
69 | # IPython Notebook
70 | .ipynb_checkpoints
71 |
72 | # pyenv
73 | .python-version
74 |
75 | # celery beat schedule file
76 | celerybeat-schedule
77 |
78 | # dotenv
79 | .env
80 |
81 | # virtualenv
82 | venv/
83 | ENV/
84 |
85 | # Spyder project settings
86 | .spyderproject
87 |
88 | # Rope project settings
89 | .ropeproject
90 |
--------------------------------------------------------------------------------
/.idea/dataSources.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | sqlite.xerial
6 | true
7 | true
8 | SQLite
9 | org.sqlite.JDBC
10 | jdbc:sqlite:$PROJECT_DIR$/monitor_db.sqlite3
11 |
12 |
13 | sqlite.xerial
14 | true
15 | true
16 | $PROJECT_DIR$/CrazyMonitor/settings.py
17 | org.sqlite.JDBC
18 | jdbc:sqlite:$PROJECT_DIR$/monitor_db.sqlite3
19 |
20 |
21 | sqlite.xerial
22 | true
23 | true
24 | SQLite
25 | org.sqlite.JDBC
26 | jdbc:sqlite:$PROJECT_DIR$/monitor_db.sqlite3
27 |
28 |
29 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/navigator-disabled/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/scrollbar-disabled/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/modules/no-data-to-display.js:
--------------------------------------------------------------------------------
1 | /*
2 | Highstock JS v4.2.4 (2016-04-14)
3 | Plugin for displaying a message when there is no data visible in chart.
4 |
5 | (c) 2010-2016 Highsoft AS
6 | Author: Oystein Moseng
7 |
8 | License: www.highcharts.com/license
9 | */
10 | (function(a){typeof module==="object"&&module.exports?module.exports=a:a(Highcharts)})(function(a){function h(){return!!this.points.length}function d(){this.hasData()?this.hideNoData():this.showNoData()}var e=a.seriesTypes,c=a.Chart.prototype,f=a.getOptions(),g=a.extend,i=a.each;g(f.lang,{noData:"No data to display"});f.noData={position:{x:0,y:0,align:"center",verticalAlign:"middle"},attr:{},style:{fontWeight:"bold",fontSize:"12px",color:"#60606a"}};i(["pie","gauge","waterfall","bubble","treemap"],
11 | function(b){if(e[b])e[b].prototype.hasData=h});a.Series.prototype.hasData=function(){return this.visible&&this.dataMax!==void 0&&this.dataMin!==void 0};c.showNoData=function(b){var a=this.options,b=b||a.lang.noData,a=a.noData;if(!this.noDataLabel)this.noDataLabel=this.renderer.label(b,0,0,null,null,null,a.useHTML,null,"no-data").attr(a.attr).css(a.style).add(),this.noDataLabel.align(g(this.noDataLabel.getBBox(),a.position),!1,"plotBox")};c.hideNoData=function(){if(this.noDataLabel)this.noDataLabel=
12 | this.noDataLabel.destroy()};c.hasData=function(){for(var a=this.series,c=a.length;c--;)if(a[c].hasData()&&!a[c].options.isInternal)return!0;return!1};c.callbacks.push(function(b){a.addEvent(b,"load",d);a.addEvent(b,"redraw",d)})});
13 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/markers-only/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/CrazyMonitorClient/plugins/linux/memory.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding:utf-8
3 |
4 |
5 | import commands
6 |
7 |
8 | def monitor(frist_invoke=1):
9 | monitor_dic = {
10 | 'SwapUsage': 'percentage',
11 | 'MemUsage' : 'percentage',
12 | }
13 | shell_command ="grep 'MemTotal\|MemFree\|Buffers\|^Cached\|SwapTotal\|SwapFree' /proc/meminfo"
14 |
15 | status,result = commands.getstatusoutput(shell_command)
16 | if status != 0: #cmd exec error
17 | value_dic = {'status':status}
18 | else:
19 | value_dic = {'status':status}
20 | for i in result.split('kB\n'):
21 | key= i.split()[0].strip(':') # factor name
22 | value = i.split()[1] # factor value
23 | value_dic[ key] = value
24 |
25 | if monitor_dic['SwapUsage'] == 'percentage':
26 | value_dic['SwapUsage_p'] = str(100 - int(value_dic['SwapFree']) * 100 / int(value_dic['SwapTotal']))
27 | #real SwapUsage value
28 | value_dic['SwapUsage'] = int(value_dic['SwapTotal']) - int(value_dic['SwapFree'])
29 |
30 | MemUsage = int(value_dic['MemTotal']) - (int(value_dic['MemFree']) + int(value_dic['Buffers']) + int(value_dic['Cached']))
31 | if monitor_dic['MemUsage'] == 'percentage':
32 | value_dic['MemUsage_p'] = str(int(MemUsage) * 100 / int(value_dic['MemTotal']))
33 | #real MemUsage value
34 | value_dic['MemUsage'] = MemUsage
35 | return value_dic
36 |
37 | if __name__ == '__main__':
38 | print monitor()
39 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/line-markers/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/themes/grid-light.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Grid-light theme for Highcharts JS
3 | * @author Torstein Honsi
4 | */
5 |
6 | // Load the fonts
7 | Highcharts.createElement('link', {
8 | href: '//fonts.googleapis.com/css?family=Dosis:400,600',
9 | rel: 'stylesheet',
10 | type: 'text/css'
11 | }, null, document.getElementsByTagName('head')[0]);
12 |
13 | Highcharts.theme = {
14 | colors: ["#7cb5ec", "#f7a35c", "#90ee7e", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee",
15 | "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
16 | chart: {
17 | backgroundColor: null,
18 | style: {
19 | fontFamily: "Dosis, sans-serif"
20 | }
21 | },
22 | title: {
23 | style: {
24 | fontSize: '16px',
25 | fontWeight: 'bold',
26 | textTransform: 'uppercase'
27 | }
28 | },
29 | tooltip: {
30 | borderWidth: 0,
31 | backgroundColor: 'rgba(219,219,216,0.8)',
32 | shadow: false
33 | },
34 | legend: {
35 | itemStyle: {
36 | fontWeight: 'bold',
37 | fontSize: '13px'
38 | }
39 | },
40 | xAxis: {
41 | gridLineWidth: 1,
42 | labels: {
43 | style: {
44 | fontSize: '12px'
45 | }
46 | }
47 | },
48 | yAxis: {
49 | minorTickInterval: 'auto',
50 | title: {
51 | style: {
52 | textTransform: 'uppercase'
53 | }
54 | },
55 | labels: {
56 | style: {
57 | fontSize: '12px'
58 | }
59 | }
60 | },
61 | plotOptions: {
62 | candlestick: {
63 | lineColor: '#404048'
64 | }
65 | },
66 |
67 |
68 | // General
69 | background2: '#F0F0EA'
70 |
71 | };
72 |
73 | // Apply the theme
74 | Highcharts.setOptions(Highcharts.theme);
75 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/arearange/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/columnrange/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/areasplinerange/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/templates/monitor/trigger_list.html:
--------------------------------------------------------------------------------
1 | {% load custom_tags %}
2 |
3 |
4 |
5 |
6 |
Hover rows
7 |
8 |
9 |
10 |
11 |
12 | {{ trigger_list }}
13 |
14 |
15 |
16 | | 事件类型 |
17 | 级别 |
18 | 内容 |
19 | 日期 |
20 |
21 |
22 |
23 |
24 | {% for alert in alert_list %}
25 |
26 | | {{ alert.get_event_type_display }} |
27 | {{ alert.trigger }} |
28 | {{ alert.log }} |
29 | {{ alert.date }} |
30 |
31 |
32 | {% endfor %}
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/ohlc/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/column/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/candlestick/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/styled-scrollbar/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/intraday-candlestick/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/area/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/areaspline/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/monitor/templatetags/custom_tags.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 | from django import template
4 | from monitor import models
5 | from django.utils.safestring import mark_safe
6 |
7 | register = template.Library()
8 |
9 | @register.simple_tag
10 | def trigger_context(data):
11 | expressions = data['positive_expressions']
12 |
13 | html = ''
14 | for expression_item in expressions:
15 | expression_obj = models.TriggerExpression.objects.get(id=expression_item['expression_obj'])
16 | line ='''service:{service} index:{service_index} operator:{operator} func:{calc_func} args:{calc_args}
17 | threshold:{threshold} calc_res:{calc_res} real_val:{real_val}
18 |
'''.format(service=expression_obj.service.name,
19 | service_index=expression_obj.service_index.name,
20 | operator=expression_obj.operator_type,
21 | calc_func=expression_obj.data_calc_func,
22 | calc_args=expression_obj.data_calc_args,
23 | threshold=expression_obj.threshold,
24 | calc_res=expression_item.get('calc_res'),
25 | real_val = expression_item.get('calc_res_val')
26 | )
27 | html +=line
28 |
29 | return mark_safe(html)
30 |
31 |
32 |
33 |
34 | @register.simple_tag
35 | def get_trigger_severity_color(alert_obj):
36 | severity_choices = {
37 | 1:'white',
38 | 2:'yellow',
39 | 3:'orange',
40 | 4:'red',
41 | 5:'darkred',
42 | }
43 |
44 | return severity_choices.get(alert_obj.trigger.severity) or ''
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/yaxis-reversed/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/themes/skies.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Skies theme for Highcharts JS
3 | * @author Torstein Honsi
4 | */
5 |
6 | Highcharts.theme = {
7 | colors: ["#514F78", "#42A07B", "#9B5E4A", "#72727F", "#1F949A", "#82914E", "#86777F", "#42A07B"],
8 | chart: {
9 | className: 'skies',
10 | borderWidth: 0,
11 | plotShadow: true,
12 | plotBackgroundImage: 'http://www.highcharts.com/demo/gfx/skies.jpg',
13 | plotBackgroundColor: {
14 | linearGradient: [0, 0, 250, 500],
15 | stops: [
16 | [0, 'rgba(255, 255, 255, 1)'],
17 | [1, 'rgba(255, 255, 255, 0)']
18 | ]
19 | },
20 | plotBorderWidth: 1
21 | },
22 | title: {
23 | style: {
24 | color: '#3E576F',
25 | font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
26 | }
27 | },
28 | subtitle: {
29 | style: {
30 | color: '#6D869F',
31 | font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
32 | }
33 | },
34 | xAxis: {
35 | gridLineWidth: 0,
36 | lineColor: '#C0D0E0',
37 | tickColor: '#C0D0E0',
38 | labels: {
39 | style: {
40 | color: '#666',
41 | fontWeight: 'bold'
42 | }
43 | },
44 | title: {
45 | style: {
46 | color: '#666',
47 | font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
48 | }
49 | }
50 | },
51 | yAxis: {
52 | alternateGridColor: 'rgba(255, 255, 255, .5)',
53 | lineColor: '#C0D0E0',
54 | tickColor: '#C0D0E0',
55 | tickWidth: 1,
56 | labels: {
57 | style: {
58 | color: '#666',
59 | fontWeight: 'bold'
60 | }
61 | },
62 | title: {
63 | style: {
64 | color: '#666',
65 | font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
66 | }
67 | }
68 | },
69 | legend: {
70 | itemStyle: {
71 | font: '9pt Trebuchet MS, Verdana, sans-serif',
72 | color: '#3E576F'
73 | },
74 | itemHoverStyle: {
75 | color: 'black'
76 | },
77 | itemHiddenStyle: {
78 | color: 'silver'
79 | }
80 | },
81 | labels: {
82 | style: {
83 | color: '#3E576F'
84 | }
85 | }
86 | };
87 |
88 | // Apply the theme
89 | var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
90 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/themes/sand-signika.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sand-Signika theme for Highcharts JS
3 | * @author Torstein Honsi
4 | */
5 |
6 | // Load the fonts
7 | Highcharts.createElement('link', {
8 | href: '//fonts.googleapis.com/css?family=Signika:400,700',
9 | rel: 'stylesheet',
10 | type: 'text/css'
11 | }, null, document.getElementsByTagName('head')[0]);
12 |
13 | // Add the background image to the container
14 | Highcharts.wrap(Highcharts.Chart.prototype, 'getContainer', function (proceed) {
15 | proceed.call(this);
16 | this.container.style.background = 'url(http://www.highcharts.com/samples/graphics/sand.png)';
17 | });
18 |
19 |
20 | Highcharts.theme = {
21 | colors: ["#f45b5b", "#8085e9", "#8d4654", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee",
22 | "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
23 | chart: {
24 | backgroundColor: null,
25 | style: {
26 | fontFamily: "Signika, serif"
27 | }
28 | },
29 | title: {
30 | style: {
31 | color: 'black',
32 | fontSize: '16px',
33 | fontWeight: 'bold'
34 | }
35 | },
36 | subtitle: {
37 | style: {
38 | color: 'black'
39 | }
40 | },
41 | tooltip: {
42 | borderWidth: 0
43 | },
44 | legend: {
45 | itemStyle: {
46 | fontWeight: 'bold',
47 | fontSize: '13px'
48 | }
49 | },
50 | xAxis: {
51 | labels: {
52 | style: {
53 | color: '#6e6e70'
54 | }
55 | }
56 | },
57 | yAxis: {
58 | labels: {
59 | style: {
60 | color: '#6e6e70'
61 | }
62 | }
63 | },
64 | plotOptions: {
65 | series: {
66 | shadow: true
67 | },
68 | candlestick: {
69 | lineColor: '#404048'
70 | },
71 | map: {
72 | shadow: false
73 | }
74 | },
75 |
76 | // Highstock specific
77 | navigator: {
78 | xAxis: {
79 | gridLineColor: '#D0D0D8'
80 | }
81 | },
82 | rangeSelector: {
83 | buttonTheme: {
84 | fill: 'white',
85 | stroke: '#C0C0C8',
86 | 'stroke-width': 1,
87 | states: {
88 | select: {
89 | fill: '#D0D0D8'
90 | }
91 | }
92 | }
93 | },
94 | scrollbar: {
95 | trackBorderColor: '#C0C0C8'
96 | },
97 |
98 | // General
99 | background2: '#E0E0E8'
100 |
101 | };
102 |
103 | // Apply the theme
104 | Highcharts.setOptions(Highcharts.theme);
105 |
--------------------------------------------------------------------------------
/statics/js/ie-emulation-modes-warning.js:
--------------------------------------------------------------------------------
1 | // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 | // IT'S JUST JUNK FOR OUR DOCS!
3 | // ++++++++++++++++++++++++++++++++++++++++++
4 | /*!
5 | * Copyright 2014-2015 Twitter, Inc.
6 | *
7 | * Licensed under the Creative Commons Attribution 3.0 Unported License. For
8 | * details, see https://creativecommons.org/licenses/by/3.0/.
9 | */
10 | // Intended to prevent false-positive bug reports about Bootstrap not working properly in old versions of IE due to folks testing using IE's unreliable emulation modes.
11 | (function () {
12 | 'use strict';
13 |
14 | function emulatedIEMajorVersion() {
15 | var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
16 | if (groups === null) {
17 | return null
18 | }
19 | var ieVersionNum = parseInt(groups[1], 10)
20 | var ieMajorVersion = Math.floor(ieVersionNum)
21 | return ieMajorVersion
22 | }
23 |
24 | function actualNonEmulatedIEMajorVersion() {
25 | // Detects the actual version of IE in use, even if it's in an older-IE emulation mode.
26 | // IE JavaScript conditional compilation docs: https://msdn.microsoft.com/library/121hztk3%28v=vs.94%29.aspx
27 | // @cc_on docs: https://msdn.microsoft.com/library/8ka90k2e%28v=vs.94%29.aspx
28 | var jscriptVersion = new Function('/*@cc_on return @_jscript_version; @*/')() // jshint ignore:line
29 | if (jscriptVersion === undefined) {
30 | return 11 // IE11+ not in emulation mode
31 | }
32 | if (jscriptVersion < 9) {
33 | return 8 // IE8 (or lower; haven't tested on IE<8)
34 | }
35 | return jscriptVersion // IE9 or IE10 in any mode, or IE11 in non-IE11 mode
36 | }
37 |
38 | var ua = window.navigator.userAgent
39 | if (ua.indexOf('Opera') > -1 || ua.indexOf('Presto') > -1) {
40 | return // Opera, which might pretend to be IE
41 | }
42 | var emulated = emulatedIEMajorVersion()
43 | if (emulated === null) {
44 | return // Not IE
45 | }
46 | var nonEmulated = actualNonEmulatedIEMajorVersion()
47 |
48 | if (emulated !== nonEmulated) {
49 | window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')
50 | }
51 | })();
52 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/themes/grid.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Grid theme for Highcharts JS
3 | * @author Torstein Honsi
4 | */
5 |
6 | Highcharts.theme = {
7 | colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
8 | chart: {
9 | backgroundColor: {
10 | linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 },
11 | stops: [
12 | [0, 'rgb(255, 255, 255)'],
13 | [1, 'rgb(240, 240, 255)']
14 | ]
15 | },
16 | borderWidth: 2,
17 | plotBackgroundColor: 'rgba(255, 255, 255, .9)',
18 | plotShadow: true,
19 | plotBorderWidth: 1
20 | },
21 | title: {
22 | style: {
23 | color: '#000',
24 | font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
25 | }
26 | },
27 | subtitle: {
28 | style: {
29 | color: '#666666',
30 | font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
31 | }
32 | },
33 | xAxis: {
34 | gridLineWidth: 1,
35 | lineColor: '#000',
36 | tickColor: '#000',
37 | labels: {
38 | style: {
39 | color: '#000',
40 | font: '11px Trebuchet MS, Verdana, sans-serif'
41 | }
42 | },
43 | title: {
44 | style: {
45 | color: '#333',
46 | fontWeight: 'bold',
47 | fontSize: '12px',
48 | fontFamily: 'Trebuchet MS, Verdana, sans-serif'
49 |
50 | }
51 | }
52 | },
53 | yAxis: {
54 | minorTickInterval: 'auto',
55 | lineColor: '#000',
56 | lineWidth: 1,
57 | tickWidth: 1,
58 | tickColor: '#000',
59 | labels: {
60 | style: {
61 | color: '#000',
62 | font: '11px Trebuchet MS, Verdana, sans-serif'
63 | }
64 | },
65 | title: {
66 | style: {
67 | color: '#333',
68 | fontWeight: 'bold',
69 | fontSize: '12px',
70 | fontFamily: 'Trebuchet MS, Verdana, sans-serif'
71 | }
72 | }
73 | },
74 | legend: {
75 | itemStyle: {
76 | font: '9pt Trebuchet MS, Verdana, sans-serif',
77 | color: 'black'
78 |
79 | },
80 | itemHoverStyle: {
81 | color: '#039'
82 | },
83 | itemHiddenStyle: {
84 | color: 'gray'
85 | }
86 | },
87 | labels: {
88 | style: {
89 | color: '#99b'
90 | }
91 | },
92 |
93 | navigation: {
94 | buttonOptions: {
95 | theme: {
96 | stroke: '#CCCCCC'
97 | }
98 | }
99 | }
100 | };
101 |
102 | // Apply the theme
103 | var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
104 |
--------------------------------------------------------------------------------
/templates/monitor/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | CrazyMonitor | Oldboy edu
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | {% block content-container %}
51 | put your page content here
52 | {% endblock %}
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
81 | {% block bottom-js %}
82 |
83 | {% endblock %}
84 |
85 |
86 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/modules/funnel.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Highcharts funnel module
4 |
5 | (c) 2010-2016 Torstein Honsi
6 |
7 | License: www.highcharts.com/license
8 | */
9 | (function(b){typeof module==="object"&&module.exports?module.exports=b:b(Highcharts)})(function(b){var q=b.getOptions(),w=q.plotOptions,r=b.seriesTypes,F=b.merge,E=function(){},B=b.each;w.funnel=F(w.pie,{animation:!1,center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",reversed:!1,dataLabels:{connectorWidth:1,connectorColor:"#606060"},size:!0,states:{select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}}});r.funnel=b.extendClass(r.pie,{type:"funnel",animate:E,translate:function(){var a=
10 | function(k,a){return/%$/.test(k)?a*parseInt(k,10)/100:parseInt(k,10)},b=0,d=this.chart,c=this.options,f=c.reversed,g=c.ignoreHiddenPoint,o=d.plotWidth,h=d.plotHeight,q=0,d=c.center,i=a(d[0],o),x=a(d[1],h),r=a(c.width,o),l,s,e=a(c.height,h),t=a(c.neckWidth,o),C=a(c.neckHeight,h),u=x-e/2+e-C,a=this.data,y,z,w=c.dataLabels.position==="left"?1:0,A,m,D,p,j,v,n;this.getWidthAt=s=function(k){var a=x-e/2;return k>u||e===C?t:t+(r-t)*(1-(k-a)/(e-C))};this.getX=function(k,a){return i+(a?-1:1)*(s(f?h-k:k)/2+
11 | c.dataLabels.distance)};this.center=[i,x,e];this.centerX=i;B(a,function(a){if(!g||a.visible!==!1)b+=a.y});B(a,function(a){n=null;z=b?a.y/b:0;m=x-e/2+q*e;j=m+z*e;l=s(m);A=i-l/2;D=A+l;l=s(j);p=i-l/2;v=p+l;m>u?(A=p=i-t/2,D=v=i+t/2):j>u&&(n=j,l=s(u),p=i-l/2,v=p+l,j=u);f&&(m=e-m,j=e-j,n=n?e-n:null);y=["M",A,m,"L",D,m,v,j];n&&y.push(v,n,p,n);y.push(p,j,"Z");a.shapeType="path";a.shapeArgs={d:y};a.percentage=z*100;a.plotX=i;a.plotY=(m+(n||j))/2;a.tooltipPos=[i,a.plotY];a.slice=E;a.half=w;if(!g||a.visible!==
12 | !1)q+=z})},drawPoints:function(){var a=this,b=a.chart.renderer,d,c,f;B(a.data,function(g){f=g.graphic;c=g.shapeArgs;d=g.pointAttr[g.selected?"select":""];f?f.attr(d).animate(c):g.graphic=b.path(c).attr(d).add(a.group)})},sortByAngle:function(a){a.sort(function(a,b){return a.plotY-b.plotY})},drawDataLabels:function(){var a=this.data,b=this.options.dataLabels.distance,d,c,f,g=a.length,o,h;for(this.center[2]-=2*b;g--;)f=a[g],c=(d=f.half)?1:-1,h=f.plotY,o=this.getX(h,d),f.labelPos=[0,h,o+(b-5)*c,h,o+
13 | b*c,h,d?"right":"left",0];r.pie.prototype.drawDataLabels.call(this)}});q.plotOptions.pyramid=b.merge(q.plotOptions.funnel,{neckWidth:"0%",neckHeight:"0%",reversed:!0});b.seriesTypes.pyramid=b.extendClass(b.seriesTypes.funnel,{type:"pyramid"})});
14 |
--------------------------------------------------------------------------------
/statics/css/dashboard.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Base structure
3 | */
4 |
5 | /* Move down content because we have a fixed navbar that is 50px tall */
6 | body {
7 | padding-top: 50px;
8 | }
9 |
10 |
11 | /*
12 | * Global add-ons
13 | */
14 |
15 | .sub-header {
16 | padding-bottom: 10px;
17 | border-bottom: 1px solid #eee;
18 | }
19 |
20 | /*
21 | * Top navigation
22 | * Hide default border to remove 1px line.
23 | */
24 | .navbar-fixed-top {
25 | border: 0;
26 | }
27 |
28 | /*
29 | * Sidebar
30 | */
31 |
32 | /* Hide for mobile, show later */
33 | .sidebar {
34 | display: none;
35 | }
36 | @media (min-width: 768px) {
37 | .sidebar {
38 | position: fixed;
39 | top: 51px;
40 | bottom: 0;
41 | left: 0;
42 | z-index: 1000;
43 | display: block;
44 | padding: 20px;
45 | overflow-x: hidden;
46 | overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
47 | background-color: #f5f5f5;
48 | border-right: 1px solid #eee;
49 | }
50 | }
51 |
52 | /* Sidebar navigation */
53 | .nav-sidebar {
54 | margin-right: -21px; /* 20px padding + 1px border */
55 | margin-bottom: 20px;
56 | margin-left: -20px;
57 | }
58 | .nav-sidebar > li > a {
59 | padding-right: 20px;
60 | padding-left: 20px;
61 | }
62 | .nav-sidebar > .active > a,
63 | .nav-sidebar > .active > a:hover,
64 | .nav-sidebar > .active > a:focus {
65 | color: #fff;
66 | background-color: #428bca;
67 | }
68 |
69 |
70 | /*
71 | * Main content
72 | */
73 |
74 | .main {
75 | padding: 20px;
76 | }
77 | @media (min-width: 768px) {
78 | .main {
79 | padding-right: 40px;
80 | padding-left: 40px;
81 | }
82 | }
83 | .main .page-header {
84 | margin-top: 0;
85 | }
86 |
87 |
88 | /*
89 | * Placeholder dashboard ideas
90 | */
91 |
92 | .placeholders {
93 | margin-bottom: 30px;
94 | text-align: center;
95 | }
96 | .placeholders h4 {
97 | margin-bottom: 0;
98 | }
99 | .placeholder {
100 | margin-bottom: 20px;
101 | }
102 | .placeholder img {
103 | display: inline-block;
104 | border-radius: 50%;
105 | }
106 |
107 |
108 |
109 |
110 | /* customize css*/
111 |
112 | .css-success{
113 | background-color: lightgreen;
114 | }
115 | .css-danger{
116 | background-color: red;
117 | }
118 | .css-warning{
119 | background-color: orangered;
120 | }
121 | .css-default{
122 | background-color: lightgray;
123 | }
--------------------------------------------------------------------------------
/monitor/backends/management.py:
--------------------------------------------------------------------------------
1 | #_*_coding:utf-8_*_
2 | __author__ = 'Alex Li'
3 |
4 | import os,sys
5 | #from perpetual_machine import
6 | import django
7 | django.setup()
8 | from monitor.backends import data_processing,trigger_handler
9 | from CrazyMonitor import settings
10 |
11 |
12 |
13 | class ManagementUtility(object):
14 | """
15 | Encapsulates the logic of the django-admin and manage.py utilities.
16 |
17 | A ManagementUtility has a number of commands, which can be manipulated
18 | by editing the self.commands dictionary.
19 | """
20 | def __init__(self, argv=None):
21 | self.argv = argv or sys.argv[:]
22 | self.prog_name = os.path.basename(self.argv[0])
23 | self.settings_exception = None
24 | self.registered_actions = {
25 | 'start':self.start,
26 | 'stop': self.stop,
27 | 'trigger_watch':self.trigger_watch,
28 | }
29 |
30 | self.argv_check()
31 |
32 | def argv_check(self):
33 | '''
34 | do basic validation argv checks
35 | :return:
36 | '''
37 | if len(self.argv) < 2:
38 | self.main_help_text()
39 | if self.argv[1] not in self.registered_actions:
40 | self.main_help_text()
41 | else:
42 | self.registered_actions[sys.argv[1]]()
43 |
44 | def start(self):
45 | '''start monitor server frontend and backend'''
46 | reactor = data_processing.DataHandler(settings)
47 | reactor.looping()
48 |
49 | def stop(self):
50 | '''stop monitor server'''
51 |
52 | def trigger_watch(self):
53 | '''start to listen triggers'''
54 | trigger_watch = trigger_handler.TriggerHandler(settings)
55 | trigger_watch.start_watching()
56 |
57 | def main_help_text(self, commands_only=False):
58 | """
59 | Returns the script's main help text, as a string.
60 | """
61 | if not commands_only:
62 | print("supported commands as flow:")
63 | for k,v in self.registered_actions.items():
64 | print(" %s%s" % (k.ljust(20),v.__doc__))
65 | exit()
66 |
67 |
68 | def execute(self):
69 | '''
70 | run according to user's input
71 | :return:
72 | '''
73 | def execute_from_command_line(argv=None):
74 | """
75 | A simple method that runs a ManagementUtility.
76 | """
77 | utility = ManagementUtility(argv)
78 | utility.execute()
79 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/flags-placement/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/intraday-area/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/dynamic-update/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/compare/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/yaxis-plotbands/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/intraday-breaks/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/modules/solid-gauge.js:
--------------------------------------------------------------------------------
1 | /*
2 | Highstock JS v4.2.4 (2016-04-14)
3 | Solid angular gauge module
4 |
5 | (c) 2010-2016 Torstein Honsi
6 |
7 | License: www.highcharts.com/license
8 | */
9 | (function(a){typeof module==="object"&&module.exports?module.exports=a:a(Highcharts)})(function(a){var q=a.getOptions().plotOptions,r=a.pInt,s=a.pick,k=a.each,l;q.solidgauge=a.merge(q.gauge,{colorByPoint:!0});l={initDataClasses:function(b){var e=this,i=this.chart,c,g=0,d=this.options;this.dataClasses=c=[];k(b.dataClasses,function(f,h){var p,f=a.merge(f);c.push(f);if(!f.color)d.dataClassColor==="category"?(p=i.options.colors,f.color=p[g++],g===p.length&&(g=0)):f.color=e.tweenColors(a.Color(d.minColor),
10 | a.Color(d.maxColor),h/(b.dataClasses.length-1))})},initStops:function(b){this.stops=b.stops||[[0,this.options.minColor],[1,this.options.maxColor]];k(this.stops,function(b){b.color=a.Color(b[1])})},toColor:function(b,e){var a,c=this.stops,g,d=this.dataClasses,f,h;if(d)for(h=d.length;h--;){if(f=d[h],g=f.from,c=f.to,(g===void 0||b>=g)&&(c===void 0||b<=c)){a=f.color;if(e)e.dataClass=h;break}}else{this.isLog&&(b=this.val2lin(b));a=1-(this.max-b)/(this.max-this.min);for(h=c.length;h--;)if(a>c[h][0])break;
11 | g=c[h]||c[h+1];c=c[h+1]||g;a=1-(c[0]-a)/(c[0]-g[0]||1);a=this.tweenColors(g.color,c.color,a)}return a},tweenColors:function(b,a,i){var c;!a.rgba.length||!b.rgba.length?b=a.input||"none":(b=b.rgba,a=a.rgba,c=a[3]!==1||b[3]!==1,b=(c?"rgba(":"rgb(")+Math.round(a[0]+(b[0]-a[0])*(1-i))+","+Math.round(a[1]+(b[1]-a[1])*(1-i))+","+Math.round(a[2]+(b[2]-a[2])*(1-i))+(c?","+(a[3]+(b[3]-a[3])*(1-i)):"")+")");return b}};k(["fill","stroke"],function(b){a.Fx.prototype[b+"Setter"]=function(){this.elem.attr(b,l.tweenColors(a.Color(this.start),
12 | a.Color(this.end),this.pos))}});a.seriesTypes.solidgauge=a.extendClass(a.seriesTypes.gauge,{type:"solidgauge",pointAttrToOptions:{},bindAxes:function(){var b;a.seriesTypes.gauge.prototype.bindAxes.call(this);b=this.yAxis;a.extend(b,l);b.options.dataClasses&&b.initDataClasses(b.options);b.initStops(b.options)},drawPoints:function(){var b=this,e=b.yAxis,i=e.center,c=b.options,g=b.chart.renderer,d=c.overshoot,f=d&&typeof d==="number"?d/180*Math.PI:0;a.each(b.points,function(a){var d=a.graphic,j=e.startAngleRad+
13 | e.translate(a.y,null,null,null,!0),k=r(s(a.options.radius,c.radius,100))*i[2]/200,m=r(s(a.options.innerRadius,c.innerRadius,60))*i[2]/200,n=e.toColor(a.y,a),o=Math.min(e.startAngleRad,e.endAngleRad),l=Math.max(e.startAngleRad,e.endAngleRad);n==="none"&&(n=a.color||b.color||"none");if(n!=="none")a.color=n;j=Math.max(o-f,Math.min(l+f,j));c.wrap===!1&&(j=Math.max(o,Math.min(l,j)));o=Math.min(j,e.startAngleRad);j=Math.max(j,e.startAngleRad);j-o>2*Math.PI&&(j=o+2*Math.PI);a.shapeArgs=m={x:i[0],y:i[1],
14 | r:k,innerR:m,start:o,end:j,fill:n};a.startR=k;if(d){if(a=m.d,d.animate(m),a)m.d=a}else d={stroke:c.borderColor||"none","stroke-width":c.borderWidth||0,fill:n,"sweep-flag":0},c.linecap!=="square"&&(d["stroke-linecap"]=d["stroke-linejoin"]="round"),a.graphic=g.arc(m).attr(d).add(b.group)})},animate:function(b){if(!b)this.startAngleRad=this.yAxis.startAngleRad,a.seriesTypes.pie.prototype.animate.call(this,b)}})});
15 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/flags-general/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/yaxis-plotlines/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/examples/data-grouping/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Example
6 |
7 |
8 |
11 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Highstock Examples
6 |
7 |
8 | Highstock Examples
9 | General
10 |
22 | Chart types
23 |
37 | Various features
38 |
46 | Flags
47 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/statics/plugins/highstock/js/modules/offline-exporting.js:
--------------------------------------------------------------------------------
1 | /*
2 | Highstock JS v4.2.4 (2016-04-14)
3 | Client side exporting module
4 |
5 | (c) 2015 Torstein Honsi / Oystein Moseng
6 |
7 | License: www.highcharts.com/license
8 | */
9 | (function(c){typeof module==="object"&&module.exports?module.exports=c:c(Highcharts)})(function(c){function y(c,e){var i=l.getElementsByTagName("head")[0],b=l.createElement("script");b.type="text/javascript";b.src=c;b.onload=e;i.appendChild(b)}var e=c.win,g=e.navigator,l=e.document;c.CanVGRenderer={};c.Chart.prototype.exportChartLocal=function(z,A){var i=this,b=c.merge(i.options.exporting,z),B=g.userAgent.indexOf("WebKit")>-1&&g.userAgent.indexOf("Chrome")<0,n=b.scale||2,p,s=e.URL||e.webkitURL||e,
10 | k,t=0,q,o,u,d=function(){if(b.fallbackToExportServer===!1)if(b.error)b.error();else throw"Fallback to export server disabled";else i.exportChart(b)},v=function(a,j,f,b,m,c,d){var h=new e.Image,i,g=function(){var b=l.createElement("canvas"),c=b.getContext&&b.getContext("2d"),e;try{if(c){b.height=h.height*n;b.width=h.width*n;c.drawImage(h,0,0,b.width,b.height);try{e=b.toDataURL(),f(e,j)}catch(g){if(g.name==="SecurityError"||g.name==="SECURITY_ERR"||g.message==="SecurityError")i(a,j);else throw g;}}else m(a,
11 | j)}finally{d&&d(a,j)}},k=function(){c(a,j);d&&d(a,j)};i=function(){h=new e.Image;i=b;h.crossOrigin="Anonymous";h.onload=g;h.onerror=k;h.src=a};h.onload=g;h.onerror=k;h.src=a},w=function(a){try{if(!B&&g.userAgent.toLowerCase().indexOf("firefox")<0)return s.createObjectURL(new e.Blob([a],{type:"image/svg+xml;charset-utf-16"}))}catch(b){}return"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(a)},r=function(a,c){var f=l.createElement("a"),d=(b.filename||"chart")+"."+c,m;if(g.msSaveOrOpenBlob)g.msSaveOrOpenBlob(a,
12 | d);else if(f.download!==void 0)f.href=a,f.download=d,f.target="_blank",l.body.appendChild(f),f.click(),l.body.removeChild(f);else try{if(m=e.open(a,"chart"),m===void 0||m===null)throw"Failed to open window";}catch(i){e.location.href=a}},x=function(){var a,j,f=i.sanitizeSVG(p.innerHTML);if(b&&b.type==="image/svg+xml")try{g.msSaveOrOpenBlob?(j=new MSBlobBuilder,j.append(f),a=j.getBlob("image/svg+xml")):a=w(f),r(a,"svg")}catch(k){d()}else a=w(f),v(a,{},function(a){try{r(a,"png")}catch(b){d()}},function(){var a=
13 | l.createElement("canvas"),b=a.getContext("2d"),j=f.match(/^