How can I test the Librato service?

A quick way to test the Librato Metrics service is sending a measurement from the command-line with curl.

Set your your user id, api token and the location of the Librato Metrics API in your environment: (Your tokens are on the page).

LIBRATO_USERID="Librato Metrics userid (email address)"
LIBRATO_API_TOKEN="Librato Metrics API Token, (long alpha numeric string)"

When submitting measurements there are two ways to submit the POST request to our API:

  1. As individual arguments
  2. As parts of a single JSON document
  1. Submitting measurements as individual arguments:
curl -g \
  --include \
  -d 'gauges[0][name]=test_post_metric' \
  -d 'gauges[0][value]=1.23' \
  -X POST \
  1. Submitting measurements as a single JSON document
cat << EOF | curl \
  --include \
  -H 'Content-Type: application/json' \
  -d @- \

Both curl commands should produce output similar to this:

HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Date: Tue, 13 Nov 2012 14:44:57 GMT
Server: nginx/1.0.14
Status: 200 OK
Content-Length: 0
Connection: keep-alive

Note: If you use measure_time to send a time stamp with your metric make sure you use the unix timestamp format in seconds not milliseconds