This commit is contained in:
cppla 2022-07-13 16:55:38 +08:00
parent a1689acbf0
commit 7316dbdddb
2 changed files with 18 additions and 12 deletions
server/src

@ -310,15 +310,19 @@ void CMain::WatchdogMessage(int ClientNetID, double load_1, double load_5, doubl
if (expression.value() > 0)
{
int ClientID = ClientNetToClient(ClientNetID);
printf("node info: %s\n", Client(ClientID)->m_aUsername);
printf("node info: %s\n", Client(ClientID)->m_aName);
printf("node info: %s\n", Client(ClientID)->m_aType);
printf("node info: %s\n", Client(ClientID)->m_aHost);
printf("node info: %s\n\n", Client(ClientID)->m_aLocation);
printf("watchdog name: %s\n", Watchdog(ID)->m_aName);
printf("watchdog rule: %s\n", Watchdog(ID)->m_aRule);
time_t currentStamp = (long long)time(/*ago*/0);
if ((currentStamp-Client(ClientID)->m_AlarmLastTime) > 1800)
{
Client(ClientID)->m_AlarmLastTime = currentStamp;
printf("node info: %s\n", Client(ClientID)->m_aUsername);
printf("node info: %s\n", Client(ClientID)->m_aName);
printf("node info: %s\n", Client(ClientID)->m_aType);
printf("node info: %s\n", Client(ClientID)->m_aHost);
printf("node info: %s\n\n", Client(ClientID)->m_aLocation);
printf("watchdog name: %s\n", Watchdog(ID)->m_aName);
printf("watchdog rule: %s\n", Watchdog(ID)->m_aRule);
}
}
ID++;
}
}
@ -675,3 +679,4 @@ int main(int argc, const char *argv[])
return RetVal;
}

@ -38,10 +38,11 @@ class CMain
char m_aPassword[128];
int m_aMonthStart; //track month network traffic. by: https://cpp.la
int64_t m_LastNetworkIN;
int64_t m_LastNetworkOUT;
int64 m_TimeConnected;
int64 m_LastUpdate;
int64_t m_LastNetworkIN; //restore month traffic info.
int64_t m_LastNetworkOUT; //restore month traffic info.
int64_t m_TimeConnected;
int64_t m_LastUpdate;
int64_t m_AlarmLastTime; //record last alarm time.
struct CStats
{