Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/pazpar2
authorDennis Schafroth <dennis@indexdata.com>
Mon, 28 Mar 2011 08:57:48 +0000 (10:57 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Mon, 28 Mar 2011 08:57:48 +0000 (10:57 +0200)
etc/check-pazpar2.sh
etc/server-status-nagios.xsl
etc/services/long_sessions.xml
src/http_command.c
src/pazpar2.c

index c5d97d6..de11de4 100755 (executable)
@@ -63,6 +63,6 @@ if [ "$CRIT_LEVEL" != "" ] ; then
     fi
 fi 
 
-echo "SESSIONS $MSG $SESSIONS ($CLIENTS) | $SESSIONS;$WARN_LEVEL;$CRIT_LEVEL "
+echo "SESSIONS $MSG $SESSIONS ($CLIENTS) [$VIRT,$VIRTUSE,$AREA,$ORDBLKS,$UORDBLKS,$FORDBLKS,$KEEPCOST,$HBLKS,$HBLKHD]   | $SESSIONS;$WARN_LEVEL;$CRIT_LEVEL "
 exit $rc
 
index 56f53fa..9a2b21b 100644 (file)
@@ -8,6 +8,10 @@
       <xsl:apply-templates />
   </xsl:template>
 
+  <xsl:template match="memory">
+      <xsl:apply-templates />
+  </xsl:template>
+
   <xsl:template match="sessions">
     <xsl:text>export SESSIONS=</xsl:text><xsl:value-of select="." />
   </xsl:template>
     <xsl:text>export RESULTSETS=</xsl:text><xsl:value-of select="." />
   </xsl:template>
 
-  <xsl:template match="*">
+  <xsl:template match="arena">
+    <xsl:text>AREA=</xsl:text><xsl:value-of select="." />
+  </xsl:template>
+
+  <xsl:template match="ordblks">
+    <xsl:text>ORDBLKS=</xsl:text><xsl:value-of select="." />
+  </xsl:template>
+
+  <xsl:template match="uordblks">
+    <xsl:text>UORDBLKS=</xsl:text><xsl:value-of select="." />
+  </xsl:template>
+
+  <xsl:template match="fordblks">
+    <xsl:text>FORDBLKS=</xsl:text><xsl:value-of select="." />
+  </xsl:template>
+
+  <xsl:template match="keepcost">
+    <xsl:text>KEEPCOST=</xsl:text><xsl:value-of select="." />
+  </xsl:template>
+
+  <xsl:template match="hblks">
+    <xsl:text>HBLKS=</xsl:text><xsl:value-of select="." />
+  </xsl:template>
+
+  <xsl:template match="hblkhd">
+    <xsl:text>HBLKHD=</xsl:text><xsl:value-of select="." />
   </xsl:template>
 
+  <xsl:template match="virt">
+    <xsl:text>VIRT=</xsl:text><xsl:value-of select="." />
+  </xsl:template>
+
+  <xsl:template match="virtuse">
+    <xsl:text>VIRTUSE=</xsl:text><xsl:value-of select="." />
+  </xsl:template>
+
+  <xsl:template match="*" />
+
 </xsl:stylesheet>
index c431027..175e8da 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<service id="perf_t" xmlns="http://www.indexdata.com/pazpar2/1.0">
+<service id="long" xmlns="http://www.indexdata.com/pazpar2/1.0">
   <timeout session="600" z3950_operation="30" z3950_session="900"/>  
   <settings target="*">
     <set target="localhost:9999/db01" name="pz:name" value="db01"/>
index e8bba87..6acc2c3 100644 (file)
@@ -41,6 +41,29 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "settings.h"
 #include "client.h"
 
+#include <malloc.h>
+
+void print_meminfo(WRBUF wrbuf) {
+#ifdef __GNUC__
+    struct mallinfo minfo;
+    minfo = mallinfo();
+    wrbuf_printf(wrbuf, "  <memory>\n"
+                        "   <arena>%d</arena>\n" 
+                        "   <uordblks>%d</uordblks>\n"
+                        "   <fordblks>%d</fordblks>\n"
+                        "   <ordblks>%d</ordblks>\n"
+                        "   <keepcost>%d</keepcost>\n"
+                        "   <hblks>%d</hblks>\n" 
+                        "   <hblkhd>%d</hblkhd>\n"
+                        "   <virt>%d</virt>\n"
+                        "   <virtuse>%d</virtuse>\n"
+                        "  </memory>\n", 
+                 minfo.arena, minfo.uordblks, minfo.fordblks,minfo.ordblks, minfo.keepcost, minfo.hblks, minfo.hblkhd, minfo.arena + minfo.hblkhd, minfo.uordblks + minfo.hblkhd);
+
+#endif
+}
+
+
 // Update this when the protocol changes
 #define PAZPAR2_PROTOCOL_VERSION "1"
 
@@ -632,6 +655,7 @@ static void cmd_server_status(struct http_channel *c)
     wrbuf_printf(c->wrbuf, "  <clients>%u</clients>\n",   clients);
     /* Only works if yaz has been compiled with enabling of this */
     wrbuf_printf(c->wrbuf, "  <resultsets>%u</resultsets>\n",resultsets);
+    print_meminfo(c->wrbuf);
 
 /* TODO add all sessions status                         */
 /*    http_sessions_t http_sessions = c->http_sessions; */
index 7f69902..84a3253 100644 (file)
@@ -35,6 +35,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <yaz/options.h>
 #include <yaz/sc.h>
 
+// #define MTRACE
+#ifdef MTRACE
+#include <mcheck.h>
+#endif
+
 static struct conf_config *sc_stop_config = 0;
 
 void child_handler(void *data)
@@ -227,10 +232,20 @@ int main(int argc, char **argv)
 {
     int ret;
     yaz_sc_t s = yaz_sc_create("pazpar2", "Pazpar2");
+    
+#ifdef MTRACE
+    mtrace();
+#endif
 
     ret = yaz_sc_program(s, argc, argv, sc_main, sc_stop);
 
     yaz_sc_destroy(&s);
+
+#ifdef MTRACE
+    muntrace();
+#endif
+
+
     exit(ret);
 }