# is-alive

> Is-Alive checks servers if they are responding anymore

Latest version **0.0.5** (published 2013-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-alive
pnpm add is-alive
yarn add is-alive
bun add is-alive
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2013-03-01 |
| First published | 2013-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Fabian Faßbender |
| Maintainers | genazt |
| Keywords | alive, server, failover |

## Links

- npm: https://www.npmjs.com/package/is-alive
- Repository: https://github.com/geNAZt/is-alive
- npm.io page: https://npm.io/package/is-alive

## Recent versions

- 0.0.5 (latest) — 2013-03-01
- 0.0.4 — 2013-02-05
- 0.0.3 — 2013-02-05
- 0.0.2 — 2013-02-03
- 0.0.1 — 2013-02-02

## README

is-alive
========

Is-Alive checks servers if they are responding anymore

Example on how to add a alive runner to a server
```javascript
var IsAlive = require('is-alive');
var isAlive = new IsAlive();
isAlive.add("http://google.com", 301, function (err) {
    "use strict";

    if (err) {
        console.log(err);
    }
});

setInterval(function () {
    console.log(isAlive.isAlive("http://google.com"));
}, 2000);

console.log(isAlive.isAlive("http://google.com"));
```

Optional Parameters in the constructor:

```javascript
options.checkInterval = options.checkInterval || 4000; //The interval in which all Servers are checked. In ms
options.timeout = options.timeout || 500; //The timeout value after which are server dead
```

Methods:

add(server, statusCodes, cb):

* server: The Server must be a http or https Adress. It gets parsed via the url.parse from NodeJS.
* statusCodes: Can be a number or an array of numbers. If the Statuscode of a request is one in this the server is alive
* cb: function(err) Gets an error if some of the data is wrong.

Return: always undefined

isAlive(server):

* server: The Server that has been given via add(server,...)

Return: true if server is alive, false if not found in isAlive or offline

Changelog:

v0.0.4:
* Emitting undefined Values fixed
* Reworked the _setServerTo function
* Used the right objects in _check

v0.0.3:
* Added down and alive events that get emitted when a server changes his state (callback gets the servername)

v0.0.2:
* Forgot the module.exports.......

---
_Source: https://npm.io/package/is-alive · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
