site-uptime-adaptor

Node JS adaptor for siteuptime.com API

npm install site-uptime-adaptor
24 downloads in the last month

site-uptime-adaptor Build Status

siteuptime.com API wrapped in Node

Examples

Get session token

var siteUptimeAdaptor = require('site-uptime-adaptor');

siteUptimeAdaptor.adaptor.getToken({
  emailAddress: 'myaccountemail@gmail.com',
  password: 'myaccountpassword'
}, function(err, token) {
  console.log(token);
});
Example output
sdfoiusdofiusdfoiusdoifudf

Get servers status

...
siteUptimeAdaptor.status.getStatus(token, function(err, serverStatus) {
  console.log(serverStatus);
});
Example output
[{
    id: '1111',
    name: 'My Site',
    host: 'example.com',
    status: 'Failed'
}, {
    id: '123123',
    name: 'image server',
    host: 'img1.example.com',
    status: 'Ok'
}]

Get uptime for a server

...
  var monitorRequest = {
    monitorId: 1111,
    year: '2013',
    month: '06'
  };

  siteUptimeAdaptor.uptime.getMonthly(token, monitorRequest, function(err, serverStatus) {
    console.log(serverStatus);
  });
Example output
{ uptime: '99.995%',
  dailyStats:
   [ { date: '2013-06-01', uptime: '100.000%' },
     { date: '2013-06-02', uptime: '100.000%' },
    ...
     { date: '2013-06-20', uptime: '100.000%' },
     { date: '2013-06-21', uptime: '99.860%' },
     { date: '2013-06-30', uptime: '100.000%' } ]     
}
npm loves you