Skip to main content
Topic: Server uptime monitoring - proof of concept (Read 958 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Server uptime monitoring - proof of concept

Using existing tools is soooo boring... while reinventing the wheel is always so fun! :D

So, a few days ago I got the idea to give it a go to create a monitoring "service" with free tools that could be used to as a proof of concept monitor if the domain responds properly.
What i used are all tools provided by google for free:
  • App script
  • Google docs
  • Data Studio

The result is:
https://datastudio.google.com/reporting/1pISX1-ui5poBVZFVKQWp_d3dThmf0fNM/page/5gwq

a little boring look for the moment, but it's just a PoC.

The concept is somehow simple: a few lines of App script sends and capture a request to a webdomain, write down the result in a Google sheet and Data studio visualize that results.
The "ping" is done ever 15 minutes and the charts are updated every 15 minutes, so in the worst case you are looking at a data that is 30 minutes old.
For the time being I didn't spend much time tuning the Data studio report, so it shows only the number of pings in a certain status per hour (so the maximum would be 4, one every 15 minutes).

The App script code is the following:
Code: [Select]
function checkSite() {
  var response = UrlFetchApp.fetch("http://www.elkarte.it/", {'muteHttpExceptions': true});
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Sheet1');
  var d = new Date();
  sheet.appendRow([d.getFullYear().toString() +
                   Utilities.formatString("%02.0f", d.getMonth()) +
                   Utilities.formatString("%02.0f", d.getDate()) +
                   Utilities.formatString("%02.0f", d.getHours())
                   , response.getResponseCode(), response.getAllHeaders().toSource()]);
}
Most of the code at the moment is currently devoted to write a date that can be digested by Data studio.

The data source in Data studio is configured with 4 fields that filter the status code responses in order to show them in 4 different charts (one for 200 = all good, one for 404 = page not found, one for 500 = server error, and one for any other code).

My intention would be to add:
  • email in case of downtime,
  • special cases (e.g. "Elk db connection error")
  • better visualization in Data studio
  • better archiving back-end (google has a db-like service, but it requires payment, so I'll have to force a google sheet to work somehow like a relational db  :-X )
  • Anything that may come to my mind and that can be worked out
Bugs creator.
Features destroyer.
Template killer.

Re: Server uptime monitoring - proof of concept

Reply #1
Very cool ... new toys to play with :D
Squish squish. squish, squish, squish.
Find a bug,
Make a wish.