增加一个todo

This commit is contained in:
cppla 2024-01-23 17:43:27 +08:00
parent 810f6a0d8a
commit fb3ecd1796
3 changed files with 33 additions and 8 deletions

@ -67,7 +67,7 @@ cd ServerStatus/server && make
#### 二、修改配置文件
```diff
! watchdog rule 可以为任何已知字段的表达式
! watchdog rule 可以为任何已知字段的表达式。注意Exprtk库默认使用窄字符类型中文等Unicode字符无法解析计算todo等待修复
! watchdog interval 最小通知间隔
! watchdog callback 可自定义为Post方法的URL告警内容将拼接其后并发起回调
@ -89,13 +89,21 @@ cd ServerStatus/server && make
"location": "🇨🇳",
"password": "USER_DEFAULT_PASSWORD",
"monthstart": 1
},
}
],
"monitors": [
{
"name": "百度一下",
"host": "https://www.baidu.com",
"interval": 60,
"type": "https"
}
],
"watchdog":
[
{
"name": "服务器负载高监控排除内存大于32G物理机同时排除俄勒冈机器",
"rule": "cpu>90&load_1>4&memory_total<33554432&name!='俄勒冈'",
"name": "服务器负载高监控排除内存大于32G物理机同时排除node1机器",
"rule": "cpu>90&load_1>4&memory_total<33554432&name!='node1'",
"interval": 600,
"callback": "https://yourSMSurl"
},
@ -106,8 +114,8 @@ cd ServerStatus/server && make
"callback": "https://yourSMSurl"
},
{
"name": "服务器宕机告警,排出俄勒冈排除s02",
"rule": "online4=0&online6=0&name!='俄勒冈'&username!='s02'",
"name": "服务器宕机告警,排出node1排除s02",
"rule": "online4=0&online6=0&name!='node1'&username!='s02'",
"interval": 600,
"callback": "https://yourSMSurl"
},
@ -124,7 +132,7 @@ cd ServerStatus/server && make
"callback": "https://yourSMSurl"
},
{
"name": "你可以组合任何已知字段的表达式",
"name": "你可以组合任何已知字段的表达式注意Exprtk库目前不支持中文等Unicode字符",
"rule": "(hdd_used/hdd_total)*100>95",
"interval": 1800,
"callback": "https://yourSMSurl"

@ -46,7 +46,7 @@
"type": "https"
},
{
"name": "主机交流",
"name": "502论坛",
"host": "https://www.hostloc.com",
"interval": 60,
"type": "https"

@ -278,6 +278,23 @@ void CMain::WatchdogMessage(int ClientNetID, double load_1, double load_5, doubl
int ID = 0;
while (strcmp(Watchdog(ID)->m_aName, "NULL"))
{
// Exprtk库默认使用窄字符类型但可能会出现中文等Unicode字符无法正确解析的问题。
// todo: 为解决此问题可以使用宽字符类型替换Exprtk库中默认的窄字符类型。
// #include <string>
// #include <vector>
// #include <exprtk.hpp>
// typedef exprtk::expression<wchar_t> expression_type;
// typedef exprtk::parser<wchar_t> parser_type;
// int main()
// {
// std::wstring expression_string = L"sin(x)";
// expression_type expression;
// parser_type parser;
// parser.compile(expression_string, expression);
// double x = 3.14;
// double result = expression.value();
// return 0;
// }
typedef exprtk::symbol_table<double> symbol_table_t;
typedef exprtk::expression<double> expression_t;
typedef exprtk::parser<double> parser_t;