heartbeat

Simple server monitor system using encrypted messages over udp
git clone https://noulin.net/git/heartbeat.git
Log | Files | Refs | README

commit ad1a0ee3518026b8bcc31bdc7d3581d2941d1ea5
parent a7d55d9ab30f58f5a1272b2f4133ed396a61d349
Author: Remy Noulin <loader2x@gmail.com>
Date:   Wed,  2 Aug 2023 21:23:48 +0200

add unknown state to show when no packet has been ever received from a machine

heartbeat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Diffstat:
Mheartbeat.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/heartbeat.c b/heartbeat.c @@ -751,7 +751,7 @@ void probe(char *cfgfile, char *secretFile, char *publicFile, char *loggerPublic iter(completeCfg, D) { if (!isOSmallDict(D)) continue; cast(smallDictt*,d,D); - setG(d, "state", "down"); // network state + setG(d, "state", "unknown"); // network state setG(d, "last", startTime); // network state change setG(d, "mId", 0); // last message id, if next mId under last one, the agent rebooted setG(d, "rebooted", FALSE); @@ -1000,7 +1000,7 @@ void probe(char *cfgfile, char *secretFile, char *publicFile, char *loggerPublic iter(completeCfg, D) { if (!isOSmallDict(D)) continue; cast(smallDictt*,d,D); - if (eqG($(d, "state"), "down")) continue; + if (eqG($(d, "state"), "down") or eqG($(d, "state"), "unknown")) continue; u64 timeout = u$(d, "timeout") ? u$(d, "timeout") : agentTimeOut; if (getCurrentUnixTime() - u$(d, "time") < timeout) continue; // send mail when agent is down