vincem, In order to start multiple monitors on a single data collector host, I modified the start/stop scripts in $ZENHOME/bin, as below. In order to get this to work, you have to:
1. Create a file in $ZENHOME/etc named something like zencommand-something.conf. 2. Ensure you set the logpath variable in the config file to something unique, and create the directory, if it does not exist. 3. Ensure you set the monitor variable in the config file to something unique, and create this "monitor" object in the Zenoss UI. 4. Overwrite the $ZENHOME/bin/zencommand (or zenperfsnmp, etc) with below, and set the MULTISTARTPREFIX and MULTISTARTSLEEP variables appropriately. --------------------------------------------------------------------------------------------------- #! /usr/bin/env bash ############################################################################# # This program is part of Zenoss Core, an open source monitoring platform. # Copyright (C) 2007, Zenoss Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 as published by # the Free Software Foundation. # # For complete information please visit: http://www.zenoss.com/oss/ ############################################################################# # zenperfsnmp, zencommand, zenping, etc. MULTISTARTPREFIX=zencommand # Sleep between starts, helps reduce load on zeodb MULTISTARTSLEEP=60 . $ZENHOME/bin/zenfunctions start() { if running; then echo is already running else echo starting... eval $SUDO $PYTHON $PRGHOME/$PRGNAME --configfile $CFGFILE \ --cycle --daemon '"$@"' ps x | grep $CFGFILE | grep -v grep | awk '{ print $1; }' > $PIDFILE fi } generic() { case "$CMD" in run) run "$@" ;; start) start "$@" ;; stop) stop ;; restart) restart "$@" ;; status) status ;; help) help ;; genconf) genconf ;; *) cat - <<HELP Usage: $0 {run|start|stop|restart|status|help|genconf} [options] where the commands are: run - start the program but don't put it in the background. NB: This mode is good for debugging. start - start the program in daemon mode -- running in the background, detached from the shell stop - stop the program restart - stop and then start the program NB: Sometimes the start command will run before the daemon has terminated. If this happens just re-run the command. status - Check the status of a daemon. This will print the current process nuber if it is running. help - display the options available for the daemon genconf - create an example configuration file with default settings HELP exit 1 esac } for conffile in $ZENHOME/etc/$MULTISTARTPREFIX*.conf; do PRGHOME=$ZENHOME/Products/ZenRRD PRGNAME=$MULTISTARTPREFIX.py CFGFILE=$conffile PIDFILE=$VARDIR/`basename $conffile | sed 's/.conf/.py/'`.pid DISPNAME=`basename $conffile | sed 's/.conf//'` echo -n $DISPNAME '' generic "$@" if [ "$CMD" == "start" ]; then sleep $MULTISTARTSLEEP fi done --------------------------------------------------------------------------------------------------- You can see that at the bottom of the script, where the default start/stop scripts just call generic "$@", this script looks for config files starting with $MULTISTARTPREFIX, and calls generic "$@" for each of them. The script also redefines generic() and start() to prevent the script from exiting after starting just one daemon. -Erik -------------------- m2f -------------------- Read this topic online here: http://forums.zenoss.com/viewtopic.php?p=35024#35024 -------------------- m2f -------------------- _______________________________________________ zenoss-users mailing list [email protected] http://lists.zenoss.org/mailman/listinfo/zenoss-users
