diff --git a/README.md b/README.md index 6136c36..d6ffef0 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ cd ServerStatus/server && make ```diff ! watchdog rule 可以为任何已知字段的表达式。 ! watchdog interval 最小通知间隔。 -! watchdog callback 可自定义为Get方法的URL,告警内容将拼接其后并发起回调。 +! watchdog callback 可自定义为Post方法的URL,告警内容将拼接其后并发起回调。 ! watchdog callback Telegram:https://api.telegram.org/bot你自己的密钥/sendMessage?parse_mode=HTML&disable_web_page_preview=true&chat_id=你自己的标识&text= ! watchdog callback Server酱: https://sctapi.ftqq.com/你自己的密钥.send?title=ServerStatus&desp= diff --git a/server/src/main.cpp b/server/src/main.cpp index 46d4ac1..36c5591 100644 --- a/server/src/main.cpp +++ b/server/src/main.cpp @@ -314,7 +314,6 @@ void CMain::WatchdogMessage(int ClientNetID, double load_1, double load_5, doubl time_t currentStamp = (long long)time(/*ago*/0); if ((currentStamp-Client(ClientID)->m_AlarmLastTime) > Watchdog(ID)->m_aInterval) { - //todo 这里需要换成线程 Client(ClientID)->m_AlarmLastTime = currentStamp; CURL *curl; CURLcode res; @@ -344,6 +343,7 @@ void CMain::WatchdogMessage(int ClientNetID, double load_1, double load_5, doubl sprintf(urlBuffer, "%s%s",Watchdog(ID)->m_aCallback, encodeUrl); + curl_easy_setopt(curl, CURLOPT_POST, 1); curl_easy_setopt(curl, CURLOPT_URL, urlBuffer); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 3L); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 6L);