%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZddlZyddljjZe	Z
Wnek
r]eZ
nXddl
mZeje�ZdZdddd	d
ddd
gZd�Zd�Zd�Zd�ZdS(uQ
Beacon to monitor statistics from ethernet adapters

.. versionadded:: 2015.5.0
i(tabsolute_importtunicode_literalsN(tmapunetwork_infou
bytes_sentu
bytes_recvupackets_sentupackets_recvuerrinuerroutudropinudropoutcC@s@i}x3tD]+}t||�r
t||�||<q
q
W|S(u)
    Convert snetinfo object to list
    (t__attrsthasattrtgetattr(tobjtrettattr((s=/usr/lib/python2.7/site-packages/salt/beacons/network_info.pyt_to_list!s

cC@ststdfStS(Nu5cannot load network_info beacon: psutil not available(t
HAS_PSUTILtFalset__virtualname__(((s=/usr/lib/python2.7/site-packages/salt/beacons/network_info.pyt__virtual__-s
c	@s�ddddddddd	g	�t|t�s:td
fSi}tt|j|��xi|jdi�D]U}t|d|t�s�tdfSt�fd
�|d|D��sitdfSqiWtdfS(u+
    Validate the beacon configuration
    utypeu
bytes_sentu
bytes_recvupackets_sentupackets_recvuerrinuerroutudropinudropoutu5Configuration for network_info beacon must be a list.u
interfacesuEConfiguration for network_info beacon must be a list of dictionaries.c3@s|]}|�kVqdS(N((t.0tj(tVALID_ITEMS(s=/usr/lib/python2.7/site-packages/salt/beacons/network_info.pys	<genexpr>Ksu3Invalid configuration item in Beacon configuration.uValid beacon configuration(	t
isinstancetlistRRtupdatetgettdicttanytTrue(tconfigt_configtitem((Rs=/usr/lib/python2.7/site-packages/salt/beacons/network_info.pytvalidate3s	

$c	
C@s�g}i}tt|j|��tjdtj�tjdt�}tjd|�xl|jdi�D]X}||krj|d|}||}t	}x�t
D]�}||kr�d|kr�|ddkr�t||d�t
||�kr�t}q�q�d|krc|ddkrct||d�t
||�krDt}q�tjdt||d��q�t||d�t
||�kr�t}q�q�q�W|r�|ji|d	6t|�d
6�q�qjqjW|S(us
    Emit the network statistics of this host.

    Specify thresholds for each network stat
    and only emit a beacon if any of them are
    exceeded.

    Emit beacon when any values are equal to
    configured values.

    .. code-block:: yaml

        beacons:
          network_info:
            - interfaces:
                eth0:
                  type: equal
                  bytes_sent: 100000
                  bytes_recv: 100000
                  packets_sent: 100000
                  packets_recv: 100000
                  errin: 100
                  errout: 100
                  dropin: 100
                  dropout: 100

    Emit beacon when any values are greater
    than configured values.

    .. code-block:: yaml

        beacons:
          network_info:
            - interfaces:
                eth0:
                  type: greater
                  bytes_sent: 100000
                  bytes_recv: 100000
                  packets_sent: 100000
                  packets_recv: 100000
                  errin: 100
                  errout: 100
                  dropin: 100
                  dropout: 100


    upsutil.net_io_counters %stpernicu	_stats %su
interfacesutypeuequalugreateruattr %su	interfaceunetwork_infoN(RRRtlogtdebugtpsutiltnet_io_countersRRRRRtNonetinttappendR	(	RRRt_statst	interfacetinterface_configt	_if_statst_diffR((s=/usr/lib/python2.7/site-packages/salt/beacons/network_info.pytbeaconQs@0

	(t__doc__t
__future__RRtloggingtsalt.utils.psutil_compattutilst
psutil_compatRRR
tImportErrorRtsalt.ext.six.movesRt	getLoggert__name__RRRR	R
RR)(((s=/usr/lib/python2.7/site-packages/salt/beacons/network_info.pyt<module>s"


					

Zerion Mini Shell 1.0