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
<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>
#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"
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; */