summaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
authortunkki <tunkki@tunkkikone>2016-08-14 17:47:01 +0300
committertunkki <tunkki@tunkkikone>2016-08-14 17:47:01 +0300
commit33f3d9b7a8183949a06adffcd8f11485bc6f5cce (patch)
tree55508980e027458ca2f437a117be22f48784f472 /index.js
parentd84a59f489b7994630a1c4c94befcc7d63f08f6c (diff)
Change update interval to 60 seconds
Diffstat (limited to 'index.js')
-rw-r--r--index.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/index.js b/index.js
index f2f9210..b57e2bc 100644
--- a/index.js
+++ b/index.js
@@ -13,6 +13,9 @@ if (args.length != 2) {
process.exit(1);
}
+var UPDATE_INTERVAL = 60000;
+var PORT = 3000;
+
var username = args[0];
var password = args[1];
@@ -30,19 +33,17 @@ app.get("/status", function(req, res) {
res.json(currentStatus);
});
-app.listen(3000, function() {
- console.log("radiodiodi status display listening on port 3000.");
+app.listen(PORT, function() {
+ console.log("radiodiodi status display listening on port " + PORT + ".");
});
-
function get_status(err, data) {
currentStatus = [];
for (var i = 0; i < data.length; i++) {
- var is_up = data[i].Status == 'Up';
var system = {}
system.name = data[i].WebsiteName;
- system.status = is_up;
+ system.status = data[i].Status == 'Up';
system.uptime = data[i].Uptime;
currentStatus.push(system);
}
@@ -50,6 +51,7 @@ function get_status(err, data) {
console.log(currentStatus);
}
+statuscake.tests(get_status);
setInterval(function() {
statuscake.tests(get_status);
-}, 5000);
+}, UPDATE_INTERVAL);