zabbix_bot.py
def zabbix_callback(room, event):
    """Callback function for the !zabbix matches.

    :param room: reference to the room
    :type room: room thingie
    :param event: the message, essentially
    :type event: event
    """
    try:
        room_id, zabbix_config = _room_init(room)
        if room_id is None:
            return

        args = event['content']['body'].split()
        args.pop(0)
        messages = []
        if len(args) == 0:
            messages = _zabbix_unacked_triggers(zabbix_config)

        elif len(args) == 1:
            arg = args[0]
            if arg == 'all':
                messages = _zabbix_all_triggers(zabbix_config)

            elif arg == 'acked':
                messages = _zabbix_acked_triggers(zabbix_config)

            elif arg == 'unacked':
                messages = _zabbix_unacked_triggers(zabbix_config)

        #     elif arg == 'hosts':
        #         hosts = zabbix.hosts(zabbix_config)

            else:
                messages = _zabbix_help()

        elif len(args) == 2:
            if args[0] == 'ack':
                trigger_id = args[1]
                messages = _zabbix_acknowledge_trigger(
                    zabbix_config, trigger_id)

            else:
                messages = _zabbix_help()

        else:
            messages = _zabbix_help()

        if len(messages) == 0:
            messages = 'Nothing to notify'

        matrix_config['message'] = messages
        matrix.send_message(matrix_config, room)

    except Exception as error:  # Keep running!
        return _error(matrix_config, room, error)
Callback function for the !zabbix matches.

    :param room: reference to the room
    :type room: room thingie
    :param event: the message, essentially
    :type event: event
    
Callback function for the !zabbix matches.
Callback function for the !zabbix matches .
def zabbix_callback(room, event):
    try:
        room_id, zabbix_config = _room_init(room)
        if room_id is None:
            return
        args = event['content']['body'].split()
        args.pop(0)
        messages = []
        if len(args) == 0:
            messages = _zabbix_unacked_triggers(zabbix_config)
        elif len(args) == 1:
            arg = args[0]
            if arg == 'all':
                messages = _zabbix_all_triggers(zabbix_config)
            elif arg == 'acked':
                messages = _zabbix_acked_triggers(zabbix_config)
            elif arg == 'unacked':
                messages = _zabbix_unacked_triggers(zabbix_config)
            else:
                messages = _zabbix_help()
        elif len(args) == 2:
            if args[0] == 'ack':
                trigger_id = args[1]
                messages = _zabbix_acknowledge_trigger(
                    zabbix_config, trigger_id)
            else:
                messages = _zabbix_help()
        else:
            messages = _zabbix_help()
        if len(messages) == 0:
            messages = 'Nothing to notify'
        matrix_config['message'] = messages
        matrix.send_message(matrix_config, room)
    except Exception as error:  
        return _error(matrix_config, room, error)
def zabbix_callback ( room , event ) : try : room_id , zabbix_config = _room_init ( room ) if room_id is None : return args = event [ 'content' ] [ 'body' ] . split ( ) args . pop ( 0 ) messages = [ ] if len ( args ) == 0 : messages = _zabbix_unacked_triggers ( zabbix_config ) elif len ( args ) == 1 : arg = args [ 0 ] if arg == 'all' : messages = _zabbix_all_triggers ( zabbix_config ) elif arg == 'acked' : messages = _zabbix_acked_triggers ( zabbix_config ) elif arg == 'unacked' : messages = _zabbix_unacked_triggers ( zabbix_config ) else : messages = _zabbix_help ( ) elif len ( args ) == 2 : if args [ 0 ] == 'ack' : trigger_id = args [ 1 ] messages = _zabbix_acknowledge_trigger ( zabbix_config , trigger_id ) else : messages = _zabbix_help ( ) else : messages = _zabbix_help ( ) if len ( messages ) == 0 : messages = 'Nothing to notify' matrix_config [ 'message' ] = messages matrix . send_message ( matrix_config , room ) except Exception as error : return _error ( matrix_config , room , error )
Callback function for the !zabbix matches.
Callback function for the !zabbix matches .
"""Callback function for the !zabbix matches.

    :param room: reference to the room
    :type room: room thingie
    :param event: the message, essentially
    :type event: event
    """ #     elif arg == 'hosts': #         hosts = zabbix.hosts(zabbix_config) # Keep running!
room
reference to the room
reference to the room
event
the message, essentially
the message essentially