SOURCES: nagios-plugin-check_mysql_replication.patch (NEW) - trap ...
glen
glen at pld-linux.org
Tue Aug 29 14:32:23 CEST 2006
Author: glen Date: Tue Aug 29 12:32:23 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- trap error with lack of permissions
- formatting fixes
---- Files affected:
SOURCES:
nagios-plugin-check_mysql_replication.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/nagios-plugin-check_mysql_replication.patch
diff -u /dev/null SOURCES/nagios-plugin-check_mysql_replication.patch:1.1
--- /dev/null Tue Aug 29 14:32:23 2006
+++ SOURCES/nagios-plugin-check_mysql_replication.patch Tue Aug 29 14:32:18 2006
@@ -0,0 +1,71 @@
+--- ./check_replication.pl~ 2006-03-14 23:00:18.000000000 +0200
++++ ./check_replication.pl 2006-08-29 15:30:08.879992908 +0300
+@@ -119,13 +119,13 @@
+ 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";
++ print "UNKNOWN: cannot connect to $host\n";
+ exit 3;
+ }
+ my $sql = "show variables";
+ my $sth = $dbh->prepare($sql);
+ if (not $sth) {
+- print "UNKNOWN: cannot prepare $sql";
++ print "UNKNOWN: cannot prepare $sql\n";
+ exit 3;
+ }
+ debug(2, "Getting slave variables");
+@@ -138,7 +138,7 @@
+ $sql = "show slave status";
+ $sth = $dbh->prepare($sql);
+ if (not $sth) {
+- print "UNKNOWN: cannot prepare $sql";
++ print "UNKNOWN: cannot prepare $sql\n";
+ exit 3;
+ }
+ debug(2, "Getting slave replication status");
+@@ -176,8 +176,8 @@
+ $dbh = DBI->connect("DBI:mysql:host=$host:port=$port", $user, $pass);
+
+ if (not $dbh) {
+- print "UNKNOWN: Cannot connect to master $host:$port";
+- die 3;
++ print "UNKNOWN: Cannot connect to master $host:$port\n";
++ exit(3);
+ }
+ $sql = "show variables";
+ $sth = $dbh->prepare($sql);
+@@ -192,6 +192,10 @@
+ $sth = $dbh->prepare($sql);
+ debug(2, "Getting master replication status");
+ $res = $sth->execute;
++ if (not $res) {
++ print "UNKNOWN: Cannot get replication status (lack of privileges?)\n";
++ exit(3);
++ }
+ $master_data->{replication} = $sth->fetchrow_hashref;
+ $sth->finish;
+
+@@ -262,7 +266,7 @@
+
+ # Step one; is the SQL slave thread running (critical if not)
+ if (lc($slave->{replication}->{'Slave_SQL_Running'}) ne lc('yes')) {
+- print "CRITICAL: Slave IO not running";
++ print "CRITICAL: Slave IO not running\n";
+ exit 2;
+ }
+
+@@ -308,10 +312,10 @@
+ print "CRITICAL: $state";
+ exit 2;
+ } elsif ($diff >= $options->{'warn'} || $table_diff_message) {
+- print "WARN: $state";
++ print "WARN: $state\n";
+ exit 1;
+ }
+- print "OK: $state";
++ print "OK: $state\n";
+ exit 0;
+ }
+
================================================================
More information about the pld-cvs-commit
mailing list