Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/cloudinit/analyze/__pycache__/ |
Upload File : |
o x[hZ% � @ s� d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlmZm Z d dl mZ ddd�Zdd � Z d d� Zdd � Zdd� Zdd� Zdd� Zdeddfdd�Zedkree� Ze�� Zej\ZZeee� dS dS )� N)�datetime�timezone)�IO)�dump�show)� json_dumpsc C sh | s t jddd�} | jddd�}d|_|jdd d �}|jddd dddd� |jddd dddd� |jdtfd� |jddd �}|jddd dddd� |jddd dddd� |jddd dddd� |jdtfd� |jd d!d �}|jddd ddd"d� |jddd dddd� |jd t fd� |jd#d$d �}|jddd ddd"d� |jddd dddd� |jd#t fd� | S )%Nzcloudinit-analyzez,Devel tool: Analyze cloud-init logs and data)�prog�description�Subcommands� subcommand)�title�destT�blamez5Print list of executed stages ordered by time to init)�helpz-iz--infile�store�infilez/var/log/cloud-init.logzspecify where to read input.)�actionr �defaultr z-oz --outfile�outfile�-zspecify where to write output. )r r z.Print list of in-order events during executionz-fz--format�print_formatz%I%D @%Es +%dszspecify formatting of output.zspecify where to write output.r z%Dump cloud-init events in JSON formatzspecify where to read input. �bootz2Print list of boot times for kernel and cloud-init)�argparse�ArgumentParser�add_subparsers�required� add_parser�add_argument�set_defaults� analyze_blame�analyze_show�analyze_dump�analyze_boot)�parser� subparsers�parser_blame�parser_show�parser_dump�parser_boot� r) �</usr/lib/python3/dist-packages/cloudinit/analyze/__init__.py� get_parser s� ��������������r+ c C s t |�\}}t�� }|\}}}}t�|tj�} t�|tj�} t�|tj�}zdd� t|�D �d }t�|d tj�} W n tyI d} tj }Y nw d}d}d}tj |tj |tj|i}|| }|| }| | ||||||| d � }|�|| j di |��� t||� |S )a� Report a list of how long different boot operations took. For Example: -- Most Recent Boot Record -- Kernel Started at: <time> Kernel ended boot at: <time> Kernel time to boot (seconds): <time> Cloud-init activated by systemd at: <time> Time between Kernel end boot and Cloud-init activation (seconds):<time> Cloud-init start: <time> c S s( g | ]}|d dkrd|d v r|�qS )�namez init-localzstarting searchr r) )�.0�er) r) r* � <listcomp>� s �z analyze_boot.<locals>.<listcomp>���� timestampz4Could not find init-local log-line in cloud-init.logz�Your Linux distro or container does not support this functionality. You must be running a Kernel Telemetry supported distro. Please check https://docs.cloud-init.io/en/latest/topics/analyze.html for more information on supported distros. a* -- Most Recent Boot Record -- Kernel Started at: {k_s_t} Kernel ended boot at: {k_e_t} Kernel time to boot (seconds): {k_r} Cloud-init activated by systemd at: {ci_sysd_t} Time between Kernel end boot and Cloud-init activation (seconds): {bt_r} Cloud-init start: {ci_start} z�-- Most Recent Container Boot Record -- Container started at: {k_s_t} Cloud-init activated by systemd at: {ci_sysd_t} Cloud-init start: {ci_start} ) �k_s_t�k_e_t�k_r�bt_r�k_e�k_s�ci_sysd� ci_sysd_t�ci_startNr) )�configure_ior �dist_check_timestampr � fromtimestampr �utc�_get_events� IndexError� FAIL_CODE�CONTAINER_CODE�SUCCESS_CODE�write�format�clean_io)r, �args�infh�outfh�kernel_info�status_code�kernel_start� kernel_end� ci_sysd_start�kernel_start_timestamp�kernel_end_timestamp�ci_sysd_start_timestamp�last_init_localr: �FAILURE_MSG�SUCCESS_MSG� CONTAINER_MSG� status_map�kernel_runtime�between_process_runtime�kwargsr) r) r* r"