[Nagiosplug-checkins] SF.net SVN: nagiosplug: [1810] nagiosplug/trunk

tonvoon at users.sourceforge.net tonvoon at users.sourceforge.net
Thu Oct 25 22:43:05 CEST 2007


Revision: 1810
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1810&view=rev
Author:   tonvoon
Date:     2007-10-25 13:43:04 -0700 (Thu, 25 Oct 2007)

Log Message:
-----------
Automatically update website with --help output. Cosmetic
fixes for some help output

Modified Paths:
--------------
    nagiosplug/trunk/plugins/check_ping.c
    nagiosplug/trunk/plugins/check_ups.c
    nagiosplug/trunk/plugins-root/check_dhcp.c

Added Paths:
-----------
    nagiosplug/trunk/tools/sync_website

Modified: nagiosplug/trunk/plugins/check_ping.c
===================================================================
--- nagiosplug/trunk/plugins/check_ping.c	2007-10-24 15:08:34 UTC (rev 1809)
+++ nagiosplug/trunk/plugins/check_ping.c	2007-10-25 20:43:04 UTC (rev 1810)
@@ -548,7 +548,7 @@
 {
 	print_revision (progname, revision);
 
-	printf ("Copyright (c) 1999 Ethan Galstad <nagios at nagios.org>");
+	printf ("Copyright (c) 1999 Ethan Galstad <nagios at nagios.org>\n");
 	printf (COPYRIGHT, copyright, email);
 
 	printf (_("Use ping to check connection statistics for a remote host."));

Modified: nagiosplug/trunk/plugins/check_ups.c
===================================================================
--- nagiosplug/trunk/plugins/check_ups.c	2007-10-24 15:08:34 UTC (rev 1809)
+++ nagiosplug/trunk/plugins/check_ups.c	2007-10-25 20:43:04 UTC (rev 1810)
@@ -598,7 +598,7 @@
 
 	print_revision (progname, revision);
 
-	printf ("Copyright (c) 2000 Tom Shields");
+	printf ("Copyright (c) 2000 Tom Shields\n");
 	printf ("Copyright (c) 2004 Alain Richard <alain.richard at equation.fr>\n");
 	printf ("Copyright (c) 2004 Arnaud Quette <arnaud.quette at mgeups.com>\n");
 	printf (COPYRIGHT, copyright, email);

Modified: nagiosplug/trunk/plugins-root/check_dhcp.c
===================================================================
--- nagiosplug/trunk/plugins-root/check_dhcp.c	2007-10-24 15:08:34 UTC (rev 1809)
+++ nagiosplug/trunk/plugins-root/check_dhcp.c	2007-10-25 20:43:04 UTC (rev 1810)
@@ -269,9 +269,6 @@
 	int dhcp_socket;
 	int result = STATE_UNKNOWN;
 
-	/* this plugin almost certainly needs root permissions. */
-	np_warn_if_not_root();
-	
 	setlocale (LC_ALL, "");
 	bindtextdomain (PACKAGE, LOCALEDIR);
 	textdomain (PACKAGE);
@@ -280,6 +277,9 @@
 		usage4 (_("Could not parse arguments"));
 		}
 
+	/* this plugin almost certainly needs root permissions. */
+	np_warn_if_not_root();
+	
 	/* create socket for DHCP communications */
 	dhcp_socket=create_dhcp_socket();
 

Added: nagiosplug/trunk/tools/sync_website
===================================================================
--- nagiosplug/trunk/tools/sync_website	                        (rev 0)
+++ nagiosplug/trunk/tools/sync_website	2007-10-25 20:43:04 UTC (rev 1810)
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+use strict;
+use DBI;
+#$ENV{PERL5LIB}="plugins-scripts"; # Needed for utils.pm
+
+unless ($ENV{DRUPAL_PASSWORD}) {
+	die "Must set envvar for DRUPAL_PASSWORD";
+}
+
+my $pid = open(F, "-|", qw(ssh -n -N -L 25555:127.0.0.1:3306 nagiosplugins.org));
+
+# Allow time for ssh tunnel to be created
+sleep 2;
+
+# To stop the death of ssh tunnel being defunct
+$SIG{CHLD} = 'IGNORE';	
+
+END { kill 'INT', $pid if $pid };
+
+my $dbh = DBI->connect("DBI:mysql:database=drupal;host=127.0.0.1;port=25555", "drupal", $ENV{DRUPAL_PASSWORD});
+
+my @plugin_paths;
+push @plugin_paths, (grep { -x $_ && -f $_ } (<plugins-root/*>, <plugins/*>) );
+
+foreach my $plugin_path (@plugin_paths) {
+	my $plugin = $plugin_path;
+	$plugin =~ s%.*/%%;
+	my $help_option = "--help";
+	$help_option = "-h" if ($plugin eq "check_icmp");
+	my $help = `$plugin_path $help_option` || die "Cannot run $plugin -h";
+	$help =~ s/</</g;
+	$help =~ s/>/>/g;
+
+	my $rows = $dbh->do("UPDATE node SET created=UNIX_TIMESTAMP(NOW()) WHERE title='$plugin'");
+	unless ($rows == 1) {
+		die "Cannot find $plugin in drupal to update - create book page first";
+	}
+
+	$dbh->do("UPDATE node_revisions SET timestamp=UNIX_TIMESTAMP(NOW()), log='Updated by update_online_manpage', teaser='$plugin --help',  body=? WHERE title='$plugin'",
+		{},
+		"<pre>".$help."</pre>");
+}
+
+print "Finished\n";


Property changes on: nagiosplug/trunk/tools/sync_website
___________________________________________________________________
Name: svn:executable
   + *


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list