-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from Financial-Times/remove-pingdom
- Loading branch information
Showing
7 changed files
with
12 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,16 @@ | ||
'use strict'; | ||
const Check = require('./check'); | ||
const status = require('./status'); | ||
const fetch = require('node-fetch'); | ||
|
||
class PingdomCheck extends Check{ | ||
|
||
constructor(options){ | ||
constructor(options) { | ||
super(options); | ||
this.checkId = options.checkId; | ||
this.url = `https://api.pingdom.com/api/2.0/checks/${this.checkId}`; | ||
this.headers = { | ||
'Authorization' : 'Basic ' + new Buffer(process.env.PINGDOM_USERNAME + ':' + process.env.PINGDOM_PASSWORD).toString('base64'), | ||
'App-Key' : 'ldbchjvwdc65gbj8grn1xuemlxrq487i', | ||
'Account-Email' : 'ftpingdom@ft.com' | ||
}; | ||
this.checkOutput = `Pingdom check ${this.checkId} has not yet run`; | ||
} | ||
|
||
async tick(){ | ||
try { | ||
const response = await fetch(this.url, { headers : this.headers }); | ||
const json = await response.json(); | ||
|
||
if(!response.ok){ | ||
throw new Error(`Pingdom API returned ${json.error.statuscode}: ${json.error.errormessage}`); | ||
} | ||
|
||
this.status = (json.check.status === 'up') ? status.PASSED : status.FAILED; | ||
this.checkOutput = `Pingdom status: ${json.check.status}`; | ||
} catch(err) { | ||
this.status = status.FAILED; | ||
this.checkOutput = `Failed to get status: ${err.message}`; | ||
} | ||
this.status = status.FAILED; | ||
this.checkOutput = 'Pingdom checks are deprecated and will be removed in a future version of n-health. Remove this check from your healthcheck config, and tag your checks with your system code in Pingdom so they can be monitored. See https://tech.in.ft.com/guides/monitoring/how-to-pingdom-check for more information.'; | ||
} | ||
|
||
tick() {} | ||
} | ||
|
||
module.exports = PingdomCheck; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters