Simple REST API monitoring tool architecture

Hi guys,
I want to build a basic app for monitoring a REST app, it would check regularly a few endpoints (up to 100) and display green if response is 200 and red otherwise. Something like Nagios, just 100 times simpler, without customization options. I don’t know how to “architect” this. I am thinking about scheduling each rest api call in its own asynchronous “thread” and have the callback update some collection kept in sync with the frontend. Not sure how to do this kind of scheduling and what does it mean to do 100 api calls asynchronously each minute from performance point of view? I know how to do async http calls, but how do I schedule 100 different calls each minute or so? Should I just add Meteor.setInterval 100 times, one for each rest call?
Any advice for me?

Just wrap them all to 1 function and schedule in syncedCron
100 calls per minute upsert-ing boolean is nothing for DB.

1 Like

Can I schedule it to run each 5 minutes until…forever?

yes, for example I have something like this to grab feed from twitch on http://shocki.tv

SyncedCron.add({
  name: 'twitch feed',
  schedule: function(parser) {
    // parser is a later.parse object
    return parser.text('every 4 minutes');
  },
  job: function() {
    getTwitchStreams(0);
    return true;
  }
});
2 Likes

Nice, I’ll give it a try. Thanks!

SyncedCron is awesome

Wait, you call out from your “REST” API every now and then to grap info from shocki.tv? What does this have to do with an API? I mean, can you just call out from any old app?