--- /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 Client Module Template</title>\r
+</head>\r
+<body>\r
+\r
+<h1>\r
+spong-client Module Template</h1>\r
+\r
+<hr WIDTH="100%">\r
+<br>This template assumes that you are creating a new client check\r
+called 'mailq'. The name of the file created should be 'check_mailq'. The\r
+file name should always be 'check_' and the registry name (e.g. for the\r
+foo check, the registry name is 'foo' and the file name is 'check_foo'.\r
+<p>The line that has the assignment to $CHECKFUNC{'registry-name'} is the\r
+key to the registry mechanism. It's what track the registry name to the\r
+your check function.\r
+<p>The registry name does not always have to match up to the service name\r
+as in this case of 'mailq'. If you where creating a new and improved function\r
+to check mail queues, you could create a module called 'my_mailq'. You\r
+would use the regiestry name 'my_mailq', but you would use the service\r
+name 'mailq' in the <tt>&status()</tt> function when reporting you\r
+info back to the server.\r
+<p>check_mailq:\r
+<p><tt># Register my routine with plugin registry</tt>\r
+<br><tt>$CHECKFUNCS{'mailq'} = \&check_mailq;</tt><tt></tt>\r
+<p><tt># Sendmail mail queue check for mail servers. It checks the number\r
+of mail</tt>\r
+<br><tt># message queued against the $MAILQWARN AND $MAILQCRIT variables.</tt>\r
+<br><tt># It runs the command in the config variable $MAILQ to do it's\r
+check.</tt><tt></tt>\r
+<p><tt>sub check_mailq {</tt>\r
+<br><tt> my($mqcnt, $message, $color, $summary );</tt><tt></tt>\r
+<p><tt> open (FOO,"$MAILQ |");</tt>\r
+<br><tt> $mqcnt = 0;</tt>\r
+<br><tt> while (<FOO>) {</tt>\r
+<br><tt> if (/Mail Queue\s+\((\d+)/)\r
+{ $mqcnt = $1; }</tt><tt></tt>\r
+<p><tt> # Grab enough to get\r
+the first 10 entries.</tt>\r
+<br><tt> if (++$lines <= 35)\r
+{ $message .= $_ };</tt>\r
+<br><tt> }</tt>\r
+<br><tt> close FOO;</tt><tt></tt>\r
+<p><tt> $color = "green";</tt>\r
+<br><tt> if ($mqcnt > $MAILQWARN) { $color = "yellow";\r
+}</tt>\r
+<br><tt> if ($mqcnt > $MAILQCRIT) { $color = "red"; }</tt><tt></tt>\r
+<p><tt> $summary = "Mail Queue count = $mqcnt";</tt><tt></tt>\r
+<p><tt> &debug("mailq - $color, $summary");</tt>\r
+<br><tt> &status( $SPONGSERVER, $HOST, "mailq", $color,\r
+$summary, $message );</tt>\r
+<br><tt>}</tt><tt></tt>\r
+<p><tt># I'm include perl code, I need this line.</tt>\r
+<br><tt>1;</tt>\r
+<p>Please note the final line. It is always required for a module file.\r
+<br> \r
+<br> \r
+</body>\r
+</html>\r
--- /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-network Module Template</title>\r
+</head>\r
+<body>\r
+\r
+<h1>\r
+spong-network Module Template</h1>\r
+\r
+<hr WIDTH="100%">\r
+<br>This template assumes that you are creating a network check called\r
+'dns'. The name of the file created should be 'check_dns'. The file name\r
+should always be 'check_' and the registry name (e.g. for the foo check,\r
+the registry name is 'foo' and the file name is 'check_foo'.\r
+<p>The line that has the assignment to $PLUGINS{'registry-name'} is the\r
+key to the registry mechanism. It's what track the registry name to the\r
+your check function.\r
+<p>The registry name does not always have to match up to the service name\r
+as in this case of 'dns'. If you where creating a new and improved function\r
+to ping and traceroute, you could create a module called 'ping_trace'.\r
+You would use the registry name 'ping_trace', but you would use the service\r
+name 'ping' in the <tt>&status()</tt> function when reporting you info\r
+back to the server.\r
+<p><tt># Register the routine with the plugin registry</tt>\r
+<br><tt>$PLUGINS{'dns'} = \&check_dns;</tt><tt></tt>\r
+<p><tt># Check to see if they have the Net::DNS module installed, and if\r
+they do we</tt>\r
+<br><tt># can then do DNS queries, and see if DNS servers are alive.</tt><tt></tt>\r
+<p><tt>eval "require Net::DNS;";</tt>\r
+<br><tt>if( ! $@ ) { $dns = 1; } else { $dns = 0; }</tt><tt></tt>\r
+<p><tt># This check will (if the Net::DNS module is available) connect\r
+to a DNS server</tt>\r
+<br><tt># and ask that server to resolve it's own name. If it can\r
+do that, then we</tt>\r
+<br><tt># assume it is ok - If it can't then something is wrong.</tt><tt></tt>\r
+<p><tt>sub check_dns {</tt>\r
+<br><tt> my( $host ) = @_;</tt>\r
+<br><tt> my( $color, $summary, $message ) = ( "green", "",\r
+"" );</tt>\r
+<br><tt> </tt>\r
+<br><tt> if( ! $dns ) {</tt>\r
+<br><tt> $summary = "can't do DNS lookups,\r
+Net::DNS not installed";</tt>\r
+<br><tt> &debug( "dns - $host - $color,\r
+$summary" );</tt>\r
+<br><tt> return ( "yellow", $summary,</tt>\r
+<br><tt> \r
+"In order to do DNS queries you must install the Net::DNS " .</tt>\r
+<br><tt> \r
+"Perl module.\nYou can find the module at your nearest CPAN " .</tt>\r
+<br><tt> \r
+"archive or http://www.perl.com/CPAN/\n" );</tt>\r
+<br><tt> }</tt>\r
+<br><tt> </tt>\r
+<br><tt> my $resolver = new Net::DNS::Resolver;</tt>\r
+<br><tt> $resolver->nameservers( $host );</tt>\r
+<br><tt> $resolver->retrans(2);</tt>\r
+<br><tt> $resolver->retry(1);</tt>\r
+<br><tt> $resolver->recurse(0);</tt>\r
+<br><tt> my $q = $resolver->search( $host, "A" );</tt>\r
+<br><tt> </tt>\r
+<br><tt> if( defined $q && defined $q->answer &&\r
+defined (($q->answer)[0]) ) {</tt>\r
+<br><tt> $color = "green";</tt>\r
+<br><tt> $summary = "dns ok";</tt>\r
+<br><tt> } else {</tt>\r
+<br><tt> $color = "red";</tt>\r
+<br><tt> $summary = "can't resolve $host";</tt>\r
+<br><tt> $message = "can't resolve $host\n";</tt>\r
+<br><tt> }</tt>\r
+<br><tt> </tt>\r
+<br><tt> &debug( "dns - $host - $color, $summary" );</tt>\r
+<br><tt> return( $color, $summary, $message );</tt>\r
+<br><tt>}</tt><tt></tt>\r
+<p><tt># I;m included perl code, I need this line.</tt>\r
+<br><tt>1;</tt>\r
+<p>Please note the final line. It is always required for a module file.\r
+<br> \r
+<br> \r
+</body>\r
+</html>\r