Class: TCellAgent::SensorEvents::ServerAgentDetailsSensorEvent

Inherits:
TCellSensorEvent
  • Object
show all
Defined in:
lib/tcell_agent/sensor_events/server_agent.rb

Instance Attribute Summary

Attributes inherited from TCellSensorEvent

#ensure, #flush, #send

Instance Method Summary collapse

Methods inherited from TCellSensorEvent

#bucket_key, #calculateOffset, #post_process

Constructor Details

#initializeServerAgentDetailsSensorEvent

Returns a new instance of ServerAgentDetailsSensorEvent.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/tcell_agent/sensor_events/server_agent.rb', line 19

def initialize
    super("server_agent_details")
    @flush = true
    @ensure = true
    begin
         = Etc.getlogin
        self["user"] = 
        TCellAgent.logger.debug("User #{}")
        begin
            info = Etc.getpwnam()
            self["group"] = info.gid.to_s
            TCellAgent.logger.debug("Group #{info.gid.to_s}")
        rescue Exception => te
            TCellAgent.logger.warn("Exception finding group id: #{te.message}")
            TCellAgent.logger.debug(te.backtrace)
            self["group"] = "unknown"
        end
    rescue Exception => to
        self["user"] = "unknown"
        self["group"] = "unknown"
        TCellAgent.logger.warn("Exception finding user & group: #{to.message}")
        TCellAgent.logger.debug(te.backtrace)
    end
end