Re: failed to read remote load
Sébastien Bonnet <[email protected]>
| Newsgroups | gmane.linux.redhat.piranha |
|---|---|
| Message-ID | <[email protected]> |
> My messages log fills up with this message. > > Sep 16 17:41:03 scweb01 nanny[20793]: The following exited abnormally: > Sep 16 17:41:03 scweb01 nanny[20793]: failed to read remote load > > Does anyone know what this means??? Yes ! Your remote load command is not correctly executed. This can be because the path is wrong or missing, or it does not return what nanny expects. For more details, start pulse/nanny with -v option to learn a bit more what is launched. If all your realservers are running Linux/Unix, I suggest you start rwhod on each of them and apply the attached patch to piranha. You will them be able to use ruptime-piranha, an efficient and simple script based on ruptime. -- Sébastien Bonnet Centre de contacts - Experian France
piranha-0.6.1-3-uptimecommand.diff
(text/plain, 2.7 KB)
--- piranha/nanny.c Mon Mar 11 20:10:39 2002
+++ piranha-0.6.1-3/nanny.c Mon Jun 3 17:07:45 2002
@@ -233,11 +233,13 @@
static char *send_str = NULL;
static char *expect_str = NULL;
static int quiesce_srv;
-static char *loadCommand = NULL;
-
+static char *loadCommandArgv[40];
static int loadConfigFile(void)
{
+ char **argp;
+ char *token;
+
int fd;
struct lvsConfig config;
struct lvsVirtualServer *vserver;
@@ -322,10 +324,24 @@
quiesce_srv = vserver->quiesceServer;
- if (vserver->loadMonitor && strcmp (vserver->loadMonitor, "uptime"))
- ASSIGNSTRING(loadCommand, vserver->loadMonitor);
- else
- ASSIGNSTRING(loadCommand, config.rshCommand);
+ argp = loadCommandArgv;
+ if (vserver->loadMonitor)
+ {
+ token = strtok (vserver->loadMonitor, " ");
+ while (token != NULL)
+ {
+ if (!strcmp (token, "%a"))
+ *argp++ = strdup (inet_ntoa (remoteAddr));
+ else if (!strcmp (token, "%h"))
+ *argp++ = strdup (serverName);
+ else
+ *argp++ = strdup (token);
+
+ token = strtok (NULL, " ");
+ }
+ }
+ *argp++ = NULL;
+
out:
lvsFreeConfig(&config);
@@ -1029,30 +1045,20 @@
}
float
-getRemoteLoad (int flags, struct in_addr *remoteAddr, int timeout,
- char *loadCommand)
+getRemoteLoad (int flags, struct in_addr *remoteAddr, int timeout)
{
- char *argv[40];
- char **argp = argv;
char *output;
char *start, *chptr;
float avg;
- *argp++ = loadCommand;
- *argp++ = inet_ntoa (*remoteAddr);
-
- if (strcmp (loadCommand, (char *) "none") == 0)
+ if ((*loadCommandArgv == NULL) || (strcmp (*loadCommandArgv, "none") == 0))
/* == 0 per bugzilla #24843 */
return -1.0; /* nothing to see here, go home silently */
- if (strcmp (loadCommand, (char *) "rup"))
- *argp++ = (char *) "uptime";
- *argp++ = NULL;
-
- logArgv (flags, argv);
+ logArgv (flags, loadCommandArgv);
- output = getExecOutput (flags, argv, timeout);
+ output = getExecOutput (flags, loadCommandArgv, timeout);
if (!output) {
piranha_log (flags, (char *) "failed to read remote load");
@@ -1099,7 +1105,7 @@
int
adjustWeight (int flags, char *ipvsadm, char *virtualAddress, int port,
struct in_addr *remoteAddr, char *routingMethod, int weight,
- int interval, int scale, char *loadCommand, int lastWeight)
+ int interval, int scale, int lastWeight)
{
int newWeight;
@@ -1127,8 +1133,7 @@
float diffThresh = (float) weight / 4;
load = getRemoteLoad (flags, remoteAddr,
- interval,
- loadCommand);
+ interval);
if ((load >= 0.0) && (load != 1.0)) {
if (load < 1.0) {
@@ -1513,7 +1518,7 @@
virtualAddress, port,
&remoteAddr, routingMethod,
weight, interval, scale,
- loadCommand, lastWeight);
+ lastWeight);
if (rc < 0)
return rc;
lastWeight = rc;
ruptime-piranha
(text/plain, 79 B)
#! /bin/sh ruptime | grep -E "^$1[ ]+" | sed -e 's/ load / load average: /g'