Skip to content

Commit

Permalink
Merge branch 'master' into etc_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewGarson committed Jul 15, 2013
2 parents 091b8b8 + d42b69a commit d02ed42
Show file tree
Hide file tree
Showing 17 changed files with 462 additions and 199 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Installing all 3 - Database MUST come before Server

NOTE:

If you are running on Redhat, Centos, Scientific of Amazon, you will need packages from EPEL.
If you are running on Redhat, Centos, Scientific or Amazon, you will need packages from EPEL.
Include "recipe[yum::epel]" in your runlist or satisfy these requirements some other way.

"recipe[yum::epel]"
Expand Down
5 changes: 5 additions & 0 deletions attributes/server.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
include_attribute "zabbix"

default['zabbix']['server']['version'] = "2.0.3"
default['zabbix']['server']['branch'] = "ZABBIX%20Latest%20Stable"
default['zabbix']['server']['source_url'] = nil
default['zabbix']['server']['install_method'] = "source"
default['zabbix']['server']['configure_options'] = [ "--with-libcurl","--with-net-snmp"]
default['zabbix']['server']['include_dir'] = "/opt/zabbix/server_include"
default['zabbix']['server']['log_file'] = ::File.join(node['zabbix']['log_dir'], "zabbix_server.log")
default['zabbix']['server']['log_level'] = 3
default['zabbix']['server']['housekeeping_frequency'] = "1"
default['zabbix']['server']['max_housekeeper_delete'] = "100000"
Expand All @@ -15,3 +18,5 @@
default['zabbix']['server']['java_gateway'] = '127.0.0.1'
default['zabbix']['server']['java_gateway_port'] = 10052
default['zabbix']['server']['java_pollers'] = 0

default['zabbix']['server']['externalscriptspath'] = "/usr/local/scripts/zabbix/externalscripts/"
209 changes: 64 additions & 145 deletions libraries/chef_zabbix_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def symbolize(options)

class << self


def find_hostgroup_ids(connection, hostgroup)
group_id_request = {
:method => "hostgroup.get",
Expand Down Expand Up @@ -139,6 +138,44 @@ def find_application_ids(connection, application, template_id)
connection.query(request)
end

def find_lld_rule_ids(connection, template_id, key)
request = {
:method => "discoveryrule.get",
:params => {
:templated => true,
:templateids => template_id,
:search => {
:key_ => key
}
}
}
connection.query(request)
end

def find_trigger_ids(connection, description)
request = {
:method => "trigger.get",
:params => {
:search => {
:description => description
}
}
}
connection.query(request)
end

def find_trigger_prototype_ids(connection, description)
request = {
:method => "triggerprototype.get",
:params => {
:search => {
:description => description
}
}
}
connection.query(request)
end

def find_item_ids(connection, template_id, key, name=nil)
request = {
:method => "item.get",
Expand All @@ -158,6 +195,22 @@ def find_item_ids(connection, template_id, key, name=nil)
connection.query(request)
end

def find_item_prototype_ids(connection, template_id, key, discovery_rule_id=nil)
request = {
:method => "itemprototype.get",
:params => {
:templateids => template_id,
:search => {
:key_ => key
}
}
}
if discovery_rule_id
request[:params][:discoveryids] = discovery_rule_id
end
connection.query(request)
end

def find_item_ids_on_host(connection, host, key)
request = {
:method => "item.get",
Expand All @@ -182,152 +235,18 @@ def find_graph_ids(connection, name)
}
connection.query(request)
end
end

module Enumeration
class << self
def included(base)
base.extend(ClassMethods)
base.send(:include, ClassMethods)
end

def extended(base)
base.send(:include, ClassMethods)
end
end

module ClassMethods
attr_reader :enumeration_values
def enum(name, val)
@enumeration_values ||= {}
@enumeration_values[name] ||= new(val)
# The better solution would be to just call define_singleton_method
# but that doesn't work in 1.8.x and we want 1.8.x compatibility
eigen_class = class << self; self; end
eigen_class.send(:define_method, name) do
@enumeration_values[name]
end
end
def find_graph_prototype_ids(connection, name)
request = {
:method => "graphprototype.get",
:params => {
:filter => {
:name => name
}
}
}
connection.query(request)
end

attr_reader :value
def initialize(value)
@value = value
end
end

class ItemType
include Enumeration
enum :zabbix_agent, 0
enum :snmp_v1_agent, 1
enum :zabbix_trapper, 2
enum :simple_check, 3
enum :snmp_v2_agent, 4
enum :zabbix_internal, 5
enum :snmp_v3_agent, 6
enum :zabbix_agent_active_check, 7
enum :zabbix_aggregate, 8
enum :web_item, 9
enum :externali_check , 10
enum :database_monitor, 11
enum :ipmi_agent, 12
enum :ssh_agent, 13
enum :telnet_agent, 14
enum :calculated, 15
enum :jmx_agent, 16
enum :snmp_trap, 17
end

class ItemValueType
include Enumeration
enum :float, 0
enum :character, 1
enum :log, 2
enum :unsigned, 3
enum :text, 4
end

class TriggerPriority
include Enumeration

enum :not_classified, 0
enum :information, 1
enum :warning, 2
enum :average, 3
enum :high, 4
enum :disaster, 5
end

class TriggerStatus
include Enumeration
enum :active, 0
enum :disabled, 1
end

class TriggerType
include Enumeration
enum :normal, 0
enum :multiple, 1
end

class GraphItemCalcFunction
include Enumeration
enum :min, 1
enum :max, 2
enum :average, 4
enum :all, 7
end

class GraphItemType
include Enumeration
enum :simple, 0
enum :aggregated, 1
enum :graph, 2
end

class GraphType
include Enumeration
enum :normal, 0
enum :stacked, 1
enum :pie, 2
enum :exploded, 3
end

class GraphAxisType
include Enumeration
enum :calculated, 0
enum :fixed, 1
# TODO: Update the graph provider to do an update after it has created
# all of its item so that you can map an item id and support this value
#enum :item, 2
end

class IPMIAuthType
include Enumeration
enum :default, -1
enum :none, 0
enum :md2, 1
enum :md5, 2
enum :straight, 3
enum :oem, 4
enum :rmcp_plus, 5
end

class IPMIPrivilege
include Enumeration
enum :callback, 1
enum :user, 2
enum :operator, 3
enum :admin, 4
enum :oem, 5
end

class HostInterfaceType
include Enumeration
enum :agent, 1
enum :snmp, 2
enum :ipmi, 3
enum :jmx, 4
end
end
end
Expand Down
Loading

0 comments on commit d02ed42

Please sign in to comment.