diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2007-10-25 20:43:04 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2007-10-25 20:43:04 +0000 |
commit | cf0dee616af1f417daa76e746dfaa50947009fac (patch) | |
tree | 58e5ae5ef39f76bce53c7b09a49dfbaf0324cfac | |
parent | 745b58a68bf2e60a6652475c56a1cff0aa6ebf9f (diff) | |
download | monitoring-plugins-cf0dee616af1f417daa76e746dfaa50947009fac.tar.gz |
Automatically update website with --help output. Cosmetic
fixes for some help output
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1810 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins-root/check_dhcp.c | 6 | ||||
-rw-r--r-- | plugins/check_ping.c | 2 | ||||
-rw-r--r-- | plugins/check_ups.c | 2 | ||||
-rwxr-xr-x | tools/sync_website | 44 |
4 files changed, 49 insertions, 5 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index c6e5af8a..bc2f4bbe 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -269,9 +269,6 @@ int main(int argc, char **argv){ | |||
269 | int dhcp_socket; | 269 | int dhcp_socket; |
270 | int result = STATE_UNKNOWN; | 270 | int result = STATE_UNKNOWN; |
271 | 271 | ||
272 | /* this plugin almost certainly needs root permissions. */ | ||
273 | np_warn_if_not_root(); | ||
274 | |||
275 | setlocale (LC_ALL, ""); | 272 | setlocale (LC_ALL, ""); |
276 | bindtextdomain (PACKAGE, LOCALEDIR); | 273 | bindtextdomain (PACKAGE, LOCALEDIR); |
277 | textdomain (PACKAGE); | 274 | textdomain (PACKAGE); |
@@ -280,6 +277,9 @@ int main(int argc, char **argv){ | |||
280 | usage4 (_("Could not parse arguments")); | 277 | usage4 (_("Could not parse arguments")); |
281 | } | 278 | } |
282 | 279 | ||
280 | /* this plugin almost certainly needs root permissions. */ | ||
281 | np_warn_if_not_root(); | ||
282 | |||
283 | /* create socket for DHCP communications */ | 283 | /* create socket for DHCP communications */ |
284 | dhcp_socket=create_dhcp_socket(); | 284 | dhcp_socket=create_dhcp_socket(); |
285 | 285 | ||
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index bf726d82..065a14c7 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c | |||
@@ -548,7 +548,7 @@ print_help (void) | |||
548 | { | 548 | { |
549 | print_revision (progname, revision); | 549 | print_revision (progname, revision); |
550 | 550 | ||
551 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>"); | 551 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); |
552 | printf (COPYRIGHT, copyright, email); | 552 | printf (COPYRIGHT, copyright, email); |
553 | 553 | ||
554 | printf (_("Use ping to check connection statistics for a remote host.")); | 554 | printf (_("Use ping to check connection statistics for a remote host.")); |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 0cd4c5a0..832c32b6 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -598,7 +598,7 @@ print_help (void) | |||
598 | 598 | ||
599 | print_revision (progname, revision); | 599 | print_revision (progname, revision); |
600 | 600 | ||
601 | printf ("Copyright (c) 2000 Tom Shields"); | 601 | printf ("Copyright (c) 2000 Tom Shields\n"); |
602 | printf ("Copyright (c) 2004 Alain Richard <alain.richard@equation.fr>\n"); | 602 | printf ("Copyright (c) 2004 Alain Richard <alain.richard@equation.fr>\n"); |
603 | printf ("Copyright (c) 2004 Arnaud Quette <arnaud.quette@mgeups.com>\n"); | 603 | printf ("Copyright (c) 2004 Arnaud Quette <arnaud.quette@mgeups.com>\n"); |
604 | printf (COPYRIGHT, copyright, email); | 604 | printf (COPYRIGHT, copyright, email); |
diff --git a/tools/sync_website b/tools/sync_website new file mode 100755 index 00000000..8489bc54 --- /dev/null +++ b/tools/sync_website | |||
@@ -0,0 +1,44 @@ | |||
1 | #!/usr/bin/perl | ||
2 | use strict; | ||
3 | use DBI; | ||
4 | #$ENV{PERL5LIB}="plugins-scripts"; # Needed for utils.pm | ||
5 | |||
6 | unless ($ENV{DRUPAL_PASSWORD}) { | ||
7 | die "Must set envvar for DRUPAL_PASSWORD"; | ||
8 | } | ||
9 | |||
10 | my $pid = open(F, "-|", qw(ssh -n -N -L 25555:127.0.0.1:3306 nagiosplugins.org)); | ||
11 | |||
12 | # Allow time for ssh tunnel to be created | ||
13 | sleep 2; | ||
14 | |||
15 | # To stop the death of ssh tunnel being defunct | ||
16 | $SIG{CHLD} = 'IGNORE'; | ||
17 | |||
18 | END { kill 'INT', $pid if $pid }; | ||
19 | |||
20 | my $dbh = DBI->connect("DBI:mysql:database=drupal;host=127.0.0.1;port=25555", "drupal", $ENV{DRUPAL_PASSWORD}); | ||
21 | |||
22 | my @plugin_paths; | ||
23 | push @plugin_paths, (grep { -x $_ && -f $_ } (<plugins-root/*>, <plugins/*>) ); | ||
24 | |||
25 | foreach my $plugin_path (@plugin_paths) { | ||
26 | my $plugin = $plugin_path; | ||
27 | $plugin =~ s%.*/%%; | ||
28 | my $help_option = "--help"; | ||
29 | $help_option = "-h" if ($plugin eq "check_icmp"); | ||
30 | my $help = `$plugin_path $help_option` || die "Cannot run $plugin -h"; | ||
31 | $help =~ s/</</g; | ||
32 | $help =~ s/>/>/g; | ||
33 | |||
34 | my $rows = $dbh->do("UPDATE node SET created=UNIX_TIMESTAMP(NOW()) WHERE title='$plugin'"); | ||
35 | unless ($rows == 1) { | ||
36 | die "Cannot find $plugin in drupal to update - create book page first"; | ||
37 | } | ||
38 | |||
39 | $dbh->do("UPDATE node_revisions SET timestamp=UNIX_TIMESTAMP(NOW()), log='Updated by update_online_manpage', teaser='$plugin --help', body=? WHERE title='$plugin'", | ||
40 | {}, | ||
41 | "<pre>".$help."</pre>"); | ||
42 | } | ||
43 | |||
44 | print "Finished\n"; | ||