示例#1
0
def get_health_monitoring_retention_max_history_count(**kwargs):  # pylint: disable=invalid-name,unused-argument
    '''
    Return the Health Monitoring retention history count.

    :return: Tthe Health Monitoring retention history count.
    :rtype: int
    '''
    hm_grains = _nisysmgmt_utils.health_monitoring_grains(__opts__)
    return hm_grains['health_monitoring_retention_max_history_count']
示例#2
0
def get_health_monitoring_retention_duration_days(**kwargs):  # pylint: disable=invalid-name,unused-argument
    '''
    Return the Health Monitoring retention duration in days.

    :return: The Health Monitoring retention duration in days.
    :rtype: int
    '''
    hm_grains = _nisysmgmt_utils.health_monitoring_grains(__opts__)
    return hm_grains['health_monitoring_retention_duration_days']
示例#3
0
def get_health_monitoring_interval(**kwargs):  # pylint: disable=unused-argument
    '''
    Return the Health Monitoring interval.

    :return: The Health Monitoring interval in seconds.
    :rtype: int
    '''
    hm_grains = _nisysmgmt_utils.health_monitoring_grains(__opts__)
    return hm_grains['health_monitoring_interval']
示例#4
0
def get_health_monitoring_enabled(**kwargs):  # pylint: disable=unused-argument
    '''
    Return whether or not Health Monitoring is enabled.

    :return: Whether or not Health Monitoring is enabled.
    :rtype: bool
    '''
    hm_grains = _nisysmgmt_utils.health_monitoring_grains(__opts__)
    return hm_grains['health_monitoring_enabled']
示例#5
0
def get_health_monitoring_retention_type(**kwargs):  # pylint: disable=invalid-name,unused-argument
    '''
    Return the Health Monitoring retention type.

    :return: The Health Monitoring retention type. Will be one of
        ``none``, ``duration``, ``count``, or ``permanent``.
    :rtype: str
    '''
    hm_grains = _nisysmgmt_utils.health_monitoring_grains(__opts__)
    return hm_grains['health_monitoring_retention_type']
示例#6
0
def _health_monitoring_grains(changes):
    '''
    Check if the Health Monitoring grains have changed.

    :param changes: Dictionary with key of which grain has changed and
        value of the new value of the changed grain. This will be modified
        when any grains have changed.
    :type changes: dict
    :return: ``True`` if any grains were changed. ``False`` otherwise.
    :rtype: bool
    '''
    changed = False
    hm_grains = _nisysmgmt_utils.health_monitoring_grains(__opts__)
    for key, val in six.iteritems(LAST_HEALTH_MONITORING_OPTIONS):
        if val != hm_grains[key]:
            changes[key] = hm_grains[key]
            LAST_HEALTH_MONITORING_OPTIONS[key] = hm_grains[key]
            if __grains__[key] != hm_grains[key]:  # pylint: disable=undefined-variable
                # Changed outside of the execution module
                __grains__[key] = hm_grains[key]
                if key == 'health_monitoring_enabled':
                    if hm_grains[key]:
                        func = 'enable_beacon'
                    else:
                        func = 'disable_beacon'
                    _init_event()
                    EVENT.fire_event(
                        {
                            'func': func,
                            'name': 'nisysmgmt_monitoring'
                        }, 'manage_beacons')
                elif key == 'health_monitoring_interval':
                    _init_event()
                    # Use an interval of 1 to have the beacon execute on the next beacon
                    # loop. It will reset this value itself.
                    EVENT.fire_event(
                        {
                            'func': 'modify',
                            'name': 'nisysmgmt_monitoring',
                            'beacon_data': [{
                                'interval': 1
                            }]
                        }, 'manage_beacons')
            changed = True
    return changed
示例#7
0
def nisysmgmt_data(grains):
    '''
    Return grains used by National Instruments Systems Management
    '''
    nigrains = {}
    nigrains.update({'nisystemlink_version': '19.0.0'})
    nigrains.update(_nisysmgmt_utils.get_computer_desc_grains(__salt__))
    if salt.utils.platform.is_windows():
        nigrains.update(_windows_platform_data())
    elif salt.utils.platform.is_linux():
        nigrains.update(_linux_platform_data())
    nigrains.update(_nisysmgmt_grains.minion_blackout_grains(__opts__))
    nigrains.update(_nisysmgmt_utils.health_monitoring_grains(__opts__))
    if 'NILinuxRT' in grains['os_family'] and 'nilrt' == grains[
            'lsb_distrib_id']:
        nigrains.update(_nisysmgmt_grains.startup_settings_grains(grains))
    nigrains.update(
        _nisysmgmt_grains.is_superuser_password_set_grains(__salt__, grains))
    nigrains.update(_nisysmgmt_grains.get_network_grains(grains))
    return nigrains