Sha256: 10f891015176b2284dd9dbb9011ea86f05c3b03ee0ad93ee71671d66c61a2454
Contents?: true
Size: 711 Bytes
Versions: 5
Compression:
Stored size: 711 Bytes
Contents
#!/usr/bin/env ruby require 'rubygems' require 'yaml' require 'getopt/std' require 'zabbixapi' opt = Getopt::Std.getopts("g:E:H:i:") group_name = opt["g"] host = opt["H"] ip = opt["i"] 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) g_id = zbx.add_or_get_group(group_name) # Create new host options = { "ip" => ip, "dns" => host, "host" => host, "useip" => 1, "groups" => [g_id] } p " * Creating host #{host}." g_id = zbx.add_host(options)
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
zabbixapi-0.3.0 | examples/zabbix_host |
zabbixapi-0.2.0 | examples/zabbix_host |
zabbixapi-0.1.9 | examples/zabbix_host |
zabbixapi-0.1.8 | examples/zabbix_host |
zabbixapi-0.1.7 | examples/zabbix_host |