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.



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

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

Instance Attribute Details

#communityObject

The community string



161
162
163
# File 'lib/nexpose/alert.rb', line 161

def community
  @community
end

#serverObject

The server to sent this alert



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

def server
  @server
end

Class Method Details

.parse(xml) ⇒ Object



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

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

Instance Method Details

#to_xmlObject



177
178
179
180
181
182
# File 'lib/nexpose/alert.rb', line 177

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