[Xymon] Flushing Stale messages?

Henrik Størner henrik at hswn.dk
Tue Mar 19 11:02:57 CET 2013

On 15-03-2013 20:31, Clark, Sean wrote:
> As to the debug loading of chk file:
> 31911 2013-03-15 15:23:17 Opening file /sw/xymon/server/etc/hosts.cfg
> 31911 2013-03-15 15:23:19 Opening file
> /sw/xymon/server/etc/client-local.cfg
> 2013-03-15 15:23:19 Setting up network listener on
> 2013-03-15 15:23:19 Setting up signal handlers
> 2013-03-15 15:23:19 Setting up xymond channels
> 31911 2013-03-15 15:23:19 Setting up status channel (id=1)
> 31911 2013-03-15 15:23:19 calling ftok('/sw/xymon/server',1)
> 31911 2013-03-15 15:23:19 ftok() returns: 0x1000047
> 31911 2013-03-15 15:23:19 shmget() returns: 0xD6800C
> 2013-03-15 15:23:19 FATAL: xymond sees clientcount 1, should be 0
> Check for hanging xymond_channel processes or stale semaphores
> 2013-03-15 15:23:19 Cannot setup status channel

This happens when xymond has crashed and is restarting, but either some 
of the old xymond_channel messages are still running (hanging on to a 
shared memory segment or a semaphore), or the shared memory segments 
were not cleaned up after the crash.

You can check with ipcs (as the xymon user) if there are any shared 
memory segments lying around after all of the xymon tasks have exited.

I have a script to cleanup everything and restart Xymon - writing new 
code may on rare occasions mean that xymond crashes :-) - feel free to 
try this. If you're not on a Linux box, make sure the "ipcs -m" and 
"ipcs -s" output has the shmid / semid in column 2. If not, adjust the 
'awk' command to grab the correct column.


if [ `id -u` != `id -u xymon` ]
         echo "You must be the 'xymon' user to run this."
         exit 1

echo "Stopping Xymon"
~xymon/server/xymon.sh stop
sleep 2
if [ -f /var/run/xymon/xymond.pid ]
         echo "Forcing kill of xymon process, PID `cat 
         kill -9 `cat /var/run/xymon/xymond.pid`

echo "Cleaning up shared memory segments"
ipcs -s|grep "^0"|awk '{print $2}'|while read ID; do ipcrm -s $ID; done
echo "Cleaning up semaphores"
ipcs -m|grep "^0"|awk '{print $2}'|while read ID; do ipcrm -m $ID; done
echo "Cleaning up socket files"
rm ~xymon/server/tmp/xymond_if

echo "Starting Xymon"
~xymon/server/xymon.sh start

echo "Done"
exit 0


More information about the Xymon mailing list