From 7ae79fe3a50f07f6674a7f4ce4ea8ba37b97c3f6 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 24 Mar 2021 14:10:17 -0700 Subject: [PATCH] graphite: restart collectd on upgrade --- src/services.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/services.js b/src/services.js index 6afa87d25..9a0851d53 100644 --- a/src/services.js +++ b/src/services.js @@ -1825,7 +1825,12 @@ function startGraphite(existingInfra, serviceConfig, callback) { shell.sudo('removeGraphiteDir', [ RMADDONDIR_CMD, 'graphite' ], {}, done); }, shell.exec.bind(null, 'startGraphite', cmd) - ], callback); + ], function (error) { + // restart collectd to get the disk stats after graphite starts. currently, there is no way to do graphite health check + if (!error) setTimeout(() => shell.sudo('restartcollectd', [ RESTART_SERVICE_CMD, 'collectd' ], {}, NOOP_CALLBACK), 60000); + + callback(error); + }); } function setupProxyAuth(app, options, callback) { @@ -2156,10 +2161,7 @@ function restartGraphite(callback) { docker.restartContainer('graphite', callback); - setTimeout(function () { - // wait for graphite to startup and then restart collectd. graphite migrations can be quite slow! - shell.sudo('restartcollectd', [ RESTART_SERVICE_CMD, 'collectd' ], {}, NOOP_CALLBACK); - }, 60000); + setTimeout(() => shell.sudo('restartcollectd', [ RESTART_SERVICE_CMD, 'collectd' ], {}, NOOP_CALLBACK), 60000); } function teardownOauth(app, options, callback) {