summaryrefslogtreecommitdiffstats
path: root/ctdb/include
diff options
context:
space:
mode:
authorroot <root@rcn1.VSOFS1.COM>2009-03-23 19:07:45 +1100
committerroot <root@rcn1.VSOFS1.COM>2009-03-23 19:07:45 +1100
commit629d5ee1fa9b84150c25c151b3bf0690cb787a90 (patch)
tree295a1f4444fe81871a0bb5b9a8da92617db01cae /ctdb/include
parentdc05c1b80cad4597c8a900d5cce41c5e7731937e (diff)
downloadsamba-629d5ee1fa9b84150c25c151b3bf0690cb787a90.tar.gz
samba-629d5ee1fa9b84150c25c151b3bf0690cb787a90.tar.xz
samba-629d5ee1fa9b84150c25c151b3bf0690cb787a90.zip
add a new command "ctdb scriptstatus"
this command shows which eventscripts were executed during the last monitoring cycle and the status from each eventscript. If an eventscript timedout or returned an error we also show the output from the eventscript. Example : [root@rcn1 ctdb-git]# ./bin/ctdb scriptstatus 6 scripts were executed last monitoring cycle 00.ctdb Status:OK Duration:0.021 Mon Mar 23 19:04:32 2009 10.interface Status:OK Duration:0.048 Mon Mar 23 19:04:32 2009 20.multipathd Status:OK Duration:0.011 Mon Mar 23 19:04:33 2009 40.vsftpd Status:OK Duration:0.011 Mon Mar 23 19:04:33 2009 41.httpd Status:OK Duration:0.011 Mon Mar 23 19:04:33 2009 50.samba Status:ERROR Duration:0.057 Mon Mar 23 19:04:33 2009 OUTPUT:ERROR: Samba tcp port 445 is not responding Add a new helper function "switch_from_server_to_client()" which both the recovery daemon can use as well as in the child process we start for running the actual eventscripts. Create several new controls, both for the eventscript child process to inform the master daemon of the current status of the scripts as well as for the ctdb tool to extract this information from the runninc daemon. (This used to be ctdb commit c98f90ad61c9b1e679116fbed948ddca4111968d)
Diffstat (limited to 'ctdb/include')
-rw-r--r--ctdb/include/ctdb.h24
-rw-r--r--ctdb/include/ctdb_private.h22
2 files changed, 46 insertions, 0 deletions
diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h
index f0f510abd3..866ba76e2a 100644
--- a/ctdb/include/ctdb.h
+++ b/ctdb/include/ctdb.h
@@ -612,4 +612,28 @@ int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb);
int switch_from_server_to_client(struct ctdb_context *ctdb);
+#define MONITOR_SCRIPT_OK 0
+#define MONITOR_SCRIPT_TIMEOUT 1
+
+#define MAX_SCRIPT_NAME 31
+#define MAX_SCRIPT_OUTPUT 511
+struct ctdb_monitoring_script_wire {
+ char name[MAX_SCRIPT_NAME+1];
+ struct timeval start;
+ struct timeval finished;
+ int32_t status;
+ int32_t timedout;
+ char output[MAX_SCRIPT_OUTPUT+1];
+};
+
+struct ctdb_monitoring_wire {
+ uint32_t num_scripts;
+ struct ctdb_monitoring_script_wire scripts[1];
+};
+
+int ctdb_ctrl_getscriptstatus(struct ctdb_context *ctdb,
+ struct timeval timeout, uint32_t destnode,
+ TALLOC_CTX *mem_ctx, struct ctdb_monitoring_wire **script_status);
+
+
#endif
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index ceac3842bd..988b6d94bb 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -412,6 +412,8 @@ struct ctdb_context {
TALLOC_CTX *eventscripts_ctx; /* a context to hold data for the RUN_EVENTSCRIPTS control */
uint32_t *recd_ping_count;
TALLOC_CTX *release_ips_ctx; /* a context used to automatically drop all IPs if we fail to recover the node */
+ TALLOC_CTX *script_monitoring_ctx; /* a context where we store results while running the monitor event */
+ TALLOC_CTX *last_monitoring_ctx;
};
struct ctdb_db_context {
@@ -550,6 +552,11 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_TAKEOVER_IP = 89,
CTDB_CONTROL_GET_PUBLIC_IPS = 90,
CTDB_CONTROL_GET_NODEMAP = 91,
+ CTDB_CONTROL_EVENT_SCRIPT_INIT = 92,
+ CTDB_CONTROL_EVENT_SCRIPT_START = 93,
+ CTDB_CONTROL_EVENT_SCRIPT_STOP = 94,
+ CTDB_CONTROL_EVENT_SCRIPT_FINISHED = 95,
+ CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS = 96,
};
/*
@@ -1401,4 +1408,19 @@ int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb, uint32_t opcode, T
extern int script_log_level;
+int ctdb_ctrl_event_script_init(struct ctdb_context *ctdb);
+int ctdb_ctrl_event_script_start(struct ctdb_context *ctdb, const char *name);
+int ctdb_ctrl_event_script_stop(struct ctdb_context *ctdb, int32_t res);
+int ctdb_ctrl_event_script_finished(struct ctdb_context *ctdb);
+
+int32_t ctdb_control_event_script_init(struct ctdb_context *ctdb);
+int32_t ctdb_control_event_script_start(struct ctdb_context *ctdb, TDB_DATA indata);
+int32_t ctdb_control_event_script_stop(struct ctdb_context *ctdb, TDB_DATA indata);
+int32_t ctdb_control_event_script_finished(struct ctdb_context *ctdb);
+
+
+int32_t ctdb_control_get_event_script_status(struct ctdb_context *ctdb, TDB_DATA *outdata);
+
+int ctdb_log_event_script_output(struct ctdb_context *ctdb, char *str, uint16_t len);
+
#endif