Class: Nexpose::SNMPAlert

Inherits:
Object
  • Object
show all
Includes:
Sanitize
Defined in:
lib/nexpose/alert.rb

Overview

SNMP Alert This class should only exist as an element of an Alert.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Sanitize

#replace_entities

Constructor Details

#initialize(community, server) ⇒ SNMPAlert

Returns a new instance of SNMPAlert.



170
171
172
173
# File 'lib/nexpose/alert.rb', line 170

def initialize(community, server)
  @community = community
  @server = server
end

Instance Attribute Details

#communityObject

The community string



165
166
167
# File 'lib/nexpose/alert.rb', line 165

def community
  @community
end

#serverObject

The server to sent this alert



168
169
170
# File 'lib/nexpose/alert.rb', line 168

def server
  @server
end

Class Method Details

.parse(xml) ⇒ Object



175
176
177
# File 'lib/nexpose/alert.rb', line 175

def self.parse(xml)
  new(xml.attributes['community'], xml.attributes['server'])
end

Instance Method Details

#to_xmlObject



181
182
183
184
185
186
# File 'lib/nexpose/alert.rb', line 181

def to_xml
  xml = '<snmpAlert'
  xml << %Q( community="#{replace_entities(community)}")
  xml << %Q( server="#{replace_entities(server)}">)
  xml << '</snmpAlert>'
end