[SCM] CTDB repository - branch master updated - ctdb-2.4-122-g6a5469a

Amitay Isaacs amitay at samba.org
Thu Oct 24 19:05:34 MDT 2013


The branch, master has been updated
       via  6a5469a63547029f4fc704a4d4075543e06c36d1 (commit)
       via  a0b965bb73777dde7a4abf80c5c4742581bce520 (commit)
       via  cea81bdd503f6ef8b5bbd3582a8e0085bb02bc9f (commit)
       via  1f6cc8764e28058c56d0350147032b6e30cb355d (commit)
       via  58ca2c3e7e3a27023ad86660f01a2052e2a19635 (commit)
      from  1f327401f2e181780937aa3f6c479376ff787f3f (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6a5469a63547029f4fc704a4d4075543e06c36d1
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Oct 24 14:26:12 2013 +1100

    doc/examples: Add CTDB configuration examples
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit a0b965bb73777dde7a4abf80c5c4742581bce520
Author: Mathieu Parent <math.parent at gmail.com>
Date:   Thu Aug 29 08:20:05 2013 +0200

    Add missing $remote_fs LSB dependency

commit cea81bdd503f6ef8b5bbd3582a8e0085bb02bc9f
Author: Mathieu Parent <math.parent at gmail.com>
Date:   Thu Aug 29 07:42:12 2013 +0200

    Improved check_ctdb
    
    - increase verbosity with "-v"
    - concat error messages (if there are several)
    - handle 255 return code as warning (as it is the return code when any of the node is missing)
    - read /etc/ctdb/nodes remotely (ctdb_check can be run on a non-ctdb host)

commit 1f6cc8764e28058c56d0350147032b6e30cb355d
Author: Mathieu Parent <math.parent at gmail.com>
Date:   Thu Aug 15 20:23:57 2013 +0200

    Add missing events.d/99.timeout

commit 58ca2c3e7e3a27023ad86660f01a2052e2a19635
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Oct 24 14:37:41 2013 +1100

    eventscripts: Instead of listing all tunables, query EventScriptTimeout
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                |    1 +
 config/ctdb.init           |    4 +-
 config/events.d/99.timeout |    2 +-
 doc/examples/README        |    4 ++
 doc/examples/cluster.conf  |   92 +++++++++++++++++++++++++++++++++++++
 doc/examples/natgw.conf    |  109 ++++++++++++++++++++++++++++++++++++++++++++
 packaging/RPM/ctdb.spec.in |    2 +
 utils/nagios/check_ctdb    |   44 ++++++++++++------
 8 files changed, 241 insertions(+), 17 deletions(-)
 create mode 100644 doc/examples/README
 create mode 100644 doc/examples/cluster.conf
 create mode 100644 doc/examples/natgw.conf


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 4e03716..0ae22e5 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -355,6 +355,7 @@ install: all manpages $(PMDA_INSTALL)
 	${INSTALLCMD} -m 755 config/events.d/62.cnfs $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/70.iscsi $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/91.lvs $(DESTDIR)$(etcdir)/ctdb/events.d
+	${INSTALLCMD} -m 644 config/events.d/99.timeout $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 644 config/nfs-rpc-checks.d/10.statd.check $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d/
 	${INSTALLCMD} -m 644 config/nfs-rpc-checks.d/20.nfsd.check $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d/
 	${INSTALLCMD} -m 644 config/nfs-rpc-checks.d/30.lockd.check $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d/
diff --git a/config/ctdb.init b/config/ctdb.init
index e761fec..0e0d379 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -10,8 +10,8 @@
 
 ### BEGIN INIT INFO
 # Provides:            ctdb
-# Required-Start:      $local_fs $syslog $network
-# Required-Stop:       $local_fs $syslog $network
+# Required-Start:      $local_fs $syslog $network $remote_fs
+# Required-Stop:       $local_fs $syslog $network $remote_fs
 # Default-Start:       2 3 4 5
 # Default-Stop:        0 1 6
 # Short-Description:   start and stop ctdb service
diff --git a/config/events.d/99.timeout b/config/events.d/99.timeout
index 258366a..2a6495a 100755
--- a/config/events.d/99.timeout
+++ b/config/events.d/99.timeout
@@ -14,7 +14,7 @@ loadconfig ctdb
 
 case "$1" in
     monitor)
-	TIMEOUT=$(ctdb listvars | awk '$1 == "EventScriptTimeout" {print $3}')
+	TIMEOUT=$(ctdb getvar EventScriptTimeout | awk '{print $3}')
 	echo "sleeping for $((TIMEOUT * 2)) seconds..."
 	sleep $((TIMEOUT * 2))
 	;;
