summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-04-12 16:30:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-04-12 16:30:42 +0000
commita7baadb7f3cdd020beee095457f897c0698e7167 (patch)
treea0c92aa2e552902cb9b0d46ca0b9301e28260f54 /daemon
parentAdding upstream version 1.30.0. (diff)
downloadnetdata-a7baadb7f3cdd020beee095457f897c0698e7167.tar.xz
netdata-a7baadb7f3cdd020beee095457f897c0698e7167.zip
Adding upstream version 1.30.1.upstream/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 346486a8..93ec78b6 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