#NEWLINE# def _add_trigger( self , host_name , url , comment = None ) : #NEWLINE# #INDENT# item_name = self . _create_item_name ( url ) #NEWLINE# status_expression = ( '{{%s:web.test.rspcode[{item_name},{item_name}].last()}}#200' % host_name ) #NEWLINE# failed_expression = ( '{{%s:web.test.fail[{item_name}].last()}}#0' % host_name ) #NEWLINE# string_expression = ( '{{%s:web.test.error[{item_name}].str(required pattern not found)}}=1' % host_name ) #NEWLINE# expression = ( '%s | %s & %s' % ( status_expression , failed_expression , string_expression ) ) #NEWLINE# trigger_result = self . zapi . trigger . create ( description = 'trigger for url {}' . format ( url ) , expression = expression . format ( item_name = item_name ) , priority = 5 , comments = comment ) #NEWLINE# return trigger_result [ 'triggerids' ] [ 0 ]