# @jwdotjs/uptime

> HTTP uptime alerts that notify failed requests to Sentry

Latest version **2.0.1** (published 2018-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jwdotjs/uptime
pnpm add @jwdotjs/uptime
yarn add @jwdotjs/uptime
bun add @jwdotjs/uptime
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2018-06-14 |
| First published | 2018-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jwdotjs |

## Links

- npm: https://www.npmjs.com/package/@jwdotjs/uptime
- npm.io page: https://npm.io/package/@jwdotjs/uptime

## Dependencies (1)

- [distraught](https://npm.io/package/distraught.md) ^2.1.0

## Recent versions

- 2.0.1 (latest) — 2018-06-14
- 2.0.0 — 2018-06-14
- 1.1.0 — 2018-03-16
- 1.0.0 — 2018-03-02

## README

# Uptime Monitoring That Logs To Sentry

## Requirements

- You must have `SENTRY_DSN` specified in your .env

## Config

- In the below example, the request object gets passed directly to [Axios](https://github.com/axios/axios)
- If you don't specify an HTTP Method in the request, it will default to GET
- If you don't specify an interval it will default to 60 seconds

```javascript
const uptime = require('@jwdotjs/uptime');

uptime({
  monitoring: [
    {
      request: {
        url: '',
        method?: 'GET'|'POST'|'PUT'|'DELETE',
        headers?: {},
        data?: {},
      },
      interval?: 60000,
    },
  ],
  maxAttempts: 2, // how many total times a request should fail consecutively before we log an error
}).init();
```

## Example Usage

```javascript
const uptime = require("@jwdotjs/uptime");

uptime({
  monitoring: [
    { request: { url: "http://www.google.com" } },
    { request: { url: "http://www.yahoo.com" } },
    { request: { url: "http://www.sitewithanoutage.com" } }
  ],
  maxAttempts: 2 // how many total times a request should fail consecutively before we log an error
}).init();
```

![Result In Console](https://i.imgur.com/9ezZwYX.png)

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