Module: Vnstat

Defined in:
lib/vnstat.rb,
lib/vnstat/error.rb,
lib/vnstat/utils.rb,
lib/vnstat/parser.rb,
lib/vnstat/result.rb,
lib/vnstat/traffic.rb,
lib/vnstat/version.rb,
lib/vnstat/document.rb,
lib/vnstat/interface.rb,
lib/vnstat/result/day.rb,
lib/vnstat/result/hour.rb,
lib/vnstat/result/month.rb,
lib/vnstat/traffic/base.rb,
lib/vnstat/traffic/tops.rb,
lib/vnstat/configuration.rb,
lib/vnstat/result/minute.rb,
lib/vnstat/traffic/daily.rb,
lib/vnstat/traffic/hourly.rb,
lib/vnstat/traffic/monthly.rb,
lib/vnstat/interface_collection.rb,
lib/vnstat/result/date_delegation.rb,
lib/vnstat/result/time_comparable.rb,
lib/vnstat/errors/unknown_interface.rb,
lib/vnstat/errors/executable_not_found.rb

Overview

The Vnstat namespace.

Defined Under Namespace

Modules: Parser, Traffic, Utils Classes: Configuration, Document, Error, ExecutableNotFound, Interface, InterfaceCollection, Result, UnknownInterface

Constant Summary collapse

VERSION =
'3.0.7'

Class Method Summary collapse

Class Method Details

.[](id) ⇒ Interface

Returns traffic information for the given interface.

Parameters:

  • id (String)

    The network interface identifier.

Returns:



49
50
51
# File 'lib/vnstat.rb', line 49

def [](id)
  interfaces[id]
end

.cli_versionString

Returns information for the currently installed version of vnstat.

Returns:

  • (String)


65
66
67
# File 'lib/vnstat.rb', line 65

def cli_version
  Utils.call_executable('-v')
end

.configConfiguration

The configuration of the Vnstat environment.

Returns:



30
31
32
# File 'lib/vnstat.rb', line 30

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Configuration

Configures the Vnstat environment.

Yield Parameters:

Returns:



39
40
41
42
# File 'lib/vnstat.rb', line 39

def configure
  yield(config)
  config
end

.interfacesInterfaceCollection

Returns traffic information for all known interfaces.

Returns:



57
58
59
# File 'lib/vnstat.rb', line 57

def interfaces
  InterfaceCollection.open
end