:ddlZddlZddlmZmZddlmZddlmZddl m Z m Z m Z m Z ddl mZmZmZddl mZmZmZdZd Zd Zd Zd Zd ZdZdZddZdS)N)TupleIterable) __version__)time_unit_type) ParseDatetimeformat_aliasesSmartFormatterBY_USAGE_PERCENT) period_type2check_percentagescheck_positive_int) alias_actioncheck_from_zero_to_max_intargparse_process_period) FIELD DESCRIPTION)anyzfaults of all types)cpuzCPU usage faults)iozmax io usage faults)iopsz,max io operations faults; (LVE version >= 8))epzmax entry processes faults)nproczmax processes faults)pmemzout of physical memory faults)vmemzout of virtual memory faults) rrzaverage CPU usage mysql_cpuzaverage MySQL CPU usagerzaverage io usage;mysql_iozaverage MySQL io usage;rz)average io operations; (LVE version >= 8)rz:average number of entry processes (concurrent connections)rzaverage number of processesrzaverage physical memory usagerzaverage virtual memory usage)r) any_faultsz#total number of faults of all typesrrrr r"r#r$r%r&) cpu_faultsz total number of CPU usage faults) io_faultsztotal number of max io faults) iops_faultsz= 8)) ep_faultsz*total number of max entry processes faults) nproc_faultsz$total number of max processes faults) pmem_faultsz-total number of out of physical memory faults) vmem_faultsz,total number of out of virtual memory faults) )KeyzFields to show)allzall available fields)rz CPU fields)rz IO fields)rz IOPS fields)rz/entry processes (concurrent connections) fields)rznumber of processes fields)rzphysical memory fields)rzvirtual memory fields)mysqlzmysql_cpu & mysql_io fieldsc|}|tt|dddvr|Stjd|dt |)Nr"z8" is an invalid; must be one of the available options: )lowerlistzipargparseArgumentTypeErrorr)valuefields value_lowereds /builddir/build/BUILDROOT/lve-stats-4.3.2-1.el9.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/lib/parsers/cloudlinux_statistics_parser.pycheck_argumentr>NslKKMMMS&\**1-abb111( h h hP^_ePfPf h h   c,t|tSN)r>BY_USAGE_FIELDSr:s r=check_by_usagerDY % 1 11r?c,t|tSrA)r> BY_FAULT_DSCRrCs r=check_by_faultrH^s % / //r?c,t|tSrA)r>ORDER_BY_FIELDSrCs r=check_order_byrKcrEr? localhostc 8 |ptj tjdtd}|dddd|d d t d d |d}|dtdtdtt|dttdd|d}|dtdtt|dtdd|ddt |d |d!d"}|d#d$t" tjd%&z d'd()|d*d+t" d'd,)|d- fd.d/|d0t&d1|d2d't)t*d3zd4gd5tt*d67|d8d9t,d:tt.|d;}|dt2d?d@|dAdBt dC||}t7|S)DNzd%(prog)s - CLI utility that provides historical information about resource usage of a running systemzcloudlinux-statistics) descriptionformatter_classprogz-jz--jsonzreturn data in JSON format store_true)helpactionz-vz --versionz&show program's version number and exitversion)rTrRrSzfilter items by resource usagez --by-usagez)R|show LVEs with usage (averaged) within z( percent of the limit available values: )typerRz --percentagez=defines percentage for --by-usage option; default %(default)sz0..100)rUdefaultrRmetavarz filter items by amount of faultsz --by-faultz;R|show only accounts that have some faults for given limit z --thresholdr3znin combination with --by-fault, shows only accounts with number of faults more then given; default %(default)s)rUrVrRz --server_idz --server-idzFused with central database for multiple servers, default "%(default)s"zfilter items by time intervalzget information for given period of time; you can either set --from and --to options, or just get information for the recent time using --period option. --from and --to values are ignored when --period is setz-fz--from )minutes+zhrun report from date and time in [YY]YY-MM-DD[ HH:MM] format; if not present last 10 minutes are assumed)rSrVnargsrRz-tz--tozhrun report up to date and time in [YY]YY-MM-DD[ HH:MM] format; if not present, reports results up to nowz--periodc$t|SrA)r )r: datetime_nows r=z)setup_statistics_parser..s|E<'H'Hr?ztime period; specify minutes with m, h - hours, days with d, and values: today, yesterday; 5m - last 5 minutes, 4h -- last four hours, 2d - last 2 days, as well as todayz--limitz2limit number of results to display, 0 is unlimitedz--show))r0r0z@R|show only the listed columns; "all" for all supported columns COLUMN_NAME)r[rSrVrRrWz-oz --order-byz/R|orders results by one of the following keys: zdetailed statisticsz--idz9get detailed statistics for database record with given idz --time-unit<z}group statistics using given time, 1 minute by default; for example: 1h or 1h30m or dynamic; available only in pair with --idz-rz--for-resellerzR9IRR0>0O0ORRSSS.8H LV^```,,-OPPL> kN[hLiLi k kmmm.4555 }3 UWWW ,,'*LMML  h}x1"====: ;;;  fm9 ::: HHHHijjj  2 ACCC L1N$O$O oQ_`lQmQm o o    l a@_@_ a accc--.CDDMS HJJJNBUVVV   S K!!%((I "9 - --r?)rLN)r8rbtypingrrlvestatsr$lvestats.lib.parsers.lveinfoargparser#lvestats.lib.commons.argparse_utilsrrr r r r r rrrrGrBrJrir>rDrHrKrur?r=r{s1"""""""" ??????ooooooooooooccccccccccqqqqqqqqqq   *     222 000 222 X.X.X.X.X.X.r?