Giter VIP home page Giter VIP logo

dashboard's Introduction

Introduction

dashboard is the Open-Falcon unified default frontend component, including:

  • user-defined dashboard and screen.
  • configure managent of alerting, hostgroup, template.
  • alerting history managent and display.
  • team management.
  • combine the multiple alerting.
  • user management, such as login, logout, register, ldap_login, etc.

Open-Falcon homepage:http://open-falcon.org

Demo site

i18n

Open-Falcon natively support zh_CN and currently partially support English. Any translation will be appreciated.

How to participate in the translation

Run in docker

Clone & Prepare

export HOME=/home/work/

mkdir -p $HOME/open-falcon/
cd $HOME/open-falcon && git clone https://github.com/open-falcon/dashboard.git
cd dashboard;

Install dependency

  • CentOS
yum install -y python-virtualenv
yum install -y python-devel
yum install -y openldap-devel
yum install -y mysql-devel
yum groupinstall "Development tools"


cd $HOME/open-falcon/dashboard/
virtualenv ./env

./env/bin/pip install -r pip_requirements.txt
  • Ubuntu
apt-get install -y python-virtualenv
apt-get install -y slapd ldap-utils
apt-get install -y libmysqld-dev
apt-get install -y build-essential
apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev

cd $HOME/open-falcon/dashboard/
virtualenv ./env

./env/bin/pip install -r pip_requirements.txt

Init database

cd /tmp/ && git clone https://github.com/open-falcon/falcon-plus.git 
cd /tmp/falcon-plus/scripts/mysql/db_schema/
mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql
rm -rf /tmp/falcon-plus/

if you are upgrading from v0.1 to version v0.2.0(or above),then

mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql

Configure

The open-falcon modules' configuration files is path/to/open-falcon-binaries/<moduleName>/config/cfg.json, change them if necessary.

MAKE SURE Open-falcon api module is up running and works as expcted before start dashboard.

dashboard config file is 'rrd/config.py', change it if necessary.

## set API_ADDR to your falcon-plus api modules addr, default value as bellow:
API_ADDR = "http://127.0.0.1:8080/api/v1" 

## set PORTAL_DB_* if necessary, default mysql user is root, default passwd is ""
## set ALARM_DB_* if necessary, default mysql user is root, default passwd is ""
## if following error msg occurred, please check DB config in rrd/config.py

Error 'NoneType' object has no attribute 'cursor'

Start in debug mode

$ source ./env/bin/python wsgi.py
$ export FLASK_ENV=development
$ flask run --host=0.0.0.0 --port=8081


open http://127.0.0.1:8081 in your browser.

Run with gunicorn in production mode

$ bash control start

open http://127.0.0.1:8081 in your browser.

Stop gunicorn

$ bash control stop

Check log

$ bash control tail

Screenshots

Mailing lists

Issue tracker

We are using the github issue tracker for the various Open-Falcon repositories to fix bugs and features request. If you need support, please send your questions to the openfalcon-users mailing list rather than filing a GitHub issue.

Please do not ask individual project members for support. Use the channels above instead, where the whole community can help you and benefit from the solutions provided. If community support is insufficient for your situation, please refer to the Commercial Support section below.

Contributing

We welcome community contributions! Open-Falcon uses GitHub to manage reviews of pull requests.

If you have a trivial fix or improvement, go ahead and create a pull request, addressing (with @...) the maintainer of this repository in the description of the pull request.

If you plan to do something more involved, first discuss your ideas on our mailing list. This will avoid unnecessary work and surely give you and us a good deal of inspiration.

Acknowledgements

Open-Falcon was initially started by Xiaomi and we would also like to acknowledge early contributions by engineers from these companies.

Wei Lai is the founder of Open-Falcon software and community.

The Open-Falcon logo and website were contributed by Cepave Design Team.

dashboard's People

Contributors

amour1688 avatar canghai908 avatar chiyuxing avatar crazw avatar dependabot[bot] avatar feiyuw avatar freedomkk-qfeng avatar gaojiasheng avatar hitripod avatar iambocai avatar jianfengye avatar juntaozhang avatar laiwei avatar linxueshi2017 avatar masato25 avatar mistshi avatar niean avatar salixleaf avatar schemacs avatar torijing avatar wss434631143 avatar xingfusye avatar xwisen avatar yao-hang avatar

Stargazers

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

Watchers

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

dashboard's Issues

给dashboard server配置url前缀的功能

如果在nginx中配置了反向代理,并且location不是 「/」,无法访问到后端的flask服务器

现在的dashboard无法配置server context作为统一的url前缀

dashboard中的图表的数据显示单位

