SOURCES: nagios-plugin-check_mysql_replication.patch (NEW) - more ...
glen
glen at pld-linux.org
Tue Feb 6 22:06:08 CET 2007
Author: glen Date: Tue Feb 6 21:06:08 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- more die() -> print + exitcode changes
---- Files affected:
SOURCES:
nagios-plugin-check_mysql_replication.patch (1.2 -> 1.3) (NEW)
---- Diffs:
================================================================
Index: SOURCES/nagios-plugin-check_mysql_replication.patch
diff -u /dev/null SOURCES/nagios-plugin-check_mysql_replication.patch:1.3
--- /dev/null Tue Feb 6 22:06:08 2007
+++ SOURCES/nagios-plugin-check_mysql_replication.patch Tue Feb 6 22:06:03 2007
@@ -0,0 +1,50 @@
+--- ./check_mysql_replication.pl 2007-02-06 22:56:59.210890129 +0200
++++ /home/glen/work/tmp/check_mysql_replication 2007-02-06 23:03:23.000000000 +0200
+@@ -125,7 +125,9 @@
+ debug(1, "Connecting to slave $host:$port as user " . $options->{'slave-user'});
+ my $dbh = DBI->connect("DBI:mysql:host=$host:port=$port", $options->{'slave-user'}, $options->{'slave-pass'});
+ if (not $dbh) {
+- print "UNKNOWN: cannot connect to $host\n";
++ my $drh = DBI->install_driver('mysql');
++ my $errs = $drh->errstr;
++ print "UNKNOWN: cannot connect to $host: $errs\n";
+ exit 3;
+ }
+ my $sql = "show variables";
+@@ -160,7 +162,11 @@
+ if (defined $random_db) {
+ debug(3, "DBs being replicated are: " . join(', ', @replicated) . "; random choice is $random_db");
+ my $sql = "use $random_db";
+- $sth = $dbh->prepare($sql) || die "Cannot prepare: $!";
++ $sth = $dbh->prepare($sql);
++ if (not $sth) {
++ print "Cannot prepare: $!";
++ exit 3;
++ }
+ $res = $sth->execute();
+ $sth->finish;
+ $sql = 'show table status';
+@@ -182,7 +188,9 @@
+ $dbh = DBI->connect("DBI:mysql:host=$host:port=$port", $user, $pass);
+
+ if (not $dbh) {
+- print "UNKNOWN: Cannot connect to master $host:$port\n";
++ my $drh = DBI->install_driver('mysql');
++ my $err = $drh->errstr;
++ print "UNKNOWN: Cannot connect to master $host:$port: $err\n";
+ exit 3;
+ }
+ $sql = "show variables";
+@@ -209,7 +217,11 @@
+ foreach my $database (keys(%{$slave_data->{replication}->{table_status}})) {
+ debug(3, "The master should check $database");
+ $sth = $dbh->prepare("use $database");
+- $sth->execute || die "Cannot use db";
++ my $rv = $sth->execute;
++ if (not $rv) {
++ print "Cannot use db";
++ exit 3;
++ }
+ $sth->finish;
+ $sth = $dbh->prepare('show table status');
+ $res = $sth->execute;
================================================================
More information about the pld-cvs-commit
mailing list