open-index/open-npm huggingface dataset:
npm package: @metasys/alarms
Description: Get alarms from a Metasys® Server
Author: Michael Welch
Latest version: 1.0.1

# alarms

Fetch alarms from the last 24 hours

## Installation

```bash
npm install -g @metasys/alarms
```

## Usage

You can fetch alarms from a metasys server.

```bash
$ alarms -u joesmith -h adx-server
Password: ************
...............................................................................
.........................................
```

## Command Line Options

```text
  -u, --username    The username of the account to login as
  -p, --password    The password of the account to login as
  -h, --host        The server to login into
  -f                The name of a file that contains the username,
                    password, and host information
```

Assuming you have a file named credentials.json that looks like this

```json
{
  "username": "joesmith",
  "password": "zjds83jsldja",
  "host": "my-adx"
}
```

You can invoke the program like this:

```shell
alarms -f credentials.json
```



## Output

The alarms that are fetched are stored to the `output/` directory where you ran the program.
npm package: @metasys/nodekit
Description: Metasys® Server REST API client for node.js
Author: Michael Welch
Latest version: 2.0.0

# nodekit

[![CircleCI](https://circleci.com/gh/metasys-server/nodekit.svg?style=svg)](https://circleci.com/gh/metasys-server/nodekit)

Metasys® Server REST API client for node.js

This library is used to consume the Metasys Server API. It currently supports V1 of the Metasys® Server API.

See [Documentation](https://metasys-server.github.io/nodekit) for more information.

## Installation

```bash
npm install @metasys/nodekit
```

## Usage

The following example will log into the server, and fetch and print each alarm with a priority in
the range of 0 to 10.

```javascript
const { MetasysServerApi } = require('@metasys/nodekit');

async function main() {
  const api = new MetasysServerApi();
  await api.login('user', 'pass', 'host');

  const alarms = await api.alarms({ priorityRange: '0,10' });
  for await (const alarm of alarms) {
    console.log(JSON.stringify(alarm, null, 2));
  }
}

main();
```

## Client Options

This library depends on [request](https://github.com/request/request#tlsssl-protocol). You can pass an `options` argument as defined by `request` as the fourth parameter
of the `login` method for any special options you need. These will be used on every future call made by the api.

For example, if you are using a self signed certificate on your Metasys Server, then the
calls to the API may fail with certificate errors if your machine is not setup to trust
the self-signed certificate.

The easiest way to handle this is to get the cert in a `.pem` format and then specify that certificate in your login method:

```javascript
const fs = require('fs')
const ca = fs.readFileSync('./path/to/cert.pem');
const api = require('@metasys/nodekit');

async main() {
  await api.login('user', 'pass', 'host', { ca });
}

main()
```

See [request](https://github.com/request/request#tlsssl-protocol) for more options.
npm package: @metasys/object
Description: Read an object from a Metasys® site
Author: Michael Welch
Latest version: 2.0.1

# object

Retrieve a metasys object from metasys server

## Installation

This can be installed globally as a command line application.

```bash
npm install -g @metasys/object
```

## Usage

```bash
$ object -u username "myAdx:myNae/Programming.AV1"
Password: *********
{
  "id": "c334e3a8-a2a0-53ec-ac86-2f2fc5746748",
  "itemReference": "myAdx:myNae/Programming.AV1",
  "name": "AV1",
  "type": "/enumSets/508/members/165",
  "self": "/objects/c334e3a8-a2a0-53ec-ac86-2f2fc5746748",
  "parent": "/objects/d24ead32-6895-5ba9-90b9-1976464c7fe0",
  "objects": "/objects/c334e3a8-a2a0-53ec-ac86-2f2fc5746748/objects",
  "networkDevice": "/networkDevices/2603fb33-3e15-5360-a27b-413fa04d166f",
  "points": "/objects/c334e3a8-a2a0-53ec-ac86-2f2fc5746748/points",
  "attributes": "/objects/c334e3a8-a2a0-53ec-ac86-2f2fc5746748/attributes",
  "alarms": "/objects/c334e3a8-a2a0-53ec-ac86-2f2fc5746748/alarms",
  "audits": "/objects/c334e3a8-a2a0-53ec-ac86-2f2fc5746748/audits"
}
```

## Specifying Credentials and Host

You must provide username and password. You can also specify a hostname.
If no hostname is provided, then you it will be derived from the specified object reference.
If no password is provided, the app will prompt you for one.

The parameters can be provided in one of three ways:

1. You can supply them on the command line:

    ```bash
    object -u john -p pass -h myadx "myadx:mynae/myobject"
    ```

2. You can supply them thru a file:

    Create a json file and name what you like (eg. metasys.json)

    ```json
    {
        "username": "john",
        "password": "pass",
        "hostname": "myadx"
    }
    ```

    And then use the `-f` switch

    ```bash
    object -f metasys.json "myadx:mynae/myobject"
    ```

3. Use environment variables (Note: password can't be specified using env variable.)

    ```bash
    export METASYS_USERNAME=john
    export METASYS_HOSTNAME=myadx
    object "myadx:mynae/myobject"
    ```

## Certificates

If you are using a self signed certificate on your Metasys® Server you should configure your computer to trust
that certificate. If you are having difficulty doing that there are two options you have.

1. Use `--ca` switch to pass a `.pem` file.

    ```bash
    object --ca /path/to/server.pem "myadx:mynae/myobject"
    ```
2. Use `--insecure` switch.

    **Note: This should never be used on a production system.
    As the switch name suggests, this is an insecure practice.**

    ```bash
    object --insecure "myadx:mynae/myobject"
    ```