Commit a24a4900 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

fnordmetric enterprise: implement --swapfile option, allow to run without /tmp/fnordmetric

parent 31f91ed5
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ FnordMetric Enterprise is configures using command line options. The valid optio
  <tr>
    <td>--tcp-threads <i>num_threads</i></th>
    <td>
      Number of worker threads for the TCP server.
      Number of worker threads for the TCP server. (default: 4)
    </td>
  </tr>
  <tr>
@@ -25,7 +25,7 @@ FnordMetric Enterprise is configures using command line options. The valid optio
  <tr>
    <td>--udp-threads <i>num_threads</i></th>
    <td>
      Number of worker threads for the UDP server.
      Number of worker threads for the UDP server. (default: 4)
    </td>
  </tr>
  <tr>
@@ -37,7 +37,7 @@ FnordMetric Enterprise is configures using command line options. The valid optio
  <tr>
    <td>--websocket-threads <i>num_threads</i></th>
    <td>
      Number of worker threads for the WebSocket server.
      Number of worker threads for the WebSocket server. (default: 4)
    </td>
  </tr>
  <tr>
@@ -49,7 +49,7 @@ FnordMetric Enterprise is configures using command line options. The valid optio
  <tr>
    <td>--http-threads <i>num_threads</i></th>
    <td>
      Number of worker threads for the HTTP server.
      Number of worker threads for the HTTP server. (default: 4)
    </td>
  </tr>
  <tr>
@@ -58,6 +58,12 @@ FnordMetric Enterprise is configures using command line options. The valid optio
      Start the Admin interface on this port.
    </td>
  </tr>
  <tr>
    <td>--swapdir <i>path</i></th>
    <td>
      Directory in which FnordMetric will store the metric peristence files on disk (default: /tmp)
    </td>
  </tr>
  <tr>
    <td>-d</th>
    <td>
+2 −3
Original line number Diff line number Diff line
@@ -2,12 +2,11 @@
Todo
====

  → fnordmetric-doc: proper screenshot in enterprise index
  → fnordmetric-enterprise: start without /tmp/fnordmetric
  → fnordmetric-enterprise: admin interface
  → fnordmetric-enterprise: csv export
  → fnordmetric-doc: proper screenshot in enterprise index
  → fnordmetric-ui: sum & avg in client
  → fnordmetric-doc: enterprise deployment (init script, puppet)
  → fnordmetric-enterprise: csv export


Next
+16 −5
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ object FnordMetric {
    'websocket_threads -> "4",
    'tcp_threads       -> "4",
    'udp_threads       -> "4",
    'swap_prefix -> "/tmp/fnordmetric"
    'swap_prefix       -> "/tmp"
  )

  val number_format = new DecimalFormat("0.#####")
@@ -66,6 +66,9 @@ object FnordMetric {
      else if (args(n) == "--udp-threads")
        { CONFIG += (('udp_threads, args(n+1))); n += 2 }

      else if (args(n) == "--swapdir")
        { CONFIG += (('swap_prefix, args(n+1))); n += 2 }

      else if ((args(n) == "-d") || (args(n) == "--debug"))
        { debug = true; n += 1 }

@@ -89,14 +92,17 @@ object FnordMetric {
  }

  def boot = try {
    FnordMetric.log("FnordMetric Enterprise " + VERSION + " (c) 2013 Paul Asmuth")

    FnordMetric.log("Booting...")
    FnordMetric.log("    swapdir: " + FnordMetric.CONFIG('swap_prefix))

    flock = new RandomAccessFile(
      new File(FnordMetric.CONFIG('swap_prefix), "server.lck"),
      new File(FnordMetric.CONFIG('swap_prefix), "fnordmetric_server.lck"),
        "rw").getChannel.tryLock

    if (flock == null)
      error("cannot aquire server.lck", true)
      error("cannot aquire fnordmetric_server.lck", true)

    val sched = new Scheduler
    sched.start
@@ -134,11 +140,16 @@ object FnordMetric {
    if (show_banner) banner()

    println("usage: fnordmetric-server [options]                                            ")
    println("  --http               <port>   start http server on this port                 ")
    println("  --http-threads       <num>    number of http worker-threads (default: 4)     ")
    println("  --tcp-threads        <num>    number of tcp worker-threads (default: 4)      ")
    println("  --tcp                <port>   start tcp server on this port                  ")
    println("  --udp-threads        <num>    number of udp worker-threads (default: 4)      ")
    println("  --udp                <port>   start udp server on this port                  ")
    println("  --websocket          <port>   start websocket server on this port            ")
    println("  --websocket-threads  <num>    number of websocket worker-threads (default: 4)")
    println("  --http               <port>   start http server on this port                 ")
    println("  --http-threads       <num>    number of http worker-threads (default: 4)     ")
    println("  --admin              <port>   start http admin web interface on this port    ")
    println("  --swapdir            <path>   store the metric persistence files here (default: /tmp)")
    println("  -h, --help                    you're reading it...                           ")
    println("  -d, --debug                   debug mode                                     ")
  }
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ class SwapFile(metric_key: MetricKey) {
  // 8 bytes value as double precision ieee 754 float)
  val BLOCK_SIZE = 18

  val file_name = "metric-" + metric_key.key +
  val file_name = "fnordmetric-" + metric_key.key +
    metric_key.mode + "-" + metric_key.flush_interval

  val file = new RandomAccessFile(new File(