Commit 3ceadbff authored by Kirk Webb's avatar Kirk Webb

Per Jay's request, log plab isalive events originating from the plab service
slivers in order to track elab<->node connectivity.

A timeval struct is appended to a file (one per node) inside
/usr/testbed/log/plabisalive.  The reporting rate has been cranked up to
once per minute.  Therefore, if all 650 plab nodes where reporting in, that
amounts to about 10 reports/sec, or 14KB/min leading to a disk consumption
rate of 21MB/day (617MB/mo or 7.5GB/year).  Not sure how long we are going
to be running this.
parent 52b13806
......@@ -22,6 +22,7 @@
#include <sys/fcntl.h>
#include <sys/syscall.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <paths.h>
#include <setjmp.h>
#include <pwd.h>
......@@ -51,6 +52,7 @@
#define USERDIR "/users"
#define NETBEDDIR "/netbed"
#define SHAREDIR "/share"
#define PLISALIVELOGDIR "/usr/testbed/log/plabisalive"
#define RELOADPID "emulab-ops"
#define RELOADEID "reloading"
#define FSHOSTID "/usr/testbed/etc/fshostid"
......@@ -5021,6 +5023,9 @@ COMMAND_PROTOTYPE(dorusage)
{
char buf[MYBUFSIZE];
float la1, la5, la15, dused;
int plfd;
struct timeval now;
char pllogfname[MAXPATHLEN];
if (sscanf(rdata, "LA1=%f LA5=%f LA15=%f DUSED=%f",
&la1, &la5, &la15, &dused) != 4) {
......@@ -5063,6 +5068,21 @@ COMMAND_PROTOTYPE(dorusage)
OUTPUT(buf, sizeof(buf), "UPDATE=%d\n", reqp->update_accounts);
client_writeback(sock, buf, strlen(buf), tcp);
/* We're going to store plab up/down data in a file for a while. */
gettimeofday(&now, NULL);
snprintf(pllogfname, sizeof(pllogfname),
"%s/%s-isalive", PLISALIVELOGDIR, reqp->pnodeid);
snprintf(buf, sizeof(buf), "%ld %ld\n",
now.tv_sec, now.tv_usec);
plfd = open(pllogfname, O_WRONLY|O_APPEND|O_CREAT,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (plfd < 0) {
errorc("Can't open log: %s", pllogfname);
} else {
write(plfd, buf, strlen(buf));
close(plfd);
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment