[Xymon] xymon-client startup script issue (and fix)

Jeremy Laidman jlaidman at rebel-it.com.au
Wed Sep 25 03:02:40 CEST 2013


So when CLIENTHOSTNAME is defined, it needs to get passed into $DAEMON (ie
runclient.sh) with the "--hostname=" parameter, because that overrides
$MACHINEDOTS, which is used in the PID filename.  If it cannot find the PID
filename, it won't be able to get the PID and kill the process.

Yes, this looks like a bug.

I don't see how "restart" worked though.  Perhaps it looked like it
restarted because it never stopped?

J



On 25 September 2013 04:51, Bakkies Gatvol <bakgat8 at hotmail.com> wrote:

> 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
>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20130925/02649b03/attachment.html>


More information about the Xymon mailing list