Sha256: 3a3e2d340d5f9f8f02425d96bda337a035c07aa1b1cecbd9cda90bf7f6928ca4

Contents?: true

Size: 562 Bytes

Versions: 5

Compression:

Stored size: 562 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'yaml'
require 'getopt/std'
require 'zabbixapi'

opt = Getopt::Std.getopts("g:E:")

group_name = opt["g"]
zabbix_env = opt["E"]

# read config
config = YAML::load(open('./config.yml'))

api_url = config[zabbix_env]["api_url"]
api_login = config[zabbix_env]["api_login"]
api_password = config[zabbix_env]["api_password"]

# Esablish new connection
zbx = Zabbix::ZabbixApi.new(api_url, api_login, api_password)

# Create new hostgroup
p " * Creating hostgroup #{group_name}."
g_id = zbx.add_or_get_group(group_name)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zabbixapi-0.3.0 examples/zabbix_group
zabbixapi-0.2.0 examples/zabbix_group
zabbixapi-0.1.9 examples/zabbix_group
zabbixapi-0.1.8 examples/zabbix_group
zabbixapi-0.1.7 examples/zabbix_group