summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-04-12 16:30:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-04-12 16:30:45 +0000
commit105ad30a29266eafedd8ef79bc21218b92415907 (patch)
treeca61c4aec3a3feceef50a88e5d125bbb2621ad3a /daemon
parentReleasing debian version 1.30.0-1. (diff)
downloadnetdata-105ad30a29266eafedd8ef79bc21218b92415907.tar.xz
netdata-105ad30a29266eafedd8ef79bc21218b92415907.zip
Merging upstream version 1.30.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--daemon/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/daemon/main.c b/daemon/main.c
index 346486a84..93ec78b6a 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -29,6 +29,10 @@ void netdata_cleanup_and_exit(int ret) {
send_statistics("EXIT", ret?"ERROR":"OK","-");
+ char agent_crash_file[FILENAME_MAX + 1];
+ snprintfz(agent_crash_file, FILENAME_MAX, "%s/.agent_crash", netdata_configured_varlib_dir);
+ (void) unlink(agent_crash_file);
+
// cleanup/save the database and exit
info("EXIT: cleaning up the database...");
rrdhost_cleanup_all();
@@ -1456,6 +1460,14 @@ int main(int argc, char **argv) {
if(rrd_init(netdata_configured_hostname, system_info))
fatal("Cannot initialize localhost instance with name '%s'.", netdata_configured_hostname);
+ char agent_crash_file[FILENAME_MAX + 1];
+ snprintfz(agent_crash_file, FILENAME_MAX, "%s/.agent_crash", netdata_configured_varlib_dir);
+ int crash_detected = (unlink(agent_crash_file) == 0);
+ int fd = open(agent_crash_file, O_WRONLY | O_CREAT | O_TRUNC, 444);
+ if (fd >= 0)
+ close(fd);
+
+
// ------------------------------------------------------------------------
// Claim netdata agent to a cloud endpoint
@@ -1498,6 +1510,8 @@ int main(int argc, char **argv) {
netdata_ready = 1;
send_statistics("START", "-", "-");
+ if (crash_detected)
+ send_statistics("CRASH", "-", "-");
// ------------------------------------------------------------------------
// Report ACLK build failure