#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def get( self ) : #NEWLINE# #INDENT# host = self . config . get ( 'destination' , self . hostname ) #NEWLINE# t0 = time . time ( ) #NEWLINE# try : #NEWLINE# #INDENT# ( out , err , code ) = ( yield fork ( '/usr/bin/avprobe' , args = ( ( 'rtsp://%s/sample_100kbit.mp4' % host ) , ) , timeout = 30.0 ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# code = 1 #NEWLINE# err = None #NEWLINE# #UNINDENT# t_delta = ( ( time . time ( ) - t0 ) * 1000 ) #NEWLINE# if ( code == 0 ) : #NEWLINE# #INDENT# e = self . createEvent ( 'ok' , ( 'RTSP Request time to %s' % host ) , t_delta ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if err : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# error = err . strip ( '\n' ) . split ( '\n' ) [ ( - 2 ) ] #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# error = err . replace ( '\n' , '-' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# error = 'Execution error' #NEWLINE# #UNINDENT# e = self . createEvent ( 'critical' , ( 'Unable to stream %s:%s' % ( host , error ) ) , t_delta ) #NEWLINE# #UNINDENT# defer . returnValue ( e )