PlotMachine.org

What is it?

PlotMachine is a tool for plotting key-value data. The advatnage of PlotMachine is that it is simple to install and simple to use.
Take a look: plot , dashboard.
PlotMachine is under active development.
Embedded:
So, please, forgive the temporarily ugly look.

Features

  • Free
  • Open source
  • Simple to install:
    • Download Cassandra, uncompress it, configure 1 line in cassandra.yaml and run bin/cassandra (on Windows bin\cassandra.bat)
    • Configure conf.properties
    • Drop into Tomcat, Jetty etc.
    • Start using
  • Simple to use
    In order to add data, just pass key value on the URL
    In order to view plots, define plots in JavaScript in a few seconds

How to

Prerequisites

  • Java 7
  • Cassandra
  • Servlet container such as Tomcat or Jetty

How to install

  • Download Cassandra
    uncompress it
    in conf/cassandra.yaml set the partitioner:
    partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner

    and run bin/cassandra (on Windows bin\cassandra.bat)
  • Configure log4j.properties to tell it where to write the log
  • Drop into Tomcat's webapps directory.

How to add data from an HTML page

  • Include the following before </body>:
    <script language="javascript" type="text/javascript" src="http://WHERE_YOU_INSTALLED_PLOTMACHINE/js/plotmachine.api.js"></script>
  • Decide how you would like to call whatever you measure. For example, let's call your measurement my_test
  • Add this to the page: <script>PlotMachine.add('http://WHERE_YOU_INSTALLED_PLOTMACHINE', 'my_test', 1);</script>

How to add data directly to PlotMachine

Make an HTTP GET request to
http://WHERE_YOU_INSTALLED_PLOTMACHINE/api/plotmachine/data/add?name=KEY&value=VALUE
where name is the name of what you're measuring and value is the current value of your measurement

Java Driver


Pass to the driver the path to plotmachine installation, measurement name and value
com.scriptedstuff.plotmachine.PlotMachine.add("http://SERVER:PORT/PATH", "page_views", 1);

How to install

Download the driver class: plotmachine.jar

How to plot data

  • Browse to http://WHERE_YOU_INSTALLED_PLOTMACHINE/plot.jsp
  • Define your plot in JavaScript Example:
    var name = 'my_plot';
    var from = '-1 week';
    var to = 'now';
    var names = ['my_test'];
    var refresh = 60000;
    var x = 'time';
    var y = 'my_test';
    var points = 50;

    Explanation:

    • name of the plot
    • from and to define the time period
      You can use 'now', 'minute', 'hour', 'day', 'week', 'month', 'year'
      examples: '-5 minutes', '-12 hours', '-10 days', '-2 weeks', '-3 months'
      from and to can be in the format '10 Jan 2011 00:00:00'
    • names is an array of measurements you want to plot.
      For example, if you want to plot registered users and guest visitors, you will write: names = ['users', 'guests'];
    • refresh is the plot refresh rate in milliseconds
    • x and y and the names of the axes
    • points is the number of data points you want to see
    • every variable must be preceded by var
    • every statement must end in ;
    • name of plot and names of measurements must consist of english letters.
      Instead of space use _

How to plot increasing data

In some cases the measured value keeps increasing.
For example I measure the number of JMS messages that have been sent since the server was started. My server always returns the total since it was started and this total always grows.
In this case use:
var diff = true;

How to plot aggregated data

If you want to aggregate data by time period, use soemthing like:
var aggregate='1 hour';
IMPORTANT: when you use aggregate, do not use points

How to embed a plot in a web page

  • Define a plot as described above
  • Add this to your HTML: <script language="javascript" type="text/javascript" src="http://plotmachine.org/js/plotmachine.embedded.merged.js"></script>
  • Create a div for your plot. I noticed that jQuery sometimes needs defined size in pixels or percents
  • Call the plot: <script>PlotMachine.embed('DOMAIN WHERE YOU RUN PLOTMACHINE', 'NAME OF YOUR PLOT', 'ID OF THE DIV');</script>
  • This page embeds a plot. Look at the source.
    You can embed multiple plots on the same web page.

How to create a dashboard

  • Go to http://WHERE_YOU_INSTALLED_PLOTMACHINE/dashboard.jsp
  • Define a dashboard by setting name and plot names:
    var name = 'views';
    var plots = ['my_plot_a','my_plot_b'];

Roadmap

Currently working on faster display of large data
Please, send feedback: plotmachine@gmail.com
PlotMachinePlotting and monitoring tool