# Ensure that all server processes can write pid files # to a distinctly-configurable location by adding a # XYMONRUNDIR environment variable # --- configure.server.rundir 2011-03-17 14:26:33.633223000 -0700 +++ configure.server 2011-03-17 14:37:09.086646313 -0700 @@ -351,6 +351,17 @@ fi echo ""; echo "" +echo "Where to put the Xymon runfiles [$XYMONLOGDIR] ? " +if test -z "$XYMONRUNDIR" +then + read XYMONRUNDIR +fi +if test -z "$XYMONRUNDIR" +then + XYMONRUNDIR="$XYMONLOGDIR" +fi +echo ""; echo "" + echo "What is the name of this host [`uname -n`] ? " if test -z "$XYMONHOSTNAME" then @@ -412,4 +412,6 @@ echo "# Where to put logfiles" >>Makefile echo "XYMONLOGDIR = $XYMONLOGDIR" >>Makefile +echo "# Where to put runfiles" >>Makefile +echo "XYMONRUNDIR = $XYMONRUNDIR" >>Makefile echo "# Where to install manpages" >>Makefile echo "MANROOT = $MANROOT" >>Makefile --- xymond/etcfiles/xymonserver.cfg.DIST.rundir 2010-11-06 08:04:49.000000000 -0700 +++ xymond/etcfiles/xymonserver.cfg.DIST 2011-01-31 12:26:36.706853305 -0800 @@ -3,4 +3,5 @@ XYMONSERVERROOT="@XYMONTOPDIR@" # Where Xymon is installed XYMONSERVERLOGS="@XYMONLOGDIR@" # Directory for server logs. The xymon user must have write-access here. +XYMONRUNDIR="@XYMONRUNDIR@" # Directory for server pid files and runtime data. The xymon user must also have write-access here. XYMONCLIENTHOME="@XYMONTOPDIR@/client" # XYMONHOME directory for the client --- xymond/etcfiles/tasks.cfg.DIST.rundir 2011-09-10 08:19:15.000000000 -0700 +++ xymond/etcfiles/tasks.cfg.DIST 2012-05-12 10:52:13.119672612 -0700 @@ -21 +21 @@ - CMD xymond --pidfile=$XYMONSERVERLOGS/xymond.pid \ + CMD xymond --pidfile=$XYMONRUNDIR/xymond.pid \ @@ -22 +22 @@ - --restart=$XYMONTMP/xymond.chk --checkpoint-file=$XYMONTMP/xymond.chk --checkpoint-interval=600 \ + --restart=$XYMONRUNDIR/xymond.chk --checkpoint-file=$XYMONRUNDIR/xymond.chk --checkpoint-interval=600 \ @@ -31 +31 @@ - CMD xymond_channel --channel=stachg --log=$XYMONSERVERLOGS/history.log xymond_history --pidfile=$XYMONSERVERLOGS/xymond_history.pid + CMD xymond_channel --channel=stachg --log=$XYMONSERVERLOGS/history.log xymond_history --pidfile=$XYMONRUNDIR/xymond_history.pid @@ -103 +103 @@ - CMD $XYMONHOME/bin/xymonproxy --server=YOUR.XYMON.SERVER.IP --report=$MACHINE.xymonproxy --no-daemon --pidfile=$XYMONSERVERLOGS/xymonproxy.pid + CMD $XYMONHOME/bin/xymonproxy --server=YOUR.XYMON.SERVER.IP --report=$MACHINE.xymonproxy --no-daemon --pidfile=$XYMONRUNDIR/xymonproxy.pid @@ -118 +118 @@ - CMD $XYMONHOME/bin/xymonfetch --server=YOUR.XYMON.SERVER.IP --no-daemon --pidfile=$XYMONSERVERLOGS/xymonfetch.pid + CMD $XYMONHOME/bin/xymonfetch --server=YOUR.XYMON.SERVER.IP --no-daemon --pidfile=$XYMONRUNDIR/xymonfetch.pid --- client/clientlaunch.cfg.DIST.rundir 2010-11-06 03:50:05.000000000 -0700 +++ client/clientlaunch.cfg.DIST 2011-01-31 16:18:15.329988892 -0800 @@ -19 +19 @@ - CMD $XYMONCLIENTHOME/bin/msgcache --no-daemon --pidfile=$XYMONCLIENTLOGS/msgcache.pid + CMD $XYMONCLIENTHOME/bin/msgcache --no-daemon --pidfile=$XYMONRUNDIR/msgcache.pid --- xymond/xymond_rrd.c.rundir 2012-05-10 06:22:22.617684140 -0700 +++ xymond/xymond_rrd.c 2012-05-11 07:57:24.351666587 -0700 @@ -240,7 +240,8 @@ /* Setup the control socket that receives cache-flush commands */ memset(&ctlsockaddr, 0, sizeof(ctlsockaddr)); - sprintf(ctlsockaddr.sun_path, "%s/rrdctl.%lu", xgetenv("XYMONTMP"), (unsigned long)getpid()); + if (xgetenv("XYMONRUNDIR") && mkdir(xgetenv("XYMONRUNDIR"), 0755) != -1) dbgprintf("Created %s\n", xgetenv("XYMONRUNDIR")); // just in case + sprintf(ctlsockaddr.sun_path, "%s/rrdctl.%lu", xgetenv("XYMONRUNDIR"), (unsigned long)getpid()); unlink(ctlsockaddr.sun_path); /* In case it was accidentally left behind */ ctlsockaddr.sun_family = AF_UNIX; ctlsocket = socket(AF_UNIX, SOCK_DGRAM, 0); --- web/showgraph.c.rundir 2012-05-10 06:22:22.228084162 -0700 +++ web/showgraph.c 2012-05-11 07:52:38.410630536 -0700 @@ -137,9 +137,9 @@ } fcntl(ctlsocket, F_SETFL, O_NONBLOCK); - dir = opendir(xgetenv("XYMONTMP")); + dir = opendir(xgetenv("XYMONRUNDIR")); if (!dir) { - errprintf("Cannot acces $XYMONTMP directory: %s\n", strerror(errno)); + errprintf("Cannot acces $XYMONRUNDIR directory: %s\n", strerror(errno)); return; } @@ -146,7 +146,7 @@ memset(&myaddr, 0, sizeof(myaddr)); myaddr.sun_family = AF_UNIX; - sprintf(myaddr.sun_path, "%s/%s", xgetenv("XYMONTMP"), d->d_name); + sprintf(myaddr.sun_path, "%s/%s", xgetenv("XYMONRUNDIR"), d->d_name); myaddrsz = sizeof(myaddr); bufp = req; bytesleft = strlen(req); do { --- xymond/trimhistory.c.rundir 2010-11-08 06:48:26.000000000 -0800 +++ xymond/trimhistory.c 2011-01-31 12:22:01.166753653 -0800 @@ -210,7 +210,7 @@ FILE *fd; long pid = -1; - sprintf(pidfn, "%s/xymond_history.pid", xgetenv("XYMONSERVERLOGS")); + sprintf(pidfn, "%s/xymond_history.pid", xgetenv("XYMONRUNDIR")); fd = fopen(pidfn, "r"); if (fd) { char l[100]; --- xymond/Makefile.rundir 2011-12-12 14:18:17.000000000 -0800 +++ xymond/Makefile 2012-05-12 10:58:50.811719015 -0700 @@ -129 +129 @@ - cat etcfiles/xymonserver.cfg.DIST | sed -e 's!@XYMONTOPDIR@!$(XYMONTOPDIR)!g'| sed -e 's!@XYMONLOGDIR@!$(XYMONLOGDIR)!g'| sed -e 's!@XYMONHOSTNAME@!$(XYMONHOSTNAME)!g'| sed -e 's!@XYMONHOSTIP@!$(XYMONHOSTIP)!g'| sed -e 's!@XYMONHOSTOS@!$(XYMONHOSTOS)!g' | sed -e 's!@XYMONHOSTURL@!$(XYMONHOSTURL)!g' | sed -e 's!@XYMONCGIURL@!$(XYMONCGIURL)!g' | sed -e 's!@SECUREXYMONCGIURL@!$(SECUREXYMONCGIURL)!g' | sed -e 's!@XYMONHOME@!$(XYMONHOME)!g' | sed -e 's!@XYMONVAR@!$(XYMONVAR)!g' | sed -e 's!@FPING@!$(FPING)!g' | sed -e 's!@MAILPROGRAM@!$(MAILPROGRAM)!g' | sed -e 's!@RUNTIMEDEFS@!$(RUNTIMEDEFS)!g' >etcfiles/xymonserver.cfg + cat etcfiles/xymonserver.cfg.DIST | sed -e 's!@XYMONTOPDIR@!$(XYMONTOPDIR)!g'| sed -e 's!@XYMONLOGDIR@!$(XYMONLOGDIR)!g'| sed -e 's!@XYMONRUNDIR@!$(XYMONRUNDIR)!g' | sed -e 's!@XYMONHOSTNAME@!$(XYMONHOSTNAME)!g'| sed -e 's!@XYMONHOSTIP@!$(XYMONHOSTIP)!g'| sed -e 's!@XYMONHOSTOS@!$(XYMONHOSTOS)!g' | sed -e 's!@XYMONHOSTURL@!$(XYMONHOSTURL)!g' | sed -e 's!@XYMONCGIURL@!$(XYMONCGIURL)!g' | sed -e 's!@SECUREXYMONCGIURL@!$(SECUREXYMONCGIURL)!g' | sed -e 's!@XYMONHOME@!$(XYMONHOME)!g' | sed -e 's!@XYMONVAR@!$(XYMONVAR)!g' | sed -e 's!@FPING@!$(FPING)!g' | sed -e 's!@MAILPROGRAM@!$(MAILPROGRAM)!g' | sed -e 's!@RUNTIMEDEFS@!$(RUNTIMEDEFS)!g' >etcfiles/xymonserver.cfg --- xymond/xymond_history.c.rundir 2011-09-04 10:24:36.000000000 -0700 +++ xymond/xymond_history.c 2011-10-11 15:35:19.000000000 -0700 @@ -86,7 +86,7 @@ /* Dont save the error buffer */ save_errbuf = 0; - sprintf(pidfn, "%s/xymond_history.pid", xgetenv("XYMONSERVERLOGS")); + sprintf(pidfn, "%s/xymond_history.pid", xgetenv("XYMONRUNDIR")); if (xgetenv("XYMONALLHISTLOG")) save_allevents = (strcmp(xgetenv("XYMONALLHISTLOG"), "TRUE") == 0); if (xgetenv("XYMONHOSTHISTLOG")) save_hostevents = (strcmp(xgetenv("XYMONHOSTHISTLOG"), "TRUE") == 0); if (xgetenv("SAVESTATUSLOG")) save_histlogs = (strncmp(xgetenv("SAVESTATUSLOG"), "FALSE", 5) != 0);