mirror of https://github.com/veops/cmdb.git
md format
This commit is contained in:
parent
e45070ebdc
commit
7abc1ad581
28
README_en.md
28
README_en.md
|
@ -4,28 +4,30 @@
|
|||
[](https://github.com/sendya/ant-design-pro-vue)
|
||||
[](https://github.com/pallets/flask)
|
||||
|
||||
|
||||
[English](README_en.md) / [中文](README.md)
|
||||
|
||||
## DEMO ONLINE
|
||||
|
||||
- Preview online: <a href="https://cmdb.veops.cn" target="_blank">CMDB</a>
|
||||
- username: demo
|
||||
- password: 123456
|
||||
|
||||
> **ATTENTION**: branch `master` may be unstable as the result of continued development, please pull code from [releases](https://github.com/veops/cmdb/releases)
|
||||
|
||||
Overview
|
||||
-------------
|
||||
## Overview
|
||||
|
||||
### Technical Architecture
|
||||
|
||||
<img src=docs/view.png />
|
||||
|
||||
### Document
|
||||
|
||||
- <a href="https://zhuanlan.zhihu.com/p/98453732" target="_blank">Design Document</a>
|
||||
- <a href="https://github.com/veops/cmdb/tree/master/docs/cmdb_api.md" target="_blank">API Documentation</a>
|
||||
- <a href="https://mp.weixin.qq.com/s/EflmmJ-qdUkddTx2hRt3pA" target="_blank">Practice of Tree View</a>
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
- Flexibility
|
||||
1. Standardize and manage complex data assets
|
||||
2. Automatically discover and inventory IT assets
|
||||
|
@ -38,6 +40,7 @@ Overview
|
|||
3. Custom field triggers
|
||||
|
||||
### Main Features
|
||||
|
||||
- Model attributes support indexing, multiple values, default sorting, font color, and computed properties.
|
||||
- Support automatic discovery, scheduled inspections, and file import.
|
||||
- Support resource, tree view, and relationship view display.
|
||||
|
@ -46,23 +49,27 @@ Overview
|
|||
- Support cross-model search.
|
||||
|
||||
### System Overview
|
||||
|
||||
- Service Tree
|
||||

|
||||
|
||||
[View more screenshots](docs/screenshot.md)
|
||||
|
||||
### More Features
|
||||
|
||||
> Welcome to visit VeOps official website to discover more free operations and maintenance systems.
|
||||
|
||||
## Recommended
|
||||
|
||||
[Spug - Open source lightweight automated operation and maintenance platform](https://github.com/openspug/spug)
|
||||
|
||||
Installation
|
||||
----
|
||||
### [One-Click Docker Quick Build](docs/docker_en.md)
|
||||
### [Local Setup](docs/local_en.md)
|
||||
### [Installation with Makefile](docs/makefile_en.md)
|
||||
## Installation
|
||||
|
||||
### [One-Click Docker Quick Build](docs/docker_en.md)
|
||||
|
||||
### [Local Setup](docs/local_en.md)
|
||||
|
||||
### [Installation with Makefile](docs/makefile_en.md)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -72,7 +79,8 @@ Installation
|
|||
1. Push to the branch (`git push origin my-feature`)
|
||||
1. Create new Pull Request
|
||||
|
||||
-----
|
||||
---
|
||||
|
||||
_**Welcome to join us through QQ group(336164978)**_
|
||||
|
||||

|
574
docs/cmdb_api.md
574
docs/cmdb_api.md
|
@ -79,78 +79,75 @@ Rule Endpoint
|
|||
```
|
||||
|
||||
## 状态返回码的定义
|
||||
* 200:成功
|
||||
* 400:失败
|
||||
* 401:未认证
|
||||
* 403:no permission
|
||||
* 404:not found
|
||||
* 500:服务器未知错误
|
||||
|
||||
- 200:成功
|
||||
- 400:失败
|
||||
- 401:未认证
|
||||
- 403:no permission
|
||||
- 404:not found
|
||||
- 500:服务器未知错误
|
||||
|
||||
## 用户接口
|
||||
|
||||
### CI 搜索接口
|
||||
|
||||
* GET `/api/v0.1/ci/s`
|
||||
* 参数
|
||||
* `string:_type` 搜索的ci_type,多个用分号隔开, 例如: _type:(server;vservser)
|
||||
* `string:q` 搜索表达式, 例如`q=hostname:cmdb*`
|
||||
* `string:fl` 返回字段(id, attr_name, attr_alias均可),英文半角逗号分隔
|
||||
* `string:ret_key` 返回字段类型 `Enum("id", "name", "alias")` 默认 `name`
|
||||
* `count` 指定一次返回CI数
|
||||
* `facet` 属性字段,逗号分隔,返回属性字段对应的所有值
|
||||
|
||||
* 搜索表达式:
|
||||
* 简单的字符串
|
||||
* `attribute:value` 指定属性搜索, `attribute`可以是`id`,`attr_name`和`attr_alias`
|
||||
* 以上的组合,逗号分隔
|
||||
|
||||
* 组合查询支持
|
||||
* `AND`关系-`默认关系`
|
||||
* `OR`关系 - eg.`-hostname:cmdb*`、
|
||||
* `NOT`关系-属性字段前加`~`eg. `~hostname:cmdb*`
|
||||
* `IN`查询. eg. `hostname:(cmdb*;cmdb-web*)` 小括号, 分号分隔
|
||||
* `RANGE`查询. eg. `hostname:[cmdb* _TO_ cmdb-web*]` `_TO_`分隔
|
||||
* `COMPARISON`查询. eg. `cpu_core_num:>5` 支持`>, >=, <, <=`
|
||||
- GET `/api/v0.1/ci/s`
|
||||
- 参数
|
||||
- `string:_type` 搜索的 ci_type,多个用分号隔开, 例如: \_type:(server;vservser)
|
||||
- `string:q` 搜索表达式, 例如`q=hostname:cmdb*`
|
||||
- `string:fl` 返回字段(id, attr_name, attr_alias 均可),英文半角逗号分隔
|
||||
- `string:ret_key` 返回字段类型 `Enum("id", "name", "alias")` 默认 `name`
|
||||
- `count` 指定一次返回 CI 数
|
||||
- `facet` 属性字段,逗号分隔,返回属性字段对应的所有值
|
||||
- 搜索表达式:
|
||||
- 简单的字符串
|
||||
- `attribute:value` 指定属性搜索, `attribute`可以是`id`,`attr_name`和`attr_alias`
|
||||
- 以上的组合,逗号分隔
|
||||
- 组合查询支持
|
||||
- `AND`关系-`默认关系`
|
||||
- `OR`关系 - eg.`-hostname:cmdb*`、
|
||||
- `NOT`关系-属性字段前加`~`eg. `~hostname:cmdb*`
|
||||
- `IN`查询. eg. `hostname:(cmdb*;cmdb-web*)` 小括号, 分号分隔
|
||||
- `RANGE`查询. eg. `hostname:[cmdb* _TO_ cmdb-web*]` `_TO_`分隔
|
||||
- `COMPARISON`查询. eg. `cpu_core_num:>5` 支持`>, >=, <, <=`
|
||||
|
||||
### CI Relation 搜索接口
|
||||
* GET `/api/v0.1/ci_relations/s`
|
||||
* 参数
|
||||
* `int:root_id` 搜索的根节点的ci_id
|
||||
* `int:level` 搜索的层级
|
||||
* `string:_type` 搜索的ci_type,多个用分号隔开, 例如: _type:(docker;kvm)
|
||||
* `string:q` 搜索表达式, 例如`q=hostname:cmdb*`
|
||||
* `string:fl` 返回字段(id, attr_name, attr_alias均可),英文半角逗号分隔
|
||||
* `string:ret_key` 返回字段类型 `Enum("id", "name", "alias")` 默认 `name`
|
||||
* `count` 指定一次返回CI数
|
||||
* `facet` 属性字段,逗号分隔,返回属性字段对应的所有值
|
||||
|
||||
* 搜索表达式:
|
||||
* 简单的字符串
|
||||
* `attribute:value` 指定属性搜索, `attribute`可以是`id`,`attr_name`和`attr_alias`
|
||||
* 以上的组合,逗号分隔
|
||||
|
||||
* 组合查询支持
|
||||
* `AND`关系-`默认关系`
|
||||
* `OR`关系 - eg.`-hostname:cmdb*`、
|
||||
* `NOT`关系-属性字段前加`~`eg. `~hostname:cmdb*`
|
||||
* `IN`查询. eg. `hostname:(cmdb*;cmdb-web*)` 小括号, 分号分隔
|
||||
* `RANGE`查询. eg. `hostname:[cmdb* _TO_ cmdb-web*]` `_TO_`分隔
|
||||
* `COMPARISON`查询. eg. `cpu_count:>5` 支持`>, >=, <, <=`
|
||||
|
||||
- GET `/api/v0.1/ci_relations/s`
|
||||
- 参数
|
||||
- `int:root_id` 搜索的根节点的 ci_id
|
||||
- `int:level` 搜索的层级
|
||||
- `string:_type` 搜索的 ci_type,多个用分号隔开, 例如: \_type:(docker;kvm)
|
||||
- `string:q` 搜索表达式, 例如`q=hostname:cmdb*`
|
||||
- `string:fl` 返回字段(id, attr_name, attr_alias 均可),英文半角逗号分隔
|
||||
- `string:ret_key` 返回字段类型 `Enum("id", "name", "alias")` 默认 `name`
|
||||
- `count` 指定一次返回 CI 数
|
||||
- `facet` 属性字段,逗号分隔,返回属性字段对应的所有值
|
||||
- 搜索表达式:
|
||||
- 简单的字符串
|
||||
- `attribute:value` 指定属性搜索, `attribute`可以是`id`,`attr_name`和`attr_alias`
|
||||
- 以上的组合,逗号分隔
|
||||
- 组合查询支持
|
||||
- `AND`关系-`默认关系`
|
||||
- `OR`关系 - eg.`-hostname:cmdb*`、
|
||||
- `NOT`关系-属性字段前加`~`eg. `~hostname:cmdb*`
|
||||
- `IN`查询. eg. `hostname:(cmdb*;cmdb-web*)` 小括号, 分号分隔
|
||||
- `RANGE`查询. eg. `hostname:[cmdb* _TO_ cmdb-web*]` `_TO_`分隔
|
||||
- `COMPARISON`查询. eg. `cpu_count:>5` 支持`>, >=, <, <=`
|
||||
|
||||
## api key 认证
|
||||
|
||||
每个用户会自动生成一个 `api key` 和 一个`secret`, 通过 API 接口使用的时候,需要提供一个参数 `_key`值为您的`api key`, 以及参数`_secret`值为除`_key`以外的参数,按照**参数名的字典序**排列,并连接到`url path` + `secret`之后的`sha1`**十六进制**值。
|
||||
|
||||
|
||||
## 管理接口
|
||||
|
||||
### Attribute 管理接口
|
||||
* GET `/api/v0.1/attributes/s` 列出所有属性
|
||||
* param
|
||||
* `string:q` 属性名称或者别名,允许为空
|
||||
* return
|
||||
|
||||
- GET `/api/v0.1/attributes/s` 列出所有属性
|
||||
|
||||
- param
|
||||
- `string:q` 属性名称或者别名,允许为空
|
||||
- return
|
||||
|
||||
```
|
||||
{
|
||||
|
@ -169,16 +166,14 @@ Rule Endpoint
|
|||
}
|
||||
```
|
||||
|
||||
* error 无
|
||||
|
||||
|
||||
* GET `/api/v0.1/attributes/<string:attr_name>`、 `/api/v0.1/attributes/<int:attr_id>` 根据属性名称、别名或ID获取属性
|
||||
* param
|
||||
* `string:attr_name` 属性名称或别名
|
||||
* `int:attr_id` 属性ID
|
||||
* `attr_id`和`attr_name`选其一
|
||||
* return
|
||||
- error 无
|
||||
|
||||
- GET `/api/v0.1/attributes/<string:attr_name>`、 `/api/v0.1/attributes/<int:attr_id>` 根据属性名称、别名或 ID 获取属性
|
||||
- param
|
||||
- `string:attr_name` 属性名称或别名
|
||||
- `int:attr_id` 属性 ID
|
||||
- `attr_id`和`attr_name`选其一
|
||||
- return
|
||||
```
|
||||
{
|
||||
"attribute": {
|
||||
|
@ -193,20 +188,35 @@ Rule Endpoint
|
|||
},
|
||||
}
|
||||
```
|
||||
- error
|
||||
- `404` 找不到属性
|
||||
- POST `/api/v0.1/attributes` 增加新的属性
|
||||
- param
|
||||
- `string:attr_name` 属性名称
|
||||
- `string:attr_alias` 属性别名,可为空,为空时等于`attr_name`
|
||||
- `boolean:choice_value` 若属性有预定义值, 则不能为空
|
||||
- `boolean:is_multivalue` 属性是否允许多值,默认`False`
|
||||
- `boolean:is_uniq` 属性是否唯一,默认`False`
|
||||
- `string:value_type` 属性值类型, `Enum("text", "int", "float", "date")`, 默认`text`
|
||||
- return
|
||||
```
|
||||
{
|
||||
"attr_id":1
|
||||
}
|
||||
```
|
||||
- error
|
||||
- `500` 属性已存在
|
||||
- `500` 属性增加失败
|
||||
- PUT `/api/v0.1/attributes/<int:attr_id>` 修改属性
|
||||
|
||||
* error
|
||||
* `404` 找不到属性
|
||||
|
||||
* POST `/api/v0.1/attributes` 增加新的属性
|
||||
* param
|
||||
* `string:attr_name` 属性名称
|
||||
* `string:attr_alias` 属性别名,可为空,为空时等于`attr_name`
|
||||
* `boolean:choice_value` 若属性有预定义值, 则不能为空
|
||||
* `boolean:is_multivalue` 属性是否允许多值,默认`False`
|
||||
* `boolean:is_uniq` 属性是否唯一,默认`False`
|
||||
* `string:value_type` 属性值类型, `Enum("text", "int", "float", "date")`, 默认`text`
|
||||
|
||||
* return
|
||||
- param
|
||||
- `string:attr_name` 属性名称
|
||||
- `string:attr_alias` 属性别名,可为空,为空时等于`attr_name`
|
||||
- `boolean:choice_value` 若属性有预定义值, 则不能为空
|
||||
- `boolean:is_multivalue` 属性是否允许多值,值为 0 或者 1,默认`False`
|
||||
- `boolean:is_uniq` 属性是否唯一,值为 0 或者 1,默认`False`
|
||||
- `string:value_type` 属性值类型, `Enum("text", "int", "float", "date")`, 默认`text`
|
||||
- return
|
||||
|
||||
```
|
||||
{
|
||||
|
@ -214,51 +224,27 @@ Rule Endpoint
|
|||
}
|
||||
```
|
||||
|
||||
* error
|
||||
* `500` 属性已存在
|
||||
* `500` 属性增加失败
|
||||
|
||||
* PUT `/api/v0.1/attributes/<int:attr_id>` 修改属性
|
||||
* param
|
||||
* `string:attr_name` 属性名称
|
||||
* `string:attr_alias` 属性别名,可为空,为空时等于`attr_name`
|
||||
* `boolean:choice_value` 若属性有预定义值, 则不能为空
|
||||
* `boolean:is_multivalue` 属性是否允许多值,值为0或者1,默认`False`
|
||||
* `boolean:is_uniq` 属性是否唯一,值为0或者1,默认`False`
|
||||
* `string:value_type` 属性值类型, `Enum("text", "int", "float", "date")`, 默认`text`
|
||||
|
||||
* return
|
||||
|
||||
```
|
||||
{
|
||||
"attr_id":1
|
||||
}
|
||||
```
|
||||
|
||||
* error
|
||||
* `500` 属性已存在
|
||||
* `500` 属性增加失败
|
||||
|
||||
* DELETE `/api/v0.1/attributes/<int:attr_id>` 根据ID删除属性
|
||||
* param
|
||||
* `int:attr_id` 属性ID
|
||||
* return
|
||||
- error
|
||||
- `500` 属性已存在
|
||||
- `500` 属性增加失败
|
||||
|
||||
- DELETE `/api/v0.1/attributes/<int:attr_id>` 根据 ID 删除属性
|
||||
- param
|
||||
- `int:attr_id` 属性 ID
|
||||
- return
|
||||
```
|
||||
{
|
||||
"message":"attribute %s deleted" % attr_name
|
||||
}
|
||||
```
|
||||
|
||||
* error
|
||||
* `404` 属性不存在
|
||||
* `500` 删除属性失败
|
||||
- error
|
||||
- `404` 属性不存在
|
||||
- `500` 删除属性失败
|
||||
|
||||
#### CIType 属性管理
|
||||
|
||||
* GET `/api/v0.1/ci_types/<int:type_id>/attributes` 根据type_id查询固有属性列表
|
||||
* return
|
||||
|
||||
- GET `/api/v0.1/ci_types/<int:type_id>/attributes` 根据 type_id 查询固有属性列表
|
||||
- return
|
||||
```
|
||||
{
|
||||
"attributes": [
|
||||
|
@ -276,49 +262,41 @@ Rule Endpoint
|
|||
"type_id": 1,
|
||||
}
|
||||
```
|
||||
|
||||
* POST `/api/v0.1/ci_types/<int:type_id>/attributes` 根据`attr_id`增加CIType的属性
|
||||
* param
|
||||
* `string:attr_id` `,`分隔的`attr_id`
|
||||
* `int:is_required` 0或者1
|
||||
|
||||
* return
|
||||
|
||||
- POST `/api/v0.1/ci_types/<int:type_id>/attributes` 根据`attr_id`增加 CIType 的属性
|
||||
- param
|
||||
- `string:attr_id` `,`分隔的`attr_id`
|
||||
- `int:is_required` 0 或者 1
|
||||
- return
|
||||
```
|
||||
{
|
||||
"attributes":[1, 2, 3]
|
||||
}
|
||||
```
|
||||
- error
|
||||
- `404` CIType 不存在
|
||||
- `404` 属性不存在
|
||||
- `500` 增加失败
|
||||
- DELETE `/api/v0.1/ci_types/<int:type_id>/attributes` 删除 CIType 的属性
|
||||
- param
|
||||
|
||||
* error
|
||||
* `404` CIType不存在
|
||||
* `404` 属性不存在
|
||||
* `500` 增加失败
|
||||
|
||||
* DELETE `/api/v0.1/ci_types/<int:type_id>/attributes` 删除CIType的属性
|
||||
* param
|
||||
* `string:attr_id` `,`分隔的`attr_id`
|
||||
|
||||
* return
|
||||
- `string:attr_id` `,`分隔的`attr_id`
|
||||
|
||||
- return
|
||||
```
|
||||
{
|
||||
"attributes":[1, 2, 3]
|
||||
}
|
||||
```
|
||||
|
||||
* error
|
||||
* `404` CIType不存在
|
||||
* `404` 属性不存在
|
||||
* `500` 增加失败
|
||||
|
||||
- error
|
||||
- `404` CIType 不存在
|
||||
- `404` 属性不存在
|
||||
- `500` 增加失败
|
||||
|
||||
### CIType 管理接口
|
||||
|
||||
* `/api/v0.1/ci_types` 列出所有CI类型
|
||||
* param `string:type_name` 类型名称,允许为空
|
||||
* return
|
||||
|
||||
- `/api/v0.1/ci_types` 列出所有 CI 类型
|
||||
- param `string:type_name` 类型名称,允许为空
|
||||
- return
|
||||
```
|
||||
{
|
||||
"numfound": 2,
|
||||
|
@ -340,12 +318,10 @@ Rule Endpoint
|
|||
],
|
||||
}
|
||||
```
|
||||
* error 无
|
||||
|
||||
* GET `/api/v0.1/ci_types/query` 查询CI类型
|
||||
* param `string:q` 可以是type_id, type_name, type_alias
|
||||
* return
|
||||
|
||||
- error 无
|
||||
- GET `/api/v0.1/ci_types/query` 查询 CI 类型
|
||||
- param `string:q` 可以是 type_id, type_name, type_alias
|
||||
- return
|
||||
```
|
||||
{
|
||||
"citype": {
|
||||
|
@ -358,20 +334,40 @@ Rule Endpoint
|
|||
}
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `400` message=输入参数缺失
|
||||
* `404` message='citype is not found'
|
||||
- error
|
||||
- `400` message=输入参数缺失
|
||||
- `404` message='citype is not found'
|
||||
- POST `/api/v0.1/ci_types` 增加新 CIType
|
||||
- param (下列参数任意一个或多个)
|
||||
- `string:type_name` CIType 名称
|
||||
- `string:type_alias` 类型别名,可为空
|
||||
- `int:_id` 唯一属性 ID
|
||||
- `string:unique` 唯一属性名称
|
||||
- `_id`和`unique`只能二选一
|
||||
- `icon_url`
|
||||
- `enabled` 0/1
|
||||
- return
|
||||
```
|
||||
{
|
||||
"type_id": 2
|
||||
}
|
||||
```
|
||||
- error
|
||||
- `400` message=输入参数缺失
|
||||
- `500` message=CIType 已存在
|
||||
- `500` message=唯一属性不存在
|
||||
- `500` message=唯一属性不是唯一的
|
||||
- PUT `/api/v0.1/ci_types/<int:type_id>` 修改 CIType
|
||||
|
||||
* POST `/api/v0.1/ci_types` 增加新CIType
|
||||
* param (下列参数任意一个或多个)
|
||||
* `string:type_name` CIType名称
|
||||
* `string:type_alias` 类型别名,可为空
|
||||
* `int:_id` 唯一属性ID
|
||||
* `string:unique` 唯一属性名称
|
||||
* `_id`和`unique`只能二选一
|
||||
* `icon_url`
|
||||
* `enabled` 0/1
|
||||
* return
|
||||
- param (下列参数任意一个或多个)
|
||||
- `string:type_name` CIType 名称
|
||||
- `string:type_alias` 类型别名,可为空
|
||||
- `int:_id` 唯一属性 ID
|
||||
- `string:unique` 唯一属性名称
|
||||
- `_id`和`unique`只能二选一
|
||||
- `icon_url`
|
||||
- `enabled` 0/1
|
||||
- return
|
||||
|
||||
```
|
||||
{
|
||||
|
@ -379,67 +375,39 @@ Rule Endpoint
|
|||
}
|
||||
```
|
||||
|
||||
* error
|
||||
* `400` message=输入参数缺失
|
||||
* `500` message=CIType已存在
|
||||
* `500` message=唯一属性不存在
|
||||
* `500` message=唯一属性不是唯一的
|
||||
|
||||
* PUT `/api/v0.1/ci_types/<int:type_id>` 修改CIType
|
||||
* param (下列参数任意一个或多个)
|
||||
* `string:type_name` CIType名称
|
||||
* `string:type_alias` 类型别名,可为空
|
||||
* `int:_id` 唯一属性ID
|
||||
* `string:unique` 唯一属性名称
|
||||
* `_id`和`unique`只能二选一
|
||||
* `icon_url`
|
||||
* `enabled` 0/1
|
||||
* return
|
||||
- error
|
||||
- `400` message=输入参数缺失
|
||||
- `500` message=CIType 已存在
|
||||
- `500` message=唯一属性不存在
|
||||
- `500` message=唯一属性不是唯一的
|
||||
|
||||
- GET/POST `/api/v0.1/ci_types/<int:type_id>/enable` 修改 CIType
|
||||
- param
|
||||
- `enabled` 0 or 1
|
||||
- return
|
||||
```
|
||||
{
|
||||
"type_id": 2
|
||||
}
|
||||
```
|
||||
|
||||
* error
|
||||
* `400` message=输入参数缺失
|
||||
* `500` message=CIType已存在
|
||||
* `500` message=唯一属性不存在
|
||||
* `500` message=唯一属性不是唯一的
|
||||
|
||||
* GET/POST `/api/v0.1/ci_types/<int:type_id>/enable` 修改CIType
|
||||
* param
|
||||
* `enabled` 0 or 1
|
||||
* return
|
||||
|
||||
```
|
||||
{
|
||||
"type_id": 2
|
||||
}
|
||||
```
|
||||
|
||||
* error
|
||||
* `500` 设置失败
|
||||
* `404` CIType不存在
|
||||
|
||||
* DELETE `/api/v0.1/ci_types/<int:type_id>` 根据ID删除CIType
|
||||
* return
|
||||
|
||||
- error
|
||||
- `500` 设置失败
|
||||
- `404` CIType 不存在
|
||||
- DELETE `/api/v0.1/ci_types/<int:type_id>` 根据 ID 删除 CIType
|
||||
- return
|
||||
```
|
||||
{
|
||||
"message":"ci type %s deleted" % type_name
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `500` 删除失败
|
||||
* `404` CIType不存在
|
||||
- error
|
||||
- `500` 删除失败
|
||||
- `404` CIType 不存在
|
||||
|
||||
### CITypeRelation 管理接口
|
||||
|
||||
* GET `/api/v0.1/relation_types` 列出所有CIType关系类型名
|
||||
* return
|
||||
|
||||
- GET `/api/v0.1/relation_types` 列出所有 CIType 关系类型名
|
||||
- return
|
||||
```
|
||||
[
|
||||
{
|
||||
|
@ -452,11 +420,9 @@ Rule Endpoint
|
|||
}
|
||||
]
|
||||
```
|
||||
* error 无
|
||||
|
||||
* GET `/api/v0.1/ci_type_relations/<int:parent_id>/children` 返回所有child id
|
||||
* return
|
||||
|
||||
- error 无
|
||||
- GET `/api/v0.1/ci_type_relations/<int:parent_id>/children` 返回所有 child id
|
||||
- return
|
||||
```
|
||||
{
|
||||
"children": [
|
||||
|
@ -472,56 +438,53 @@ Rule Endpoint
|
|||
]
|
||||
}
|
||||
```
|
||||
* error 无
|
||||
- error 无
|
||||
- GET `/api/v0.1/ci_type_relations/<int:child_id>/parents` 返回 parent id
|
||||
|
||||
* GET `/api/v0.1/ci_type_relations/<int:child_id>/parents` 返回parent id
|
||||
* return
|
||||
- return
|
||||
|
||||
```
|
||||
{
|
||||
"parents": [{'parent':1, 'relaltion_type': 'containes', "ctr_id":1}],
|
||||
}
|
||||
```
|
||||
* error 无
|
||||
|
||||
- error 无
|
||||
|
||||
* POST `/api/v0.1/ci_type_relations/<int:parent_id>/<int:child_id>` 增加CIType关系
|
||||
* param
|
||||
* `string:relation_type` 类型名称
|
||||
* return
|
||||
|
||||
- POST `/api/v0.1/ci_type_relations/<int:parent_id>/<int:child_id>` 增加 CIType 关系
|
||||
- param
|
||||
- `string:relation_type` 类型名称
|
||||
- return
|
||||
```
|
||||
{
|
||||
"ctr_id": 1
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `500` 增加失败
|
||||
* `404` CIType不存在
|
||||
|
||||
* DELETE `/api/v0.1/ci_type_relations/<int:ctr_id>` 根据`ctr_id`删除CIType关系
|
||||
* return
|
||||
|
||||
- error
|
||||
- `500` 增加失败
|
||||
- `404` CIType 不存在
|
||||
- DELETE `/api/v0.1/ci_type_relations/<int:ctr_id>` 根据`ctr_id`删除 CIType 关系
|
||||
- return
|
||||
```
|
||||
{
|
||||
"message": "CIType relation deleted"
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `500` 删除失败
|
||||
* `404` 关系不存在
|
||||
|
||||
|
||||
- error
|
||||
- `500` 删除失败
|
||||
- `404` 关系不存在
|
||||
|
||||
### CI 管理接口
|
||||
|
||||
* GET `/api/v0.1/ci/type/<int:type_id>` 查询CIType的所有CI,一次返回25条记录
|
||||
* param
|
||||
* `string:fields` 返回属性名、id,逗号隔开
|
||||
* `string:ret_key` 返回属性key,默认'name',还可是'id', 'alias'
|
||||
* `int:page` 页码
|
||||
- GET `/api/v0.1/ci/type/<int:type_id>` 查询 CIType 的所有 CI,一次返回 25 条记录
|
||||
|
||||
* return
|
||||
- param
|
||||
|
||||
- `string:fields` 返回属性名、id,逗号隔开
|
||||
- `string:ret_key` 返回属性 key,默认'name',还可是'id', 'alias'
|
||||
- `int:page` 页码
|
||||
|
||||
- return
|
||||
|
||||
```
|
||||
{
|
||||
|
@ -542,12 +505,13 @@ Rule Endpoint
|
|||
]
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `404` CIType不存在
|
||||
|
||||
* GET `/api/v0.1/ci/<int:ci_id>` 查询CI
|
||||
- error
|
||||
- `404` CIType 不存在
|
||||
|
||||
* return
|
||||
- GET `/api/v0.1/ci/<int:ci_id>` 查询 CI
|
||||
|
||||
- return
|
||||
|
||||
```
|
||||
{
|
||||
|
@ -562,59 +526,51 @@ Rule Endpoint
|
|||
"ci_id": 1
|
||||
}
|
||||
```
|
||||
* error 无
|
||||
|
||||
- error 无
|
||||
|
||||
|
||||
* POST `/api/v0.1/ci` 增加CI
|
||||
* param
|
||||
* `string:ci_type` CIType name 或者id
|
||||
* `string:_no_attribute_policy` 当添加不存在的attribute时的策略, 默认`ignore`
|
||||
* 其他url参数`k=v`: `k` 为属性名(id或别名亦可), `v`为对应的值
|
||||
* 此CIType的`unique`字段必须包含在url参数中
|
||||
* return
|
||||
|
||||
- POST `/api/v0.1/ci` 增加 CI
|
||||
- param
|
||||
- `string:ci_type` CIType name 或者 id
|
||||
- `string:_no_attribute_policy` 当添加不存在的 attribute 时的策略, 默认`ignore`
|
||||
- 其他 url 参数`k=v`: `k` 为属性名(id 或别名亦可), `v`为对应的值
|
||||
- 此 CIType 的`unique`字段必须包含在 url 参数中
|
||||
- return
|
||||
```
|
||||
{
|
||||
"ci_id": 1,
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `500` 添加失败
|
||||
|
||||
* PUT `/api/v0.1/ci` 修改CI
|
||||
* param
|
||||
* `string:ci_type` CIType name 或者id
|
||||
* `string:_no_attribute_policy` 当添加不存在的attribute时的策略, 默认`ignore`
|
||||
* 其他url参数`k=v`: `k` 为属性名(id或别名亦可), `v`为对应的值
|
||||
* 此CIType的`unique`字段必须包含在url参数中
|
||||
* return
|
||||
|
||||
- error
|
||||
- `500` 添加失败
|
||||
- PUT `/api/v0.1/ci` 修改 CI
|
||||
- param
|
||||
- `string:ci_type` CIType name 或者 id
|
||||
- `string:_no_attribute_policy` 当添加不存在的 attribute 时的策略, 默认`ignore`
|
||||
- 其他 url 参数`k=v`: `k` 为属性名(id 或别名亦可), `v`为对应的值
|
||||
- 此 CIType 的`unique`字段必须包含在 url 参数中
|
||||
- return
|
||||
```
|
||||
{
|
||||
"ci_id":1,
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `500` 添加失败
|
||||
|
||||
* DELETE `/api/v0.1/ci/<int:ci_id>` 删除ci
|
||||
* return
|
||||
|
||||
- error
|
||||
- `500` 添加失败
|
||||
- DELETE `/api/v0.1/ci/<int:ci_id>` 删除 ci
|
||||
- return
|
||||
```
|
||||
{
|
||||
"message":"ok",
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `500` 删除失败
|
||||
|
||||
- error
|
||||
- `500` 删除失败
|
||||
|
||||
## CI Relation 管理接口
|
||||
|
||||
* GET `/api/v0.1/ci_relations/<int:first_ci_id>/second_cis` 返回所有second cis
|
||||
* return
|
||||
|
||||
- GET `/api/v0.1/ci_relations/<int:first_ci_id>/second_cis` 返回所有 second cis
|
||||
- return
|
||||
```
|
||||
{
|
||||
"numfound": 1,
|
||||
|
@ -629,10 +585,10 @@ Rule Endpoint
|
|||
]
|
||||
}
|
||||
```
|
||||
* error 无
|
||||
- error 无
|
||||
- GET `/api/v0.1/ci_relations/<int:second_ci_id>/first_cis` 返回 first cis
|
||||
|
||||
* GET `/api/v0.1/ci_relations/<int:second_ci_id>/first_cis` 返回first cis
|
||||
* return
|
||||
- return
|
||||
|
||||
```
|
||||
{
|
||||
|
@ -648,47 +604,42 @@ Rule Endpoint
|
|||
"numfound": 1
|
||||
}
|
||||
```
|
||||
* error 无
|
||||
|
||||
- error 无
|
||||
|
||||
* POST `/api/v0.1/ci_relations/<int:first_ci_id>/<int:second_ci_id>` 增加CI关系
|
||||
* param
|
||||
* `int: more` more实例
|
||||
* `string:relation_type` 类型名称
|
||||
* return
|
||||
|
||||
- POST `/api/v0.1/ci_relations/<int:first_ci_id>/<int:second_ci_id>` 增加 CI 关系
|
||||
- param
|
||||
- `int: more` more 实例
|
||||
- `string:relation_type` 类型名称
|
||||
- return
|
||||
```
|
||||
{
|
||||
"cr_id":1
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `500` 增加失败
|
||||
* `404` CI不存在
|
||||
|
||||
* DELETE `/api/v0.1/ci_relations/<int:cr_id>` 根据`cr_id`删除CI关系
|
||||
* return
|
||||
|
||||
- error
|
||||
- `500` 增加失败
|
||||
- `404` CI 不存在
|
||||
- DELETE `/api/v0.1/ci_relations/<int:cr_id>` 根据`cr_id`删除 CI 关系
|
||||
- return
|
||||
```
|
||||
{
|
||||
"message":"CIType relation deleted"
|
||||
}
|
||||
```
|
||||
* error
|
||||
* `500` 删除失败
|
||||
* `404` 关系不存在
|
||||
|
||||
|
||||
- error
|
||||
- `500` 删除失败
|
||||
- `404` 关系不存在
|
||||
|
||||
## 历史记录管理接口
|
||||
* GET `/api/v0.1/history/records` 查询历史记录
|
||||
* param
|
||||
* `int: page`
|
||||
* `string: username` 变更用户
|
||||
* `string: start` 变更开始时间
|
||||
* `string: end` 变更结束时间
|
||||
* return
|
||||
|
||||
- GET `/api/v0.1/history/records` 查询历史记录
|
||||
- param
|
||||
- `int: page`
|
||||
- `string: username` 变更用户
|
||||
- `string: start` 变更开始时间
|
||||
- `string: end` 变更结束时间
|
||||
- return
|
||||
```
|
||||
{
|
||||
"username": "",
|
||||
|
@ -710,11 +661,9 @@ Rule Endpoint
|
|||
]
|
||||
}
|
||||
```
|
||||
* error 无
|
||||
|
||||
* GET `/api/v0.1/history/records/<int:record_id>` 历史记录详情
|
||||
* return
|
||||
|
||||
- error 无
|
||||
- GET `/api/v0.1/history/records/<int:record_id>` 历史记录详情
|
||||
- return
|
||||
```
|
||||
{
|
||||
"username": "demo",
|
||||
|
@ -732,6 +681,5 @@ Rule Endpoint
|
|||
"attr_history": {}
|
||||
}
|
||||
```
|
||||
|
||||
* error
|
||||
* `404` 该记录不存在
|
||||
- error
|
||||
- `404` 该记录不存在
|
||||
|
|
|
@ -1,38 +1,33 @@
|
|||
# CMDB 查询 API 文档
|
||||
|
||||
|
||||
|
||||
## 用户接口
|
||||
|
||||
### CI 通用搜索接口
|
||||
|
||||
##### 搜索所有的 CI 实例
|
||||
|
||||
* GET `/api/v0.1/ci/s`
|
||||
* 参数
|
||||
* `string:_type` 搜索的ci_type,多个用分号隔开, 例如: _type:(docker;kvm)
|
||||
* `string:q` 搜索表达式, 例如`q=hostname:cmdb*`
|
||||
* `string:fl` 返回字段(id, attr_name, attr_alias均可),英文半角逗号分隔
|
||||
* `string:ret_key` 返回字段类型 `Enum("id", "name", "alias")` 默认 `name`
|
||||
* `count` 指定一次返回CI数
|
||||
* `facet` 属性字段,逗号分隔,返回属性字段对应的所有值
|
||||
|
||||
* 搜索表达式:
|
||||
* 简单的字符串
|
||||
* `attribute:value` 指定属性搜索, `attribute`可以是`id`,`attr_name`和`attr_alias`
|
||||
* 以上的组合,逗号分隔
|
||||
|
||||
* 组合查询支持
|
||||
* `AND`关系-`默认关系`
|
||||
* `OR`关系 - eg.`-hostname:cmdb*`、
|
||||
* `NOT`关系-属性字段前加`~`eg. `~hostname:cmdb*`
|
||||
* `IN`查询. eg. `hostname:(cmdb*;cmdb-web*)` 小括号, 分号分隔
|
||||
* `RANGE`查询. eg. `hostname:[cmdb* _TO_ cmdb-web*]` `_TO_`分隔
|
||||
* `COMPARISON`查询. eg. `cpu_count:>5` 支持`>, >=, <, <=`
|
||||
|
||||
* 返回结果
|
||||
* 搜索表达式 `/api/v0.1/ci/s?q=_type:kvm,status:在线,idc:南汇,private_ip:10.1.1.1*&page=1&fl=hostname,private_ip&facet=private_ip&count=1`
|
||||
* 返回数据(默认json)
|
||||
|
||||
- GET `/api/v0.1/ci/s`
|
||||
- 参数
|
||||
- `string:_type` 搜索的 ci_type,多个用分号隔开, 例如: \_type:(docker;kvm)
|
||||
- `string:q` 搜索表达式, 例如`q=hostname:cmdb*`
|
||||
- `string:fl` 返回字段(id, attr_name, attr_alias 均可),英文半角逗号分隔
|
||||
- `string:ret_key` 返回字段类型 `Enum("id", "name", "alias")` 默认 `name`
|
||||
- `count` 指定一次返回 CI 数
|
||||
- `facet` 属性字段,逗号分隔,返回属性字段对应的所有值
|
||||
- 搜索表达式:
|
||||
- 简单的字符串
|
||||
- `attribute:value` 指定属性搜索, `attribute`可以是`id`,`attr_name`和`attr_alias`
|
||||
- 以上的组合,逗号分隔
|
||||
- 组合查询支持
|
||||
- `AND`关系-`默认关系`
|
||||
- `OR`关系 - eg.`-hostname:cmdb*`、
|
||||
- `NOT`关系-属性字段前加`~`eg. `~hostname:cmdb*`
|
||||
- `IN`查询. eg. `hostname:(cmdb*;cmdb-web*)` 小括号, 分号分隔
|
||||
- `RANGE`查询. eg. `hostname:[cmdb* _TO_ cmdb-web*]` `_TO_`分隔
|
||||
- `COMPARISON`查询. eg. `cpu_count:>5` 支持`>, >=, <, <=`
|
||||
- 返回结果
|
||||
- 搜索表达式 `/api/v0.1/ci/s?q=_type:kvm,status:在线,idc:南汇,private_ip:10.1.1.1*&page=1&fl=hostname,private_ip&facet=private_ip&count=1`
|
||||
- 返回数据(默认 json)
|
||||
```
|
||||
{
|
||||
facet: {
|
||||
|
@ -75,34 +70,30 @@
|
|||
|
||||
##### 搜索所有的 CI 之间的关系,比如某一个产品线线的所有应用或者是所有服务器
|
||||
|
||||
* GET `/api/v0.1/ci_relations/s`
|
||||
* 参数
|
||||
* `int:root_id` 搜索的根节点的ci_id
|
||||
* `int:level` 搜索的层级
|
||||
* `string:_type` 搜索的ci_type,多个用分号隔开, 例如: _type:(docker;kvm)
|
||||
* `string:q` 搜索表达式, 例如`q=hostname:cmdb*`
|
||||
* `string:fl` 返回字段(id, attr_name, attr_alias均可),英文半角逗号分隔
|
||||
* `string:ret_key` 返回字段类型 `Enum("id", "name", "alias")` 默认 `name`
|
||||
* `count` 指定一次返回CI数
|
||||
* `facet` 属性字段,逗号分隔,返回属性字段对应的所有值
|
||||
|
||||
* 搜索表达式:
|
||||
* 简单的字符串
|
||||
* `attribute:value` 指定属性搜索, `attribute`可以是`id`,`attr_name`和`attr_alias`
|
||||
* 以上的组合,逗号分隔
|
||||
|
||||
* 组合查询支持
|
||||
* `AND`关系-`默认关系`
|
||||
* `OR`关系 - eg.`-hostname:cmdb*`、
|
||||
* `NOT`关系-属性字段前加`~`eg. `~hostname:cmdb*`
|
||||
* `IN`查询. eg. `hostname:(cmdb*;cmdb-web*)` 小括号, 分号分隔
|
||||
* `RANGE`查询. eg. `hostname:[cmdb* _TO_ cmdb-web*]` `_TO_`分隔
|
||||
* `COMPARISON`查询. eg. `cpu_count:>5` 支持`>, >=, <, <=`
|
||||
|
||||
* 返回结果
|
||||
* 搜索表达式 `/api/v0.1/ci_relations/s?root_id=53&level=3&q=_type:kvm,status:在线,idc:南汇,private_ip:10.1.1.1*&page=1&fl=hostname,private_ip&facet=private_ip&count=1`
|
||||
* 返回数据(默认json)
|
||||
|
||||
- GET `/api/v0.1/ci_relations/s`
|
||||
- 参数
|
||||
- `int:root_id` 搜索的根节点的 ci_id
|
||||
- `int:level` 搜索的层级
|
||||
- `string:_type` 搜索的 ci_type,多个用分号隔开, 例如: \_type:(docker;kvm)
|
||||
- `string:q` 搜索表达式, 例如`q=hostname:cmdb*`
|
||||
- `string:fl` 返回字段(id, attr_name, attr_alias 均可),英文半角逗号分隔
|
||||
- `string:ret_key` 返回字段类型 `Enum("id", "name", "alias")` 默认 `name`
|
||||
- `count` 指定一次返回 CI 数
|
||||
- `facet` 属性字段,逗号分隔,返回属性字段对应的所有值
|
||||
- 搜索表达式:
|
||||
- 简单的字符串
|
||||
- `attribute:value` 指定属性搜索, `attribute`可以是`id`,`attr_name`和`attr_alias`
|
||||
- 以上的组合,逗号分隔
|
||||
- 组合查询支持
|
||||
- `AND`关系-`默认关系`
|
||||
- `OR`关系 - eg.`-hostname:cmdb*`、
|
||||
- `NOT`关系-属性字段前加`~`eg. `~hostname:cmdb*`
|
||||
- `IN`查询. eg. `hostname:(cmdb*;cmdb-web*)` 小括号, 分号分隔
|
||||
- `RANGE`查询. eg. `hostname:[cmdb* _TO_ cmdb-web*]` `_TO_`分隔
|
||||
- `COMPARISON`查询. eg. `cpu_count:>5` 支持`>, >=, <, <=`
|
||||
- 返回结果
|
||||
- 搜索表达式 `/api/v0.1/ci_relations/s?root_id=53&level=3&q=_type:kvm,status:在线,idc:南汇,private_ip:10.1.1.1*&page=1&fl=hostname,private_ip&facet=private_ip&count=1`
|
||||
- 返回数据(默认 json)
|
||||
```
|
||||
{
|
||||
facet: {
|
||||
|
@ -140,4 +131,3 @@
|
|||
page: 1
|
||||
}
|
||||
```
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
- 进入主目录(先安装 docker 环境)
|
||||
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
### Install by Docker
|
||||
|
||||
- Prepare: install docker and docker-compose
|
||||
- In directory cmdb
|
||||
```
|
||||
|
|
|
@ -1,32 +1,33 @@
|
|||
本地搭建: 环境和依赖
|
||||
----
|
||||
## 本地搭建: 环境和依赖
|
||||
|
||||
- 存储: mysql, redis
|
||||
- python 版本: >=python3.8
|
||||
|
||||
Install
|
||||
----
|
||||
## Install
|
||||
|
||||
- 启动 mysql 服务, redis 服务
|
||||
|
||||
- 创建数据库 cmdb
|
||||
- 拉取代码
|
||||
|
||||
```bash
|
||||
git clone https://github.com/veops/cmdb.git
|
||||
cd cmdb
|
||||
cp cmdb-api/settings.example.py cmdb-api/settings.py
|
||||
```
|
||||
|
||||
**设置 cmdb-api/settings.py 里的 database**
|
||||
|
||||
- 安装库
|
||||
- 后端: ```cd cmdb-api && pipenv run pipenv install && cd ..```
|
||||
- 前端: ```cd cmdb-ui && yarn install && cd ..```
|
||||
|
||||
- 创建数据库表: 进入**cmdb-api**目录执行 ```pipenv run flask db-setup && pipenv run flask init-cache```
|
||||
- 后端: `cd cmdb-api && pipenv run pipenv install && cd ..`
|
||||
- 前端: `cd cmdb-ui && yarn install && cd ..`
|
||||
- 创建数据库表: 进入**cmdb-api**目录执行 `pipenv run flask db-setup && pipenv run flask init-cache`
|
||||
- 可以将 docs/cmdb.sql 导入到数据库里,登录用户和密码分别是:demo/123456
|
||||
|
||||
- 启动服务
|
||||
- 后端: 进入**cmdb-api**目录执行 ```pipenv run flask run -h 0.0.0.0```
|
||||
- 前端: 进入**cmdb-ui**目录执行```yarn run serve```
|
||||
- worker: 进入**cmdb-api**目录执行 ```pipenv run celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1```
|
||||
|
||||
- 后端: 进入**cmdb-api**目录执行 `pipenv run flask run -h 0.0.0.0`
|
||||
- 前端: 进入**cmdb-ui**目录执行`yarn run serve`
|
||||
- worker: 进入**cmdb-api**目录执行 `pipenv run celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1`
|
||||
|
||||
- 浏览器打开: [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
- 如果是非本机访问, 要修改**cmdb-ui/.env**里**VUE_APP_API_BASE_URL**里的 IP 地址为后端服务的 ip 地址
|
||||
|
|
|
@ -1,29 +1,31 @@
|
|||
### Install
|
||||
|
||||
- Start mysql, redis
|
||||
- Create mysql database: cmdb
|
||||
- Pull code
|
||||
|
||||
```bash
|
||||
git clone https://github.com/veops/cmdb.git
|
||||
cd cmdb
|
||||
cp cmdb-api/settings.example.py cmdb-api/settings.py
|
||||
```
|
||||
|
||||
**set database in config file cmdb-api/settings.py**
|
||||
|
||||
- Install library
|
||||
- backend: ```cd cmdb-api && pipenv run pipenv install && cd ..```
|
||||
- frontend: ```cd cmdb-ui && yarn install && cd ..```
|
||||
|
||||
- backend: `cd cmdb-api && pipenv run pipenv install && cd ..`
|
||||
- frontend: `cd cmdb-ui && yarn install && cd ..`
|
||||
- Create tables of cmdb database:
|
||||
|
||||
in **cmdb-api** directory: ```pipenv run flask db-setup && pipenv run flask init-cache```
|
||||
in **cmdb-api** directory: `pipenv run flask db-setup && pipenv run flask init-cache`
|
||||
- Suggest step: (default: user:demo,password:123456)
|
||||
|
||||
``` source docs/cmdb.sql```
|
||||
` source docs/cmdb.sql`
|
||||
|
||||
- Start service
|
||||
- backend: in **cmdb-api** directory: ```pipenv run flask run -h 0.0.0.0```
|
||||
- frontend: in **cmdb-ui** directory: ```yarn run serve```
|
||||
- worker: in **cmdb-api** directory: ```pipenv run celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1```
|
||||
|
||||
- backend: in **cmdb-api** directory: `pipenv run flask run -h 0.0.0.0`
|
||||
- frontend: in **cmdb-ui** directory: `yarn run serve`
|
||||
- worker: in **cmdb-api** directory: `pipenv run celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1`
|
||||
|
||||
- homepage: [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
- if not run localhost: please change ip address(**VUE_APP_API_BASE_URL**) in config file **cmdb-ui/.env** into your backend ip address
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
Install by Makefile
|
||||
----
|
||||
## Install by Makefile
|
||||
|
||||
- 启动 mysql 服务, redis 服务
|
||||
|
||||
- 创建数据库 cmdb
|
||||
- 拉取代码
|
||||
|
||||
```bash
|
||||
git clone https://github.com/veops/cmdb.git
|
||||
cd cmdb
|
||||
cp cmdb-api/settings.example.py cmdb-api/settings.py
|
||||
```
|
||||
|
||||
**设置 cmdb-api/settings.py 里的 database**
|
||||
|
||||
- 顺序在 cmdb 目录下执行
|
||||
- 环境: ```make env```
|
||||
- 启动API: ```make api```
|
||||
- 启动UI: ```make ui```
|
||||
- 启动worker: ```make worker```
|
||||
|
||||
- 环境: `make env`
|
||||
- 启动 API: `make api`
|
||||
- 启动 UI: `make ui`
|
||||
- 启动 worker: `make worker`
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
### Install by Makefile
|
||||
|
||||
- Start mysql,redis
|
||||
- Create mysql database: cmdb
|
||||
- Pull code
|
||||
|
||||
```bash
|
||||
git clone https://github.com/veops/cmdb.git
|
||||
cd cmdb
|
||||
cp cmdb-api/settings.example.py cmdb-api/settings.py
|
||||
```
|
||||
|
||||
**set database in config file cmdb-api/settings.py**
|
||||
|
||||
- In cmdb directory,start in order as follows:
|
||||
- enviroment: ```make env```
|
||||
- start API: ```make api```
|
||||
- start UI: ```make ui```
|
||||
- start worker: ```make worker```
|
||||
- enviroment: `make env`
|
||||
- start API: `make api`
|
||||
- start UI: `make ui`
|
||||
- start worker: `make worker`
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
### 系统概览
|
||||
|
||||
- 服务树
|
||||

|
||||
|
||||
|
@ -29,4 +30,3 @@
|
|||
- 定制仪表盘
|
||||
|
||||

|
||||
|
||||
|
|
Loading…
Reference in New Issue