diff --git a/doc/examples/README b/doc/examples/README
new file mode 100644
index 0000000..71337b7
--- /dev/null
+++ b/doc/examples/README
@@ -0,0 +1,4 @@
+This directory includes sample CTDB cluster configurations.
+
+  o cluster.conf - Basic cluster setup
+  o natgw.conf   - Basic cluster setup with NAT gateway feature
diff --git a/doc/examples/cluster.conf b/doc/examples/cluster.conf
new file mode 100644
index 0000000..871468e
--- /dev/null
+++ b/doc/examples/cluster.conf
@@ -0,0 +1,92 @@
+#
+# CTDB configuration for simple cluster
+#
+# This is the sample configuration for a 3-node CTDB cluster providing file
+# services via Samba and NFS.
+#
+# Cluster details:
+#
+#                internal network (192.168.1.0/24)
+#   -------+----------------------+-----------------------+----------
+#          |                      |                       |
+#          |                      |                       |
+#     eth0 | 192.168.1.1     eth0 | 192.168.1.2      eth0 | 192.168.1.3
+#    +-----+-----+          +-----+-----+           +-----+-----+
+#    |           |          |           |           |           |
+#    |  Node 1   |          |  Node 2   |           |  Node 3   |
+#    |           |          |           |           |           |
+#    +-----+-----+          +-----+-----+           +-----+-----+
+#     eth1 | 10.1.1.1        eth1 | 10.1.1.2         eth1 | 10.1.1.3
+#          |                      |                       |
+#          |                      |                       |
+#   -------+----------------------+-----------------------+----------
+#                  public network (10.1.1.0/24)
+#
+#
+# Storage details:
+#
+#  Each node has a shared storage - /shared
+#
+#
+# Service details:
+#
+#  Cluster provides file services on following IP addresses
+#
+#     10.1.1.101 - 10.1.1.106
+#
+#  Each node also has a fixed IP address on public network.  This is used to
+#  communicate to network infrastructure (e.g. DNS, Active Directory, ...).
+#  Make sure that file services are not available on these fixed IP addresses
+#  (e.g. network filtering, using cluster hostname instead of IPs)
+
+
+CTDB_RECOVERY_LOCK=/shared/recovery.lock
+
+#
+# Nodes configuration
+#
+# ---------- /etc/ctdb/nodes ----------
+# 192.168.1.1
+# 192.168.1.2
+# 192.168.1.3
+# ---------- /etc/ctdb/nodes ----------
+#
+CTDB_NODES=/etc/ctdb/nodes
+
+#
+# Public addresses configuration
+#
+# ---------- /etc/ctdb/public_addresses ----------
+# 10.1.1.101/24 eth1
+# 10.1.1.102/24 eth1
+# 10.1.1.103/24 eth1
+# 10.1.1.104/24 eth1
+# 10.1.1.105/24 eth1
+# 10.1.1.106/24 eth1
+# ---------- /etc/ctdb/public_addresses ----------
+#
+CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
+
+# Enable logging to syslog
+CTDB_SYSLOG=yes
+
+# Default log level
+CTDB_DEBUGLEVEL=NOTICE
+
+# Auto start/stop managed services
+CTDB_AUTO_STARTSTOP=yes
+
+#
+# Samba configuration
+#
+CTDB_MANAGES_SAMBA=yes
+# CTDB_SAMBA_SKIP_SHARE_CHECK=yes
+
+CTDB_MANAGES_WINBIND=yes
+
+#
+# NFS configuration
+#
+CTDB_MANAGES_NFS=yes
+CTDB_RPCINFO_LOCALHOST="127.0.0.1"
+# CTDB_MONITOR_NFS_THREAD_COUNT=yes
diff --git a/doc/examples/natgw.conf b/doc/examples/natgw.conf
new file mode 100644
index 0000000..2e3a3ea
--- /dev/null
+++ b/doc/examples/natgw.conf
@@ -0,0 +1,109 @@
+#
+# CTDB configuration for simple cluster with NAT gateway
+#
+# This is the sample configuration for a 3-node CTDB cluster providing file
+# services via Samba and NFS.
+#
+# Cluster details:
+#
+#                internal network (192.168.1.0/24)
+#   -------+----------------------+-----------------------+----------
+#          |                      |                       |
+#          |                      |                       |
+#     eth0 | 192.168.1.1     eth0 | 192.168.1.2      eth0 | 192.168.1.3
+#    +-----+-----+          +-----+-----+           +-----+-----+
+#    |           |          |           |           |           |
+#    |  Node 1   |          |  Node 2   |           |  Node 3   |
+#    |           |          |           |           |           |
+#    +-----+-----+          +-----+-----+           +-----+-----+
+#     eth1 |                 eth1 |                  eth1 |
+#          |                      |                       |
+#          |                      |                       |
+#   -------+----------------------+-----------------------+-----+----
+#                  public network (10.1.1.0/24)                 |
+#                                                               | 10.1.1.254
+#                                                               o (router)
+#
+# Storage details:
+#
+#  Each node has a shared storage - /shared
+#
+#
+# Service details:
+#
+#  Cluster provides file services on following IP addresses
+#
+#     10.1.1.101 - 10.1.1.106
+#
+#  When a node is not hosting any IPs, it cannot connect to network
+#  infrastructure (e.g. DNS, Active Directory, ...).
+#
+#  Using NAT gateway feature of CTDB allows a node not hosting IPs to connect
+#  to network infrastructure.
+
+
+CTDB_RECOVERY_LOCK=/shared/recovery.lock
+
+#
+# Nodes configuration
+#
+# ---------- /etc/ctdb/nodes ----------
+# 192.168.1.1
+# 192.168.1.2
+# 192.168.1.3
+# ---------- /etc/ctdb/nodes ----------
+#
+CTDB_NODES=/etc/ctdb/nodes
+
+#
+# Public addresses configuration
+#
+# ---------- /etc/ctdb/public_addresses ----------
+# 10.1.1.101/24 eth1
+# 10.1.1.102/24 eth1
+# 10.1.1.103/24 eth1
+# 10.1.1.104/24 eth1
+# 10.1.1.105/24 eth1
+# 10.1.1.106/24 eth1
+# ---------- /etc/ctdb/public_addresses ----------
+#
+CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
+
+# Enable logging to syslog
+CTDB_SYSLOG=yes
+
+# Default log level
+CTDB_DEBUGLEVEL=NOTICE
+
+# Auto start/stop managed services
+CTDB_AUTO_STARTSTOP=yes
+
+#
+# Samba configuration
+#
+CTDB_MANAGES_SAMBA=yes
+# CTDB_SAMBA_SKIP_SHARE_CHECK=yes
+
+CTDB_MANAGES_WINBIND=yes
+
+#
+# NFS configuration
+#
+CTDB_MANAGES_NFS=yes
+CTDB_RPCINFO_LOCALHOST="127.0.0.1"
+# CTDB_MONITOR_NFS_THREAD_COUNT=yes
+
+#
+# NAT gateway configuration
+#
+# ---------- /etc/ctdb/natgw_nodes ----------
+# 192.168.1.1
+# 192.168.1.2
+# 192.168.1.3
+# ---------- /etc/ctdb/natgw_nodes ----------
+#
+CTDB_NATGW_PUBLIC_IP=10.1.1.121/24
+CTDB_NATGW_PUBLIC_IFACE=eth1
+CTDB_NATGW_DEFAULT_GATEWAY=10.1.1.254
+CTDB_NATGW_PRIVATE_NETWORK=192.168.1.0/24
+CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 5a675a2..b7d1bef 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -163,6 +163,7 @@ rm -rf $RPM_BUILD_ROOT
 %doc README.eventscripts README.notify.d
 %doc doc/recovery-process.txt
 %doc doc/*.html
+%doc doc/examples
 %{_sysconfdir}/sudoers.d/ctdb
 %{_sysconfdir}/ctdb/functions
 %{_sysconfdir}/ctdb/events.d/00.ctdb
@@ -183,6 +184,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_sysconfdir}/ctdb/events.d/62.cnfs
 %{_sysconfdir}/ctdb/events.d/70.iscsi
 %{_sysconfdir}/ctdb/events.d/91.lvs
+%{_sysconfdir}/ctdb/events.d/99.timeout
 %config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/10.statd.check
 %config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/20.nfsd.check
 %config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/30.lockd.check
diff --git a/utils/nagios/check_ctdb b/utils/nagios/check_ctdb
index cc0c222..837a0a4 100644
--- a/utils/nagios/check_ctdb
+++ b/utils/nagios/check_ctdb
@@ -26,7 +26,7 @@ use Nagios::Plugin;
 use File::Basename;
 
 $PROGNAME = basename($0);
-$VERSION = '0.3';
+$VERSION = '0.4';
 
 my $np = Nagios::Plugin->new(
   usage => "Usage: %s -i <info>\n"
@@ -110,7 +110,6 @@ my $percw;
 my $percc;
 
 $output = "";
-$result = OK;
 
 if (defined($critical))
 {
@@ -139,9 +138,12 @@ sub safe_open_command {
     $stderr = "";
     close STDERR;
     open(STDERR, ">>", \$stderr) or die "Can't open STDERR: $!";
+    if ($np->opts->verbose) {
+      print "Executing: @_\n";
+    }
     if (!open(PIPE, '-|', @_)) {
         $result = CRITICAL;
-        $output = "Cannot open command '@_': $! ($stderr)";
+        $output .= "Cannot open command '@_': $! ($stderr). ";
         # restore STDERR
         open(STDERR, ">", \*OLDERR) or die "Can't dup OLDERR: $!";
     }
@@ -152,22 +154,29 @@ sub safe_close_command {
 
     if ($? == -1) {
         $result = CRITICAL;
-        $output = "failed to execute: $!";
+        $output .= "failed to execute: $!. ";
     } elsif ($? & 127) {
         $result = CRITICAL;
-        $output = sprintf("child died with signal %d, %s coredump",
+        $output .= sprintf("child died with signal %d, %s coredump. ",
             ($? & 127), ($? & 128) ? 'with' : 'without');
     } elsif ($? >> 8) {
-        $result = CRITICAL;
-        $output = sprintf("child exited with value %d", $? >> 8);
+        if (($? >> 8) == 255) {
+            # ctdb returns -1=255 if any node is disconnected
+            $result = WARNING;
+            $output .= sprintf("child exited with value %d. ", $? >> 8) if $output eq "";
+        } else {
+            $result = CRITICAL;
+            $output .= sprintf("child exited with value %d. ", $? >> 8);
+        }
     }
     # restore STDERR
-    open(STDERR, ">&OLDERR")    or die "Can't dup OLDERR: $!";
+    open(STDERR, ">&OLDERR") or die "Can't dup OLDERR: $!";
 }
 
 # main :
 
 if ($info eq "scriptstatus") {
+    $result = OK;
     safe_open_command('ctdb', '-Y', 'scriptstatus');
     if ($result == OK) {
         my $script_count = 0;
@@ -186,7 +195,7 @@ if ($info eq "scriptstatus") {
             my $error = join(':', @error);
             if ($error ne "") {
                 $output = "$output ;; " if $output;
-                $output = "$output$name ($status=$code): $error";
+                $output = "$output$name ($status=$code): $error ";
                 if ($result != CRITICAL) {
                     $result = WARNING;
                 }
@@ -217,15 +226,19 @@ if ($info eq "scriptstatus") {
      }
     $np->nagios_exit($result, $output);
 } elsif ($info eq "ping") {
+    # Get expected nodes count
+    $result = OK;
+    safe_open_command('cat', '/etc/ctdb/nodes');
+    1 while( <PIPE> );
+    my $max_nodes_count = $.;
+    safe_close_command();
+    # ctdb ping
+    $result = OK;
     safe_open_command('ctdb', '-n', 'all', 'ping');
     if ($result == OK) {
         my $nodes_count = 0;
         my $time_total = 0.0;
         my $clients_count = 0;
-        open(CTDB_NODES, "/etc/ctdb/nodes");
-        1 while( <CTDB_NODES> );
-        my $max_nodes_count = $.;
-
         while (<PIPE>) {
             chop;
             if ($_ =~ /^response from (\d+) time=([0-9.]+) sec  \((\d+) clients\)$/) {
@@ -233,11 +246,14 @@ if ($info eq "scriptstatus") {
                 $nodes_count += 1;
                 $time_total += $time;
                 $clients_count += $clients;
+            } elsif ($_ =~ /^Unable to get ping response from node (\d+)$/) {
+                #
             } else {
                 $result = CRITICAL;
-                $output = "'$_' doesn't match regexp."
+                $output .= "'$_' doesn't match regexp. "
             }
         }
+        $output .= sprintf("%d missing nodes. ", $max_nodes_count - $nodes_count) if $nodes_count < $max_nodes_count;
         safe_close_command();
         $np->add_perfdata(label => "nodes", value => $nodes_count, uom => '',
             min => 0, max => $max_nodes_count, warning => $warning, critical => $critical);


-- 
CTDB repository


More information about the samba-cvs mailing list