# oppsy

> An EventEmitter useful for collecting hapi server ops information

Latest version **2.0.1** (published 2019-02-11) · BSD-3-Clause license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install oppsy
pnpm add oppsy
yarn add oppsy
bun add oppsy
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2019-02-11 |
| First published | 2015-11-11 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 1 |
| Unpacked size | 29.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 25 |
| Maintainers | hueniverse |
| Keywords | hapi, ops, hapi-plugin |

## Links

- npm: https://www.npmjs.com/package/oppsy
- Repository: https://github.com/hapijs/oppsy
- Homepage: https://github.com/hapijs/oppsy#readme
- Issues: https://github.com/hapijs/oppsy/issues
- npm.io page: https://npm.io/package/oppsy

## Dependencies (1)

- [hoek](https://npm.io/package/hoek.md) 6.x.x

## Recent versions

- 2.0.1 (latest) — 2019-02-11
- 2.0.0 — 2017-12-12
- 1.0.2 — 2016-05-20
- 1.0.1 — 2015-11-18
- 1.0.0 — 2015-11-18
- 0.0.1 — 2015-11-11

## README

# oppsy

An EventEmitter useful for collecting hapi server ops information.

[![Build Status](https://secure.travis-ci.org/hapijs/oppsy.svg)](http://travis-ci.org/hapijs/oppsy)![Current Version](https://img.shields.io/npm/v/oppsy.svg)

Lead Maintainer: [Adam Bretz](https://github.com/arb)

## Usage

```js
const Oppsy = require('oppsy');
const Hapi = require('hapi');

const server = new Hapi.Server();
const oppsy = new Oppsy(server);
oppsy.on('ops', (data) => {
  console.log(data);
});

await server.start();

oppsy.start(1000);
```

This creates a new Oppsy object and starts collecting information every 1000 miliseconds

### new Oppsy(server, [config])

Creates a new Oppsy object.
- `server` - the hapi server to collect information about.
- `[config]` - optional configuration object
  - `httpAgents` - the list of httpAgents to report socket information about. Can be a single http.Agent or an array of agents objects. Defaults to Http.globalAgent.
  - `httpsAgents` - the list of httpsAgents to report socket information about. Can be a single https.Agent or an array of agents. Defaults to Https.globalAgent.

The oppsy object is an EventEmitter so it exposes the same API(`.on` and `.emit`) as the Node EventEmitter object. After it is started, it emits an "ops" event after a set interval with the collected ops information as the event payload.

#### oppsy.start(interval)

Starts an Oppsy object collecting network and server information.
- `interval` - number of milliseconds to wait between each data sampling.

#### oppsy.stop()

Stops an Oppsy objects collecting.

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