--- /dev/null
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">\r
+<html>\r
+<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
+ <meta name="Author" content="noman">\r
+ <meta name="GENERATOR" content="Mozilla/4.6 [en] (WinNT; I) [Netscape]">\r
+ <title>spong-server Data Module Template</title>\r
+</head>\r
+<body>\r
+\r
+<h1>\r
+spong-server Data Module Template</h1>\r
+\r
+<hr WIDTH="100%">\r
+<br>This template will be a simple example that will write incoming 'cpu'\r
+status updates into a queueing directory. Each file will have the\r
+host's name plus the current time are it's file name. \r
+\r
+The file name of the module must begin with 'data_'. The registry key can\r
+be anything, but it should be consistent with the procedure's name. And the\r
+registry must be unique among the other loaded modules; otherwise, one\r
+module will overylay the other.\r
+\r
+<p>The line that has the assignment to $DATAFUNCS{'registry-name'} is the\r
+key to the registry mechanism. It's what used to track the registry name to the\r
+your data module.\r
+\r
+<pre>\r
+# Register the routine with the plugin registry\r
+$DATAFUNCS{'cpu_queue'} = \&data_cpu_queue;\r
+\r
+$CPU_QUEUE_DIR = "/var/spool/spong-queue"; # The spooling directory\r
+\r
+sub data_cpu_queue {\r
+ my( $host, $service, $color, $start, $time, $sum, $message ) = @_;\r
+\r
+ if ( $service ne 'cpu' ) { return; }\r
+\r
+ my( $file ) = "$CPU_QUEUE_DIR/$host-" . time();\r
+\r
+ open(FH,"> $file") or\r
+ die("plugin::data_cpu_queue: Could not open file $file: $!");\r
+\r
+ print FH "hostname: $host\n";\r
+ print FH "color: $color\n";\r
+ print FH "start-time: $start\n";\r
+ print FH "last-update: $time\n";\r
+ print FH "summary: $sum\n";\r
+ print FH "message:\n$message\n";\r
+\r
+ close FH;\r
+}\r
+\r
+# I'm included perl code, I need this line.\r
+1;\r
+</pre>\r
+\r
+<p>Please note the final line. It is always required for a module file.\r
+</body>\r
+</html>\r