搜索看看
数据开放接口 / 1.获取监控日志列表接口
1、示例,下面【2】是参数说明:
请求URL:http://localhost:9999/fileWarnInfo/agentList 请求方式:POST 请求参数(Content-Type:application/json): { "wgToken":"65d05df102851c6535322e73b2f99c06", "hostname":"192.168.1.2" } 返回结果: { "msg":"", "code":"0", "data":[ { "filePath":"E:\\apache-tomcat-8.5.23\\logs", "active":"1", "warnChars":"ProtocolHandler", "remark":"", "hostname":"10.2.10.19", "fileSize":"21805", "createTime":1640612238000, "warnRows":"137", "id":"1474709995865112576", "fileNamePrefix":"catalina" } ] }
2、参数说明:
请求参数(Content-Type:application/json): { "wgToken":"必填,server/config/application.yml里的wgToken配置项的md5加密字符串,大小写均可", "hostname":"主机ip,完全匹配,非模糊查询" } 返回结果: { "msg":"错误信息", "code":"0成功1错误", "data":[ { "filePath":"监控日志文件或文件夹的完整路径", "active":"监控状态,1监控中,2已停止", "warnChars":"监控关键字,多个用逗号隔开", "remark":"备注", "hostname":"主机IP", "fileSize":"文件大小", "createTime":"添加时间,毫秒", "warnRows":"当前监控读取截至行数", "id":"1474709995865112576", "fileNamePrefix":"日志文件名称需包含的关键字(当监控日志文件夹时,此处才生效,用来标识文件夹下的日志文件名称里需要包含的关键字)" } ] }
2.获取监控日志告警详情信息接口
1.示例,下面【2】是参数说明:
请求URL:http://localhost:9999/fileWarnInfo/agentStateListList 请求方式:POST 请求参数(Content-Type:application/json): { "wgToken":"65d05df102851c6535322e73b2f99c06", "fileWarnId":"cc4d34273ce04273b3af0bb47909aa7a", "page":1, "pageSize":20 } 返回结果: { "msg":"", "code":"0", "data":{ "total":39, "pages":2, "pageSize":20, "page":1, "list":[ { "createTime":1607130461000, "warContent":"1453行出现告警关键字:
error
", "fileWarnId":"cc4d34273ce04273b3af0bb47909aa7a", "filePath":"E:/wgcloud/wgcloud-v3.2.8/server/log/wgcloud.2020-12-03.0.log", "id":"7cf987e3b4684f61a22a2abfd99e2f2d" } ] } }
2.参数说明:
请求参数(Content-Type:application/json): { "wgToken":"必填,server/config/application.yml里的wgToken配置项的md5加密字符串,v3.3.7之前版本字符串需小写,v3.3.7(含)之后大小写均可", "fileWarnId":"必填,监控文件id,即上面接口返回结果的id", "page":"必填,第几页", "pageSize":"必填,每页多少条" } 返回结果: { "msg":"错误信息", "code":"0成功1错误", "data":{ "total":"总数据条数", "pages":"总页数", "pageSize":"每页多少条", "page":"第几页", "list":[ { "createTime":"添加时间", "warContent":"告警内容", "fileWarnId":"监控文件id", "filePath":"日志文件路径", "id":"7cf987e3b4684f61a22a2abfd99e2f2d" } ] } }