add_host( params )
param = {
name: 'foo',
address: 'foo.bar.com',
display_name: 'test node',
max_check_attempts: 5,
notes: 'test node',
vars: {
description: 'host foo',
os: 'Linux',
partitions: {
'/' => {
crit: '95%',
warn: '90%'
}
}
}
}
@icinga.add_host(param)
delete_host( params )
@icinga.delete_host(name: 'foo')
modify_host( params )
param = {
name: 'foo',
address: 'foo.bar.com',
display_name: 'Host for an example Problem',
max_check_attempts: 10,
}
or
param = {
name: 'foo',
address: 'foo.bar.com',
notes: 'an demonstration object',
vars: {
description: 'schould be delete ASAP',
os: 'Linux',
partitions: {
'/' => {
crit: '98%',
warn: '95%'
}
}
},
merge_vars: true
}
or
param = {
name: 'foo',
address: 'foo.bar.com',
vars: {
description: 'removed all other custom vars',
}
}
@icinga.modify_host( name: 'foo')
hosts( params )
@icinga.host(name: 'icinga2')
hosts
@icinga.hosts
exists_host?( host_name )
@icinga.exists_host?('icinga2')
host_objects( params )
@icinga.host_objects(attrs: ['name', 'state'])
count_hosts_with_problems
@icinga.count_hosts_with_problems
list_hosts_with_problems( max_items )
@icinga.list_hosts_with_problems
@icinga.list_hosts_with_problems( 10 )
hosts_all
@icinga.hosts_all
host_problems
all, down, critical, unknown, handled, adjusted = @icinga.host_problems.values
or
p = @icinga.host_problems
down = h.dig(:down)
host_severity( params )
original code are from Icinga Web2
host_severity( {'attrs' => { 'state' => 0.0, 'acknowledgement' => 0.0, 'downtime_depth' => 0.0 } } )