summaryrefslogtreecommitdiffstats
path: root/metrics-proxy
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2020-03-05 01:15:40 +0100
committergjoranv <gv@verizonmedia.com>2020-03-05 13:40:41 +0100
commit122cb8dd9c81037cf87a4fb8c6633fe3b609e00e (patch)
tree95e93f74a614cc57d88fb525beb0ae07cefa339b /metrics-proxy
parentaccc56ff5c08007c3f5b44fb04d9e9f07fda2629 (diff)
Use new scripts for starting/stopping the Telegraf process.
Diffstat (limited to 'metrics-proxy')
-rw-r--r--metrics-proxy/src/main/java/ai/vespa/metricsproxy/telegraf/Telegraf.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/telegraf/Telegraf.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/telegraf/Telegraf.java
index c12cf5b2e09..549371ffb74 100644
--- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/telegraf/Telegraf.java
+++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/telegraf/Telegraf.java
@@ -6,7 +6,6 @@ import com.yahoo.component.AbstractComponent;
import com.yahoo.log.LogLevel;
import com.yahoo.system.execution.ProcessExecutor;
import com.yahoo.system.execution.ProcessResult;
-import com.yahoo.vespa.defaults.Defaults;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
@@ -16,6 +15,7 @@ import java.io.Reader;
import java.io.Writer;
import java.util.logging.Logger;
+import static com.yahoo.vespa.defaults.Defaults.getDefaults;
import static com.yahoo.yolean.Exceptions.uncheck;
/**
@@ -23,9 +23,15 @@ import static com.yahoo.yolean.Exceptions.uncheck;
*/
public class Telegraf extends AbstractComponent {
- private static final String TELEGRAF_CONFIG_PATH = "/etc/telegraf/telegraf.conf";
+ // These paths must coincide with the paths in the start/stop-telegraf shell scripts.
+ private static final String TELEGRAF_CONFIG_PATH = getDefaults().underVespaHome("conf/telegraf/telegraf.conf");
+ private static final String TELEGRAF_LOG_FILE_PATH = getDefaults().underVespaHome("logs/telegraf/telegraf.log");
+
+ private static final String START_TELEGRAF_SCRIPT = getDefaults().underVespaHome("libexec/vespa/start-telegraf.sh");
+ private static final String STOP_TELEGRAF_SCRIPT = getDefaults().underVespaHome("libexec/vespa/stop-telegraf.sh");
+
private static final String TELEGRAF_CONFIG_TEMPLATE_PATH = "templates/telegraf.conf.vm";
- private static final String TELEGRAF_LOG_FILE_PATH = Defaults.getDefaults().underVespaHome("logs/telegraf/telegraf.log");
+
private final TelegrafRegistry telegrafRegistry;
private static final Logger logger = Logger.getLogger(Telegraf.class.getName());
@@ -53,11 +59,12 @@ public class Telegraf extends AbstractComponent {
}
private void restartTelegraf() {
- executeCommand("service telegraf restart");
+ executeCommand(STOP_TELEGRAF_SCRIPT);
+ executeCommand(START_TELEGRAF_SCRIPT);
}
private void stopTelegraf() {
- executeCommand("service telegraf stop");
+ executeCommand(STOP_TELEGRAF_SCRIPT);
}
private void executeCommand(String command) {