Permalink
Browse files

* Adding an extra status: maintenance

  • Loading branch information...
1 parent 4911fc9 commit e9b64e0775f8211d989bd470f957287f6368470c @stelcheck stelcheck committed Jan 17, 2013
Showing with 55 additions and 31 deletions.
  1. +4 −1 api.js
  2. +6 −2 plugins/irc/irc_plugin.js
  3. +3 −1 public/index.html
  4. +42 −27 public/styles/master.css
View
5 api.js
@@ -98,7 +98,9 @@ module.exports.checkAllServices = function() {
status.services[i].statusCode = 0;
status.services[i].message = '';
- sources[settings.services[i].check].call(null, settings.services[i], status.services[i], controller.emit);
+ sources[settings.services[i].check].call(null, settings.services[i], status.services[i], function (serviceStatus, service) {
+ controller.emit(serviceStatus, service);
+ });
}
/**
@@ -111,6 +113,7 @@ module.exports.checkAllServices = function() {
status.summarize.lastupdate = status.lastupdate;
status.summarize.up = _.reduce(_.select(status.services, function(data){ return data.status == 'up'; }), function(memo, num){ return memo + 1; }, 0);
status.summarize.critical = _.reduce(_.select(status.services, function(data){ return data.status == 'critical'; }), function(memo, num){ return memo + 1; }, 0);
+ status.summarize.maintenance = _.reduce(_.select(status.services, function(data){ return data.status == 'maintenance'; }), function(memo, num){ return memo + 1; }, 0);
status.summarize.down = _.reduce(_.select(status.services, function(data){ return data.status == 'down'; }), function(memo, num){ return memo + 1; }, 0);
status.summarize.unknown = _.reduce(_.select(status.services, function(data){ return data.status == 'unknown'; }), function(memo, num){ return memo + 1; }, 0);
View
8 plugins/irc/irc_plugin.js
@@ -31,6 +31,10 @@ exports.create = function(api, settings) {
checkChanges(service);
});
+ api.on('maintenance', function(service) {
+ checkChanges(service);
+ });
+
checkChanges = function(service) {
if (!lastService[service.name]) {
lastService[service.name] = {};
@@ -47,9 +51,9 @@ exports.create = function(api, settings) {
};
api.on('refresh', function(status) {
- var count = (status.summarize.critical + status.summarize.down + status.summarize.unknown).toString();
+ var count = status.summarize.up + status.summarize.critical + status.summarize.down + status.summarize.unknown + status.summarize.maintenance;
if (lastCount != count) {
- var msg = 'Up: ' + status.summarize.up + ', ' + 'Critical: ' + status.summarize.critical + ', Down: ' + status.summarize.down + ', Unknown: ' + status.summarize.unknown;
+ var msg = 'Up: ' + status.summarize.up + ', ' + 'Critical: ' + status.summarize.critical + ', Down: ' + status.summarize.down + ', Maintenance: ' + status.summarize.maintenance + ', Unknown: ' + status.summarize.unknown;
bot.say(channels, msg);
lastCount = count;
}
View
4 public/index.html
@@ -114,7 +114,8 @@
<span class="summarizeup up glow"><span class="strikethrough"></span><strong>${up}</strong></span>
<span class="summarizecritical critical glow"><span class="strikethrough"></span><strong>${critical}</strong></span>
<span class="summarizedown down glow"><span class="strikethrough"></span><strong>${down}</strong></span>
- <span class="summarizeunknown unknown glow"><span class="strikethrough"></span><strong>${unknown}</strong></span>
+ <span class="summarizemaintenance maintenance glow"><span class="strikethrough"></span><strong>${maintenance}</strong></span>
+ <span class="summarizeunknown unknown glow"><span class="strikethrough"></span><strong>${unknown}</strong></span>
</h2>
<p class="info"><span class="label">Last update:</span><span id="lastupdate">${lastupdate}</span></p>
</li>
@@ -140,6 +141,7 @@ <h1 id="title">Services Status Dashboard</h1>
<span class="summarizeup">Up</span>
<span class="summarizecritical">Critical</span>
<span class="summarizedown">Down</span>
+ <span class="summarizemaintenance">Maintenance</span>
<span class="summarizeunknown">Unknown</span>
</div>
<ul id="summarize"></ul>
View
69 public/styles/master.css
@@ -13,7 +13,7 @@ body {
/* LAST UPDATE */
.lastupdate {
- font-size: 11px; color: #557880;
+ font-size: 11px; color: #557880;
text-align: center;
margin: 20px 0px 0px 0px;
}
@@ -22,7 +22,7 @@ body {
/* FOOTER */
.footer {
- font-size: 11px; color: #557880;
+ font-size: 11px; color: #557880;
text-align: center;
margin: 0px 0px 20px 0px;
}
@@ -35,24 +35,24 @@ body {
font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;
color: #fff;
-
+
width: 612px;
margin: 30px 10px 50px 10px;
border: 1px solid #353a3b;
-
+
-webkit-border-radius: 5px; -moz-border-radius: 5px;
-webkit-box-shadow: 0px 2px 4px #000; -moz-box-shadow: 0px 2px 4px #000;
-
+
background: #333;
background: url(../images/status-board-background-bottom.png) bottom left repeat;
background: url(../images/status-board-background-top.png) top left repeat-x,
url(../images/status-board-background-bottom.png) bottom left repeat;
-
+
}
/* VARIOUS BOARD STYLES */
-
+
.arrivals-board a {
color: #b2d9ff;
}
@@ -67,7 +67,7 @@ body {
}
/* LEGEND */
-
+
.legend {
position: relative;
font-size: 13px; font-weight: bold; text-transform: uppercase; text-shadow: 0px -1px 0px #222;
@@ -76,7 +76,7 @@ body {
padding: 0px 15px;
border-bottom: 1px solid rgba(0,0,0,0.25);
}
-
+
.legend span {
display: block;
position: absolute; top: 10px;
@@ -91,13 +91,16 @@ body {
left: 50px;
}
.legend .summarizecritical {
- left: 190px;
+ left: 150px;
}
.legend .status {
left: 382px;
}
.legend .summarizedown {
- left: 362px;
+ left: 280px;
+ }
+ .legend .summarizemaintenance {
+ left: 371px;
}
.legend .code {
left: 512px;
@@ -121,33 +124,34 @@ body {
font-size: 18px; line-height: 24px;
position: relative;
- margin: 0px;
+ margin: 0px;
padding: 35px 0px 10px 0px;
-
+
border-top: 1px solid #373737;
border-top: 1px solid rgba(255,255,255,0.08);
border-bottom: 1px solid #333;
border-bottom: 1px solid rgba(0,0,0,0.25);
-
+
background: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.05)), to(rgba(255,255,255,0.0))) repeat-x;
-webkit-background-size: 100px 100px;
}
-
-
+
+
/* PROJECT HEADLINE */
-
+
.project h2 {
font-size: 15px; line-height: 38px; font-weight: normal;
color: #eee;
text-transform: uppercase; text-shadow: 0px -1px 0px #000;
margin: 8px 0px 8px 0px; padding: 0px 10px 0px 10px;
}
-
+
.project h2 .service,
.project h2 .summarizeup,
.project h2 .summarizecritical,
.project h2 .status,
.project h2 .summarizedown,
+ .project h2 .summarizemaintenance,
.project h2 .code,
.project h2 .summarizeunknown {
display: block; height: 38px;
@@ -156,23 +160,23 @@ body {
margin-right: 5px; padding-left: 8px;
overflow: hidden;
}
-
+
.project h2 .service {
left: 10px;
width: 350px;
}
.project h2 .summarizeup {
font-size: 36px; line-height: 38px; font-weight: normal;
- text-align: center;
+ text-align: center;
left: 10px;
width: 85px;
}
.project h2 .summarizecritical {
font-size: 36px; line-height: 38px; font-weight: normal;
text-align: center;
- left: 170px;
+ left: 130px;
width: 85px;
}
@@ -184,15 +188,22 @@ body {
.project h2 .summarizedown {
font-size: 36px; line-height: 38px; font-weight: normal;
text-align: center;
- left: 335px;
+ left: 254px;
+ width: 85px;
+ }
+
+ .project h2 .summarizemaintenance {
+ font-size: 36px; line-height: 38px; font-weight: normal;
+ text-align: center;
+ left: 375px;
width: 85px;
}
.project h2 .code {
left: 510px;
width: 70px;
}
-
+
.project h2 .summarizeunknown {
font-size: 36px; line-height: 38px; font-weight: normal;
text-align: center;
@@ -212,7 +223,7 @@ body {
background: url(../images/status-display-strikethrough.png) 0px 17px repeat-x;
position: absolute; top: 0px; left: 2px;
}
-
+
.project h2 .service .strikethrough {
width: 386px;
}
@@ -274,15 +285,19 @@ body {
0px 0px 5px rgba(255, 88, 88, 0.8);
}
.project h2 .up.glow {
- text-shadow: 0px -1px 0px #000,
+ text-shadow: 0px -1px 0px #000,
0px 0px 5px rgba(199, 255, 171, 0.8);
}
+ .project h2 .maintenance.glow {
+ text-shadow: 0px -1px 0px #000,
+ 0px 0px 5px rgba(204, 229, 225, 0.8);
+ }
.project h2 .critical.glow {
- text-shadow: 0px -1px 0px #000,
+ text-shadow: 0px -1px 0px #000,
0px 0px 5px rgba(204, 229, 225, 0.8);
}
.project h2 .unknown.glow {
- text-shadow: 0px -1px 0px #000,
+ text-shadow: 0px -1px 0px #000,
0px 0px 5px rgba(204, 229, 225, 0.8);
}

0 comments on commit e9b64e0

Please sign in to comment.