Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
btrz-health-check
Advanced tools
A series of classes that will ping different service types to verify accessibility.
A series of classes that will ping different service types to verify accessibility. Used in Betterez microservices to check status of dependent services.
io.js >= 2.0.3 node >= v4.2
The main class is the HealthCheckers
class.
This class exposes only one method .checkStatus()
that takes an array of checkers.
Each checker will check one service and returns a promise that will resolve or reject accordingly to the status of the service.
The module comes with a series of checkers that you can configure and use for your particular case (see below for more information).
You can also create your own checkers easily.
All custom providers will return a promise that resolves or fails with the service name and status.
{name: "ServiceName", status: 200} //if promise resolves
{name: "ServiceName", status: 200} //if promise rejects
All custom providers also take an optional options
parameter that allow to override the service name and to provide a logger object.
Override the service name is useful when you need to validate the connection to multiple services of the same type.
let mongoChecker = new MongoDbHealthChecker(mongoDriver, {name: "MyCustomServiceName"});
You can also provide a logger to log the error on failure. The object should have an .error
function. It will be called with the name of the service and the error.
let mongoChecker = new MongoDbHealthChecker(mongoDriver, {logger: myLogger});
Will check connectivity to Amazon SQS. It will read a list of queues available for the logged in user.
{name: "SQS", status: 200} //if promise resolves
{name: "SQS", status: 200} //if promise rejects
#### Usage
let SQSHealthChecker = require("btrz-health-checker").SQSHealthChecker;
let sqsChecker = new SQSHealthChecker(awsSqsDriver);
sqsChecker.checkStatus()
.then(function (result) {
//If's working fine
})
.catch(function (result) {
//Something is not wright.
});
The only mandatory parameter is an instance of a properly configured AWS SQS driver.
Internally we will call the listQueues()
function, so it should at least implement that function.
Will check connectivity to MongoDb doing a call to collectionNames in the MongoDb driver.
{name: "MongoDb", status: 200} //if promise resolves
{name: "MongoDb", status: 200} //if promise rejects
let MongoDbHealthChecker = require("btrz-health-checker").MongoDbHealthChecker;
let mongoChecker = new MongoDbHealthChecker(mongoDriver);
mongoChecker.checkStatus()
.then(function (result) {
//If's working fine
})
.catch(function (result) {
//Something is not wright.
});
The only mandatory parameter is an instance of a properly configured mongoDriver.
Internally we will call the collectionNames()
function, so it should at least implement that function.
Will check connectivity to a socket server using the net
module
{name: "Socket", status: 200} //if promise resolves
{name: "Socket", status: 200} //if promise rejects
let SocketHealthChecker = require("btrz-health-checker").SocketHealthChecker;
let socketChecker = new SocketHealthChecker(mongoDriver);
socketChecker.checkStatus()
.then(function (result) {
//If's working fine
})
.catch(function (result) {
//Something is not wright.
});
The only mandatory parameter is a config literal with a host and port to connect to.
The config can also contains a timeout
property and it will be use to fail in case the timeout is reached, the default value is 5000.
Will check connectivity to the Sequelize DB doing a call to authenticate.
{name: "Sequelize DB", status: 200} //if promise resolves
{name: "Sequelize DB", status: 500} //if promise rejects
const SequelizeDbHealthChecker = require("btrz-health-checker").SequelizeDbHealthChecker,
sequelizeChecker = new SequelizeDbHealthChecker(sequelize);
sequelizeChecker.checkStatus()
.then((result) => {
//working fine
})
.catch((result) => {
//Something is not right.
});
The only mandatory parameter is an instance of sequelize.
Internally we will call the authenticate()
function along with a valid sequelize config, so it should at least implement that function with a valid DB config.
FAQs
A series of classes that will ping different service types to verify accessibility.
The npm package btrz-health-check receives a total of 56 weekly downloads. As such, btrz-health-check popularity was classified as not popular.
We found that btrz-health-check demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.