现在图表的数据显示单位都是按1000计算的。即1000=1K,100000=1M,....
但是对于磁盘容量,网络数据等,似乎按1024计算更为合适。
是否可以在dashboard的图边上增加个选项,选择计算方式为1000还是1024~~

创建策略检索metric报错

使用docker运行dashboard
下面是详细日志

2018-01-09 07:39:35 ERROR:400:{"error":"open ./api/data/metric: no such file or directory"}

2018-01-09 07:39:35 INFO:10.44.74.218 - - [09/Jan/2018 07:39:35] "GET /api/metric/query?query=value&limit=10&_=1515482390237 HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1478, in full_dispatch_request
    response = self.make_response(rv)
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1577, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/werkzeug/wrappers.py", line 824, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/werkzeug/test.py", line 854, in run_wsgi_app
    app_iter = app(environ, start_response)
TypeError: 'list' object is not callable

监控页面 chart 没有数据js报错

错误信息

TypeError: Cannot read property '1' of undefined at c.FlotServ.self.summary (/static/js/util_ng.js?_v=0.0.4:348:33) at /static/js/big_ng.js?_v=0.0.4:79:35 at /static/js/angular.min.js:72:45 at K (/static/js/angular.min.js:100:79) at K (/static/js/angular.min.js:100:79) at /static/js/angular.min.js:101:245 at k.$eval (/static/js/angular.min.js:112:15) at k.$digest (/static/js/angular.min.js:109:96) at k.$apply (/static/js/angular.min.js:112:345) at h (/static/js/angular.min.js:72:300)
 /static/js/angular.min.js:92

dashboard中筛选问题

在dashboard首页,选定一个Endpoint,做Counter筛选,可以获取到符合条件的所有数据,但在screen页面,新建graph项中填写同一个Endpoint,Counter筛选条件保持一致,绘图时只显示部分符合条件的数据,只显示同一个tag数据。(显示的是同一个tag数据量最大的,其他的tag未显示)

dashboard中查询不到数据

falcon_portal数据库中的host表,有对应的主机。

dashboard没有错误日志。
hbs没有错误日志。

如何定位问题原因?

dashboard cann't run

when I run debug
`[root@localhost dashboard]# ./env/bin/python wsgi.py

[warning] no local config file
Traceback (most recent call last):
File "wsgi.py", line 10, in
from rrd import app
File "/home/work/open-falcon/dashboard/rrd/init.py", line 17, in
from view import api
ImportError: cannot import name api
[root@localhost dashboard]# `

dashboard似乎不该假定用户一定使用virtualenv部署

尝试部署了一下open-falcon,在部署到dashboard时碰到一个问题,想和大家探讨一下:

wsgi.py中有如下代码:

activate_this = '%s/env/bin/activate_this.py' % base_dir
execfile(activate_this, dict(__file__=activate_this))

这个代码的前提假设是认为用户一定会使用virtualenv进行部署。
但我认为,只要依赖条件满足了, 应该与我是用virtualenv部署还是用系统Python运行时部署没有关系,因此这个假定条件有点武断了。
在我的环境下,我直接使用的是系统python运行时,因此直接把这两句话给注掉了

是否可以考虑在上述代码中加个判断条件? 比如:

activate_this = '%s/env/bin/activate_this.py' % base_dir
if os.path.isfile(activate_this):
    execfile(activate_this, dict(__file__=activate_this))

欢迎大家指正。

改脚本只支持python2,已修改支持python3

