Wednesday, August 24, 2011

[Data In] Linux Command Line Data Logging

Nimbits provides you with an SDK (software development kit) that allows you to develop your own software using libraries we provided. These libraries simplify the use of the REST API which are web services you can also use to access Nimbits data.

Nimbits has a collection of REST web services you can use to create data points, categories, and read and write data to data points.  These services use Nimbits' built in authentication process using a secret key, or you can use Google account credentials. The SDK just saves you the trouble of figuring out google's authentication process and gives you easy to use functions to automate your use of Nimbits.

Debian and Ubuntu users can write scripts that use Nimbits by installing the SDK from our repository. This  simply installs the java nimbits library JAR on your system and puts a shell script called nimbits in your path so you can script against nimbits at the command line like this:


$nimbits action=recordvalue point=foo value=42.0 email=test@example.com password=secretpassword


Installing

Before installing Nimbits, you'll want to install Java and ensure it's on your class path. You can know this by opening a teminal and typing

$java -version

You can install java using a command like this:

$sudo apt-get install openjdk-6-jdk

You can install the Nimbits SDK using aptitude from our repository. This will keep you up to date with new versions of the SDK. Learn more about debian repositories here:

https://help.ubuntu.com/community/Repositories/Ubuntu

Simply edit your /etc/apt/sources.list file and add the following line to the bottom

deb http://deb.nimbits.net/packages/ ./
then run:


sudo apt-get update
sudo apt-get upgrade
You will be prompted to install nimbits. (you may also get a warning that you are unable to authenticate us, please enter Y To continue).


You can add /opt/nimbits/nimbits.jar to your java programs and use all of the methods in there to program against a Nimbits Server, or you can use the command line interface to write bash scripts. The SDK provides a tools for storing URL, password and account information in a hash file on your system.

Please visit the Nimbits SDK WIKI for more samples and information.

Example

Here is an example command the records a value to a data point using the hashed credential file mentioned above. The file contains the url of the Target Nimbits Server and credentials.

#!/bin/bash


KEY=[path to my key file]
nimbits -point=foo -action=recordvalue -value=1.0 -i=$KEY