clean code

This commit is contained in:
710leo 2020-09-26 16:37:46 +08:00
parent 86b31575eb
commit 8379624581
4 changed files with 0 additions and 169 deletions

View File

@ -1,55 +0,0 @@
<img src="https://s3-gz01.didistatic.com/n9e-pub/image/n9e-logo-bg-white.png" width="200" alt="Nightingale"/>
<br>
[中文简介](README_ZH.md)
Nightingale is a fork of Open-Falcon, and all the core modules have been greatly optimized. It integrates the best practices of DiDi. You can think of it as the next generation of Open-Falcon, and use directly in production environment.
## Documentation
Nightingale user manual: [https://n9e.didiyun.com/](https://n9e.didiyun.com/)
## Compile
```bash
mkdir -p $GOPATH/src/github.com/didi
cd $GOPATH/src/github.com/didi
git clone https://github.com/didi/nightingale.git
cd nightingale
./control build
```
## Quickstart with Docker
We has offered a Docker demo for the users who want to give it a try. Before you get started, make sure you have installed **Docker** & **docker-compose** and there are some details you should know.
* We highly recommend users prepare a new VM environment to use it.
* All the core components will be installed on your OS according to the `docker-compose.yaml`.
* Nightingale will use the following ports, `80`, `5800`, `5810`, `5811`, `5820`, `5821`, `5830`, `5831`, `5840`, `5841`, `6379`, `2058`, `3306`.
Okay. Run it! Once the docker finish its jobs, visits http://your-env-ip in your broswer. Default username and password is `root:root`.
```bash
$ docker-compose up -d
```
![dashboard](https://user-images.githubusercontent.com/19553554/78956965-8b9c6180-7b16-11ea-9747-6ed5e62b068d.png)
## Upgrading
- If upgrade `version<1.4.0` to `v1.4.0`, follow the operating instructions in [v1.4.0](https://github.com/didi/nightingale/releases/tag/v1.4.0) release
- If upgrade from `version>1.4.0 & version<2.3.0` to `v2.3.0`, need import this [sql](https://github.com/didi/nightingale/blob/master/sql/upgrade_2.3.0.sql)
## Team
[ulricqin](https://github.com/ulricqin) [710leo](https://github.com/710leo) [jsers](https://github.com/jsers) [hujter](https://github.com/hujter) [n4mine](https://github.com/n4mine) [heli567](https://github.com/heli567)
## Community
Nightingale is developed in open. Here we set up an organization, [github.com/n9e](https://github.com/n9e), which is used to communicate and contribute. We sincerely hope more developers can use their creativity to make lots of related projects for the Nightingale ecosystem.
## License
<img alt="Apache-2.0 license" src="https://s3-gz01.didistatic.com/n9e-pub/image/apache.jpeg" width="128">
Nightingale is available under the Apache-2.0 license. See the [LICENSE](LICENSE) file for more info.

View File

@ -1,52 +0,0 @@
<img src="https://s3-gz01.didistatic.com/n9e-pub/image/n9e-logo-bg-white.png" width="200" alt="Nightingale"/>
<br>
[English Introduction](README.md)
Nightingale 是一套衍生自 Open-Falcon 的互联网监控解决方案,融入了部分滴滴生产环境的最佳实践,灵活易用,稳定可靠,是一个生产环境直接可用的版本 :-)
## 文档
使用手册请参考:[夜莺使用手册](https://n9e.didiyun.com/)
## 编译
```bash
mkdir -p $GOPATH/src/github.com/didi
cd $GOPATH/src/github.com/didi
git clone https://github.com/didi/nightingale.git
cd nightingale
./control build
```
## 快速开始
使用 docker 和 docker-compose 环境可以快速部署一整套 nightingale 系统,涵盖了所有的核心组件。
* 强烈建议使用一个新的虚拟环境来部署和测试这个系统。
* 系统组件占用了以下端口,`80`, `5800`, `5810`, `5811`, `5820`, `5821`, `5830`, `5831`, `5840`, `5841`, `6379`, `2058`, `3306`,部署前请确保这些端口没有被使用。
使用 docker-compose 一键构建部署,完成以后可以使用浏览器打开 http://your-env-ip。 默认的登录账号密码均为 `root`
```bash
$ docker-compose up -d
```
![dashboard](https://user-images.githubusercontent.com/19553554/78956965-8b9c6180-7b16-11ea-9747-6ed5e62b068d.png)
## 版本升级
如果需要从 `v1.4.0` 之前的版本升级到 `v1.4.0` , 按照 [v1.4.0](https://github.com/didi/nightingale/releases/tag/v1.4.0) release 说明操作即可
## 团队
[ulricqin](https://github.com/ulricqin) [710leo](https://github.com/710leo) [jsers](https://github.com/jsers) [hujter](https://github.com/hujter) [n4mine](https://github.com/n4mine) [heli567](https://github.com/heli567)
## 社区
[github.com/n9e](https://github.com/n9e) 是为夜莺所创建的 Organization用于收集和开发夜莺周边项目。
## License
<img alt="Apache-2.0 license" src="https://s3-gz01.didistatic.com/n9e-pub/image/apache.jpeg" width="128">
Nightingale 基于 Apache-2.0 许可证进行分发和使用,更多信息参见 [LICENSE](LICENSE)。

View File

@ -1,46 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: ulric.qin@gmail.com
import time
import commands
import json
import sys
import os
items = []
def collect_myself_status():
item = {}
item["metric"] = "plugin.myself.status"
item["value"] = 1
item["tags"] = ""
items.append(item)
def main():
code, endpoint = commands.getstatusoutput(
"timeout 1 /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1")
if code != 0:
sys.stderr.write('cannot get local ip')
return
timestamp = int("%d" % time.time())
plugin_name = os.path.basename(sys.argv[0])
step = int(plugin_name.split("_", 1)[0])
collect_myself_status()
for item in items:
item["endpoint"] = endpoint
item["timestamp"] = timestamp
item["step"] = step
print json.dumps(items)
if __name__ == "__main__":
sys.stdout.flush()
main()
sys.stdout.flush()

View File

@ -1,16 +0,0 @@
#!/bin/bash
# author: ulric.qin@gmail.com
duration=$(cat /proc/uptime | awk '{print $1}')
localip=$(/usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1)
step=$(basename $0|awk -F'_' '{print $1}')
echo '[
{
"endpoint": "'${localip}'",
"tags": "",
"timestamp": '$(date +%s)',
"metric": "sys.uptime.duration",
"value": '${duration}',
"step": '${step}'
}
]'