%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/beacons/ |
Current File : //usr/lib/python2.7/site-packages/salt/beacons/load.pyc |
� ���^c @@ s� d Z d d l m Z m Z d d l Z d d l Z d d l Z d d l m Z d d l m Z e j e � Z d Z i Z d � Z d � Z d � Z d S( u% Beacon to emit system load averages i ( t absolute_importt unicode_literalsN( t map( t zipu loadc C@ s t j j j � r t St Sd S( N( t saltt utilst platformt is_windowst Falset __virtualname__( ( ( s5 /usr/lib/python2.7/site-packages/salt/beacons/load.pyt __virtual__ s c C@ s8 t | t � s t d f Si } t t | j | � � d | k ra t | d t � sa t d f Sn d | k r� t | d t � s� t d f Sn d | k r� t d f St d � | j d i � D� � s� t d f Sx\ d d d g D]K } t | d | t � st d f St | d | � d k r� t d f Sq� Wt d f S( u+ Validate the beacon configuration u- Configuration for load beacon must be a list.u emitatstartupuE Configuration for load beacon option emitatstartup must be a boolean.u onchangeonlyuD Configuration for load beacon option onchangeonly must be a boolean.u averagesu3 Averages configuration is required for load beacon.c s@ s | ] } | d k Vq d S( u 1mu 5mu 15mN( u 1mu 5mu 15m( ( t .0t j( ( s5 /usr/lib/python2.7/site-packages/salt/beacons/load.pys <genexpr>; s uH Averages configuration for load beacon must contain 1m, 5m or 15m items.u 1mu 5mu 15muY Averages configuration for load beacon: 1m, 5m and 15m items must be a list of two items.i uP Configuration for load beacon: 1m, 5m and 15m items must be a list of two items.u Valid beacon configuration( t isinstancet listR R t updatet boolt anyt gett lent True( t configt _configt item( ( s5 /usr/lib/python2.7/site-packages/salt/beacons/load.pyt validate s* c C@ sK t j d � i } t t | j | � � d | k rB t | d <n d | k r[ t | d <n g } t j � } d d d g } t t | | � � } | d r� t s� x% d d d g D] } | | t | <q� W| d s� t j d � | Sq� n t } x d d d g D]�} | | j d i � k r | d rWt | | � t | d | d � k r�t t | � t | d | d � k r�t j d t | | � t | d | d � t t | � � t } Pn t | | � t | d | d � k r�t t | � t | d | d � k r�t j d t | | � t | d | d � t t | � � t } Pq�q�t | | � t | d | d � k s�t | | � t | d | d � k r�t j d t | | � t | d | d � t | d | d � � t } Pq�q q W| d r1x( d d d g D] } | | t | <qWn | rG| j | � n | S( u� Emit the load averages of this host. Specify thresholds for each load average and only emit a beacon if any of them are exceeded. `onchangeonly`: when `onchangeonly` is True the beacon will fire events only when the load average pass one threshold. Otherwise, it will fire an event at each beacon interval. The default is False. `emitatstartup`: when `emitatstartup` is False the beacon will not fire event when the minion is reload. Applicable only when `onchangeonly` is True. The default is True. .. code-block:: yaml beacons: load: - averages: 1m: - 0.0 - 2.0 5m: - 0.0 - 1.5 15m: - 0.1 - 1.0 - emitatstartup: True - onchangeonly: False u load beacon startingu emitatstartupu onchangeonlyu 1mu 5mu 15mu) Don't emit because emitatstartup is Falseu averagesi u$ Emit because %f > %f and last was %fi u# Emit because %f < %f and last was%fu Emit because %f < %f or > %f( t logt traceR R R R R t ost getloadavgt dictR t LAST_STATUSt debugR t floatt append( R R t rett avgst avg_keyst avg_dictt kt send_beacon( ( s5 /usr/lib/python2.7/site-packages/salt/beacons/load.pyt beaconN sh " (( (( (( ( t __doc__t __future__R R t loggingR t salt.utils.platformR t salt.ext.six.movesR R t getLoggert __name__R R R R R R( ( ( ( s5 /usr/lib/python2.7/site-packages/salt/beacons/load.pyt <module> s .