Sha256: 4bfc41d77aa94e8edd41b565da8b6d1d987ea1f3cd2d05ca1b886852f21a90ad

Contents?: true

Size: 1.2 KB

Versions: 25

Compression:

Stored size: 1.2 KB

Contents

module MCollective
  module Agent
    class Netstat < RPC::Agent
      metadata    :name        => "netstat info",
                  :description => "Agent to get netstat info",
                  :author      => "Reactor8",
                  :license     => "",
                  :version     => "",
                  :url         => "",
                  :timeout     => 2
      action "get_tcp_udp" do 
        output = `netstat -nltpu`
        results = output.scan(/(^[a-z0-9]+)\s+(\d)\s+(\d)\s+([0-9:.*]+)\s+([0-9:.*]+)\s+(LISTEN)?\s+([0-9a-zA-Z\/\-: ]+)/m)

        netstat_result = []
        results.each do |result|
          netstat_packet = {}
          netstat_packet.store(:protocol, result[0])
          netstat_packet.store(:recv_q,   result[1])
          netstat_packet.store(:send_q,   result[2])
          netstat_packet.store(:local,    result[3])
          netstat_packet.store(:foreign,  result[4])
          netstat_packet.store(:state,    result[5])
          netstat_packet.store(:program,  result[6].strip)
          netstat_result << netstat_packet
        end

        reply[:data]  = netstat_result
        reply[:pbuilderid] = Facts["pbuilderid"]
        reply[:status] = :ok
      end
    end
  end
end

Version data entries

25 entries across 23 versions & 1 rubygems

Version Path
dtk-node-agent-0.7.7 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.7.6 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.7.5 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.7.4.1 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.7.4 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.7.3 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.7.2 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.7.1 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.7.0 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.6.7 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.6.6 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.6.4 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.6.3 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.6.2 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.6.1 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.6.0 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.5.17 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.5.16 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.5.15 mcollective_additions/plugins/v1.2/agent/netstat.rb
dtk-node-agent-0.5.14 mcollective_additions/plugins/v1.2/agent/netstat.rb