Class: OpsviewRest::Servicecheck
- Inherits:
-
Object
- Object
- OpsviewRest::Servicecheck
- Includes:
- Mixin
- Defined in:
- lib/opsview_rest/servicecheck.rb
Instance Attribute Summary collapse
-
#opsview ⇒ Object
Returns the value of attribute opsview.
-
#options ⇒ Object
Returns the value of attribute options.
-
#resource_type ⇒ Object
Returns the value of attribute resource_type.
Instance Method Summary collapse
-
#initialize(opsview, options = {}) ⇒ Servicecheck
constructor
A new instance of Servicecheck.
Methods included from Mixin
#resource_path, #save, #to_json
Constructor Details
#initialize(opsview, options = {}) ⇒ Servicecheck
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/opsview_rest/servicecheck.rb', line 9 def initialize(opsview, = {}) = { name: 'Unknown', description: 'Unknown', keywords: [], attribute: nil, servicegroup: 'Unknown', dependencies: ['Opsview Agent'], check_period: '24x7', check_interval: '5', check_attempts: '3', retry_check_interval: '1', plugin: 'check_nrpe', args: '', stalking: nil, volatile: false, invertresults: false, notification_options: 'w,c,r', notification_period: nil, notification_interval: nil, flap_detection_enabled: true, checktype: 'Active Plugin', save: true, replace: false }.update @opsview = opsview @resource_type = [:type] [:keywords] = [:keywords].map { |x| { 'name' => x } } [:servicegroup] = { 'name' => [:servicegroup] } [:dependencies] = [:dependencies].map { |x| { 'name' => x } } [:check_period] = { 'name' => [:check_period] } [:plugin] = { 'name' => [:plugin] } [:volatile] = ([:volatile] ? 1 : 0) [:invertresults] = ([:invertresults] ? 1 : 0) [:flap_detection_enabled] = ([:flap_detection_enabled] ? 1 : 0) [:checktype] = { 'name' => [:checktype] } save([:replace]) if [:save] end |
Instance Attribute Details
#opsview ⇒ Object
Returns the value of attribute opsview.
7 8 9 |
# File 'lib/opsview_rest/servicecheck.rb', line 7 def opsview @opsview end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/opsview_rest/servicecheck.rb', line 7 def end |
#resource_type ⇒ Object
Returns the value of attribute resource_type.
7 8 9 |
# File 'lib/opsview_rest/servicecheck.rb', line 7 def resource_type @resource_type end |