[Exim] PATCH: show only queue entries with duration > ?min i…

Top Page
Delete this message
Reply to this message
Author: Andreas Piesk
Date:  
To: exim-users
Subject: [Exim] PATCH: show only queue entries with duration > ?min in eximon
This is a multi-part message in MIME format.
--

I find it somewhat annoying to see all (frozen, deferred and being
delivered) entries in the queue window. i changed eximon to display the
entries with duration > 0min only. the duration can be controlled by the
new environment variable 'QUEUE_MIN_TIME' (default: -1). not setting
this variable changes nothing in eximon's behaviour.

maybe someone else find this useful.

-ap

--
Andreas Piesk, Netzwerkadministration
Heise Zeitschriften Verlag GmbH & Co KG
Helstorfer Str. 7, D-30625 Hannover
Mail: Andreas.Piesk@???
Fon: +49 511 5352-477
--
diff -Pur exim-4.10/exim_monitor/EDITME exim-4.10.mod/exim_monitor/EDITME
--- exim-4.10/exim_monitor/EDITME    Mon Jul 22 10:59:52 2002
+++ exim-4.10.mod/exim_monitor/EDITME    Wed Dec 11 09:25:14 2002
@@ -97,6 +97,10 @@


# QUEUE_INTERVAL=300

+# Display only entries in the queue window with duration > QUEUE_MIN_TIME
+
+# QUEUE_MIN_TIME=-1
+
# The size of the popup text window that is used for looking at the
# contents of messages, etc.

diff -Pur exim-4.10/exim_monitor/em_globals.c exim-4.10.mod/exim_monitor/em_globals.c
--- exim-4.10/exim_monitor/em_globals.c    Mon Jul 22 10:59:52 2002
+++ exim-4.10.mod/exim_monitor/em_globals.c    Wed Dec 11 09:17:35 2002
@@ -73,6 +73,7 @@
 uschar *queue_stripchart_name = NULL;
 int     queue_update = 60;
 int     queue_width = 600;
+int    queue_min_time = -1;


pcre *yyyymmdd_regex;

diff -Pur exim-4.10/exim_monitor/em_hdr.h exim-4.10.mod/exim_monitor/em_hdr.h
--- exim-4.10/exim_monitor/em_hdr.h    Wed Dec 11 09:26:30 2002
+++ exim-4.10.mod/exim_monitor/em_hdr.h    Wed Dec 11 09:22:50 2002
@@ -281,6 +281,7 @@
 extern uschar *queue_stripchart_name; /* sic */
 extern int     queue_update;        /* update interval */
 extern int     queue_width;         /* width of queue window */
+extern int     queue_min_time;      /* for hiding queue entries */


 extern pcre   *yyyymmdd_regex;    /* for matching yyyy-mm-dd */


diff -Pur exim-4.10/exim_monitor/em_init.c exim-4.10.mod/exim_monitor/em_init.c
--- exim-4.10/exim_monitor/em_init.c    Mon Jul 22 10:59:52 2002
+++ exim-4.10.mod/exim_monitor/em_init.c    Wed Dec 11 09:18:18 2002
@@ -193,6 +193,9 @@
 s = US getenv("QUEUE_WIDTH");
 if (s != NULL && (x = Uatoi(s)) != 0) queue_width = x;


+s = US getenv("QUEUE_MIN_TIME");
+if (s != NULL && (x = Uatoi(s)) != 0) queue_min_time = x;
+
s = US getenv("SPOOL_DIRECTORY");
if (s != NULL) spool_directory = string_copy(s);

diff -Pur exim-4.10/exim_monitor/em_queue.c exim-4.10.mod/exim_monitor/em_queue.c
--- exim-4.10/exim_monitor/em_queue.c    Mon Jul 22 10:59:52 2002
+++ exim-4.10.mod/exim_monitor/em_queue.c    Wed Dec 11 09:19:13 2002
@@ -687,112 +687,115 @@
   uschar u = 'm';
   int t = (now - p->input_time)/60;  /* minutes on queue */


-  if (t > 90)
+  /* show only items with queuetime > queue_min_time */
+  if (t > queue_min_time)
     {
-    u = 'h';
-    t = (t + 30)/60;
-    if (t > 72)
+    if (t > 90)
       {
-      u = 'd';
-      t = (t + 12)/24;
-      if (t > 99)                    /* someone had > 99 days */
+      u = 'h';
+      t = (t + 30)/60;
+      if (t > 72)
         {
-        u = 'w';
-        t = (t + 3)/7;
-        if (t > 99)                  /* so, just in case */
+        u = 'd';
+        t = (t + 12)/24;
+        if (t > 99)                    /* someone had > 99 days */
           {
-          u = 'y';
-          t = (t + 26)/52;
+          u = 'w';
+          t = (t + 3)/7;
+          if (t > 99)                  /* so, just in case */
+            {
+            u = 'y';
+            t = (t + 26)/52;
+            }
           }
         }
       }
-    }
-
-  update_recipients(p);                   /* update destinations */
-
-  /* Can't set this earlier, as header data may change things. */


-  dd = p->destinations;
+    update_recipients(p);                   /* update destinations */


