fix
This commit is contained in:
parent
357c908612
commit
e8e596ba72
@ -8,19 +8,72 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
-author("licheng5").
|
||||
|
||||
%% 状态定义
|
||||
-define(STATUS_INACTIVE, 0).
|
||||
-define(STATUS_ONLINE, 1).
|
||||
-define(STATUS_OFFLINE, 2).
|
||||
-define(STATUS_DELETE, 3).
|
||||
%% 主机状态定义
|
||||
-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,
|
||||
%% 接入时间
|
||||
activated_ts = 0 :: integer(),
|
||||
%% 最后上线时间
|
||||
update_ts = 0 :: integer(),
|
||||
status = 0 :: integer()
|
||||
}).
|
||||
|
||||
@ -39,7 +39,7 @@ insert(Id, Name, Model, CellId) ->
|
||||
cell_id = CellId,
|
||||
terminal_num = 0,
|
||||
update_ts = 0,
|
||||
status = ?STATUS_INACTIVE
|
||||
status = ?HOST_STATUS_INACTIVE
|
||||
},
|
||||
|
||||
case mnesia:transaction(fun() -> mnesia:write(host, Host, write) end) of
|
||||
|
||||
@ -36,7 +36,7 @@ insert(Id, HostId, Name, ProductId, VendorId, Model, CellId) ->
|
||||
cell_id = CellId,
|
||||
host_id = HostId,
|
||||
update_ts = 0,
|
||||
status = ?STATUS_INACTIVE
|
||||
status = ?HOST_STATUS_INACTIVE
|
||||
},
|
||||
|
||||
case mnesia:transaction(fun() -> mnesia:write(terminal, Terminal, write) end) of
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user