60 lines
1.1 KiB
Markdown
60 lines
1.1 KiB
Markdown
服务性能监控
|
||
|
||
适用场景:
|
||
-- 1、人数采集
|
||
2、服务性能
|
||
|
||
|
||
|
||
数据结构
|
||
{
|
||
id:int,
|
||
name:string,
|
||
host:sting,
|
||
area:string,
|
||
port:int,
|
||
url:string,
|
||
user:string,
|
||
sendto:string,
|
||
costtime:int,
|
||
status:bool,
|
||
clientip:string,
|
||
client_area:string,
|
||
}
|
||
|
||
工作流程:
|
||
1、client访问接口,按区域过滤获得需验证的服务明细(id,area,url)
|
||
2、访问服务的url获得状态及耗费时间(id,costtime,status)
|
||
3、将上述内容加上clientip,client_area发送给server端
|
||
4、server端将数据写入数据库,针对异常发送报警信息
|
||
|
||
mysql:
|
||
table:
|
||
service_name
|
||
id,name,host,area,port,url,user,sendto
|
||
service_info
|
||
id,costtime,status,clientip,client_area
|
||
|
||
server:
|
||
接口规划:
|
||
1、返回需监控的内容
|
||
get /getlist area
|
||
return (id,url)
|
||
2、记录监控的数据
|
||
post /putdata (id,costtime,status,clientip,client_area)
|
||
return bool
|
||
3、可用性接口
|
||
get /alive
|
||
return {status:1}
|
||
|
||
client:
|
||
--定期触发
|
||
持续运行,读取配置文件的时间间隔
|
||
实现可用性接口
|
||
get /alive
|
||
return {status:1}
|
||
日志记录
|
||
|
||
|
||
|