Class: Vmstat::NetworkInterface

Inherits:
Struct
  • Object
show all
Defined in:
lib/vmstat/network_interface.rb

Overview

Gathered the network interface information.

Constant Summary collapse

ETHERNET_TYPE =

The type of ethernet devices on freebsd/mac os x

0x06
LOOPBACK_TYPE =

The type of loopback devices on freebsd/mac os x

0x18

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#in_bytesFixnum

the number od bytes that where received inbound.

Returns:

  • (Fixnum)

    the current value of in_bytes



10
11
12
# File 'lib/vmstat/network_interface.rb', line 10

def in_bytes
  @in_bytes
end

#in_dropsFixnum

the number of drops that where received inbound.

Returns:

  • (Fixnum)

    the current value of in_drops



10
11
12
# File 'lib/vmstat/network_interface.rb', line 10

def in_drops
  @in_drops
end

#in_errorsFixnum

the number of errors that where received inbound.

Returns:

  • (Fixnum)

    the current value of in_errors



10
11
12
# File 'lib/vmstat/network_interface.rb', line 10

def in_errors
  @in_errors
end

#nameSymbol

the system name for the network interface.

Returns:

  • (Symbol)

    the current value of name



10
11
12
# File 'lib/vmstat/network_interface.rb', line 10

def name
  @name
end

#out_bytesFixnum

the number od bytes that where send outbound.

Returns:

  • (Fixnum)

    the current value of out_bytes



10
11
12
# File 'lib/vmstat/network_interface.rb', line 10

def out_bytes
  @out_bytes
end

#out_errorsFixnum

the number od errors that where send outbound.

Returns:

  • (Fixnum)

    the current value of out_errors



10
11
12
# File 'lib/vmstat/network_interface.rb', line 10

def out_errors
  @out_errors
end

#typeFixnum

the type of the interface (bsd numbers)

Returns:

  • (Fixnum)

    the current value of type



10
11
12
# File 'lib/vmstat/network_interface.rb', line 10

def type
  @type
end

Instance Method Details

#ethernet?TrueClass, FalseClass

Checks if this network interface is a ethernet device.

Returns:

  • (TrueClass, FalseClass)

    true if it is a ethernet device, false otherwise.



29
30
31
# File 'lib/vmstat/network_interface.rb', line 29

def ethernet?
  type == ETHERNET_TYPE
end

#loopback?TrueClass, FalseClass

Checks if this network interface is a loopback device.

Returns:

  • (TrueClass, FalseClass)

    true if it is a loopback device, false otherwise.



22
23
24
# File 'lib/vmstat/network_interface.rb', line 22

def loopback?
  type == LOOPBACK_TYPE
end