--- old/utils_threshold.c   2010-07-09 11:01:59.000000000 +0100
+++ src/utils_threshold.c	2011-03-02 22:57:17.000000000 +0000
@@ -40,6 +40,7 @@
 #define UT_FLAG_INVERT  0x01
 #define UT_FLAG_PERSIST 0x02
 #define UT_FLAG_PERCENTAGE 0x04
+#define UT_FLAG_PERSIST_OK 0x10
 /* }}} */
 
 /*
@@ -253,6 +254,24 @@
   return (0);
 } /* int ut_config_type_persist */
 
+static int ut_config_type_persist_ok (threshold_t *th, oconfig_item_t *ci)
+{
+  if ((ci->values_num != 1)
+      || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
+  {
+    WARNING ("threshold values: The `PersistOK' option needs exactly one "
+	"boolean argument.");
+    return (-1);
+  }
+
+  if (ci->values[0].value.boolean)
+    th->flags |= UT_FLAG_PERSIST_OK;
+  else
+    th->flags &= ~UT_FLAG_PERSIST_OK;
+
+  return (0);
+} /* int ut_config_type_persist_ok */
+
 static int ut_config_type_percentage(threshold_t *th, oconfig_item_t *ci)
 {
   if ((ci->values_num != 1)
@@ -350,6 +369,8 @@
       status = ut_config_type_invert (&th, option);
     else if (strcasecmp ("Persist", option->key) == 0)
       status = ut_config_type_persist (&th, option);
+    else if (strcasecmp ("PersistOK", option->key) == 0)
+      status = ut_config_type_persist_ok (&th, option);
     else if (strcasecmp ("Percentage", option->key) == 0)
       status = ut_config_type_percentage (&th, option);
     else if (strcasecmp ("Hits", option->key) == 0)
@@ -616,8 +637,9 @@
   if ( (th->hits != 0) )
   {
     int hits = uc_get_hits(ds,vl);
-    /* The STATE_OKAY always reset hits, or if hits reaise the limit */
-    if ( (state == STATE_OKAY) || (hits > th->hits) )
+    /* STATE_OKAY resets hits unless PERSIST_OK flag is set. Hits resets if
+     * threshold is hit. */
+    if ( ( (state == STATE_OKAY) && ((th->flags & UT_FLAG_PERSIST_OK) == 0) ) || (hits > th->hits) )
     {
         DEBUG("ut_report_state: reset uc_get_hits = 0");
         uc_set_hits(ds,vl,0); /* reset hit counter and notify */
@@ -630,13 +652,13 @@
 
   state_old = uc_get_state (ds, vl);
 
-  /* If the state didn't change, only report if `persistent' is specified and
-   * the state is not `okay'. */
+  /* If the state didn't change, report if `persistent' is specified. If the
+   * state is `okay', then only report if `persist_ok` flag is set. */
   if (state == state_old)
   {
     if ((th->flags & UT_FLAG_PERSIST) == 0)
       return (0);
-    else if (state == STATE_OKAY)
+    else if ( (state == STATE_OKAY) && ((th->flags & UT_FLAG_PERSIST_OK) == 0) )
       return (0);
   }
 
