csle_collector.docker_stats_manager.dao package

Submodules

csle_collector.docker_stats_manager.dao.docker_stats module

class csle_collector.docker_stats_manager.dao.docker_stats.DockerStats(pids: float = 0.0, timestamp: str = '', cpu_percent: float = 0.0, mem_current: float = 0.0, mem_total: float = 0.0, mem_percent: float = 0.0, blk_read: float = 0.0, blk_write: float = 0.0, net_rx: float = 0.0, net_tx: float = 0.0, container_name: str = '', ip: Optional[str] = None, ts: Union[None, float] = None)[source]

Bases: csle_base.json_serializable.JSONSerializable

DTO class containing docker statistics

static compute_averages(stats_list: List[csle_collector.docker_stats_manager.dao.docker_stats.DockerStats]) csle_collector.docker_stats_manager.dao.docker_stats.DockerStats[source]

Compute average stats from a list

Parameters

stats_list – the list to use to compute averages

Returns

a new DockerStats object with the averages

copy() csle_collector.docker_stats_manager.dao.docker_stats.DockerStats[source]
Returns

a copy of the object

static from_dict(parsed_stats_dict: Dict[str, Any]) csle_collector.docker_stats_manager.dao.docker_stats.DockerStats[source]

Parses a DockerStats object from a dict

Parameters

parsed_stats_dict – the dict to parse

Returns

the parsed DockerStats object

static from_json_file(json_file_path: str) csle_collector.docker_stats_manager.dao.docker_stats.DockerStats[source]

Reads a json file and converts it to a DTO

Parameters

json_file_path – the json file path

Returns

the converted DTO

static from_kafka_record(record: str) csle_collector.docker_stats_manager.dao.docker_stats.DockerStats[source]

Converts a kafka record to a DTO

Parameters

record – the recordto convert

Returns

the created DTO

get_deltas(stats_prime: csle_collector.docker_stats_manager.dao.docker_stats.DockerStats) Tuple[List[int], List[str]][source]

Get the deltas between two stats objects

Parameters
  • stats_prime – the stats object to compare with

  • max_counter – the maximum counter_value

Returns

the deltas and the labels

get_values() Tuple[List[int], List[str]][source]

Get the current values

Returns

the values and the labels

num_attributes() int[source]
Returns

The number of attributes of the DTO

static schema() csle_collector.docker_stats_manager.dao.docker_stats.DockerStats[source]
Returns

get the schema of the DTO

to_dict() Dict[str, Any][source]

Converts the object to a dict representation

Returns

a dict representation of the object

to_kafka_record(ip: str) str[source]

Converts the DTO to a kafka record

Parameters

ip – the ip to add to the DTO

Returns

the Kafka record

update_with_kafka_record(record: str) None[source]

Updates the DTO with a given kafka record

Parameters

record – the record to update with

Returns

None

update_with_kafka_record_ip(record: str, ip: str) None[source]

Updates the DTO with a given kafka record

Parameters
  • record – the record to update with

  • ip – the ip of the host

Returns

None

Module contents