%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/status.pyc

�
���^c@@s_dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddl
mZddlmZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZeje�ZdZ iZ!id	d
6Z"eje#�Zd�Z$d�Z%d
�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d�Z3d�Z4d�Z5d�Z6d�Z7d�Z8d �Z9de;d!�Z<d"�Z=dd#�Z>d$d%�Z?dS(&us
Module for returning various status data about a minion.
These data can be useful for compiling into stats later.
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(trange(tzip(tCommandExecutionErrorustatusutimeutime_cC@s tjjj�rtdfStS(u0
    Not all functions supported by Windows
    u0Windows platform is not supported by this module(tsalttutilstplatformt
is_windowstFalset__virtualname__(((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt__virtual__1s
cC@s=|j�rt|�Syt|�SWntk
r8|SXdS(u�
    Convert a string to a number.
    Returns an integer if the string represents an integer, a floating
    point number if the string is a real number, or the string unchanged
    otherwise.
    N(tisdigittinttfloatt
ValueError(ttext((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt_number;s

cC@s�d}tdd�}|ddkr5td��n|d}|jd�}|djd	�}t|d�d
t|d�dt|d�dt|d
�}|S(u
    Return the number of seconds since boot time on AIX

    t=$(LC_ALL=POSIX ps -o etime= -p 1)
    d=0 h=0
    case $t in *-*) d=${t%%-*}; t=${t#*-};; esac
    case $t in *:*:*) h=${t%%:*}; t=${t#*:};; esac
    s=$((d*86400 + h*3600 + ${t%%:*}*60 + ${t#*:}))

    t is 7-20:46:46
    iucmd.run_allups -o etime= -p 1uretcodeu#Unable to find boot_time for pid 1.ustdoutu-iu:i�Qii<i(t__salt__RtsplitR(t	boot_secstrestbt_timetdaysthms((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt_get_boot_time_aixJs
FcC@sftdd�}|jd�}|dj�}i|djd�d6|djd�d6|d	d
6S(u(
    Return the load average on AIX
    ucmd.runuuptimeuload averageiu,u1-miniu5-miniu15-min(RRtstrip(tuptimetldavgtload_avg((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt_aix_loadavgascC@s*tdddt�j�}t|d�S(uH
    Return the maximun number of PROCESSES allowed per user on AIX
    ucmd.runu!lsattr -E -l sys0 | grep maxuproctpython_shelli(RtTrueRR(tnprocs((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
_aix_nprocnscC@s=i}d}d}d}tdtddt�j�}|jd�j�}d|krk|jd�}nd|kr�|jd�}nd|kr�|jd�}nd|kr�|jd�}nd	|kr�|jd	�}nxS|D]K}|s�q�n|j�}i||d
6dj||�d6|||<q�W|S(
u�
    Return the process data

    .. versionchanged:: 2016.11.4
        Added support for AIX

    CLI Example:

    .. code-block:: bash

        salt '*' status.procs
    iucmd.runupsR!uUSERuUIDuPIDuCOMMANDuCMDuuseru ucmd(Rt
__grains__R"t
splitlinestpopRtindextjoin(trettuindtpindtcindtplinestguidetlinetcomps((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytprocsvs. 
#cC@s�i}tdd�}xdtj|�D]S\}}dj|jd�d�}t|�}x|D]}||||<qaWq&W|S(u�
    Return a custom composite of status data and info for this minion,
    based on the minion config file. An example config like might be::

        status.cpustats.custom: [ 'cpu', 'ctxt', 'btime', 'processes' ]

    Where status refers to status.py, cpustats is the function
    where we get our data, and custom is this function It is followed
    by a list of keys that we want returned.

    This function is meant to replace all_status(), which returns
    anything and everything, which we probably don't want.

    By default, nothing is returned. Warning: Depending on what you
    include, there can be a LOT here!

    CLI Example:

    .. code-block:: bash

        salt '*' status.custom
    uconfig.dot_valsustatusu{0}()u.i(RRt	iteritemstformatRteval(R*tconftkeytvaltfunctvalstitem((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytcustom�s
cC@sdtj�}tjjj�r�d}tjj|�sQtdj	d|���ntjj
j|��)}tt
|j�j�d��}WdQXn�tjjj�r�tdd�}|ddkr�td	��nt|t|d
j�d��}n|tjjj�s tjjj�r^tdd
�}|sEtd��nt|t|��}ntjjj�s�tjjj�rLtdd
�}|s�td��n|jd�djd�dj�jdd�}tgg|jd�D]}|j�jd�^q�D]\}}	|t|	�f^q�}
t||
d�}n,tjjj�rjt�}ntdd�Stjj||�}tjj|�}||}
i|d6|j�d6t||�d6|
jd6dj	|
jd|
jdd�d6}tjjj d �r`tjjj�r1d nd!}t!td|�jtj"��|d"<n|S(#u�
    Return the uptime for this system.

    .. versionchanged:: 2015.8.9
        The uptime function was changed to return a dictionary of easy-to-read
        key/value pairs containing uptime information, instead of the output
        from a ``cmd.run`` call.

    .. versionchanged:: 2016.11.0
        Support for OpenBSD, FreeBSD, NetBSD, MacOS, and Solaris

    .. versionchanged:: 2016.11.4
        Added support for AIX

    CLI Example:

    .. code-block:: bash

        salt '*' status.uptime
    u/proc/uptimeuFile {ut_path} was not found.tut_pathiNucmd.run_allu%kstat -p unix:0:system_misc:boot_timeuretcodeu"The boot_time kstat was not found.ustdouti����u
sysctl.getu
kern.boottimeu*Cannot find kern.boottime system parameteru{u}u uu,u=usecucmd.runuuptimeusecondsu	since_isousince_tudaysu{0}:{1}ii<utimeuwhouwho -suusers(#ttimeRRR	tis_linuxtostpathtexistsRR4tfilestfopenRRtreadRtis_sunosRt
is_openbsdt	is_netbsdt
is_freebsdt	is_darwinRtreplacetdicttis_aixRtdatetimetutcfromtimestampt	isoformatRtsecondstwhichtlentlinesep(tcurr_secondsR=trfhRQRtbt_datatdatatptktvRt	boot_timet	curr_timetup_timetut_rettwho_cmd((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR�sP+'$$2\


()cC@srtddkrt�Sytj�}Wn#tk
rLtjjd��nXi|dd6|dd6|dd	6S(
u
    Return the load averages for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    CLI Example:

    .. code-block:: bash

        salt '*' status.loadavg

        :raises CommandExecutionError: If the system cannot report loadaverages to Python
    ukerneluAIXu1status.loadavag is not available on your platformiu1-miniu5-miniu15-min(R%R R@t
getloadavgtAttributeErrorRt
exceptionsR(R((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytloadavgs
c@s|d�}d�}d�}d�}d�}i|d6|d6|d6|d	6|d
6}d�|jtd�fd
���S(u
    Return the CPU stats for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    .. versionchanged:: 2018.3.0
        Added support for OpenBSD

    CLI Example:

    .. code-block:: bash

        salt '*' status.cpustats
    cS@s�i}y@tjjjdd��"}tjjj|j��}WdQXWntk
rYn�Xx�|j�D]�}|syqgn|j	�}|ddkr.it
|d�d6t
|d�d	6t
|d
�d6t
|d�d
6t
|d�d6t
|d�d6t
|d�d6t
|d�d6||d<qg|ddkr�it
|d�d6g|dD]}t
|�^q]d6||d<qg|ddkr�it
|d�d6g|dD]}t
|�^q�d6||d<qgt
|d�||d<qgW|S(u;
        linux specific implementation of cpustats
        u
/proc/staturNiucpuiuidleiuiowaitiuirqiuniceiusoftirqiustealiusystemiuuseruintrutotaluirqsusoftirqs(RRRCRDtstringutilst
to_unicodeREtIOErrorR&RR(R*tfp_tstatsR0R1tx((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytlinux_cpustats8s6%
22c	S@s�tdd�j�}|dj�}|jd�}|dj�}|jd�}|dj�}d}i}xy||D]m}it||d|�d6t||dd|�d	6t||dd|�d
6||<|d7}q{W|S(u=
        freebsd specific implementation of cpustats
        ucmd.runu	vmstat -Piucpu0iuusiiusyuid(RR&RR(R(	tvmstattvm0tcpu0loctvm1tusloctvm2tcpuctrR*tcpu((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytfreebsd_cpustatsZs$cS@s�tdd�j�}|dj�}i}x�|D]�}|jd�rNq3n|j�}i|t|d�<xGtdt|�d�D],}t||�|t|d�||<q�Wq3W|S(u;
        sunos specific implementation of cpustats
        ucmd.runu
mpstat 1 2iuCPUi(RR&Rt
startswithRRRS(tmpstattfieldsR*Rsti((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytsunos_cpustatsms
 .c	S@s�i}g|d<d}g}xstdd�j�D][}|sEq3nt|d�}|jd�r�|jd�}|dji�i|d|d<|dj�}xQtdt|��D]7}||jd	�}|d|d|d|d<q�Wn|jd
�r|j�}q3n|r3|j�}i|t|d�<xJtdt|�d�D],}t||�|t|d�||<q[Wq3q3W|S(u9
        AIX specific implementation of cpustats
        umpstatucmd.runu	mpstat -auSystemu:usystemiiu=ucpuN(	tNoneRR&RSRuRtappendRR(	R*tprocnRwR0R1t	cpu_compsRxtcpu_valstcpustat((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytaix_cpustats}s2
% 1cS@s�tdd�j�}|dj�}i}xi|dD]]}|j�}|d}i||<x4t|d�D]"\}}||d|||<qnWq7W|S(u=
        openbsd specific implementation of cpustats
        ucmd.runusystat -s 2 -B cpuiiii(RR&Rt	enumerate(tsystatRwR*Rstcpu_linetcpu_idxtidxtfield((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytopenbsd_cpustats�s

uLinuxuFreeBSDuOpenBSDuSunOSuAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((terrmsg(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt<lambda>�s(tgetR%(RkRtRyR�R�tget_version((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytcpustats(s	"			!	
c@sld�}d�}d�}d�}i|d6|d6|d6|d6}d	�|jtd
�fd���S(u
    Return the memory info for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    .. versionchanged:: 2018.3.0
        Added support for OpenBSD

    CLI Example:

    .. code-block:: bash

        salt '*' status.meminfo
    cS@s�i}y@tjjjdd��"}tjjj|j��}WdQXWntk
rYn�Xx�|j�D]|}|syqgn|j	�}|dj
dd�|d<i|dd6||d<t|�d	krg|d	||dd
<qgqgW|S(u:
        linux specific implementation of meminfo
        u
/proc/meminfourNiu:uiuvalueiuunit(RRRCRDReRfRERgR&RRKRS(R*RhRiR0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
linux_meminfo�s %
cS@s!tdd�j�}g|D]}|jd�r|^q}g|D]}|jd�^qE}g|D]%}g|D]}|j�^qt^qg}g|D]}|dr�|^q�}i}x |D]}|d||d<q�Wtdd�j�}g|D]}|r�|^q�}||d<|S(	u<
        freebsd specific implementation of meminfo
        ucmd.runu	sysctl vmuvmu:iiusysctl -n vm.vmtotalu
vm.vmtotal(RR&RuRR(tsysctlvmRjtyR*R0tsysctlvmtot((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytfreebsd_meminfo�s("2#

cS@sli}g|d<g|d<d}g}t}x�tdd�j�D]�}|sUqCntjd|�ry|j�}qCn|jd�s�|jd�r?t|d�}|dj	i�|j�}i|d||d<x\t
dt|��D]E}t|�|d	kr�||d	|d||d||<q�q�WqCn|jd
�s]|jd�rt|d�}|dj	i�|j�}dj|d|d	�}i|d||<xXt
dt|��D]A}t|�|d
kr�||d
|d||||<q�q�WqCn|jd�r>|j�}t}qCn|rCt|d�}|dj	i�|j�}i|d||d<xTt
dt|��D]=}t|�|kr�|||d||d||<q�q�WqCqCqCWx}tdd�j�D]e}|sq�nt|d�}|dj	i�|j�jdd	�}|d|d||d	<q�W|S(u8
        AIX specific implementation of meminfo
        usvmonuvmstatucmd.runusvmon -Gu\sumemoryupiniiupg spaceuin useu{0} {1}iuPageSizeu	vmstat -vu N(
RzRRR&tretmatchRRuRSR{RR4tlstrip(R*R|Rwt
pagesize_flagR0R1Rxtpg_space((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytaix_meminfo�sh


-))
cS@sdtdd�j�}ddddddd	d
g}|dj�dd!}tt||��}|S(
u<
        openbsd specific implementation of meminfo
        ucmd.runuvmstatuactive virtual pagesufree list sizeupage faultsupages reclaimedupages paged inupages paged outupages freedu
pages scannedii
(RR&RRLR(RlRwRXR*((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytopenbsd_meminfoEs		uLinuxuFreeBSDuOpenBSDuAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR�\s(R�R%(R�R�R�R�R�((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytmeminfo�s			O	
c@szd�}d�}d�}d�}i|d6|d6|d6|d6|d	6|d
6}d�|jtd�fd
���S(u/
    .. versionchanged:: 2016.3.2
        Return the CPU info for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    .. versionchanged:: 2018.3.0
        Added support for NetBSD and OpenBSD

    CLI Example:

    .. code-block:: bash

        salt '*' status.cpuinfo
    cS@s�i}y@tjjjdd��"}tjjj|j��}WdQXWntk
rYn�Xx�|j�D]x}|syqgn|j	d�}|dj
�|d<|ddkr�|dj	�||d<qg|dj
�||d<qgW|S(u7
        linux specific cpuinfo implementation
        u
/proc/cpuinfourNu:iuflagsi(RRRCRDReRfRERgR&RR(R*RhRiR0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
linux_cpuinfops%
cS@s�d}i}tdj�d
kr+d}nd}xetd|�j�D]M}|sZqHn|j|�}|dj�|d<|d	j�||d<qHW|S(u5
        bsd specific cpuinfo implementation
        usysctl hw.model hw.ncpuukernelunetbsduopenbsdu=u:ucmd.runii(unetbsduopenbsd(R%tlowerRR&RR(tbsd_cmdR*tsepR0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytbsd_cpuinfo�s	cS@s�i}i|d<xutdd�j�D]]}|s9q'n|jd�}|dj�|d<t|dj�j��|d|d<q'Wg|d<d}x�tdd�j�D]�}|s�q�n|jd	�r�t|d�}|j�}|dji�d
|kr^i|d|d<t	|d�|d|dd
<t	|d
�|d|dd<q�d|kr�i|d|d<t	|d�|d|dd<q�q�|jd�r�|j�|d|d<q�|jd�r�|j�j�}|dd|d|d<t	|d�|d|d<t	|d�|d|d<t	|d�|d|d<dj
|d|dd �|d|d<q�q�W|S( u7
        sunos specific cpuinfo implementation
        uisainfoucmd.runu
isainfo -xu:iiupsrinfou
psrinfo -v -puThe physical processorucoresutopologyiiuthreadsuvirtualu iunameuvendorufamilyumodeliustepu{0} {1}i
ii����uclockNu      u    (RR&RRtsortedRzRuRSR{RR4(R*R0R1R|((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
sunos_cpuinfo�sD
,
 #&1cS@si}g|d<g|d<d}x�tdddt�j�D]�}|sOq=nt|d�}|jd�s}|jd�r=|dji�|jd�}|d	j�|d	<|d
|d||d	<q=q=q=Wx�tdddt�j�D]�}|sq�nt|d�}|jd�r�|dji�|jd�}|d	j�|d	<|d
|d||d	<q�q�q�Wx�tdd
dt�j�D]p}|s�q�nt|d�}|dji�|jd�}|d	j�|d	<|d
|d||d	<q�W|S(u6
        AIX  specific cpuinfo implementation
        uprtconfulparstatucmd.runuprtconf | grep -i "Processor"R!u	ProcessoruNumberu:iiuprtconf | grep "CPU"uCPUulparstat -i | grep CPUN(	RzRR"R&RSRuR{Rtrstrip(R*R|R0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytaix_cpuinfo�sB

###uLinuxuFreeBSDuNetBSDuOpenBSDuSunOSuAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR�,s(R�R%(R�R�R�R�R�((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytcpuinfo_s			C	F
c@scd�}d�}d�}i|d6|d6|d6|d6}d�|jtd	�fd
���S(u�
    .. versionchanged:: 2016.3.2
        Return the disk stats for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    CLI Example:

    .. code-block:: bash

        salt '*' status.diskstats
    cS@s�i}y@tjjjdd��"}tjjj|j��}WdQXWntk
rYn,Xx(|j�D]}|syqgn|j	�}it
|d�d6t
|d�d6t
|d�d	6t
|d
�d6t
|d�d
6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6||d<qgW|S( u<
        linux specific implementation of diskstats
        u/proc/diskstatsurNiumajoriuminoriudeviceiureads_issuediureads_mergediusectors_readiums_spent_readingiuwrites_completediu
writes_mergedi	usectors_writteni
ums_spent_writingiuio_in_progressiums_spent_in_ioi
uweighted_ms_spent_in_io(RRRCRDReRfRERgR&RR(R*RhRiR0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytlinux_diskstats=s4%
 cS@s�i}tdd�j�}|d}xr|dD]f}|j�}i||d<xCt|j�d|d�D]$\}}t|�||d|<qoWq1W|S(uU
        generic implementation of diskstats
        note: freebsd and sunos
        ucmd.runuiostat -xzdiii(RR&RRR(R*tiostattheaderR0R1tmetrictvalue((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytgeneric_diskstats^s
* c
S@s�i}d
}g}d}d}x�tdd�j�D]�}|s5|jd�s5|jd�rfq5ntjd|�s�|jd�}|dj�}|d}|d	}|d	j�}g||<t||�}||ji�i||||<q5nd|kro|jd�}|d	j�}|dj	�}t||�}||ji�i||||<q5|j�}xPt
dt|��D]9}	t|�|	kr�||	||||||	<q�q�Wq5W|S(u:
        AIX specific implementation of diskstats
        uucmd.runuiostat -dDVuSystemu-----------u\su:iiN(RzRR&RuR�R�RRSR{R�R(
R*R|Rwt	disk_namet	disk_modeR0t	dsk_compst
dsk_firstsR1Rx((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
aix_diskstatsms>%


)uLinuxuFreeBSDuSunOSuAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR��s(R�R%(R�R�R�R�((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt	diskstats/s	!		8
cG@sXt�}t�}|s(|jd�n=x:|D]2}|jd�rT|j|�q/|j|�q/W|r�tjdjd�|D���}tddkr�yFtjj	j
dd��(}tjjj|j
��j�}Wd	QXWq0tk
r�iSXn5tddkr$tdd
�j�}ntd��x�|D]�}|j�}tddkr�t|�dkr�|d}	|d}
|j|
�r�|j|	�q�q�q7t|�dkr7|d}	|d}
|j|
�r�|j|	�q�q7q7Wni}xX|D]P}tj|�}
|
j}|
j|}|
j|}i|d6|d6||<qW|S(u�
    Return the disk usage for this minion

    Usage::

        salt '*' status.diskusage [paths and/or filesystem types]

    CLI Example:

    .. code-block:: bash

        salt '*' status.diskusage         # usage for all filesystems
        salt '*' status.diskusage / /tmp  # usage for / and /tmp
        salt '*' status.diskusage ext?    # usage for ext[234] filesystems
        salt '*' status.diskusage / ext?  # usage for / and all ext filesystems
    u*u/u|cs@s'|]}tj|�jd�VqdS(u(%s)N(tfnmatcht	translateR4(t.0tfstype((s7/usr/lib/python2.7/site-packages/salt/modules/status.pys	<genexpr>�sukerneluLinuxu/proc/mountsurNuFreeBSDuSunOSucmd.runumount -pu3status.diskusage not yet supported on this platformiiiiu	availableutotal(uFreeBSDuSunOS(tsettaddRuR�tcompileR)R%RRRCRDReRfRER&tOSErrorRRRRSR�R@tstatvfstf_bsizetf_bavailtf_blocks(targstselectedtfstypestargtregexRhtifileR0R1tmntptR�R*RAtfsstatstblkszt	availablettotal((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt	diskusage�sT		
+






	

c@sad�}d�}i|d6|d6|d6|d6|d6}d�|jtd	�fd
���S(u�
    .. versionchanged:: 2016.3.2
        Return the virtual memory stats for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    CLI Example:

    .. code-block:: bash

        salt '*' status.vmstats
    cS@s�i}y@tjjjdd��"}tjjj|j��}WdQXWntk
rYnHXxD|j�D]6}|syqgn|j	�}t
|d�||d<qgW|S(u:
        linux specific implementation of vmstats
        u/proc/vmstaturNii(RRRCRDReRfRERgR&RR(R*RhRiR0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
linux_vmstats
s%
cS@sqi}xdtdd�j�D]L}|j�}|dj�rt|dj��|dj|d�<qqW|S(uw
        generic implementation of vmstats
        note: works on FreeBSD, SunOS and OpenBSD (possibly others)
        ucmd.runu	vmstat -siu i(RR&RRRRR)(R*R0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytgeneric_vmstatss.uLinuxuFreeBSDuOpenBSDuSunOSuAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR�2s(R�R%(R�R�R�((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytvmstats�s		

c@sad�}d�}i|d6|d6|d6|d6td6}d�|jtd	�fd
���S(u,
    Return the number of processing units available on this system

    .. versionchanged:: 2016.11.4
        Added support for AIX

    .. versionchanged:: 2018.3.0
        Added support for Darwin, FreeBSD and OpenBSD

    CLI Example:

    .. code-block:: bash

        salt '*' status.nproc
    cS@s7yttdd�j��SWntk
r2dSXdS(u8
        linux specific implementation of nproc
        ucmd.rununprociN(RRRR(((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytlinux_nprocEs
cS@s(tdd�}|sdSt|�SdS(u1
        generic implementation of nproc
        u
sysctl.getuhw.ncpuiN(RR(t	ncpu_data((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
generic_nprocNsuLinuxuDarwinuFreeBSDuOpenBSDuAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR�cs(R$R�R%(R�R�R�((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytnproc5s			
c@s�d�}�fd�}d��d�}d�}i|d6�d6�d6|d	6|d
6}d�|jtd�fd
���S(u
    Return the network stats for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    .. versionchanged:: 2018.3.0
        Added support for OpenBSD

    CLI Example:

    .. code-block:: bash

        salt '*' status.netstats
    c
S@s*i}y@tjjjdd��"}tjjj|j��}WdQXWntk
rYn�Xdg}x�|j�D]�}|s�qpn|j	�}|d|dkrt
|�d}i}x>t|�D]0}|dkr�q�q�t||�|||<q�W|dj
dd�}	|||	<qp|}qpW|S(u8
        linux specific netstats implementation
        u/proc/net/netstaturNuiiu:(RRRCRDReRfRERgR&RRSRRRK(
R*RhRitheadersR0R1R(trowR�trowname((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytlinux_netstatsvs,%
	

c@s��S(N(((tbsd_netstats(s7/usr/lib/python2.7/site-packages/salt/modules/status.pytfreebsd_netstats�scS@s�i}x�tdd�j�D]�}|jd�r8qn|jd�sp|j�djdd�}i||<q|j�}|dj�r|d||dj|d	�<qqW|S(
u6
        bsd specific netstats implementation
        ucmd.runu
netstat -su		u	iu:uu i(RR&RuRRKRR)(R*R0R7R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR��s
&cS@s8i}x+tdd�j�D]}|jdd�j�}t|�dkr]|jd�nd|krt|�dkr�|dj�s�|ddd	kr�t|d�|d<n|d||d<nt|�dkr0|d
j�s|d
dd	krt|d
�|d
<n|d
||d<q0qqW|S(u8
        sunos specific netstats implementation
        ucmd.runu
netstat -su=u = iiiiu-i(RR&RKRRSR'RR(R*R0((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytsunos_netstats�s$$cS@si}g}d}d}x�tdd�j�D]�}|sAq/ntjd|�r�d|kr�|jd�}|d}g||<t||�}||ji�q/q/|j�}|dj�|d<|dj	�r/t
|d�|||dj|d�<q/q/q/W|S(	u6
        AIX specific netstats implementation
        ucmd.runu
netstat -su\su:iu iN(RzRR&R�R�RRSR{RRRR)(R*RwR|t
proto_nameR0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytaix_netstats�s(

,uLinuxuFreeBSDuOpenBSDuSunOSuAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR��s(R�R%(R�R�R�R�R�((R�R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytnetstatsfs				
c@sld�}d�}d�}d�}i|d6|d6|d6|d6}d	�|jtd
�fd���S(u�
    .. versionchanged:: 2016.3.2
        Return the network device stats for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    CLI Example:

    .. code-block:: bash

        salt '*' status.netdev
    cS@si}y@tjjjdd��"}tjjj|j��}WdQXWntk
rYn�Xx�|j�D]�}|syqgn|j	d�dkr�qgn|j
�}|j
d�dj�|d<|jd|j
d�dj�j
�d�i|dd6t
|d�d	6t
|d
�d6t
|d�d
6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d�d6t
|d �d!6t
|d"�d#6t
|d$�d%6t
|d&�d'6||d<qgW|S((u9
        linux specific implementation of netdev
        u
/proc/net/devurNu:iiuifaceiurx_bytesiu
rx_compressediurx_dropiurx_errsiurx_fifoiurx_framei	urx_multicastiu
rx_packetsi
utx_bytesiu
tx_carrieriutx_collsiu
tx_compressedi
utx_dropiutx_errsiutx_fifoiu
tx_packets(RRRCRDReRfRERgR&tfindRRtinsertR(R*RhRiR0R1((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytlinux_netdev�s@%
- c@s��fd����}tdd�j�}|tdd�j�d7}|dj�}xh|dD]\}|j�}xGtdd�D]6}t||�||d|d	|d
||<q�WqgW|S(u;
        freebsd specific implementation of netdev
        c@s
tj��S(N(tcollectionstdefaultdict((t
_dict_tree(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR� sucmd.rununetstat -i -n -4 -b -dunetstat -i -n -6 -b -diiii
ii(RR&RRR(R*tnetstatR�R0R1Rx((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytfreebsd_netdevs	8cS@si}xtdj�tdD]�}tddjd|��j�}tddjd|��j�}|dj�|d<|dj�|d<|dj�|d<|dj�|d<i||<x�tt|d�d�D]�}|d|d	kr�q�n|d|dkr?|d|||djd
|d|�<q�t|d|�|||d|<q�Wx�tt|d�d�D]�}|d|d	kr�q�n|d|dkr�|d|||djd
|d|�<q�t|d|�|||d|<q�WqW|S(u9
        sunos specific implementation of netdev
        uip4_interfacesuip6_interfacesucmd.rununetstat -i -I {dev} -n -f inettdevunetstat -i -I {dev} -n -f inet6iiuNameuAddressuNet/DestuIPv4 {field}R�uIPv6 {field}(uAddressuNet/Dest(uAddressuNet/Dest(	R%tkeysRR4R&RRRSR(R*R�tnetstat_ipv4tnetstat_ipv6Rx((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytsunos_netdev+s,""
!-(!-,c	S@s�i}g}d}x�tdj�tdj�D]b}tddjd|��j�}tddjd|��j�}g||<x|D]�}|jd�r�|j�}q�n|j�}t|�dkr�t	d	j|���n|d
jd�rq�nt||�}||j
i�i|||d<xPtd
t|��D]9}t|�|krK|||||d||<qKqKWq�Wx|D]�}|jd�r�|j�}q�n|j�}t|�dkr�t	d	j|���n|d
jd�r	q�nt||�}||j
i�i|||d<xPtd
t|��D]9}t|�|krR|||||d||<qRqRWq�Wq1W|S(u7
        AIX specific implementation of netdev
        uip4_interfacesuip6_interfacesucmd.rununetstat -i -n -I {dev} -f inetR�unetstat -i -n -I {dev} -f inet6uNameiu5Insufficent data returned by command to process '{0}'iulinkuipv4iuipv6N(RzR%R�RR4R&RuRRSRR{R(	R*RwR|R�R�R�R0R1Rx((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
aix_netdevOsL%
""

)
-uLinuxuFreeBSDuSunOSuAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR��s(R�R%(R�R�R�R�R�((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytnetdev�s	(		$	@
c@sZd�}d�}i|d6|d6|d6|d6}d�|jtd�fd	���S(
u�
    Return a list of logged in users for this minion, using the w command

    CLI Example:

    .. code-block:: bash

        salt '*' status.w
    cS@s�g}tdd�j�}x�|D]�}|s5q#n|j�}i|dd6|dd6|dd6|d	d
6|dd6|d
d6dj|d�d6}|j|�q#W|S(u5
        Linux specific implementation for w
        ucmd.runuw -fhiuidleiujcpuiuloginiupcpuiuttyiuuseru iuwhat(RR&RR)R{(t	user_listtusersR�R1trec((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytlinux_w�s
cS@s�g}tdd�j�}x�|D]|}|s5q#n|j�}i|dd6|dd6|dd6|d	d
6|dd6d
j|d�d6}|j|�q#W|S(u2
        Generic BSD implementation for w
        ucmd.runuw -hiufromiuidleiuloginiuttyiuuseru iuwhat(RR&RR)R{(R�R�R�R1R�((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytbsd_w�s
uDarwinuFreeBSDuLinuxuOpenBSDu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR��s(R�R%(R�R�R�((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytw�s
		
cC@srit�d6t�d6t�d6t�d6t�d6t�d6t�d6t�d6t�d	6t	�d
6t
�d6S(u�
    Return a composite of all status data and info for this minion.
    Warning: There is a LOT here!

    CLI Example:

    .. code-block:: bash

        salt '*' status.all_status
    ucpuinfoucpustatsu	diskstatsu	diskusageuloadavgumeminfounetdevunetstatsuuptimeuvmstatsuw(R�R�R�R�RdR�R�R�RR�R�(((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
all_status�s









cC@s�td}td|dt�}d}xb|j�D]T}d|krKq3ntj||�r3|rp|d7}n||j�d7}q3q3W|S(u�
    Return the PID or an empty string if the process is running or not.
    Pass a signature to use to find the process via ps.  Note you can pass
    a Python-compatible regular expression to return all pids of
    processes matching the regexp.

    .. versionchanged:: 2016.11.4
        Added support for AIX

    CLI Example:

    .. code-block:: bash

        salt '*' status.pid <sig>
    upsucmd.run_stdoutR!uu
status.pidu
i(R%RR"R&R�tsearchR(tsigtcmdtoutputtpidsR0((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytpid�s

c@s]d�}d�}i|d6|d6|d6d�d6}d�|jtd	�fd
���S(u
    Return the system version for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    .. versionchanged:: 2018.3.0
        Added support for OpenBSD

    CLI Example:

    .. code-block:: bash

        salt '*' status.version
    cS@s]yDtjjjdd��&}tjjj|j��j�SWdQXWntk
rXiSXdS(u:
        linux specific implementation of version
        u
/proc/versionurN(	RRRCRDReRfRERRg(Rh((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt
linux_versions
)
cS@stdd�S(u8
        bsd specific implementation of version
        ucmd.runusysctl -n kern.version(R(((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytbsd_version)suLinuxuFreeBSDuOpenBSDcS@stdd�S(Nucmd.runu
oslevel -s(R(((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR�4suAIXu;This method is unsupported on the current operating system!ukernelc@s�S(N(((R�(s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR�8s(R�R%(R�R�R�((R�s7/usr/lib/python2.7/site-packages/salt/modules/status.pytversions	
	
cC@sd}|r$tjjj|�}n|s.dSt}tdddd�}tjjj|�}x$|D]}||krft}PqfqfW||k	rtjj	j
ddtdt�}|r�|ji|d	6tj
jd
d��q|ji|d	6tj
jd
d��n|S(
u�
    .. versionadded:: 2014.7.0

    Return the connection status with master. Fire an event if the
    connection to master is not as expected. This function is meant to be
    run via a scheduled job from the minion. If master_ip is an FQDN/Hostname,
    it must be resolvable to a valid IPv4 address.

    .. versionchanged:: 2016.11.4
        Added support for AIX

    CLI Example:

    .. code-block:: bash

        salt '*' status.master
    Nu
config.getupublish_porttdefaulti�uminiontoptstlistenumasterttypeu	connectedudisconnected(RzRRtnetworkthost_to_ipsRRtremote_port_tcpR"teventt	get_eventt__opts__t
fire_eventtminiontmaster_event(tmastert	connectedt
master_ipstmaster_connection_statustportt
connected_ipst	master_ipR�((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyR;s$
!))c	C@sn|dks|dkrtStjt�}||d<d|krK|d=n|jtjj|��y#|jtjj	|dt��Wnt
k
r�tSX|jdd�}idd6}t}tjj
jj|d	d
�}y%|j|ddd
|�}t}Wnt
k
r}nX|rjtjjjddtdt�}|ji|d6tjjdd��n|S(u�
    .. versionadded:: 2016.3.0

    Sends ping request to the given master. Fires '__master_failback' event on success.
    Returns bool result.

    CLI Example:

    .. code-block:: bash

        salt '*' status.ping_master localhost
    uumasteru	master_iptfallbackuauth_timeouti<upingucmdtcryptuclearttriesittimeoutuminionR�R�R�ufailbackN(RzRtcopytdeepcopyRtupdateRRtprep_ip_porttresolve_dnst	ExceptionR�t	transporttclientt
ReqChanneltfactorytsendR"RR�RRR(	RR�RtloadtresulttchanneltpayloadteR�((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytping_masterjs0


#


!)cC@s�|st}nd|krtS|d}|tkr9tSt||�}|s�|jdd�pp|jdd�}tjd||�t|d|�t|d|�tjd	||�ntS(
u
    Forces proxy minion reconnection when not alive.

    proxy_name
        The virtual name of the proxy module.

    opts: None
        Opts dictionary. Not intended for CLI usage.

    CLI Example:

        salt '*' status.proxy_reconnect rest_sample
    uproxyu.aliveuproxyiduuidu"%s (%s proxy) is down. Restarting.u	.shutdownu.inituRestarted %s (%s proxy)!(RRt	__proxy__R�tlogtinfotdebugR"(t
proxy_nameR�tproxy_keepalive_fntis_alivet	minion_id((s7/usr/lib/python2.7/site-packages/salt/modules/status.pytproxy_reconnect�s	
$u%A, %d. %B %Y %I:%M%pcC@stjj�}|j|�S(u#
    .. versionadded:: 2016.3.0

    Return the current time on the minion,
    formatted based on the format parameter.

    Default date format: Monday, 27. July 2015 07:55AM

    CLI Example:

    .. code-block:: bash

        salt '*' status.time

        salt '*' status.time '%s'

    (RNttodaytstrftime(R4tdt((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyttime_�s(@t__doc__t
__future__RRRRNR@R�tloggingR�R�RR>tsalt.extRtsalt.ext.six.movesRtsalt.configRtsalt.miniontsalt.utils.eventtsalt.utils.filestsalt.utils.networktsalt.utils.pathtsalt.utils.platformtsalt.utils.stringutilsRtsalt.exceptionsRt	getLoggert__file__R"RRt__func_alias__t__name__R
RRR R$R2R<RRdR�R�R�R�R�R�R�R�R�R�R�R�R�RzR"RR R)R-(((s7/usr/lib/python2.7/site-packages/salt/modules/status.pyt<module>sl
	
			
		'	#	L		�	�	�	�	L	9	1	�	�	=		 	,/	,$

Zerion Mini Shell 1.0