Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

replace TSDASH_PLOT_DIR envar with plot.tsdash.dir property

  • Loading branch information...
commit 4b218523e8e05a653ba3ac50b54f0c5dab083ce5 1 parent df850d8
Claudiu Dan Gheorghe claudiugh authored
7 conf/tsdash.properties
View
@@ -2,12 +2,13 @@
hbase.tsdash.datatable=tsdb
hbase.tsdash.uidtable=tsdb-uid
+hbase.zookeeper.quorum=localhost
+
# urlpattern is the pattern used to generate URLs of the plots generated by running Gnuplot
# The parameters are:
# - %h host
-# - %p port
+# - %p port; by default is 8090
# - %f filename
plot.tsdash.urlpattern=http://%h:%p/plots/%f
-hbase.zookeeper.quorum=localhost
-
+plot.tsdash.dir=/var/www/tsdash/plots
1  server/.gitignore
View
@@ -1 +1,2 @@
build/
+bin/
6 server/src/com/facebook/tsdb/tsdash/server/TsdbServlet.java
View
@@ -48,6 +48,9 @@
public static final String URL_PATTERN_PARAM = "plot.tsdash.urlpattern";
public static final String DEFAULT_URL_PATTERN = "http://%h:%p/plots/%f";
public static final int DEFAULT_PLOT_PORT = 8090;
+ public static final String PLOTS_DIR_PARAM = "plot.tsdash.dir";
+ public static final String DEFAULT_PLOTS_DIR = "/tmp";
+ public static String plotsDir = DEFAULT_PLOTS_DIR;
private static String URLPattern = DEFAULT_URL_PATTERN;
private String hostname = null;
@@ -60,6 +63,9 @@ private static void loadConfiguration() {
URLPattern = tsdbConf.getProperty(URL_PATTERN_PARAM,
DEFAULT_URL_PATTERN);
logger.info("URL pattern: " + URLPattern);
+ plotsDir = tsdbConf.getProperty(PLOTS_DIR_PARAM,
+ DEFAULT_PLOTS_DIR);
+ logger.info("Plots are being written to: " + plotsDir);
} catch (FileNotFoundException e) {
System.err.println("Cannot find " + PROPERTIES_FILE);
} catch (IOException e) {
14 server/src/com/facebook/tsdb/tsdash/server/gnuplot/GnuplotProcess.java
View
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Random;
+import com.facebook.tsdb.tsdash.server.TsdbServlet;
import com.facebook.tsdb.tsdash.server.model.Metric;
public abstract class GnuplotProcess {
@@ -33,11 +34,6 @@
public static final String BASH = "/bin/bash";
public static final String GNUPLOT = "/usr/local/bin/gnuplot";
private static Random rand = new Random();
- private static String outputDir;
-
- static {
- outputDir = System.getenv(OUTPUT_DIR_ENV);
- }
protected Process gnuplot;
protected BufferedWriter gnuplotStdin;
@@ -47,10 +43,6 @@
protected int plotNo = 0;
public GnuplotProcess() throws Exception {
- if (outputDir == null) {
- throw new Exception("Output dir not specified. Please set "
- + OUTPUT_DIR_ENV + " envirnonment variable");
- }
id = rand.nextInt();
if (id < 0) {
id = - id;
@@ -68,11 +60,11 @@ protected String getPipeFilename(int pipeNo) {
}
protected static String noDataFilename() {
- return outputDir + "/no_data.jpg";
+ return TsdbServlet.plotsDir + "/no_data.jpg";
}
protected String getOutputFilename(GnuplotOptions options) {
- return String.format("%s/%d-%d.%s", outputDir, id, plotNo,
+ return String.format("%s/%d-%d.%s", TsdbServlet.plotsDir, id, plotNo,
options.getTerminal());
}
Please sign in to comment.
Something went wrong with that request. Please try again.