Coder Social home page Coder Social logo

fe's Introduction

falcon-fe

鉴于很多用户反馈UIC太难安装了(虽然我觉得其实很容易……),用Go语言重新实现了一个,也就是这个falcon-fe了。

另外,监控系统组件比较多,有不少web组件,比如uic、portal、alarm、dashboard,没有一个统一的地方汇总查看,falcon-fe也做了一些快捷配置,类似监控系统的hao123导航了

安装Go语言环境

cd ~
wget http://dinp.qiniudn.com/go1.4.1.linux-amd64.tar.gz
tar zxvf go1.4.1.linux-amd64.tar.gz
mkdir -p workspace/src
echo "" >> .bashrc
echo 'export GOROOT=$HOME/go' >> .bashrc
echo 'export GOPATH=$HOME/workspace' >> .bashrc
echo 'export PATH=$GOROOT/bin:$GOPATH/bin:$PATH' >> .bashrc
echo "" >> .bashrc
source .bashrc

编译安装fe模块

cd $GOPATH/src/github.com/open-falcon
git clone https://github.com/open-falcon/fe.git
cd fe
go get ./...
./control build
./control start

配置介绍

{
    "log": "debug",
    "company": "MI", # 填写自己公司的名称,用于生成联系人二维码
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:1234" # 自己随便搞个端口,别跟现有的重复了,可以使用8080,与老版本保持一致
    },
    "cache": {
        "enabled": true,
        "redis": "127.0.0.1:6379", # 这个redis跟judge、alarm用的redis不同,这个只是作为缓存来用
        "idle": 10,
        "max": 1000,
        "timeout": {
            "conn": 10000,
            "read": 5000,
            "write": 5000
        }
    },
    "salt": "0i923fejfd3", # 搞一个随机字符串
    "canRegister": true,
    "ldap": {
        "enabled": false,
        "addr": "ldap.example.com:389",
        "baseDN": "dc=example,dc=com",
        "bindDN": "cn=mananger,dc=example,dc=com",#允许匿名查询的话,填""值即可
        "bindPasswd": "12345678",
        "userField": "uid", #用于认证的属性,通常为 uid 或 sAMAccountName(AD)。也可以使用诸如mail的属性,这样认证的用户名就是邮箱(前提ldap里有)
        "attributes": ["sn","mail","telephoneNumber"] #数组顺序重要,依次为姓名,邮箱,电话在ldap中的属性名。fe将按这些属性名去ldap中查询新用户的属性,并插入到fe的数据库内。
    },
    "uic": {
        "addr": "root:password@tcp(127.0.0.1:3306)/fe?charset=utf8&loc=Asia%2FChongqing",
        "idle": 10,
        "max": 100
    },
    "shortcut": {
        "falconPortal": "http://11.11.11.11:5050/", 浏览器可访问的portal地址
        "falconDashboard": "http://11.11.11.11:7070/", 浏览器可访问的dashboard地址
        "falconAlarm": "http://11.11.11.11:6060/" 浏览器可访问的alarm的http地址
    }
}

设置root账号的密码

该项目中的注册用户是有不同角色的,目前分三种角色:普通用户、管理员、root账号。系统启动之后第一件事情应该是设置root的密码,浏览器访问:http://fe.example.com/root?password=abc (此处假设你的项目访问地址是fe.example.com,也可以使用ip),这样就设置了root账号的密码为abc。普通用户可以支持注册。

fe's People

Contributors

freedomkk-qfeng avatar itxx00 avatar laiwei avatar minimum-hsu avatar niean avatar ulricqin avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fe's Issues

FE 登录提交或注册提交报错

RT.

错误日志如下:

2015/06/26 12:54:58 read config file: cfg.json successfully
2015/06/26 12:54:59 [app.go:103] [I] http server Running on 0.0.0.0:10003

2015/06/26 12:55:09 [router.go:871] [C] the request url is /auth/login
2015/06/26 12:55:09 [router.go:872] [C] Handler crashed with error runtime error: invalid memory address or nil pointer dereference
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/runtime/asm_amd64.s:401
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/runtime/panic.go:387
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/runtime/panic.go:42
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/runtime/sigpanic_unix.go:26
2015/06/26 12:55:09 [router.go:878] [C] /home/laiwei/gopath-open-falcon/src/github.com/toolkits/cache/cache.go:126
2015/06/26 12:55:09 [router.go:878] [C] /home/laiwei/gopath-open-falcon/src/github.com/open-falcon/fe/model/uic/user.go:71
2015/06/26 12:55:09 [router.go:878] [C] /home/laiwei/gopath-open-falcon/src/github.com/open-falcon/fe/model/uic/user.go:82
2015/06/26 12:55:09 [router.go:878] [C] /home/laiwei/gopath-open-falcon/src/github.com/open-falcon/fe/http/uic/auth_controller.go:98
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/runtime/asm_amd64.s:401
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/reflect/value.go:419
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/reflect/value.go:296
2015/06/26 12:55:09 [router.go:878] [C] /home/laiwei/gopath-open-falcon/src/github.com/astaxie/beego/router.go:794
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/net/http/server.go:1703
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/net/http/server.go:1204
2015/06/26 12:55:09 [router.go:878] [C] /usr/local/go/src/runtime/asm_amd64.s:2232