-  /* Check to see if this message is on the hide list; if any hide
-  item has timed out, remove it from the list. Hide if all destinations
-  are on the hide list. */
+    /* Can't set this earlier, as header data may change things. */


-  for (ddd = dd; ddd != NULL; ddd = ddd->next)
-    {
-    skip_item *sk;
-    skip_item **skp;
-    int len_address;
+    dd = p->destinations;


-    if (ddd->address[0] == '*') break;
-    len_address = Ustrlen(ddd->address);
+    /* Check to see if this message is on the hide list; if any hide
+    item has timed out, remove it from the list. Hide if all destinations
+    are on the hide list. */


-    for (skp = &queue_skip; ; skp = &(sk->next))
+    for (ddd = dd; ddd != NULL; ddd = ddd->next)
       {
-      int len_skip;
+      skip_item *sk;
+      skip_item **skp;
+      int len_address;
+
+      if (ddd->address[0] == '*') break;
+      len_address = Ustrlen(ddd->address);


-      sk = *skp;
-      while (sk != NULL && now >= sk->reveal)
+      for (skp = &queue_skip; ; skp = &(sk->next))
         {
-        *skp = sk->next;
-        store_free(sk);
+        int len_skip;
+
         sk = *skp;
-        if (queue_skip == NULL)
+        while (sk != NULL && now >= sk->reveal)
           {
-          XtDestroyWidget(unhide_widget);
-          unhide_widget = NULL;
+          *skp = sk->next;
+          store_free(sk);
+          sk = *skp;
+          if (queue_skip == NULL)
+            {
+            XtDestroyWidget(unhide_widget);
+            unhide_widget = NULL;
+            }
           }
-        }
-      if (sk == NULL) break;
-
-      /* If this address matches the skip item, break (sk != NULL) */
+        if (sk == NULL) break;


-      len_skip = Ustrlen(sk->text);
-      if (len_skip <= len_address &&
-          Ustrcmp(ddd->address + len_address - len_skip, sk->text) == 0)
-        break;
-      }
-
-    if (sk == NULL) break;
-    }
+        /* If this address matches the skip item, break (sk != NULL) */


-  /* Don't use more than one call of anon() in one statement - it uses
-  a fixed static buffer. */
-
-  if (ddd != NULL || dd == NULL)
-    {
-    text_showf(queue_widget, "%c%2d%c %s %s %-8s ",
-      (p->frozen)? '*' : ' ',
-      t, u,
-      string_format_size(p->size, big_buffer),
-      p->name,
-      (p->sender == NULL)? US"       " :
-        (p->sender[0] == 0)? US"<>     " : anon(p->sender));
-
-    text_showf(queue_widget, "%s%s%s",
-      (dd == NULL || dd->address[0] == '*')? "" : "<",
-      (dd == NULL)? US"" : anon(dd->address),
-      (dd == NULL || dd->address[0] == '*')? "" : ">");
+        len_skip = Ustrlen(sk->text);
+        if (len_skip <= len_address &&
+            Ustrcmp(ddd->address + len_address - len_skip, sk->text) == 0)
+          break;
+        }


-    if (dd != NULL && dd->parent != NULL && dd->parent->address[0] != '*')
-      text_showf(queue_widget, " parent <%s>", anon(dd->parent->address));
+      if (sk == NULL) break;
+      }


-    text_show(queue_widget, US"\n");
+    /* Don't use more than one call of anon() in one statement - it uses
+    a fixed static buffer. */


-    if (dd != NULL) dd = dd->next;
-    while (dd != NULL && count++ < queue_max_addresses)
+    if (ddd != NULL || dd == NULL)
       {
-      text_showf(queue_widget, "                                     <%s>",
-        anon(dd->address));
-      if (dd->parent != NULL && dd->parent->address[0] != '*')
+      text_showf(queue_widget, "%c%2d%c %s %s %-8s ",
+        (p->frozen)? '*' : ' ',
+        t, u,
+        string_format_size(p->size, big_buffer),
+        p->name,
+        (p->sender == NULL)? US"       " :
+          (p->sender[0] == 0)? US"<>     " : anon(p->sender));
+
+      text_showf(queue_widget, "%s%s%s",
+        (dd == NULL || dd->address[0] == '*')? "" : "<",
+        (dd == NULL)? US"" : anon(dd->address),
+        (dd == NULL || dd->address[0] == '*')? "" : ">");
+
+      if (dd != NULL && dd->parent != NULL && dd->parent->address[0] != '*')
         text_showf(queue_widget, " parent <%s>", anon(dd->parent->address));
+
       text_show(queue_widget, US"\n");
-      dd = dd->next;
+
+      if (dd != NULL) dd = dd->next;
+      while (dd != NULL && count++ < queue_max_addresses)
+        {
+        text_showf(queue_widget, "                                     <%s>",
+          anon(dd->address));
+        if (dd->parent != NULL && dd->parent->address[0] != '*')
+          text_showf(queue_widget, " parent <%s>", anon(dd->parent->address));
+        text_show(queue_widget, US"\n");
+        dd = dd->next;
+        }
+      if (dd != NULL)
+        text_showf(queue_widget, "                                     ...\n");
       }
-    if (dd != NULL)
-      text_showf(queue_widget, "                                     ...\n");
     }
-
   p = p->next;
   }
 }
--