ExFacts v0.1.9 ExFacts.System.Disk

Handles all logic with regards to collecting metrics on the disks of the host.

Direct calls can be made to all functions, but it recommended that only the following entry points be used.

Summary

Functions

Using the data provided by ExFacts.System.Disk.get_file_systems/2 it converts each list item to populate a complete ExFacts.System.Disk.PartitionStat struct

Using the mtab information provided by ExFacts.System.Disk.read_mtab/0 and the boolean variable all it will return the filesystems of the host as list

Queries the host udev subsystem to gather the data of a disk and returns the serial. Assumes the program will have access to udevadm either at the default path of /sbin/udevadm or the supplied path via configuration

Returns ExFacts.System.Disk.IOCounterStat structs for each disk passed in. queries the host system to gather the IO data and populates the struct accordingly

Reads the disk information from the host, cleans up the data a bit and returns a list with the info

Auxilary function used by ExFacts.System.Disk.io_counters/1 to create the struct with the passed in data for each disk

Reads the hosts mtab and returns a list of lists containing the data for further use

Returns ExFacts.System.Disk.UsageStat struc for the passed in path

Functions

generate_list(data)
generate_list(data :: []) :: %ExFacts.System.Disk.PartitionStat{device: term, fs_type: term, mount_point: term, opts: term}

Using the data provided by ExFacts.System.Disk.get_file_systems/2 it converts each list item to populate a complete ExFacts.System.Disk.PartitionStat struct.

get_file_systems(mtab, all)
get_file_systems(mtab :: [], all :: boolean) :: [binary]

Using the mtab information provided by ExFacts.System.Disk.read_mtab/0 and the boolean variable all it will return the filesystems of the host as list.

get_fs_type(path)
get_fs_type(String.t) :: String.t
get_serial(disk)
get_serial(String.t) :: String.t

Queries the host udev subsystem to gather the data of a disk and returns the serial. Assumes the program will have access to udevadm either at the default path of /sbin/udevadm or the supplied path via configuration.

io_counters(disks)
io_counters([String.t]) :: [%ExFacts.System.Disk.IOCounterStat{io_time: term, iops_in_progress: term, merged_read_count: term, merged_write_count: term, name: term, read_bytes: term, read_count: term, read_time: term, serial_number: term, weighted_io: term, write_bytes: term, write_count: term, write_time: term}]

Returns ExFacts.System.Disk.IOCounterStat structs for each disk passed in. queries the host system to gather the IO data and populates the struct accordingly.

partitions(all \\ true)
partitions(boolean) :: tuple

Reads the disk information from the host, cleans up the data a bit and returns a list with the info.

Options

The accepted options are:

  • :all - configures which disks are returned, true for all, false for physical disks and their respective mounts only.
populate_io(name, acc, data)
populate_io(String.t, List.t, [[String.t]]) :: [%ExFacts.System.Disk.IOCounterStat{io_time: term, iops_in_progress: term, merged_read_count: term, merged_write_count: term, name: term, read_bytes: term, read_count: term, read_time: term, serial_number: term, weighted_io: term, write_bytes: term, write_count: term, write_time: term}]

Auxilary function used by ExFacts.System.Disk.io_counters/1 to create the struct with the passed in data for each disk.

read_mtab()
read_mtab() :: [[binary]]

Reads the hosts mtab and returns a list of lists containing the data for further use.

usage(path)
usage(String.t) :: %ExFacts.System.Disk.UsageStat{free: term, fs_type: term, inodes_free: term, inodes_total: term, inodes_used: term, inodes_used_percent: term, path: term, total: term, used: term, used_percent: term}

Returns ExFacts.System.Disk.UsageStat struc for the passed in path.