--- /dev/null
+=head1 NAME\r
+\r
+spong-server-mod-tempate - how to build a spong-server data module\r
+\r
+=head1 DESCRIPTION\r
+\r
+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 overlay the other.\r
+\r
+The line that has the assignment to C<$DATAFUNCS{'registry-name'}> is the\r
+key to the registry mechanism. It's what ties the registry name to the\r
+your data module.\r
+\r
+data_cpu_queue:\r
+\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
+ if (! open(FH,"> $file") ) {\r
+ &main::error("plugin::data_cpu_queue: Could not open file $file: $!");\r
+ return;\r
+ }\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
+ &main::debug("plugin::data_cpu_queue: event written to file $file",5);\r
+ }\r
+\r
+ # I'm included perl code, I need this line.\r
+ 1;\r
+\r
+Please note the final line. It is always required for a module file.\r
+\r
+You should use the C<E<amp>main::error()> function to log any error encountered\r
+in your module. The C<E<amp>main::error()> function is used to write output\r
+whenever something interesting happens in your module. \r
+\r
+Any configuration varirables needed for your data modules can be put into the\r
+Global section of your module as shown above. Of it can be added into the\r
+F<spong.conf> or F<spong.conf.E<lt>hostE<gt>> configuration files.\r
+Configuration variables for your module should be named to match them up\r
+with the name of your customized check. \r
+\r
+=head1 SEE ALSO\r
+\r
+L<developer-guide>, L<spong-server>, L<spong.conf>\r
+\r
+=head1 AUTHOR\r
+\r
+Stephen L Johnson <F<sjohnson@monsters.org>>\r
+\r
+=head1 HISTORY\r
+\r
+Based on code/ideas from Sean MacGuire (BB), and Helen Harrison (Pong). Ed Hill\r
+original converted Big Brother (http://www.bb4.com) into Perl which diverged\r
+from Big Brother to become Spong. Ed Hill continued Spong development until\r
+version 2.1. Stephen L Johnson took over development in October, 1999 with his\r
+changes which became Spong 2.5.\r
+\r