Class: WmiMonitoring
- Inherits:
-
Object
- Object
- WmiMonitoring
- Defined in:
- lib/monitor/client/wmi/wmi_monitoring.rb
Constant Summary collapse
- TESTOP =
["=", "!=", "<", ">","Contain","Not contain"]
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
-
#wmiref ⇒ Object
Returns the value of attribute wmiref.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #get_state ⇒ Object
-
#initialize(st, wmiref_name, op, th, sev) ⇒ WmiMonitoring
constructor
A new instance of WmiMonitoring.
- #oper ⇒ Object
- #raw_severity ⇒ Object
-
#request(node) ⇒ Object
compute the value.
- #severity ⇒ Object
Constructor Details
#initialize(st, wmiref_name, op, th, sev) ⇒ WmiMonitoring
Returns a new instance of WmiMonitoring.
8 9 10 11 12 13 14 15 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 8 def initialize (st, wmiref_name, op, th, sev) @state=st @wmiref=wmiref_name @oper=op @value=th #index of $status @severity=sev end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 4 def value @value end |
#wmiref ⇒ Object
Returns the value of attribute wmiref.
4 5 6 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 4 def wmiref @wmiref end |
Instance Method Details
#active? ⇒ Boolean
25 26 27 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 25 def active?() return @state==1 end |
#get_state ⇒ Object
21 22 23 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 21 def get_state() return @state end |
#oper ⇒ Object
17 18 19 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 17 def oper() return TESTOP[@oper] end |
#raw_severity ⇒ Object
53 54 55 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 53 def raw_severity() return @severity end |
#request(node) ⇒ Object
compute the value
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 32 def request(node) if node != nil wmiref=$wmi_refs[@wmiref].value.dup if node.get_account_id("wmi") begin login, password = node.get_account_id("wmi") resultt=wmi_request(login, password, node.ip, wmiref) if resultt.size() > 0 return resultt end rescue Exception => msg $log.error("Exception WMI request for #{wmiref}: #{msg}") raise end else $log.error("wmi login/password not set for host #{node.ip}") end end return nil end |
#severity ⇒ Object
57 58 59 |
# File 'lib/monitor/client/wmi/wmi_monitoring.rb', line 57 def severity() return $status[@severity] end |