1.1.0 • Published 2 years ago

zabbix-cli-ts v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

This is a typescript lib to make calls to the zabbix api.

Validated in version 6.0 of Zabbix API

Getting started

Install this lib:

npm install zabbix-cli-ts

The available methods are:

  • apiinfo.version
  • user.login
  • user.logout
  • user.get
  • problem.get
  • hostgroup.get
  • host.get
  • event.get
  • trigger.get

The parameters used by the constructor in the ZabbixAPI class are respectively:

  • url: zabbix api
  • username: user defined in zabbix
  • password: password defined in zabbix
  • options:
    • authToken: token to login (If completed, the class will not login automatically)
    • timeout: milliseconds to abort the request (default: undefined)

Usage examples

The example below calls the event.get method:

import ZabbixAPI from 'zabbix-cli-ts'

async function getEvent() {
  const zabbix = new ZabbixAPI('[ZBX_URL]', '[ZBX_USER]', '[ZBX_PASS]')

  const item = await zabbix.event({
    limit: 1,
    output: 'extend'
  })

  zabbix.logout()
}

getEvent()

The library has a method to call any method from the zabbix api, it just won't be typed with the same call and return parameters:

import ZabbixAPI from 'zabbix-cli-ts'

async function getResquest() {
  const zabbix = new ZabbixAPI('[ZBX_URL]', '[ZBX_USER]', '[ZBX_PASS]')

  const item = await zabbix.request('history.get', {
    limit: 1,
    output: 'extend'
  })

  zabbix.logout()
}

getRequest()

Using request timeout:

import ZabbixAPI from 'zabbix-cli-ts'

const zabbix = new ZabbixAPI('[ZBX_URL]', '[ZBX_USER]', '[ZBX_PASS]', {
  timeout: 30000
})
1.1.0

2 years ago

1.1.0-rc.11

2 years ago

1.1.0-rc.7

2 years ago

1.1.0-rc.6

2 years ago

1.1.0-rc.9

2 years ago

1.1.0-rc.8

2 years ago

1.1.0-rc.10

2 years ago

1.1.0-rc.5

2 years ago

1.1.0-rc.3

2 years ago

1.1.0-rc.2

2 years ago

1.1.0-rc.4

2 years ago

1.1.0-rc.1

2 years ago

1.0.5-rc.6

2 years ago

1.0.5-rc.7

2 years ago

1.0.5

2 years ago

1.0.5-rc.4

2 years ago

1.0.5-rc.5

2 years ago

1.0.5-rc.2

2 years ago

1.0.5-rc.3

2 years ago

1.0.5-rc.1

2 years ago

1.0.4-rc.1

2 years ago

1.0.4-rc.2

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0-rc.3

2 years ago

1.0.0-rc.2

2 years ago

1.0.0-rc.1

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago