123 lines
2.4 KiB
Erlang
123 lines
2.4 KiB
Erlang
%%%-------------------------------------------------------------------
|
||
%%% @author licheng5
|
||
%%% @copyright (C) 2023, <COMPANY>
|
||
%%% @doc
|
||
%%%
|
||
%%% @end
|
||
%%% Created : 14. 2月 2023 19:48
|
||
%%%-------------------------------------------------------------------
|
||
-author("licheng5").
|
||
|
||
%% 主机状态定义
|
||
-define(HOST_STATUS_INACTIVE, 0).
|
||
-define(HOST_STATUS_ONLINE, 1).
|
||
-define(HOST_STATUS_OFFLINE, 2).
|
||
-define(HOST_STATUS_DELETE, 3).
|
||
|
||
%% cpu相关
|
||
-record(cpu_metric, {
|
||
%% cpu编号
|
||
num = 1,
|
||
%% 负载
|
||
load = 0
|
||
}).
|
||
|
||
%% 内存相关, 单位kb
|
||
-record(memory_metric, {
|
||
%% 使用量
|
||
used = 0,
|
||
%% 总量
|
||
total = 0
|
||
}).
|
||
|
||
%% 硬盘相关, 单位kb
|
||
-record(disk_metric, {
|
||
%% 使用量
|
||
used = 0,
|
||
%% 总量
|
||
total = 0
|
||
}).
|
||
|
||
%% 接口相关
|
||
-record(interface_metric, {
|
||
%% 接口名称
|
||
name = <<>>,
|
||
%% 接口详情
|
||
desc = <<>>,
|
||
%% 接口状态
|
||
status
|
||
}).
|
||
|
||
%% 主机指标
|
||
-record(host_metrics, {
|
||
cpus = [],
|
||
cpu_temperature = 0,
|
||
memory = #memory_metric{},
|
||
disk = #disk_metric{},
|
||
interfaces = []
|
||
}).
|
||
|
||
%% 主机定义
|
||
-record(host, {
|
||
%% ID
|
||
id :: binary(),
|
||
%% 名称
|
||
name :: binary(),
|
||
%% 型号
|
||
model :: binary(),
|
||
%% 单元网格编号
|
||
cell_id :: integer(),
|
||
%% 接入设备数
|
||
terminal_num = 0 :: integer(),
|
||
%% 服务器指标
|
||
metrics = #host_metrics{},
|
||
%% 接入时间
|
||
activated_ts = 0 :: integer(),
|
||
%% 最后上线时间
|
||
update_ts = 0 :: integer(),
|
||
status = 0 :: integer()
|
||
}).
|
||
|
||
%% 终端表
|
||
-record(terminal, {
|
||
%% ID
|
||
id :: binary(),
|
||
%% 关联主机
|
||
host_id :: binary(),
|
||
%% 名称
|
||
name :: binary(),
|
||
%% 产品ID,枚举类型
|
||
product_id :: integer(),
|
||
%% 厂商ID,枚举类型
|
||
vendor_id :: integer(),
|
||
%% 型号
|
||
model :: binary(),
|
||
%% 所在单元ID,管理系统负责
|
||
cell_id :: integer(),
|
||
%% 终端状态
|
||
status = 0 :: integer(),
|
||
%% 最后上线时间
|
||
update_ts = 0 :: integer()
|
||
}).
|
||
|
||
%% 微服务表
|
||
-record(micro_service, {
|
||
%% ID
|
||
id :: binary(),
|
||
%% 关联主机
|
||
host_id :: binary(),
|
||
%% 名称
|
||
name :: binary(),
|
||
%% 产品ID,枚举类型
|
||
product_id :: integer(),
|
||
%% 厂商ID,枚举类型
|
||
vendor_id :: integer(),
|
||
%% 型号
|
||
model :: binary(),
|
||
%% 所在单元ID,管理系统负责
|
||
cell_id :: integer(),
|
||
%% 终端状态
|
||
status = 0 :: integer(),
|
||
%% 最后上线时间
|
||
update_ts = 0 :: integer()
|
||
}). |