[Xymon] xymon-client startup script issue (and fix)
Bakkies Gatvol
bakgat8 at hotmail.com
Tue Sep 24 20:51:22 CEST 2013
I am documenting this for whomever else may need this. This file is from an rpm xymon-client-4.3.10-1 that I got off the net somewhere. I just figured out why the "stop" does not work.
I set CLIENTHOSTNAME in here
=> more /etc/default/xymon-client
# Configure the Xymon client settings.
# You MUST set the list of Xymon servers that this
# client reports to.
# It is good to use IP-adresses here instead of DNS
# names - DNS might not work if there's a problem.
#
# E.g. (a single Xymon server)
# XYMONSERVERS="192.168.1.1"
# or (multiple servers)
# XYMONSERVERS="10.0.0.1 192.168.1.1"
XYMONSERVERS="10.65.1.66 10.65.20.151"
# The defaults usually suffice for the rest of this file,
# but you can tweak the hostname that the client reports
# data with.
# Thu Mar 21 15:30:16 EDT 2013
CLIENTHOSTNAME="$(hostname | cut -f1 -d'.')"
# Red Hat EL version 3 uses a different vmstat layout
# than all other Linux versions. So for a client running this
# particular OS, set CLIENTOS as below.
# Do NOT set this on any other Red Hat version.
# CLIENTOS="rhel3"
but the script does not pass that info on the stop - so the start worked fine, but the stop not. Even the restart worked. I fixed below
#
# xymon-client This shell script takes care of starting and stopping
# the Xymon client.
#
# chkconfig: 2345 80 20
# description: Xymon is a network monitoring tool that allows \
# you to monitor hosts and services. This client reports local \
# system statistics (cpu-, memory-, disk-utilisation etc) \
# to the Xymon server.
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/lib/xymon/client/runclient.sh
NAME=xymon-client
DESC=xymon-client
test -x $DAEMON || exit 0
CMD="$1"
# Include xymon-client defaults if available
DMNOPTS=""
if [ -f /etc/default/xymon-client ] ; then
. /etc/default/xymon-client
else
echo "Installation failure - missing /etc/default/xymon-client"
exit 1
fi
if [ "$XYMONSERVERS" = "" ]; then
echo "Please configure XYMONSERVERS in /etc/default/xymon-client"
exit 1
fi
set $XYMONSERVERS
if [ $# -eq 1 ]; then
echo "XYMSRV=\"$XYMONSERVERS\"" >/var/run/xymonclient-runtime.cfg
echo "XYMSERVERS=\"\"" >>/var/run/xymonclient-runtime.cfg
else
echo "XYMSRV=\"0.0.0.0\"" >/var/run/xymonclient-runtime.cfg
echo "XYMSERVERS=\"$XYMONSERVERS\"" >>/var/run/xymonclient-runtime.cfg
fi
if [ "$CLIENTHOSTNAME" != "" ]; then
DMNOPTS="${DMNOPTS} --hostname=${CLIENTHOSTNAME}"
fi
if [ "$CLIENTOS" != "" ]; then
DMNOPTS="${DMNOPTS} --os=${CLIENTOS}"
fi
set -e
case "$CMD" in
start)
echo -n "Starting $DESC: "
su -c "$DAEMON $DMNOPTS start" - xymon
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
su -c "$DAEMON stop" - xymon ### is
## su -c "$DAEMON $DMNOPTS stop" - xymon # ## should be this!!!
echo "$NAME."
;;
restart)
echo -n "Restarting $DESC: "
su -c "$DAEMON stop" - xymon
su -c "$DAEMON $DMNOPTS start" - xymon
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart}" >&2
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20130924/20e6d0b9/attachment.html>
More information about the Xymon
mailing list