登录和退出登录需要20秒

fe日志

登录

[ORM] - 2016-04-01 17:21:19 - [Queries/default] - [  OK /    db.Query /     1.7ms] - [select id from user where name = ?] - `root`
[ORM] - 2016-04-01 17:21:29 - [Queries/default] - [  OK / db.QueryRow /     1.8ms] - [SELECT `id`, `name`, `cnname`, `passwd`, `email`, `phone`, `im`, `qq`, `role`, `created` FROM `user` WHERE `id` = ?] - `1`
[ORM] - 2016-04-01 17:21:29 - [Queries/default] - [  OK /     db.Exec /   194.3ms] - [INSERT INTO `session` (`uid`, `sig`, `expired`) VALUES (?, ?, ?)] - `1`, `1d97167cf7eb11e58cfffa163e728d19`, `1462094489`
2016/04/01 17:21:29 [router.go:828][D] | POST       | /auth/login                              | 20.20048836s     | match      | /auth/login

退出登录

[ORM] - 2016-04-01 17:23:33 - [Queries/default] - [  OK / db.QueryRow /     1.9ms] - [SELECT `id`, `uid`, `sig`, `expired` FROM `session` WHERE `sig` = ?] - `1d97167cf7eb11e58cfffa163e728d19`
[ORM] - 2016-04-01 17:23:43 - [Queries/default] - [  OK / db.QueryRow /     1.7ms] - [SELECT `id`, `name`, `cnname`, `passwd`, `email`, `phone`, `im`, `qq`, `role`, `created` FROM `user` WHERE `id` = ?] - `1`
[ORM] - 2016-04-01 17:23:43 - [Queries/default] - [  OK /    db.Query /     0.8ms] - [SELECT T0.`id`, T0.`sig` FROM `session` T0 WHERE T0.`uid` = ? LIMIT 1000] - `1`
[ORM] - 2016-04-01 17:23:43 - [Queries/default] - [  OK /     db.Exec /   201.9ms] - [DELETE FROM `session` WHERE `id` = ?] - `1`
2016/04/01 17:23:53 [router.go:828][D] | GET        | /me/logout                               | 30.208005618s    | match      | /me/logout                               | 

db.Exec每次都在200 ms 左右,而 完成整个登录 需要20s 这是为什么

fe 封装的http库 可否换个名称

如果main.go代码里引入 pprof,会有冲突

import (
  _ "net/http/pprof"
 "github.com/open-falcon/fe/http"
)
func main() {
  ...
    model.InitDatabase()
    cache.InitCache()

    go func() {
        log.Println(http.ListenAndServe("localhost:6060", nil))
    }()
    http.Start()
}

编译

[root@fe]# ./control build
# _/opt/open-falcon/fe
./main.go:37: undefined: "github.com/open-falcon/fe/http".ListenAndServe

请问cache的redis有设置密码的requirepass,如何传参?

这段代码中:

...
"cache": {
        "enabled": true,
        "redis": "127.0.0.1:6379", # 这个redis跟judge、alarm用的redis不同,这个只是作为缓存来用
        "idle": 10,
        "max": 1000,
        "timeout": {
            "conn": 10000,
            "read": 5000,
            "write": 5000
        }
    }
...

用于redis启动的配置redis.conf中配置了requirepass(访问redis的密码),上述代码如何传参?

無法註冊帳號

根據 http://book.open-falcon.com/zh/install/prepare.html 操作,
使用 http://7xiumq.com1.z0.glb.clouddn.com/open-falcon-binary-0.0.4.tar.gz 部署,
無法設置 fe 的 root 帳號的密碼為 abc,也無法註冊普通用戶。

app.log 相關訊息

[ORM] - 2015-08-05 04:04:11 - [Queries/default] - [FAIL / db.Exec / 2.6ms] - [INSERT INTO user (name, cnname, passwd, email, phone, im, qq, role, created) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] - root, , df5ec8cce00f2fe6d09a9807421f1eb7,, ,, ``,2,`` - Error 1048: Column 'created' cannot be null

補充

Docker 版本 https://github.com/frostynova/open-falcon-docker 可以成功註冊帳號。

UIC的理解

UIC的英文缩写是什么呢?看了些相关资料,但不是很了解这是一个什么概念

User Identity Center ?

引用官网gitbook上 --“我们把用户的联系信息维护在一个叫UIC(新用户推荐使用Go版本的UIC,即:falcon-fe项目)的系统里,以后如果要修改手机号、邮箱,只要在UIC中修改一次即可。报警接收人也不是单个的人,而是一个组(UIC中称为Team),比如falcon这个系统的任何组件出问题了,都应该发报警给falcon的运维和开发人员,发给falcon这个团队,这样一来,新员工入职只要加入falcon这个Team即可;员工离职,只要从falcon这个Team删掉即可。

浏览器访问UIC,如果启用了LDAP,那就用LDAP账号登陆,如果没有启用,那就注册一个或者找管理员帮忙开通。创建一个Team,名称姑且叫falcon,把自己加进去,待会用来做测试”

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.