[Reconnoiter-devel] [reconnoiter commit] r420 - docs/config/modules trunk/src/modules-lua

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Sun Sep 7 11:38:24 EDT 2008


Author: jesus
Date: 2008-09-07 11:38:24 -0400 (Sun, 07 Sep 2008)
New Revision: 420

Added:
   docs/config/modules/noit.module.smtp.xml
   docs/config/modules/noit.module.varnish.xml
   trunk/src/modules-lua/extract_xml.lua
Modified:
   trunk/src/modules-lua/Makefile.in
Log:
autobuild docs form lua stuff... the things you can do in lua are as evil as perl, refs #21

Added: docs/config/modules/noit.module.smtp.xml
===================================================================
--- docs/config/modules/noit.module.smtp.xml	                        (rev 0)
+++ docs/config/modules/noit.module.smtp.xml	2008-09-07 15:38:24 UTC (rev 420)
@@ -0,0 +1,43 @@
+<module>
+  <name>smtp</name>
+  <description><para>Send an email via an SMTP server.</para></description>
+  <loader>lua</loader>
+  <object>noit.module.smtp</object>
+  <moduleconfig />
+  <checkconfig>
+    <parameter name="port" required="optional" default="25"
+               allowed="\d+">Specifies the TCP port to connect to.</parameter>
+    <parameter name="ehlo" required="optional" default="noit.local"
+               allowed="\d+">Specifies the EHLO parameter.</parameter>
+    <parameter name="from" required="optional" default=""
+               allowed="\d+">Specifies the envelope sender.</parameter>
+    <parameter name="to" required="required"
+               allowed="\d+">Specifies the envelope recipient.</parameter>
+    <parameter name="payload" required="optional" default="Subject: Testing"
+               allowed="\d+">Specifies the payload sent (on the wire). CR LF DOT CR LF is appended automatically.</parameter>
+  </checkconfig>
+  <examples>
+    <example>
+      <title>Send an email to test SMTP service.</title>
+      <para>The following example sends an email via 10.80.117.6 from test at omniti.com to devnull at omniti.com</para>
+      <programlisting><![CDATA[
+      <noit>
+        <modules>
+          <loader image="lua" name="lua">
+            <config><directory>/opt/reconnoiter/libexec/modules-lua/?.lua</directory></config>
+          </loader>
+          <module loader="lua" name="smtp" object="noit.module.smtp"/>
+        </modules>
+        <checks>
+          <check uuid="2d42adbc-7c7a-11dd-a48f-4f59e0b654d3" module="smtp" target="10.80.117.6">
+            <config>
+              <from>test at omniti.com</from>
+              <to>devnull at omniti.com</to>
+            </config>
+          </check>
+        </checks>
+      </noit>
+      ]]></programlisting>
+    </example>
+  </examples>
+</module>

Added: docs/config/modules/noit.module.varnish.xml
===================================================================
--- docs/config/modules/noit.module.varnish.xml	                        (rev 0)
+++ docs/config/modules/noit.module.varnish.xml	2008-09-07 15:38:24 UTC (rev 420)
@@ -0,0 +1,31 @@
+<module>
+  <name>varnish</name>
+  <description><para>Monitor maagement metrics of a Varnish instance.</para></description>
+  <loader>lua</loader>
+  <object>noit.module.varnish</object>
+  <moduleconfig />
+  <checkconfig>
+    <parameter name="port" required="optional" default="8081"
+               allowed="\d+">Specifies the port on which the management interface can be reached.</parameter>
+  </checkconfig>
+  <examples>
+    <example>
+      <title>Monitor two varnish instances with management on port 8081</title>
+      <para>The following example pulls are metrics available from Varnish running on 10.1.2.3 and 10.1.2.4</para>
+      <programlisting><![CDATA[
+      <noit>
+        <modules>
+          <loader image="lua" name="lua">
+            <config><directory>/opt/reconnoiter/libexec/modules-lua/?.lua</directory></config>
+          </loader>
+          <module loader="lua" name="varnish" object="noit.module.varnish"/>
+        </modules>
+        <checks>
+          <check uuid="2d42adbc-7c7a-11dd-a48f-4f59e0b654d3" module="varnish" target="10.1.2.3" />
+          <check uuid="324c2234-7c7a-11dd-8585-cbb783f8267f" module="varnish" target="10.1.2.4" />
+        </checks>
+      </noit>
+      ]]></programlisting>
+    </example>
+  </examples>
+</module>

Modified: trunk/src/modules-lua/Makefile.in
===================================================================
--- trunk/src/modules-lua/Makefile.in	2008-09-07 05:17:30 UTC (rev 419)
+++ trunk/src/modules-lua/Makefile.in	2008-09-07 15:38:24 UTC (rev 420)
@@ -36,3 +36,8 @@
 	for lua in $(LUA); do \
 		$(INSTALL) -m 0644 $$lua $(DESTDIR)$(MODULES_DIR)/$$lua ; \
 	done
+
+alldocs:	../modules/docs
+	for lua in $(LUA); do \
+		$(top_srcdir)/src/lua/src/lua extract_xml.lua $$lua ../modules/docs ; \
+	done

Added: trunk/src/modules-lua/extract_xml.lua
===================================================================
--- trunk/src/modules-lua/extract_xml.lua	                        (rev 0)
+++ trunk/src/modules-lua/extract_xml.lua	2008-09-07 15:38:24 UTC (rev 420)
@@ -0,0 +1,29 @@
+rc = 0
+
+function extract(file, docsdir)
+  local module = file:gsub('.lua$', ''):gsub('/', '.')
+  local M = require(module)
+  if not M or not M.onload then
+    return
+  end
+  M.onload( {
+    xml_description =
+      function(xml)
+        local f = io.open(docsdir .. "/" .. module .. ".xml", "w+")
+        if not f then
+          rc = 2
+        end
+        f:write(xml)
+        f:close()
+      end
+  })
+end
+
+
+if (#arg) ~= 2 then
+  print(string.format("%s <module> <docs directory>\n", (arg[0])))
+  os.exit(1)
+end
+
+extract(arg[1], arg[2])
+os.exit(rc)



More information about the Reconnoiter-devel mailing list