%PDF- %PDF-
| Direktori : /proc/self/root/proc/thread-self/root/usr/lib/python2.7/site-packages/salt/beacons/ |
| Current File : //proc/self/root/proc/thread-self/root/usr/lib/python2.7/site-packages/salt/beacons/status.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 Z e j e
� Z d Z d � Z
d � Z d � Z d S( u�
The status beacon is intended to send a basic health check event up to the
master, this allows for event driven routines based on presence to be set up.
The intention of this beacon is to add the config options to add monitoring
stats to the health beacon making it a one stop shop for gathering systems
health and status data
.. versionadded:: 2016.11.0
To configure this beacon to use the defaults, set up an empty dict for it in
the minion config:
.. code-block:: yaml
beacons:
status: []
By default, all of the information from the following execution module
functions will be returned:
- loadavg
- cpustats
- meminfo
- vmstats
- time
You can also configure your own set of functions to be returned:
.. code-block:: yaml
beacons:
status:
- time:
- all
- loadavg:
- all
You may also configure only certain fields from each function to be returned.
For instance, the ``loadavg`` function returns the following fields:
- 1-min
- 5-min
- 15-min
If you wanted to return only the ``1-min`` and ``5-min`` fields for ``loadavg``
then you would configure:
.. code-block:: yaml
beacons:
status:
- loadavg:
- 1-min
- 5-min
Other functions only return a single value instead of a dictionary. With these,
you may specify ``all`` or ``0``. The following are both valid:
.. code-block:: yaml
beacons:
status:
- time:
- all
beacons:
status:
- time:
- 0
If a ``status`` function returns a list, you may return the index marker or
markers for specific list items:
.. code-block:: yaml
beacons:
status:
- w:
- 0
- 1
- 2
.. warning::
Not all status functions are supported for every operating system. Be certain
to check the minion log for errors after configuring this beacon.
i ( t absolute_importt unicode_literalsNu statusc C@ s# t | t � s t d f St d f S( u+
Validate the the config is a dict
u/ Configuration for status beacon must be a list.u Valid beacon configuration( t
isinstancet listt Falset True( t config( ( s7 /usr/lib/python2.7/site-packages/salt/beacons/status.pyt validatej s
c C@ s t S( N( t __virtualname__( ( ( s7 /usr/lib/python2.7/site-packages/salt/beacons/status.pyt __virtual__s s c C@ s� t j | � t j j � j � } t | � d k rr i d g d 6d g d 6d g d 6d g d 6d g d 6g } n t | t � s� | g } n i } x;| D]3} x*| D]"} i | | <y t d j | � � } Wn/ t
j j k
r} t j d | | � q� n Xt | | t � s&| | g } n
| | } x� | D]� } | d k rV| | | <q7yF y | | | | | <Wn) t
k
r�| t | � | | | <n XWq7t k
r�} d
j | � | | <q7Xq7Wq� Wq� Wi | d 6| d 6g S(
u1
Return status for requested information
i u allu loadavgu cpustatsu meminfou vmstatsu timeu
status.{0}uH Status beacon attempted to process function %s but encountered error: %su, Status beacon is incorrectly configured: {0}u tagu data( t logt debugt datetimet utcnowt isoformatt lenR R t __salt__t formatt saltt
exceptionst CommandExecutionErrort TypeErrort intt KeyError( R t ctimet rett entryt funct datat exct
func_itemst item( ( s7 /usr/lib/python2.7/site-packages/salt/beacons/status.pyt beaconw sJ
#( t __doc__t
__future__R R t loggingR t salt.exceptionsR t salt.utils.platformt getLoggert __name__R
R R R R ( ( ( s7 /usr/lib/python2.7/site-packages/salt/beacons/status.pyt <module>Z s