zabbix_bot.py
def _dnsjedi_chunks_summary(zabbix_config):
    """Returns a summary about the clustermanager chunks.

    :param zabbix_config: the zabbix configuration
    :type zabbix_config: dict
    :return: message to send back
    """
    color_config = {}
    for key, value in matrix.read_config(args['config'], 'Colors').items():
        if key.startswith('dnsjedi'):
            key = key.replace('dnsjedi_', '')
            color_config[key] = value

    logging.debug(color_config)

    lines = []
    clustermanagers = zabbix.get_itemvalues_for_group(
        zabbix_config, 'Clustermanagers',
        ['cms.chunks_left',
         'cms.co_queue_len_forecast',
         ])

    if clustermanagers is not None:
        for name, value in sorted(clustermanagers.items()):
            chunks_left = value[0]
            time_left = _dnsjedi_forecast_format(value[1])
            if chunks_left != '0':
                line = "{0}: {1} chunks left, {2}".format(
                    name, chunks_left, time_left)

            else:
                line = "{0}: done".format(name)

            formatted_line = matrix_alert.colorize(color_config, line)
            lines.append(formatted_line)

    return "<br />".join(lines)
Returns a summary about the clustermanager chunks.

    :param zabbix_config: the zabbix configuration
    :type zabbix_config: dict
    :return: message to send back
    
Returns a summary about the clustermanager chunks.
Returns a summary about the clustermanager chunks .
def _dnsjedi_chunks_summary(zabbix_config):
    color_config = {}
    for key, value in matrix.read_config(args['config'], 'Colors').items():
        if key.startswith('dnsjedi'):
            key = key.replace('dnsjedi_', '')
            color_config[key] = value
    logging.debug(color_config)
    lines = []
    clustermanagers = zabbix.get_itemvalues_for_group(
        zabbix_config, 'Clustermanagers',
        ['cms.chunks_left',
         'cms.co_queue_len_forecast',
         ])
    if clustermanagers is not None:
        for name, value in sorted(clustermanagers.items()):
            chunks_left = value[0]
            time_left = _dnsjedi_forecast_format(value[1])
            if chunks_left != '0':
                line = "{0}: {1} chunks left, {2}".format(
                    name, chunks_left, time_left)
            else:
                line = "{0}: done".format(name)
            formatted_line = matrix_alert.colorize(color_config, line)
            lines.append(formatted_line)
    return "<br />".join(lines)
def _dnsjedi_chunks_summary ( zabbix_config ) : color_config = { } for key , value in matrix . read_config ( args [ 'config' ] , 'Colors' ) . items ( ) : if key . startswith ( 'dnsjedi' ) : key = key . replace ( 'dnsjedi_' , '' ) color_config [ key ] = value logging . debug ( color_config ) lines = [ ] clustermanagers = zabbix . get_itemvalues_for_group ( zabbix_config , 'Clustermanagers' , [ 'cms.chunks_left' , 'cms.co_queue_len_forecast' , ] ) if clustermanagers is not None : for name , value in sorted ( clustermanagers . items ( ) ) : chunks_left = value [ 0 ] time_left = _dnsjedi_forecast_format ( value [ 1 ] ) if chunks_left != '0' : line = "{0}: {1} chunks left, {2}" . format ( name , chunks_left , time_left ) else : line = "{0}: done" . format ( name ) formatted_line = matrix_alert . colorize ( color_config , line ) lines . append ( formatted_line ) return "<br />" . join ( lines )
Returns a summary about the clustermanager chunks.
Returns a summary about the clustermanager chunks .
"""Returns a summary about the clustermanager chunks.

    :param zabbix_config: the zabbix configuration
    :type zabbix_config: dict
    :return: message to send back
    """
message to send back
message to send back
zabbix_config
the zabbix configuration
the zabbix configuration