mysql包使用mysql官方提供的mysql-connector-python==2.1.6
python-ldap包更改为python3-ldap==0.9.8.4
使用python3解释器修改
wsgi.py
注释19-20行内容
#activate_this = '%s/venv/bin/activate_this.py' % base_dir
#execfile(activate_this, dict(file=activate_this))
./rrd/init.py
修改34-39行
from .view import index
from .view.auth import auth
from .view.user import user
from .view.team import team
from .view.dashboard import chart, screen
from .view.portal import *
./rrd/store.py
第17行修改为
import mysql.connector
第39行修改为
conn = mysql.connector.connect(
修改第48行内容
except Exception as e:
./rrd/service/group_service.py
修改第32行
except Exception as e:

目前使用ldap登录存在问题

数据库连接问题

现象描述:

#访问前端界面dashboard、screen之外的面板报错如下:
暂时无法访问,请联系管理员.

error: 'NoneType' object has no attribute 'cursor'

traceback日志如下:
Traceback (most recent call last):
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/work/open-falcon/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/work/open-falcon/dashboard/rrd/view/portal/home.py", line 19, in home_get
    vs, total = HostGroup.query(page, limit, query, me)
  File "/home/work/open-falcon/dashboard/rrd/model/portal/host_group.py", line 47, in query
    vs = cls.select_vs(where=where, params=params, page=page, limit=limit, order='grp_name')
  File "/home/work/open-falcon/dashboard/rrd/model/portal/bean.py", line 90, in select_vs
    rows = cls.select(where=where, params=params, order=order, limit=limit, page=page, offset=offset)
  File "/home/work/open-falcon/dashboard/rrd/model/portal/bean.py", line 86, in select
    return cls._db.query_all(sql, params)
  File "/home/work/open-falcon/dashboard/rrd/store.py", line 95, in query_all
    cursor = self.execute(*a, **kw)
  File "/home/work/open-falcon/dashboard/rrd/store.py", line 58, in execute
    cursor = self.get_conn().cursor()
AttributeError: 'NoneType' object has no attribute 'cursor'

#dashboard 后台报错如下:
mysql config is :{'DB_PASS': '123456', 'DB_NAME': 'falcon_portal', 'DB_USER': 'root', 'DB_HOST': '127.0.0.1', 'DB_PORT': '3306'}
2017-05-04 07:50:18 CRITICAL:connect db: an integer is required
mysql config is :{'DB_PASS': '123456', 'DB_NAME': 'falcon_portal', 'DB_USER': 'root', 'DB_HOST': '127.0.0.1', 'DB_PORT': '3306'}
2017-05-04 07:50:18 CRITICAL:connect db: an integer is required

问题原因:

def connect_db(cfg):
    try:
        print("mysql config is :{}".format(cfg))
        conn = MySQLdb.connect(
            host=cfg['DB_HOST'],
            port=int(cfg['DB_PORT']),   //端口号转换为整型就没这问题
            user=cfg['DB_USER'],
            passwd=cfg['DB_PASS'],
            db=cfg['DB_NAME'],
            use_unicode=True,
            charset="utf8")
        return conn
    except Exception, e:
        logging.getLogger().critical('connect db: %s' % e)
        return None
  • mysql 为docker hub 镜像mysql:5.7

拼写小错误

rrd/module/user.py的第38行的cnmame应改成cnname。
这个错误会导致在 team里添加成员的时候cnname字段显示是undefined。

org.springframework.web.HttpRequestMethodNotSupportedException

{"timestamp":"2017-12-12T12:02:28.414+0800","status":405,"error":"Method Not Allowed","exception":"org.springframework.web.HttpRequestMethodNotSupportedException","message":"Request method \u0027POST\u0027 not supported","path":"/api/v1/user/create"}

dashboard查看图的时候保存screen功能

1、用了一段时间open-falcon后,发现dashboard对于添加screen时需要反复来回添加host和metrics, 可不可以在dashboard主界面看图的界面上有个保存为screen的功能?
2、在两次不同的counter条件搜索后选定后的counters不能同时显示,后面勾选的counter会覆盖前一次的counter,这算个bug吗?
谢谢

expression页面分页链接地址错误

rrd/templates/portal/expression/list.html line 61

{{ blocks.pager('/portal/expressions?q='+data.query+'&mine='+data.mine, data.total, data.limit, data.page) }}

分页报404,链接地址中‘expressions’应该是‘expression’

模板添加策略获取metric列表500

master 克隆时间: 5月10号

配置:
dashboard:
API_ADDR = os.environ.get("API_ADDR","http://10.27.10.164:7103/api/v1")

api cfg.json
"metric_list_file": "/data/apidata/metric",
"web_port": ":7103",

环境:
Flask (0.10.1)
gunicorn (18.0)
itsdangerous (0.24)
Jinja2 (2.7.2)
MarkupSafe (1.0)
MySQL-python (1.2.5)
pip (1.4.1)
python-dateutil (2.2)
python-ldap (2.4.38)
requests (2.3.0)
setuptools (0.9.8)
six (1.10.0)
Werkzeug (0.9.4)
wsgiref (0.1.2)

2017-05-12 13:23:58 INFO:10.27.10.164 - - [12/May/2017 13:23:58] "GET /api/metric/query?query=in&limit=10&_=1494556741582 HTTP/1.0" 500 -
Traceback (most recent call last):
File "/data/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/data/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/data/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/data/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/data/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1478, in full_dispatch_request
response = self.make_response(rv)
File "/data/dashboard/env/lib/python2.7/site-packages/flask/app.py", line 1577, in make_response
rv = self.response_class.force_type(rv, request.environ)
File "/data/dashboard/env/lib/python2.7/site-packages/werkzeug/wrappers.py", line 824, in force_type
response = BaseResponse(*_run_wsgi_app(response, environ))
File "/data/dashboard/env/lib/python2.7/site-packages/werkzeug/test.py", line 854, in run_wsgi_app
app_iter = app(environ, start_response)
TypeError: 'list' object is not callable

screen 中graph 创建体验问题

目前我在screen 中添加graph 需要一行写一个counter,大部分时候不知道所有counter 的完整名字,效率很低。

能否在dashbord 首页搜索counter 时,新增一个功能按钮可以批量将一批counter 添加到一个screen 中?

存在SQL注入漏洞

dashboard/rrd/model/endpoint.py 中拼装查询条件时,使用了简单的字符串拼接,存在SQL注入漏洞。虽然监控系统可能主要是内部人员使用,但有时手误或其他情况可能导致严重安全问题,希望能修复一下。另外,估计 portal 等项目也存在这样的安全问题。对 Python 不熟悉,没办法提交 pull request,抱歉

        sql = '''select id, endpoint, ts from endpoint where ts > %s '''
        for q in qs:
            sql += ''' and endpoint like %s'''
        sql += ''' limit %s,%s'''

图表显示数据延时

使用API以5s间隔时间push数据,用于实时观察接口调用情况,发现:

  1. dashboard 分别率最低30s
  2. 数据延时,延时将近5分钟

另外: 可否提供类似Google charts开源图表那种 鼠标移动上去时,显示标尺和每条线的数值,现在必须点到对应线上确定时间点才显示,线多的时候很很难看清楚。

dashboard中ldap的binddn 的password

dashboard中ldap的binddn 的password在哪里填写

LDAP_ENABLED = False
LDAP_SERVER = "ldap.forumsys.com:389"
LDAP_BASE_DN = "dc=example,dc=com"
LDAP_BINDDN_FMT = "uid=%s,dc=example,dc=com"
LDAP_SEARCH_FMT = "uid=%s"
LDAP_ATTRS = ["cn","mail","telephoneNumber"]
LDAP_TLS_START_TLS = False
LDAP_TLS_CACERTDIR = ""
LDAP_TLS_CACERTFILE = "/etc/openldap/certs/ca.crt"
LDAP_TLS_CERTFILE = ""
LDAP_TLS_KEYFILE = ""
LDAP_TLS_REQUIRE_CERT = True
LDAP_TLS_CIPHER_SUITE = ""

open-falcon如何设置监听浮动ip的端口?

我们的服务器是用pacemaker这种工具做的冷双机,同一时间只在一边启动进程,进程和浮动ip关联,现在发现配置的时候,配置浮动ip的监听端口,无法告警!!

dashboard出现如下warning,当前图形也查不出

空白页面

query中诶呀

/home/falcon/dashboard/rrd/store.py:38: Warning: Data truncated for column 'counters' at row 1
cursor.execute(_a, *_kw)
/home/falcon/dashboard/rrd/store.py:38: Warning: Data truncated for column 'counters' at row 1
cursor.execute(_a, *_kw)

NoneType object has no attribute 'cursor'

def execute(self, *a, **kw):
    cursor = kw.pop('cursor', None)
    try:
        cursor = cursor or self.get_conn().cursor()
        cursor.execute(*a, **kw)
    except (AttributeError, MySQLdb.OperationalError):
        self.conn and self.conn.close()
        self.conn = None
        cursor = self.get_conn().cursor()
        cursor.execute(*a, **kw)
    return cursor

报错直接致命第71行,这里为什么又要连一次呢,上面不是已经捕获了错误了么,except里面再连一次,就捕获不到错误了啊

store.py查询方法问题

 def execute(self, *a, **kw):
     cursor = kw.pop('cursor', None)
     try:
         cursor = cursor or self._conn.cursor()
         cursor.execute(*a, **kw)
     except (AttributeError, MySQLdb.OperationalError):
         self._conn and self._conn.close()
         self.connect()
         cursor = self._conn.cursor()
         cursor.execute(*a, **kw)
     return cursor

大家好,我是初学者,如上方法,针对同样数据当我多次调用查询,会出现数据结果不一致,怀疑是因为没有释放连接,我修改为每次执行完都放掉conn,每次执行时候新建conn,问题解决。
请问这个是这个方法的bug,还是我理解的不正确,还是程序在别的地方控制事物了?请告知

graph页面展示内存是除以1000,而不是除以1024

从agent获取内存数据存入rrd库里面是字节单位,但是graph那边页面展示会换算成G/M等单位,但是是除以1000的样式,目前看grafana和open-falcon/dashboard 都是处理的,这块主要感觉是得要单独对内存数据进行处理。

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.