Fix Contrail alerts

Change-Id: Ibdcfd6d5c6f574c93e692a5c48854d1bbb786226
diff --git a/opencontrail/map.jinja b/opencontrail/map.jinja
index 809520c..670f8a2 100644
--- a/opencontrail/map.jinja
+++ b/opencontrail/map.jinja
@@ -322,14 +322,14 @@
         'vrouter_dns_xmpp_sessions_variation_threshold': 5,
         'vrouter_lls_too_high_threshold': 10,
         'vrouter_lls_variation_threshold': 5,
-        'vrouter_flows_active_too_high_threshold': 1200,
-        'vrouter_flows_discard_too_high_threshold': 1200,
-        'vrouter_flows_flow_action_drop_too_high_threshold': 5,
+        'vrouter_flows_active_too_high_threshold': 100,
+        'vrouter_flows_discard_too_high_threshold': 0.1,
+        'vrouter_flows_flow_action_drop_too_high_threshold': 0.2,
         'vrouter_flows_frag_err_too_high_threshold': 100,
-        'vrouter_flows_invalid_nh_too_high_threshold': 104,
-        'vrouter_flows_composite_invalid_interface_too_high_threshold': 105,
+        'vrouter_flows_invalid_nh_too_high_threshold': 0.1,
+        'vrouter_flows_composite_invalid_interface_too_high_threshold': 0.05,
         'vrouter_flows_invalid_label_too_high_threshold': 100,
-        'vrouter_flows_flow_queue_limit_exceeded_too_high_threshold': 100,
+        'vrouter_flows_flow_queue_limit_exceeded_too_high_threshold': 0.1,
         'vrouter_flows_flow_table_full_too_high_threshold': 100,
     },
 }, grain='os_family', merge=salt['pillar.get']('opencontrail:monitoring')) %}
diff --git a/opencontrail/meta/prometheus.yml b/opencontrail/meta/prometheus.yml
index b360903..421fbd6 100644
--- a/opencontrail/meta/prometheus.yml
+++ b/opencontrail/meta/prometheus.yml
@@ -335,7 +335,7 @@
     ContrailFlowsActiveTooMany:
       if: >-
     {%- set vrouter_flows_active_toohigh_threshold = monitoring.vrouter_flows_active_too_high_threshold %}
-        min(contrail_vrouter_flows_active) by (host) >= {{ vrouter_flows_active_toohigh_threshold }}
+        deriv(contrail_vrouter_flows_active[5m]) >= {{ vrouter_flows_active_toohigh_threshold }}
 {%- raw %}
       for: 2m
       labels:
@@ -347,7 +347,7 @@
     ContrailFlowsDiscardTooMany:
       if: >-
     {%- set vrouter_flows_discard_toohigh_threshold = monitoring.vrouter_flows_discard_too_high_threshold %}
-        min(contrail_vrouter_flows_discard) by (host) >= {{ vrouter_flows_discard_toohigh_threshold }}
+        rate(contrail_vrouter_flows_discard[5m]) >= {{ vrouter_flows_discard_toohigh_threshold }}
 {%- raw %}
       for: 2m
       labels:
@@ -383,7 +383,7 @@
     ContrailFlowsInvalidNHTooMany:
       if: >-
     {%- set vrouter_flows_invalid_nh_toohigh_threshold = monitoring.vrouter_flows_invalid_nh_too_high_threshold %}
-        min(contrail_vrouter_flows_invalid_nh) by (host) >= {{ vrouter_flows_invalid_nh_toohigh_threshold }}
+        rate(contrail_vrouter_flows_invalid_nh[5m]) >= {{ vrouter_flows_invalid_nh_toohigh_threshold }}
 {%- raw %}
       for: 2m
       labels:
@@ -395,7 +395,7 @@
     ContrailFlowsInvalidITFTooMany:
       if: >-
     {%- set vrouter_flows_composite_invalid_interface_toohigh_threshold = monitoring.vrouter_flows_composite_invalid_interface_too_high_threshold %}
-        min(contrail_vrouter_flows_composite_invalid_interface) by (host) >= {{ vrouter_flows_composite_invalid_interface_toohigh_threshold }}
+        rate(contrail_vrouter_flows_composite_invalid_interface[5m]) >= {{ vrouter_flows_composite_invalid_interface_toohigh_threshold }}
 {%- raw %}
       for: 2m
       labels:
@@ -419,7 +419,7 @@
     ContrailFlowsQueueLimitExceededTooMany:
       if: >-
     {%- set vrouter_flows_flow_queue_limit_exceeded_toohigh_threshold = monitoring.vrouter_flows_flow_queue_limit_exceeded_too_high_threshold %}
-        min(contrail_vrouter_flows_flow_queue_limit_exceeded) by (host) >= {{ vrouter_flows_flow_queue_limit_exceeded_toohigh_threshold }}
+        rate(contrail_vrouter_flows_flow_queue_limit_exceeded[5m]) >= {{ vrouter_flows_flow_queue_limit_exceeded_toohigh_threshold }}
 {%- raw %}
       for: 2m
       labels: