Skip to content

Commit

Permalink
making mysql check work.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsu committed Sep 11, 2012
1 parent 9c96df0 commit c70ebda
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ services:
```
### Services
<<<<<<< Updated upstream
Services are a way of grouping several sensor checks together. In the example above, we have a "google" service w
hich we check by making a get request to "https://www.google.com" and also seeing if we have a connection to port 8
Expand Down Expand Up @@ -103,4 +104,4 @@ host: host # required
user: user # required
password: pass # required
sql: "SELECT * FROM users LIMIT 1" # defaults to "SHOW TABLES"
```
```
7 changes: 4 additions & 3 deletions lib/strategies/mysql.ms
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module.exports = #(options) {
var sql = options.query || "SHOW TABLES";
var mysql = require('mysql');
var conn = mysql.createConnection({ host: options.host, user: option.user, password: options.password });
conn.connect();
var conn = mysql.createClient(options);

return #(cb) {
conn.query(sql, #(err, rows, fields) { cb(err); });
conn.query(sql, #(err, rows, fields) {
cb(err);
});
};
};
8 changes: 8 additions & 0 deletions mock/example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
services:
# mysql:
# mysql:
# strategy: mysql
# sql: SHOW TABLES
# user: root
# password: root
# database: mysql

google:
www:
strategy: http
Expand Down
4 changes: 2 additions & 2 deletions www/views/sensor.jade
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ block content
th Last Failure
td
= sensor.lastFailure
if typeof sensor.lastError == 'string'
= " (" + sensor.lastError + ")";
if sensor.lastError
= " (" + sensor.lastError.toString() + ")";
tr
th Uptime
td
Expand Down

0 comments on commit c70ebda

Please sign in to comment.