(self, state, server)
Create an event with a message describing the replication
        state of a mongo node
Create an event with a message describing the replication
        state of a mongo node
Create an event with a message describing the replication state of a mongo node
def create_event(self, state, server):
        """Create an event with a message describing the replication
        state of a mongo node"""

        def get_state_description(state):
            if state == 0:
                return 'Starting Up'
            elif state == 1:
                return 'Primary'
            elif state == 2:
                return 'Secondary'
            elif state == 3:
                return 'Recovering'
            elif state == 4:
                return 'Fatal'
            elif state == 5:
                return 'Starting up (initial sync)'
            elif state == 6:
                return 'Unknown'
            elif state == 7:
                return 'Arbiter'
            elif state == 8:
                return 'Down'
            elif state == 9:
                return 'Rollback'

        status = get_state_description(state)
        msg_title = "%s is %s" % (server, status)
        msg = "TokuMX %s just reported as %s" % (server, status)

        self.event(
            {
                'timestamp': int(time.time()),
                'event_type': 'tokumx',
                'msg_title': msg_title,
                'msg_text': msg,
                'host': self.hostname,
            }
        )
def create_event ( self , state , server ) : def get_state_description ( state ) : if state == 0 : return 'Starting Up' elif state == 1 : return 'Primary' elif state == 2 : return 'Secondary' elif state == 3 : return 'Recovering' elif state == 4 : return 'Fatal' elif state == 5 : return 'Starting up (initial sync)' elif state == 6 : return 'Unknown' elif state == 7 : return 'Arbiter' elif state == 8 : return 'Down' elif state == 9 : return 'Rollback' status = get_state_description ( state ) msg_title = "%s is %s" % ( server , status ) msg = "TokuMX %s just reported as %s" % ( server , status ) self . event ( { 'timestamp' : int ( time . time ( ) ) , 'event_type' : 'tokumx' , 'msg_title' : msg_title , 'msg_text' : msg , 'host' : self . hostname , } )