Commit b0f453df authored by Leigh Stoller's avatar Leigh Stoller

Add to the normal testbed boot/shutdown sequence (instead of starting by

hand). Also add enable sitevar since we run this only on clusters that
support portstats on the control network.
parent 2dc8041f
......@@ -147,6 +147,11 @@ case "$1" in
@prefix@/sbin/aptevent_daemon
fi
if [ -x @prefix@/sbin/cnetwatch ]; then
echo -n " cnetwatch"
@prefix@/sbin/cnetwatch
fi
if [ -x @prefix@/sbin/apt_checkup ]; then
echo -n " apt_checkup"
@prefix@/sbin/apt_checkup
......@@ -282,6 +287,9 @@ case "$1" in
if [ -r /var/run/aptevent_daemon.pid ]; then
kill `cat /var/run/aptevent_daemon.pid`
fi
if [ -r /var/run/cnetwatch.pid ]; then
kill `cat /var/run/cnetwatch.pid`
fi
if [ -r /var/run/apt_checkup.pid ]; then
kill `cat /var/run/apt_checkup.pid`
fi
......
......@@ -180,6 +180,7 @@ INSERT INTO sitevariables VALUES ('general/admission_control','0','0','When set,
INSERT INTO sitevariables VALUES ('general/cnet_firewalls','0','0','When set, control network firewalls are supported via control network vlans.',0);
INSERT INTO sitevariables VALUES ('general/export_active',NULL,'0','Stop exporting shared user and project directories when they have been inactive for this number of days or longer (0==do not inactivate).',0);
INSERT INTO sitevariables VALUES ('general/root_keypair',NULL,'-1','Default distribution of per-experiment root keypairs (-1==disable root keypair mechanism, 0==do not distribute to any nodes, 1==distribute to all nodes).',0);
INSERT INTO sitevariables VALUES ('cnetwatch/enable',NULL,'0','Enable control network watcher; only works on clusters that support portstats on the control switches.',0);
INSERT INTO sitevariables VALUES ('cnetwatch/check_interval',NULL,'600','Interval in seconds at which to collect info (should be at least 10 seconds, 0 means do not run cnetwatch)',0);
INSERT INTO sitevariables VALUES ('cnetwatch/alert_interval',NULL,'600','Interval in seconds over which to calculate packet/bit rates and to log alerts (should be an integer multiple of check_interval)',0);
INSERT INTO sitevariables VALUES ('cnetwatch/pps_threshold',NULL,'50000','Packet rate in packets/sec in excess of which to log an alert (0 means do not generate packet rate alerts)',0);
......
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
my $svar = 'cnetwatch/enable';
DBQueryFatal("INSERT INTO `sitevariables` VALUES ".
"('$svar',NULL,'0',".
"'Enable control network watcher; only works on clusters ".
"that support portstats on the control switches.',0)")
if (!TBSiteVarExists($svar));
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
......@@ -155,6 +155,9 @@ if ($PGENISUPPORT) {
#
# Read sitevars to establish defaults:
#
# cnetwatch/enable
# Zero means don't run cnetwatch (exit immediately).
#
# cnetwatch/check_interval
# Interval at which to collect info.
# Zero means don't run cnetwatch (exit immediately).
......@@ -180,6 +183,13 @@ if ($PGENISUPPORT) {
# Zero means no limit to the emails.
#
my $tmp;
my $svar = "cnetwatch/enable";
if (TBGetSiteVar($svar, \$tmp)) {
if ($tmp == 0) {
print STDERR "WARNING: cnetwatch disabled by sitevar\n";
exit(0);
}
}
my $svar = "cnetwatch/check_interval";
if (TBGetSiteVar($svar, \$tmp)) {
if ($tmp == 0 || $tmp >= 10) {
......@@ -327,10 +337,17 @@ if (!TBAdmin()) {
}
# Go to ground.
if (!$debug) {
if (! ($debug || $runonce)) {
if (CheckDaemonRunning("cnetwatch")) {
fatal("Not starting another cnetwatch, use debug/runonce mode!");
}
# Go to ground.
if (TBBackGround($LOGFILE)) {
exit(0);
}
if (MarkDaemonRunning("cnetwatch")) {
fatal("Could not mark daemon as running!");
}
}
# Set up syslog
......@@ -343,8 +360,7 @@ if ($reportlog) {
} elsif (open(RL, ">>$reportlog")) {
RL->autoflush(1);
} else {
print STDERR "Could not open report log '$reportlog'\n";
exit(1);
fatal("Could not open report log '$reportlog'");
}
}
......
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